chore(lps-admin): 폴더명 lps-temp-fe → lps-admin
임시 FE 가 정식 관리자 콘솔이 되어 이름을 용도에 맞게 변경. 루트 병렬 유지(lps/ 는 파이썬 백엔드 루트라 중첩 시 비대칭 + Docker 빌드 컨텍스트 오염). package.json name 동기화. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6eb71eb035
commit
992a3246a8
21 files changed
+1
-1
No files matched your search
@@ -0,0 +1,61 @@
|
||||
/** 앱 레이아웃 — 좌측 네비 + 상단 헬스 배지. */
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { NavLink, Outlet } from "react-router";
|
||||
import { healthz } from "../api/client";
|
||||
|
||||
const MENU = [
|
||||
{ to: "/", label: "대시보드", end: true },
|
||||
{ to: "/jobs", label: "작업 큐" },
|
||||
{ to: "/products", label: "상품·가격" },
|
||||
{ to: "/crawl", label: "크롤 상태" },
|
||||
{ to: "/costs", label: "비용" },
|
||||
{ to: "/settings", label: "설정" },
|
||||
];
|
||||
|
||||
export default function Layout() {
|
||||
const health = useQuery({ queryKey: ["healthz"], queryFn: healthz, refetchInterval: 10_000 });
|
||||
const up = health.data === true;
|
||||
return (
|
||||
<div className="mx-auto flex min-h-screen max-w-[1280px]">
|
||||
<aside className="w-[196px] shrink-0 border-r border-line-200 px-3 py-5">
|
||||
<div className="mb-6 flex items-center gap-2.5 px-2">
|
||||
<span className="grid h-8 w-8 place-items-center rounded-lg bg-gradient-to-br from-primary-600 to-[#8b7bff] text-[14px] font-extrabold text-white">L</span>
|
||||
<div>
|
||||
<div className="text-[14px] font-bold leading-tight">LPS 관리자</div>
|
||||
<div className="text-[10.5px] font-medium text-ink-400">인터넷 최저가 검색</div>
|
||||
</div>
|
||||
</div>
|
||||
<nav aria-label="주 메뉴">
|
||||
<ul className="space-y-0.5">
|
||||
{MENU.map((m) => (
|
||||
<li key={m.to}>
|
||||
<NavLink
|
||||
to={m.to}
|
||||
end={m.end}
|
||||
className={({ isActive }) =>
|
||||
`block rounded-lg px-3 py-2 text-[13px] font-semibold transition-colors ${
|
||||
isActive ? "bg-primary-50 text-primary-700" : "text-ink-700 hover:bg-surface-2"
|
||||
}`
|
||||
}
|
||||
>
|
||||
{m.label}
|
||||
</NavLink>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
<div className="mt-8 flex items-center gap-2 px-3 text-[11.5px] font-semibold text-ink-500">
|
||||
<span
|
||||
className={`h-2 w-2 rounded-full ${up ? "bg-ok-600" : "bg-dead-600"}`}
|
||||
aria-hidden
|
||||
/>
|
||||
{up ? "API 연결됨" : "API 연결 안 됨"}
|
||||
</div>
|
||||
</aside>
|
||||
<main className="min-w-0 flex-1 px-6 py-5">
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/** 공용 UI 조각 — 카드·스탯 타일·상태 배지·빈/오류 표시. 웹 표준 시맨틱 마크업 유지. */
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import type { JobStatusName } from "../api/types";
|
||||
|
||||
export function Card({ title, hint, children, className = "" }: {
|
||||
title?: ReactNode; hint?: ReactNode; children: ReactNode; className?: string;
|
||||
}) {
|
||||
return (
|
||||
<section className={`rounded-xl border border-line-200 bg-surface shadow-[0_1px_2px_rgba(16,24,40,.04)] ${className}`}>
|
||||
{title !== undefined && (
|
||||
<header className="flex items-center gap-2 border-b border-line-100 px-4 py-2.5">
|
||||
<h2 className="text-[13px] font-bold tracking-tight">{title}</h2>
|
||||
{hint && <span className="ml-auto text-[11px] text-ink-400">{hint}</span>}
|
||||
</header>
|
||||
)}
|
||||
<div className="p-4">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export function StatTile({ label, value, sub, tone = "default" }: {
|
||||
label: string; value: ReactNode; sub?: ReactNode;
|
||||
tone?: "default" | "ok" | "warn" | "run" | "dead";
|
||||
}) {
|
||||
const toneCls = {
|
||||
default: "text-ink-900",
|
||||
ok: "text-ok-600",
|
||||
warn: "text-warn-600",
|
||||
run: "text-run-600",
|
||||
dead: "text-dead-600",
|
||||
}[tone];
|
||||
return (
|
||||
<div className="rounded-xl border border-line-200 bg-surface px-4 py-3">
|
||||
<div className="text-[11.5px] font-semibold text-ink-500">{label}</div>
|
||||
<div className={`mt-0.5 text-[22px] font-bold leading-tight ${toneCls}`}>{value}</div>
|
||||
{sub && <div className="mt-0.5 text-[11px] text-ink-400">{sub}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const STATUS_STYLE: Record<JobStatusName, { dot: string; bg: string; text: string; label: string }> = {
|
||||
PENDING: { dot: "bg-warn-600", bg: "bg-warn-50", text: "text-warn-700", label: "대기" },
|
||||
RUNNING: { dot: "bg-run-600", bg: "bg-run-50", text: "text-run-600", label: "처리중" },
|
||||
DONE: { dot: "bg-ok-600", bg: "bg-ok-50", text: "text-ok-600", label: "완료" },
|
||||
DEAD: { dot: "bg-dead-600", bg: "bg-dead-50", text: "text-dead-600", label: "실패" },
|
||||
};
|
||||
|
||||
export function StatusBadge({ status }: { status: JobStatusName }) {
|
||||
const s = STATUS_STYLE[status];
|
||||
return (
|
||||
<span className={`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-semibold ${s.bg} ${s.text}`}>
|
||||
<span className={`h-1.5 w-1.5 rounded-full ${s.dot}`} aria-hidden />
|
||||
{s.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function Empty({ children }: { children: ReactNode }) {
|
||||
return <p className="py-8 text-center text-[12.5px] text-ink-400">{children}</p>;
|
||||
}
|
||||
|
||||
export function ErrorNote({ error }: { error: unknown }) {
|
||||
return (
|
||||
<p role="alert" className="rounded-lg bg-dead-50 px-3 py-2 text-[12.5px] font-medium text-dead-600">
|
||||
{error instanceof Error ? error.message : "요청에 실패했습니다"}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
export function Loading() {
|
||||
return <p className="py-8 text-center text-[12.5px] text-ink-400" aria-busy="true">불러오는 중…</p>;
|
||||
}
|
||||
Reference in new issue
Block a user