// Hook: reads/writes sessionStorage for content filter preference
App.useContentFilter = function useContentFilter() {
    const key = 'rb_content_filter';
    const [mode, setModeState] = React.useState(() => {
        try { return sessionStorage.getItem(key) || 'included'; }
        catch { return 'included'; }
    });

    const setMode = (val) => {
        setModeState(val);
        try { sessionStorage.setItem(key, val); } catch {}
    };

    return [mode, setMode];
};

// Toggle component: "Included" / "All"
App.ContentToggle = function ContentToggle({ mode, onChange }) {
    return (
        <div className="content-toggle">
            <button
                className={'content-toggle-btn' + (mode === 'included' ? ' active' : '')}
                onClick={() => onChange('included')}
            >
                Included
            </button>
            <button
                className={'content-toggle-btn' + (mode === 'all' ? ' active' : '')}
                onClick={() => onChange('all')}
            >
                All
            </button>
        </div>
    );
};
