Remove macro color-code legend from the public menu
The 'Código de color de macros' collapsible bar took prominent space for secondary info that's already self-explanatory on each card's back (full text labels like 'Proteína 19g' next to their color). Removed it from the toggle row in both views; the row is justify-end so the cards/list view toggle reflows cleanly with no gap. Dropped the now-unused MacroLegend component and the anyMacros computation. The macro text labels on the card backs are unchanged. Build passes.
This commit is contained in:
1 parent
da2c0113e0
commit
2bd7da0839
2 files changed
+1
-44
No files matched your search
@@ -1,39 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { MACRO_COLORS, MACRO_KEYS } from '@/lib/macros';
|
||||
|
||||
// Collapsible accessible legend for the universal macro color code.
|
||||
export default function MacroLegend() {
|
||||
const t = useTranslations('macros');
|
||||
const tm = useTranslations('menu');
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<div className="glass rounded-2xl px-4 py-3">
|
||||
<button
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
className="flex w-full items-center justify-between text-sm font-medium"
|
||||
aria-expanded={open}
|
||||
>
|
||||
<span>{tm('macroLegend')}</span>
|
||||
<span className={`transition-transform ${open ? 'rotate-180' : ''}`}>⌄</span>
|
||||
</button>
|
||||
{open && (
|
||||
<ul className="mt-3 grid grid-cols-2 gap-2">
|
||||
{MACRO_KEYS.map((key) => (
|
||||
<li key={key} className="flex items-center gap-2 text-sm">
|
||||
<span
|
||||
className="h-3 w-3 rounded-full"
|
||||
style={{ background: MACRO_COLORS[key] }}
|
||||
aria-hidden
|
||||
/>
|
||||
<span className="text-[var(--text)]/80">{t(key)}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import { pickText } from '@/lib/text';
|
||||
import BrandHeader from './BrandHeader';
|
||||
import DishCard from './DishCard';
|
||||
import ListRow from './ListRow';
|
||||
import MacroLegend from './MacroLegend';
|
||||
import Gallery from './Gallery';
|
||||
import AiConsultant from './AiConsultant';
|
||||
import SuggestionCarousel from './SuggestionCarousel';
|
||||
@@ -79,11 +78,9 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
||||
|
||||
const ordersEnabled = menu.restaurant.ordersEnabled;
|
||||
const splitEnabled = ordersEnabled && !!menu.restaurant.splitEnabled;
|
||||
// Macros hierarchy: global flag AND the section's own flag. The legend appears
|
||||
// only if at least one visible section actually shows macros.
|
||||
// Macros hierarchy: shown only if the global flag AND the section's flag are on.
|
||||
const globalMacros = menu.restaurant.showMacros;
|
||||
const sectionShowsMacros = (s: { showMacros?: boolean }) => globalMacros && s.showMacros !== false;
|
||||
const anyMacros = globalMacros && sections.some((s) => s.showMacros !== false);
|
||||
|
||||
function scrollToSection(id: string) {
|
||||
setActiveSection(id);
|
||||
@@ -215,7 +212,6 @@ export default function PublicMenu({ menu, slug }: { menu: MenuSnapshot; slug: s
|
||||
|
||||
{/* View toggle (cards vs traditional list). Not persisted. */}
|
||||
<div className="mb-4 flex items-center justify-end gap-3">
|
||||
{anyMacros && <div className="min-w-0 flex-1"><MacroLegend /></div>}
|
||||
<div className="glass-pill inline-flex shrink-0 rounded-full p-1 text-sm">
|
||||
<button
|
||||
onClick={() => setView('cards')}
|
||||
|
||||
Reference in new issue
Block a user