chore: update various components and services for improved functionality and consistency, including formatting adjustments and minor refactors
This commit is contained in:
@@ -23,19 +23,19 @@ export function ClientHomePage() {
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/komga/home", {
|
||||
cache: 'default' // Utilise le cache HTTP du navigateur
|
||||
cache: "default", // Utilise le cache HTTP du navigateur
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
const errorCode = errorData.error?.code || ERROR_CODES.KOMGA.SERVER_UNREACHABLE;
|
||||
|
||||
|
||||
// Si la config Komga est manquante, rediriger vers les settings
|
||||
if (errorCode === ERROR_CODES.KOMGA.MISSING_CONFIG) {
|
||||
router.push("/settings");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
throw new Error(errorCode);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export function ClientHomePage() {
|
||||
|
||||
// Récupérer les nouvelles données
|
||||
const response = await fetch("/api/komga/home", {
|
||||
cache: 'reload' // Force un nouveau fetch après invalidation
|
||||
cache: "reload", // Force un nouveau fetch après invalidation
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -128,4 +128,3 @@ export function ClientHomePage() {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ export function HomeContent({ data, refreshHome }: HomeContentProps) {
|
||||
|
||||
// Vérifier si la HeroSection a déjà été affichée
|
||||
useEffect(() => {
|
||||
const heroShown = localStorage.getItem('heroSectionShown');
|
||||
const heroShown = localStorage.getItem("heroSectionShown");
|
||||
if (!heroShown && data.ongoing && data.ongoing.length > 0) {
|
||||
setShowHero(true);
|
||||
localStorage.setItem('heroSectionShown', 'true');
|
||||
localStorage.setItem("heroSectionShown", "true");
|
||||
}
|
||||
}, [data.ongoing]);
|
||||
|
||||
|
||||
@@ -79,13 +79,11 @@ function MediaCard({ item, onClick }: MediaCardProps) {
|
||||
const { t } = useTranslate();
|
||||
const isSeries = "booksCount" in item;
|
||||
const { isAccessible } = useBookOfflineStatus(isSeries ? "" : item.id);
|
||||
|
||||
|
||||
const title = isSeries
|
||||
? item.metadata.title
|
||||
: item.metadata.title ||
|
||||
(item.metadata.number
|
||||
? t("navigation.volume", { number: item.metadata.number })
|
||||
: "");
|
||||
(item.metadata.number ? t("navigation.volume", { number: item.metadata.number }) : "");
|
||||
|
||||
const handleClick = () => {
|
||||
// Pour les séries, toujours autoriser le clic
|
||||
@@ -100,7 +98,7 @@ function MediaCard({ item, onClick }: MediaCardProps) {
|
||||
onClick={handleClick}
|
||||
className={cn(
|
||||
"flex-shrink-0 w-[200px] relative flex flex-col hover:bg-accent hover:text-accent-foreground transition-colors overflow-hidden",
|
||||
(!isSeries && !isAccessible) ? "cursor-not-allowed" : "cursor-pointer"
|
||||
!isSeries && !isAccessible ? "cursor-not-allowed" : "cursor-pointer"
|
||||
)}
|
||||
>
|
||||
<div className="relative aspect-[2/3] bg-muted">
|
||||
|
||||
Reference in New Issue
Block a user