fix: xrelDates State im Modal, ERSCHEINUNGSDATEN von xREL statt TMDb
This commit is contained in:
@@ -458,6 +458,7 @@ function FavoritenKalender({ onOpenModal }) {
|
|||||||
function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
||||||
const [detail, setDetail] = useState(null);
|
const [detail, setDetail] = useState(null);
|
||||||
const [xrel, setXrel] = useState(null); // null=nicht gesucht, []=gesucht
|
const [xrel, setXrel] = useState(null); // null=nicht gesucht, []=gesucht
|
||||||
|
const [xrelDates, setXrelDates] = useState([]);
|
||||||
const [xrelLoading, setXrelLoading] = useState(false);
|
const [xrelLoading, setXrelLoading] = useState(false);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
@@ -466,7 +467,7 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
|||||||
const detailRef = useRef(null);
|
const detailRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true); setDetail(null); setXrel(null); setError('');
|
setLoading(true); setDetail(null); setXrel(null); setXrelDates([]); setError('');
|
||||||
detailRef.current = null;
|
detailRef.current = null;
|
||||||
api(`/tools/media/movie/${tmdbId}`)
|
api(`/tools/media/movie/${tmdbId}`)
|
||||||
.then(d => {
|
.then(d => {
|
||||||
@@ -480,7 +481,10 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
|||||||
imdb_id: d.imdb_id || '',
|
imdb_id: d.imdb_id || '',
|
||||||
});
|
});
|
||||||
api(`/tools/media/movie/${tmdbId}/xrel?${params}`)
|
api(`/tools/media/movie/${tmdbId}/xrel?${params}`)
|
||||||
.then(r => { if (r.xrel?.length > 0) { setXrel(r.xrel); onHasXrel?.(tmdbId); } })
|
.then(r => {
|
||||||
|
if (r.xrel_dates?.length > 0) setXrelDates(r.xrel_dates);
|
||||||
|
if (r.xrel?.length > 0) { setXrel(r.xrel); onHasXrel?.(tmdbId); }
|
||||||
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
})
|
})
|
||||||
.catch(e => { setError(e.message); setLoading(false); });
|
.catch(e => { setError(e.message); setLoading(false); });
|
||||||
@@ -502,6 +506,7 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
|||||||
if (forceRefresh) params.set('refresh', '1');
|
if (forceRefresh) params.set('refresh', '1');
|
||||||
const r = await api(`/tools/media/movie/${tmdbId}/xrel?${params}`);
|
const r = await api(`/tools/media/movie/${tmdbId}/xrel?${params}`);
|
||||||
setXrel(r.xrel || []);
|
setXrel(r.xrel || []);
|
||||||
|
if (r.xrel_dates?.length > 0) setXrelDates(r.xrel_dates);
|
||||||
if (r.has_xrel) onHasXrel?.(tmdbId);
|
if (r.has_xrel) onHasXrel?.(tmdbId);
|
||||||
} catch(_) { setXrel([]); }
|
} catch(_) { setXrel([]); }
|
||||||
finally { setXrelLoading(false); }
|
finally { setXrelLoading(false); }
|
||||||
@@ -580,6 +585,7 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
|||||||
{detail.vote_average > 0 && <Badge bg="rgba(255,230,109,0.15)" color="#ffe66d">★ {detail.vote_average.toFixed(1)}</Badge>}
|
{detail.vote_average > 0 && <Badge bg="rgba(255,230,109,0.15)" color="#ffe66d">★ {detail.vote_average.toFixed(1)}</Badge>}
|
||||||
{detail.runtime > 0 && <Badge bg="rgba(255,255,255,0.07)" color="rgba(255,255,255,0.7)">⏱ {detail.runtime} Min</Badge>}
|
{detail.runtime > 0 && <Badge bg="rgba(255,255,255,0.07)" color="rgba(255,255,255,0.7)">⏱ {detail.runtime} Min</Badge>}
|
||||||
{fskStyle && <Badge bg={fskStyle.bg} color={fskStyle.color}>FSK {detail.fsk}</Badge>}
|
{fskStyle && <Badge bg={fskStyle.bg} color={fskStyle.color}>FSK {detail.fsk}</Badge>}
|
||||||
|
{detail.release_date && <Badge bg="rgba(255,255,255,0.07)" color="rgba(255,255,255,0.55)">🇩🇪 {fmtDE(detail.release_date)}</Badge>}
|
||||||
{detail.countries?.length > 0 && <Badge bg="rgba(255,255,255,0.07)" color="rgba(255,255,255,0.4)">🌍 {detail.countries.slice(0,2).join(' · ')}</Badge>}
|
{detail.countries?.length > 0 && <Badge bg="rgba(255,255,255,0.07)" color="rgba(255,255,255,0.4)">🌍 {detail.countries.slice(0,2).join(' · ')}</Badge>}
|
||||||
</div>
|
</div>
|
||||||
{detail.genres?.length > 0 && (
|
{detail.genres?.length > 0 && (
|
||||||
@@ -593,11 +599,11 @@ function MovieModal({ tmdbId, onClose, mobile, onHasXrel }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{detail.release_dates?.length > 0 && (
|
{xrelDates.length > 0 && (
|
||||||
<div style={{ marginTop:16 }}>
|
<div style={{ marginTop:16 }}>
|
||||||
<div style={{ ...S.head, marginBottom:8 }}>ERSCHEINUNGSDATEN</div>
|
<div style={{ ...S.head, marginBottom:8 }}>ERSCHEINUNGSDATEN</div>
|
||||||
<div style={{ display:'flex', flexDirection:'column', gap:4 }}>
|
<div style={{ display:'flex', flexDirection:'column', gap:4 }}>
|
||||||
{detail.release_dates.map((r, i) => (
|
{xrelDates.map((r, i) => (
|
||||||
<div key={i} style={{ display:'flex', justifyContent:'space-between', alignItems:'center',
|
<div key={i} style={{ display:'flex', justifyContent:'space-between', alignItems:'center',
|
||||||
fontSize:11, fontFamily:'monospace', padding:'3px 0',
|
fontSize:11, fontFamily:'monospace', padding:'3px 0',
|
||||||
borderBottom:'1px solid rgba(255,255,255,0.05)' }}>
|
borderBottom:'1px solid rgba(255,255,255,0.05)' }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user