Remove the Palette tab from the editor

The per-restaurant palette was retired in the redesign (menu colors are fixed), so
the Palette editor tab no longer affected anything. Removed the tab and its
PaletteTab component; the editor now has 4 tabs (Catalog, Brand, Orders, QR). The
Restaurant.palette value is kept because the QR tab still uses it for its color
templates.
This commit is contained in:
Jorem Juárez committed 2026-06-26 11:24:15 -06:00
1 parent ffa8766540
commit 595769ced0
2 files changed
+2 -119

No files matched your search

+2 -5
View File
@@ -5,14 +5,13 @@ import { useTranslations } from 'next-intl';
import type { EditorData, EditorSection } from './types';
import LanguageSwitch from '@/components/LanguageSwitch';
import CatalogTab from './CatalogTab';
import PaletteTab from './PaletteTab';
import BrandTab from './BrandTab';
import OrdersTab from './OrdersTab';
import QrTab from './QrTab';
import PublishModal from './PublishModal';
import { ClipboardList, Palette, Store, Bell, QrCode, type LucideIcon } from 'lucide-react';
import { ClipboardList, Store, Bell, QrCode, type LucideIcon } from 'lucide-react';
type Tab = 'catalog' | 'palette' | 'brand' | 'orders' | 'qr';
type Tab = 'catalog' | 'brand' | 'orders' | 'qr';
export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: string }) {
const t = useTranslations('editor');
@@ -26,7 +25,6 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
const tabs: { id: Tab; label: string; Icon: LucideIcon }[] = [
{ id: 'catalog', label: t('catalog'), Icon: ClipboardList },
{ id: 'palette', label: t('palette'), Icon: Palette },
{ id: 'brand', label: t('brand'), Icon: Store },
{ id: 'orders', label: t('orders'), Icon: Bell },
{ id: 'qr', label: t('qr'), Icon: QrCode },
@@ -56,7 +54,6 @@ export default function Editor({ data, baseUrl }: { data: EditorData; baseUrl: s
onRestored={(name) => setPublishedName(name)}
/>
)}
{tab === 'palette' && <PaletteTab slug={data.slug} initialPalette={data.palette} />}
{tab === 'brand' && (
<BrandTab
slug={data.slug}
-114
View File
@@ -1,114 +0,0 @@
'use client';
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import type { Palette } from '@/lib/types';
import { PALETTE_PRESETS } from '@/lib/palette';
import { api } from './api';
const FIELDS: { key: keyof Palette; label: string }[] = [
{ key: 'background', label: 'Fondo' },
{ key: 'accent', label: 'Acento' },
{ key: 'text', label: 'Texto' },
];
export default function PaletteTab({
slug,
initialPalette,
}: {
slug: string;
initialPalette: Palette;
}) {
const t = useTranslations('editor');
const tc = useTranslations('common');
const [palette, setPalette] = useState<Palette>({
...PALETTE_PRESETS[0].palette,
...initialPalette,
});
const [saving, setSaving] = useState(false);
const [saved, setSaved] = useState(false);
function update(next: Palette) {
setPalette(next);
setSaved(false);
}
async function save() {
setSaving(true);
try {
await api(slug, '/palette', { method: 'PATCH', json: { palette } });
setSaved(true);
} finally {
setSaving(false);
}
}
return (
<div className="flex flex-col gap-4">
{/* Live preview */}
<div
className="rounded-3xl p-5"
style={{ background: palette.background }}
>
<div
className="rounded-2xl border border-white/60 p-4"
style={{ background: palette.surface, backdropFilter: 'blur(12px)' }}
>
<h3 className="display text-lg font-semibold" style={{ color: palette.text }}>
Vista previa
</h3>
<button
className="mt-2 rounded-full px-4 py-2 text-sm text-white"
style={{ background: palette.accent }}
>
Acento
</button>
</div>
</div>
{/* Presets */}
<div className="flex flex-wrap gap-2">
{PALETTE_PRESETS.map((p) => (
<button
key={p.id}
onClick={() => update({ ...p.palette })}
className="glass-soft flex items-center gap-2 rounded-full px-3 py-2 text-sm"
>
<span
className="h-4 w-4 rounded-full border border-white/60"
style={{ background: p.palette.accent }}
/>
{p.label}
</button>
))}
</div>
{/* Custom colors */}
<div className="glass rounded-3xl p-4">
<div className="flex flex-col gap-3">
{FIELDS.map((f) => (
<label key={f.key} className="flex items-center justify-between text-sm">
{f.label}
<input
type="color"
value={palette[f.key] ?? '#ffffff'}
onChange={(e) => update({ ...palette, [f.key]: e.target.value })}
className="h-9 w-16 rounded-lg border-0 bg-transparent"
/>
</label>
))}
</div>
</div>
<p className="text-xs text-[var(--text)]/55">⚠️ {t('paletteHint')}</p>
<button
onClick={save}
disabled={saving}
className="rounded-2xl bg-[var(--accent)] py-3 font-medium text-white disabled:opacity-50"
>
{saved ? '✓ ' : ''}{tc('save')}
</button>
</div>
);
}