fix: Custom Event für Media-Navigation (Dashboard-Badge → Favoriten-Tab)
This commit is contained in:
@@ -42,13 +42,12 @@ export default function Media({ toast, mobile, initTab, onInitTabConsumed }) {
|
||||
const [activeTool, setActiveTool] = useState('kino');
|
||||
const [favIds, toggleFav] = useFavIds();
|
||||
|
||||
// Wenn von außen ein Tab vorgegeben wird (z.B. Dashboard-Badge)
|
||||
// Auf Custom Event hören (z.B. Dashboard-Badge → Favoriten)
|
||||
useEffect(() => {
|
||||
if (initTab) {
|
||||
setActiveTool(initTab);
|
||||
onInitTabConsumed?.();
|
||||
}
|
||||
}, [initTab]);
|
||||
const handler = (e) => setActiveTool(e.detail);
|
||||
window.addEventListener('media-navigate', handler);
|
||||
return () => window.removeEventListener('media-navigate', handler);
|
||||
}, []);
|
||||
const [modal, setModal] = useState(null); // { id, media_type }
|
||||
const [xrelIds, setXrelIds] = useState(new Set()); // tmdb_ids mit bekannten Releases
|
||||
|
||||
|
||||
Reference in New Issue
Block a user