refactor #27

Merged
rov merged 3 commits from refactor into main 2026-03-28 19:47:51 -03:00
4 changed files with 50 additions and 114 deletions
Showing only changes of commit d579878459 - Show all commits

View File

@ -7,9 +7,9 @@ import {
useDeleteMangaIngestReview, useDeleteMangaIngestReview,
useResolveMangaIngestReview, useResolveMangaIngestReview,
} from "@/api/generated/manga-ingest-review/manga-ingest-review.ts"; } from "@/api/generated/manga-ingest-review/manga-ingest-review.ts";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button.tsx";
import { Card } from "@/components/ui/card"; import { Card } from "@/components/ui/card.tsx";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input.tsx";
interface ImportReviewCardProps { interface ImportReviewCardProps {
importReview: MangaIngestReviewDTO; importReview: MangaIngestReviewDTO;

View File

@ -0,0 +1,45 @@
import {Card} from "@/components/ui/card.tsx";
import {AlertCircle} from "lucide-react";
import {useGetMangaIngestReviews} from "@/api/generated/manga-ingest-review/manga-ingest-review.ts";
import {ImportReviewCard} from "@/features/admin/components/ImportReviewCard.tsx";
export const IngestReview = () => {
const { data: importReviewData, queryKey } = useGetMangaIngestReviews();
return (<div className="space-y-6">
<div>
<h2 className="text-xl font-semibold text-foreground">
Ingest Review
</h2>
<p className="text-sm text-muted-foreground">
Review and resolve imports that need manual matching.
</p>
</div>
{!importReviewData?.data || importReviewData.data.length === 0 ? (
<Card className="p-8 text-center">
<AlertCircle className="mx-auto h-12 w-12 text-muted-foreground" />
<h2 className="mt-4 text-lg font-semibold text-foreground">
No Imports to Review
</h2>
<p className="mt-2 text-muted-foreground">
All your imports have been processed successfully!
</p>
</Card>
) : (
<div className="space-y-4">
<div className="text-sm text-muted-foreground">
{importReviewData.data.length} import
{importReviewData.data.length !== 1 ? "s" : ""} to review
</div>
{importReviewData.data.map((importReview) => (
<ImportReviewCard
key={importReview.id}
importReview={importReview}
queryKey={queryKey}
/>
))}
</div>
)}
</div>);
};

View File

@ -7,6 +7,7 @@ import { FailedImportJobs } from "@/features/admin/components/FailedImportJobs.t
import { ProviderManager } from "@/features/admin/components/ProviderManager.tsx"; import { ProviderManager } from "@/features/admin/components/ProviderManager.tsx";
import {MangaImport} from "@/features/admin/components/MangaImport.tsx"; import {MangaImport} from "@/features/admin/components/MangaImport.tsx";
import {useGetMangaImportJobs} from "@/api/generated/content/content.ts"; import {useGetMangaImportJobs} from "@/api/generated/content/content.ts";
import {IngestReview} from "@/features/admin/components/IngestReview.tsx";
type Tab = type Tab =
| "import" | "import"
@ -72,10 +73,8 @@ const Admin = () => {
return ( return (
<main className="min-h-screen bg-background"> <main className="min-h-screen bg-background">
<div className="flex"> <div className="flex">
{/* Sidebar */}
<aside className="sticky top-0 h-screen w-64 shrink-0 border-r border-border bg-card"> <aside className="sticky top-0 h-screen w-64 shrink-0 border-r border-border bg-card">
<div className="flex h-full flex-col"> <div className="flex h-full flex-col">
{/* Sidebar Header */}
<div className="border-b border-border px-6 py-5"> <div className="border-b border-border px-6 py-5">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Shield className="h-5 w-5 text-primary" /> <Shield className="h-5 w-5 text-primary" />
@ -88,7 +87,6 @@ const Admin = () => {
</p> </p>
</div> </div>
{/* Nav */}
<nav className="flex-1 space-y-1 px-3 py-4"> <nav className="flex-1 space-y-1 px-3 py-4">
{tabs.map((tab) => ( {tabs.map((tab) => (
<button <button
@ -117,7 +115,6 @@ const Admin = () => {
))} ))}
</nav> </nav>
{/* Sidebar Footer */}
<div className="border-t border-border px-3 py-4"> <div className="border-t border-border px-3 py-4">
<Button <Button
variant="ghost" variant="ghost"
@ -131,47 +128,11 @@ const Admin = () => {
</div> </div>
</aside> </aside>
{/* Main Content */}
<div className="flex-1 px-8 py-8"> <div className="flex-1 px-8 py-8">
{activeTab === "providers" && <ProviderManager />} {activeTab === "providers" && <ProviderManager />}
{/*{activeTab === "manga" && <AdminMangaTable />}*/} {/*{activeTab === "manga" && <AdminMangaTable />}*/}
{activeTab === "import" && <MangaImport />} {activeTab === "import" && <MangaImport />}
{activeTab === "ingest-review" && <IngestReview />}
{/*{activeTab === "ingest-review" && (*/}
{/* <div className="space-y-6">*/}
{/* <div>*/}
{/* <h2 className="text-xl font-semibold text-foreground">*/}
{/* Ingest Review*/}
{/* </h2>*/}
{/* <p className="text-sm text-muted-foreground">*/}
{/* Review and resolve imports that need manual matching.*/}
{/* </p>*/}
{/* </div>*/}
{/* {failedImports.length === 0 ? (*/}
{/* <Card className="p-8 text-center">*/}
{/* <AlertCircle className="mx-auto h-12 w-12 text-muted-foreground" />*/}
{/* <h3 className="mt-4 text-lg font-semibold text-foreground">*/}
{/* No Pending Reviews*/}
{/* </h3>*/}
{/* <p className="mt-2 text-muted-foreground">*/}
{/* All imports have been processed successfully.*/}
{/* </p>*/}
{/* </Card>*/}
{/* ) : (*/}
{/* <div className="space-y-4">*/}
{/* <p className="text-sm text-muted-foreground">*/}
{/* {failedImports.length} import*/}
{/* {failedImports.length !== 1 ? "s" : ""} to review*/}
{/* </p>*/}
{/* {failedImports.map((fi) => (*/}
{/* <FailedImportCard key={fi.id} failedImport={fi} />*/}
{/* ))}*/}
{/* </div>*/}
{/* )}*/}
{/* </div>*/}
{/*)}*/}
{activeTab === "import-jobs" && <FailedImportJobs />} {activeTab === "import-jobs" && <FailedImportJobs />}
{/*{activeTab === "users" && <AdminUserManager />}*/} {/*{activeTab === "users" && <AdminUserManager />}*/}

View File

@ -1,70 +0,0 @@
"use client";
import { AlertCircle } from "lucide-react";
import { useEffect } from "react";
import { useNavigate } from "react-router";
import { useGetMangaIngestReviews } from "@/api/generated/manga-ingest-review/manga-ingest-review.ts";
import { Card } from "@/components/ui/card";
import { useAuth } from "@/contexts/AuthContext.tsx";
import { ImportReviewCard } from "@/features/import-review/ImportReviewCard.tsx";
export default function ImportReviewPage() {
const navigate = useNavigate();
const { user, isAuthenticated } = useAuth();
const { data: importReviewData, queryKey } = useGetMangaIngestReviews();
useEffect(() => {
if (!user) {
return;
}
if (!isAuthenticated) {
navigate("/login");
}
}, [isAuthenticated, navigate, user]);
if (!user) {
return null;
}
return (
<main className="min-h-screen bg-background">
<div className="container mx-auto px-4 py-8">
<div className="mb-8">
<h1 className="text-3xl font-bold text-foreground">Import Review</h1>
<p className="mt-2 text-muted-foreground">
Review and resolve manga imports by manually matching them with
MyAnimeList entries.
</p>
</div>
{!importReviewData?.data || importReviewData.data.length === 0 ? (
<Card className="p-8 text-center">
<AlertCircle className="mx-auto h-12 w-12 text-muted-foreground" />
<h2 className="mt-4 text-lg font-semibold text-foreground">
No Imports to Review
</h2>
<p className="mt-2 text-muted-foreground">
All your imports have been processed successfully!
</p>
</Card>
) : (
<div className="space-y-4">
<div className="text-sm text-muted-foreground">
{importReviewData.data.length} import
{importReviewData.data.length !== 1 ? "s" : ""} to review
</div>
{importReviewData.data.map((importReview) => (
<ImportReviewCard
key={importReview.id}
importReview={importReview}
queryKey={queryKey}
/>
))}
</div>
)}
</div>
</main>
);
}