import React, { useEffect, useState } from 'react'; import { LuLayoutGrid, LuList } from 'react-icons/lu'; import { cn } from '../copilot/cn'; export type ContentView = 'grid' | 'table'; interface ViewToggleProps { value: ContentView; onChange: (view: ContentView) => void; className?: string; } function ToggleButton({ active, label, onClick, children, }: { active: boolean; label: string; onClick: () => void; children: React.ReactNode; }): JSX.Element { return ( ); } function ViewToggle({ value, onChange, className, }: ViewToggleProps): JSX.Element { return (
onChange('grid')} > onChange('table')} >
); } const VIEW_STORAGE_KEY = 'recomaze.contents.view'; export function useContentView(): [ContentView, (view: ContentView) => void] { const [view, setView] = useState('grid'); useEffect(() => { try { const stored = window.localStorage.getItem(VIEW_STORAGE_KEY); if (stored === 'table') setView('table'); } catch { /* private mode / blocked storage - the default is fine */ } }, []); const choose = (next: ContentView): void => { setView(next); try { window.localStorage.setItem(VIEW_STORAGE_KEY, next); } catch { /* the choice still applies for this session */ } }; return [view, choose]; } export default ViewToggle;