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