formatDiagnostics(data.diagnostics),
[data.diagnostics],
);
- const warning = totalItems > 0
+ const incompleteSources = [
+ ...(data.diagnostics?.missing_sources ?? []),
+ ...(data.diagnostics?.stale_sources ?? []),
+ ];
+ let warning = totalItems > 0
? "正在显示已缓存内容;刷新异常已记录,后台会在下一轮刷新。"
: "媒体墙刷新暂未产生可展示资源,后台会在下一轮刷新。";
+ if (incompleteSources.length > 0) {
+ warning = "正在显示已缓存内容;部分来源缺失或过期,后台会继续补齐。";
+ }
return (
@@ -384,7 +369,7 @@ function MediaPosterCard({
sizes="(max-width: 640px) 42vw, (max-width: 1024px) 20vw, 200px"
/>
-
+
{mediaTypeLabels[item.media_type]}
{item.episode && (
@@ -421,7 +406,7 @@ function MediaDetailSheet({
const isMobile = useIsMobile();
if (!item) return null;
const radarHref = buildRadarHref(item);
- const rating = firstString(item.douban_rating, item.imdb_rating);
+ const rating = firstRating(item.douban_rating, item.imdb_rating);
return (
(null);
-
- if (item.poster_url && item.poster_url !== failedPosterUrl) {
+ const [failedPoster, setFailedPoster] = useState<{
+ item: MediaWallItem;
+ url: string;
+ } | null>(null);
+ const posterUrl = item.poster_url;
+ const posterFailed = failedPoster?.item === item && failedPoster.url === posterUrl;
+
+ if (posterUrl && !posterFailed) {
return (
setFailedPosterUrl(item.poster_url || null)}
+ onError={() => setFailedPoster({ item, url: posterUrl })}
/>
);
}
@@ -659,10 +649,11 @@ function hashString(value: string) {
return hash;
}
-function firstString(...values: unknown[]) {
+function firstRating(...values: unknown[]) {
for (const value of values) {
- if (value === null || value === undefined || value === "") continue;
- return typeof value === "number" ? formatNumber(value) : String(value);
+ const rating = typeof value === "number" ? value : Number(String(value).trim());
+ if (!Number.isFinite(rating) || rating <= 0) continue;
+ return typeof value === "number" ? formatNumber(value) : String(value).trim();
}
return "";
}
@@ -681,14 +672,14 @@ export function HomeMediaWallLoading() {
- {[0, 1, 2, 3, 4].map((section) => (
+ {loadingRailKeys.map((section) => (
- {[0, 1, 2, 3, 4, 5].map((item) => (
+ {loadingItemKeys.map((item) => (
diff --git a/frontend/components/radar/filter-selects.tsx b/frontend/components/radar/filter-selects.tsx
index 943375b..d222b3e 100644
--- a/frontend/components/radar/filter-selects.tsx
+++ b/frontend/components/radar/filter-selects.tsx
@@ -105,8 +105,7 @@ export function FilterSelects({
});
};
- // 使用动态数据或回退到硬编码数据
- const countries = filterOptions?.countries || FILTER_OPTIONS.countries;
+ const countries = filterOptions?.countries ?? [];
const standards = (filterOptions?.standards && filterOptions.standards.length > 0)
? filterOptions.standards
: FALLBACK_STANDARDS;
@@ -146,7 +145,7 @@ export function FilterSelects({
)}
{/* 国家/地区筛选 */}
- {visibleFilters.includes("country") && (
+ {visibleFilters.includes("country") && countries.length > 0 && (