fix: xREL Badges persistent – onXrelLoaded Callback propagiert zu Media-Parent
This commit is contained in:
@@ -125,8 +125,8 @@ export default function Media({ toast, mobile }) {
|
||||
<span style={{ color:'rgba(255,255,255,0.5)', fontFamily:'monospace', fontSize:10 }}>{active?.desc}</span>
|
||||
</div>
|
||||
|
||||
{activeTool === 'kino' && <KinoGrid onOpenModal={setModal} xrelIds={xrelIds} />}
|
||||
{activeTool === 'demnächst' && <DemnächstGrid onOpenModal={setModal} xrelIds={xrelIds} />}
|
||||
{activeTool === 'kino' && <KinoGrid onOpenModal={setModal} xrelIds={xrelIds} onXrelLoaded={ids => setXrelIds(prev => new Set([...prev, ...ids]))} />}
|
||||
{activeTool === 'demnächst' && <DemnächstGrid onOpenModal={setModal} xrelIds={xrelIds} onXrelLoaded={ids => setXrelIds(prev => new Set([...prev, ...ids]))} />}
|
||||
{activeTool === 'favoriten' && <FavoritenKalender onOpenModal={setModal} />}
|
||||
</div>
|
||||
|
||||
@@ -256,7 +256,7 @@ function useFavIds() {
|
||||
}
|
||||
|
||||
// ── Kino Grid – alle laufenden Filme ─────────────────────────────────────────
|
||||
function KinoGrid({ onOpenModal, xrelIds }) {
|
||||
function KinoGrid({ onOpenModal, xrelIds, onXrelLoaded }) {
|
||||
const [movies, setMovies] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
@@ -273,7 +273,7 @@ function KinoGrid({ onOpenModal, xrelIds }) {
|
||||
if (ids) api(`/tools/media/xrel-cached?ids=${ids}`)
|
||||
.then(result => {
|
||||
const hits = Object.entries(result).filter(([,v])=>v).map(([k])=>Number(k));
|
||||
if (hits.length) setXrelIds(prev => new Set([...prev, ...hits]));
|
||||
if (hits.length) onXrelLoaded?.(hits);
|
||||
}).catch(()=>{});
|
||||
})
|
||||
.catch(e => setError(e.message))
|
||||
@@ -316,7 +316,7 @@ function KinoGrid({ onOpenModal, xrelIds }) {
|
||||
}
|
||||
|
||||
// ── Demnächst – wochenweise Neustarts ────────────────────────────────────────
|
||||
function DemnächstGrid({ onOpenModal, xrelIds }) {
|
||||
function DemnächstGrid({ onOpenModal, xrelIds, onXrelLoaded }) {
|
||||
const [groups, setGroups] = useState({});
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
@@ -331,7 +331,7 @@ function DemnächstGrid({ onOpenModal, xrelIds }) {
|
||||
if (ids) api(`/tools/media/xrel-cached?ids=${ids}`)
|
||||
.then(result => {
|
||||
const hits = Object.entries(result).filter(([,v])=>v).map(([k])=>Number(k));
|
||||
if (hits.length) setXrelIds(prev => new Set([...prev, ...hits]));
|
||||
if (hits.length) onXrelLoaded?.(hits);
|
||||
}).catch(()=>{});
|
||||
})
|
||||
.catch(e => setError(e.message))
|
||||
|
||||
Reference in New Issue
Block a user