이름: solution/front → solution/frontend

`backend` 옆에 `front` 가 있을 이유가 없었다. negosium 의 negodata/front 를 그대로
베꼈고 그게 왜 front 인지는 따져보지 않았다 — 근거 없이 들여온 이름이라 바로잡는다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019uYhHQdssRubirPirrdJJC
This commit is contained in:
minaChoiandClaude Opus 5 committed 2026-08-31 15:27:16 +09:00
1 parent 06f6438d9b
commit c85c577349
480 files changed
+22 -22

No files matched your search

@@ -0,0 +1,128 @@
import type {ComponentType, ReactNode} from 'react';
import {Link, NavLink, useLocation} from 'react-router';
import {LayoutGrid, LogOut, Search, Wand2} from 'lucide-react';
import {cn} from '@/lib/utils';
import {useAuthStore} from '@/stores/auth';
export type NavItem = {
to: string;
/** 활성 표시용 경로. 쿼리스트링이 붙은 `to` 로는 pathname 을 비교할 수 없다. */
match: string;
label: string;
icon: ComponentType<{className?: string}>;
};
/**
* ★ 메뉴를 이 파일에 하드코딩하지 않는다 — 앱마다 다르고, **섞이면 새어 나간다.**
* 내부 메뉴(`/places`, `/local-content`)를 여기 두면 그 경로 이름이 사장님 번들에
* 문자열로 남는다(실측: 앱을 가른 뒤에도 dist 에서 `local-content` 가 나왔다).
* 앱을 가른 이유가 그거라 메뉴도 앱이 들고 온다. 내부 메뉴는 `admin/src/app/router.tsx`.
*
* ★ 빌더는 `?new=1` 로 간다. 그냥 `/builder` 로 보내면 저장된 위저드 상태가 복원돼
* 지난번에 편집하던 가게의 에디터가 뜬다(BuilderPage 주석) — 새로 만들러 누른 사람에게는
* 남의 화면이다.
*/
const OWNER_NAV: NavItem[] = [
{to: '/builder?new=1', match: '/builder', label: '새 사이트', icon: Wand2},
];
export function AppShell({children, nav = OWNER_NAV}: {children: ReactNode; nav?: NavItem[]}) {
const user = useAuthStore((s) => s.user);
const signOut = useAuthStore((s) => s.signOut);
const location = useLocation();
return (
<div className="flex h-screen w-screen overflow-hidden bg-background text-foreground">
<aside className="hidden w-56 shrink-0 flex-col border-r border-sidebar-border bg-sidebar md:flex">
<Link to={nav[0]?.to ?? '/'} className="flex items-center gap-2 px-4 py-4">
<img src="/brand/web4ai-wordmark.svg" alt="Web4Ai" className="h-7 w-auto" />
</Link>
<nav className="flex-1 space-y-0.5 px-2">
{nav.map(({to, match, label, icon: Icon}) => (
<NavLink
key={to}
to={to}
className={() =>
cn(
'flex items-center gap-2 rounded-md px-2.5 py-2 text-xs font-medium transition-colors',
location.pathname.startsWith(match)
? 'bg-sidebar-accent text-sidebar-accent-foreground'
: 'text-sidebar-foreground hover:bg-sidebar-accent/60',
)
}
>
<Icon className="size-4" />
<span>{label}</span>
</NavLink>
))}
</nav>
<div className="border-t border-sidebar-border p-3">
<div className="mb-2 truncate text-[11px] text-sidebar-foreground">
{user?.name ?? user?.id}
{user?.companyName ? ` · ${user.companyName}` : ''}
</div>
<button
type="button"
onClick={signOut}
className="flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-xs text-sidebar-foreground transition-colors hover:bg-sidebar-accent/60"
>
<LogOut className="size-3.5" />
<span>로그아웃</span>
</button>
</div>
</aside>
<div className="flex min-w-0 flex-1 flex-col overflow-hidden">
<main className="flex-1 overflow-y-auto">{children}</main>
</div>
</div>
);
}
export function PageContainer({
title,
description,
actions,
children,
}: {
title: string;
description?: string;
actions?: ReactNode;
children: ReactNode;
}) {
return (
<div className="mx-auto w-full max-w-6xl px-5 py-6">
<header className="mb-5 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
<div>
<h1 className="text-lg font-semibold tracking-tight">{title}</h1>
{description && <p className="mt-0.5 text-xs text-muted-foreground">{description}</p>}
</div>
{actions && <div className="flex items-center gap-2">{actions}</div>}
</header>
{children}
</div>
);
}
export function EmptyState({
icon: Icon = LayoutGrid,
title,
description,
action,
}: {
icon?: typeof Search;
title: string;
description?: string;
action?: ReactNode;
}) {
return (
<div className="flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border px-6 py-14 text-center">
<Icon className="size-6 text-muted-foreground" />
<p className="text-sm font-medium">{title}</p>
{description && <p className="max-w-md text-xs text-muted-foreground">{description}</p>}
{action && <div className="mt-2">{action}</div>}
</div>
);
}
@@ -0,0 +1,25 @@
import type {ReactNode} from 'react';
import {Navigate, useLocation} from 'react-router';
import {Loader2} from 'lucide-react';
import {useAuthStore} from '@/stores/auth';
export function RequireAuth({children}: {children: ReactNode}) {
const location = useLocation();
const isRestoring = useAuthStore((s) => s.isRestoring);
const user = useAuthStore((s) => s.user);
// 복구가 끝나기 전에 판단하면, 새로고침할 때마다 로그인 화면이 한 번 번쩍인다.
if (isRestoring) {
return (
<div className="flex h-screen items-center justify-center text-muted-foreground">
<Loader2 className="size-5 animate-spin" />
</div>
);
}
if (!user) {
return <Navigate to="/login" replace state={{from: location.pathname}} />;
}
return <>{children}</>;
}
@@ -0,0 +1,28 @@
import {cva, type VariantProps} from 'class-variance-authority';
import type {HTMLAttributes} from 'react';
import {cn} from '@/lib/utils';
const badgeVariants = cva(
'inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs tracking-tight whitespace-nowrap',
{
variants: {
variant: {
default: 'bg-muted text-foreground border-border',
outline: 'bg-transparent text-muted-foreground border-border',
warning: 'bg-warning/10 text-warning border-warning/30 font-medium',
success: 'bg-success/10 text-success border-success/30',
accent: 'bg-primary text-primary-foreground border-primary',
contrast: 'bg-foreground text-background border-foreground',
},
},
defaultVariants: {variant: 'default'},
},
);
export interface BadgeProps
extends HTMLAttributes<HTMLSpanElement>,
VariantProps<typeof badgeVariants> {}
export function Badge({className, variant, ...props}: BadgeProps) {
return <span className={cn(badgeVariants({variant}), className)} {...props} />;
}
@@ -0,0 +1,56 @@
import {cva, type VariantProps} from 'class-variance-authority';
import type {ButtonHTMLAttributes} from 'react';
import {Loader2} from 'lucide-react';
import {cn} from '@/lib/utils';
const buttonVariants = cva(
'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-40 select-none cursor-pointer [&_svg]:shrink-0',
{
variants: {
variant: {
primary: 'bg-primary text-primary-foreground hover:bg-primary/90',
secondary: 'bg-card text-foreground border border-border hover:bg-muted',
outline: 'bg-transparent text-foreground border border-border hover:bg-muted',
ghost: 'bg-transparent text-muted-foreground hover:bg-muted hover:text-foreground',
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
contrast: 'bg-foreground text-background hover:bg-foreground/90',
},
size: {
sm: 'h-8 px-2.5 text-xs [&_svg]:size-3.5',
md: 'h-9 px-4 text-sm [&_svg]:size-4',
lg: 'h-11 px-6 text-base [&_svg]:size-4',
icon: 'h-8 w-8 [&_svg]:size-4',
},
},
defaultVariants: {variant: 'secondary', size: 'md'},
},
);
export interface ButtonProps
extends ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
isLoading?: boolean;
}
export function Button({
className,
variant,
size,
isLoading = false,
disabled,
children,
...props
}: ButtonProps) {
return (
<button
className={cn(buttonVariants({variant, size}), className)}
disabled={disabled || isLoading}
{...props}
>
{isLoading && <Loader2 className="animate-spin" aria-hidden />}
{children}
</button>
);
}
export {buttonVariants};
@@ -0,0 +1,27 @@
import type {HTMLAttributes} from 'react';
import {cn} from '@/lib/utils';
export function Card({className, ...props}: HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn('rounded-xl border border-border bg-card text-card-foreground', className)}
{...props}
/>
);
}
export function CardHeader({className, ...props}: HTMLAttributes<HTMLDivElement>) {
return <div className={cn('flex flex-col gap-1 px-5 py-4', className)} {...props} />;
}
export function CardTitle({className, ...props}: HTMLAttributes<HTMLHeadingElement>) {
return <h3 className={cn('text-sm font-semibold text-foreground', className)} {...props} />;
}
export function CardDescription({className, ...props}: HTMLAttributes<HTMLParagraphElement>) {
return <p className={cn('text-xs text-muted-foreground', className)} {...props} />;
}
export function CardContent({className, ...props}: HTMLAttributes<HTMLDivElement>) {
return <div className={cn('px-5 pb-5', className)} {...props} />;
}
@@ -0,0 +1,77 @@
import {useEffect, type ReactNode} from 'react';
import {X} from 'lucide-react';
import {cn} from '@/lib/utils';
interface DialogProps {
open: boolean;
onClose: () => void;
title: string;
description?: string;
children: ReactNode;
/** 항상 아래에 붙어 있어야 하는 영역(주요 버튼). 본문이 길어도 잘리지 않는다. */
footer?: ReactNode;
className?: string;
}
export function Dialog({open, onClose, title, description, children, footer, className}: DialogProps) {
useEffect(() => {
if (!open) return;
const onKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Escape') onClose();
};
// 배경 스크롤 잠금 — 모달 뒤 페이지가 같이 움직이면 어디를 보는지 잃는다.
const previous = document.body.style.overflow;
document.body.style.overflow = 'hidden';
window.addEventListener('keydown', onKeyDown);
return () => {
document.body.style.overflow = previous;
window.removeEventListener('keydown', onKeyDown);
};
}, [open, onClose]);
if (!open) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4" role="presentation">
<div
className="fixed inset-0 bg-foreground/50 backdrop-blur-[2px]"
onClick={onClose}
aria-hidden
/>
<div
role="dialog"
aria-modal="true"
aria-label={title}
className={cn(
// ★ 내용이 화면보다 길어도 헤더·본문만 늘어나고 하단 버튼은 잘리지 않아야 한다.
// 실제로 발행 모달이 화면을 넘겨 [발행하기] 가 화면 밖으로 밀려났다.
// 그래서 다이얼로그 높이를 뷰포트로 묶고, 넘치는 것은 본문이 스크롤한다.
'relative z-10 flex max-h-[calc(100dvh-2rem)] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-border bg-card shadow-xl',
className,
)}
>
<div className="flex shrink-0 items-start justify-between gap-4 border-b border-border bg-muted/40 px-5 py-3.5">
<div>
<h2 className="text-sm font-semibold text-foreground">{title}</h2>
{description && (
<p className="mt-0.5 text-xs text-muted-foreground">{description}</p>
)}
</div>
<button
type="button"
onClick={onClose}
aria-label="닫기"
className="rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<X className="size-4" />
</button>
</div>
{/* 본문만 스크롤한다 — footer 를 쓰는 화면은 버튼이 항상 아래에 붙어 있게 된다. */}
<div className="min-h-0 flex-1 overflow-y-auto p-5">{children}</div>
{footer && (
<div className="shrink-0 border-t border-border bg-card px-5 py-3.5">{footer}</div>
)}
</div>
</div>
);
}
@@ -0,0 +1,14 @@
import type {InputHTMLAttributes} from 'react';
import {cn} from '@/lib/utils';
export function Input({className, ...props}: InputHTMLAttributes<HTMLInputElement>) {
return (
<input
className={cn(
'w-full rounded-md border border-border bg-muted/50 px-3 py-2 text-sm text-foreground transition-colors outline-none placeholder:text-muted-foreground focus:border-ring focus:bg-card focus:ring-1 focus:ring-ring disabled:opacity-50',
className,
)}
{...props}
/>
);
}
@@ -0,0 +1,31 @@
import {cn} from '@/lib/utils';
interface ProgressProps {
/** 0 ~ 100 */
value: number;
className?: string;
'aria-label'?: string;
}
export function Progress({value, className, ...props}: ProgressProps) {
const clamped = Math.max(0, Math.min(100, value));
return (
<div
role="progressbar"
aria-valuenow={clamped}
aria-valuemin={0}
aria-valuemax={100}
aria-label={props['aria-label']}
className={cn('relative h-2 w-full overflow-hidden rounded-full bg-muted', className)}
>
<div
className="h-full rounded-full bg-primary transition-[width] duration-500 ease-out"
style={{width: `${clamped}%`}}
/>
{/* 0% 구간에서도 '진행 중'이 보이게 광택을 얹는다. */}
<div className="pointer-events-none absolute inset-0 overflow-hidden">
<div className="o2o-progress-shimmer h-full w-1/5 bg-gradient-to-r from-transparent via-white/50 to-transparent" />
</div>
</div>
);
}
@@ -0,0 +1,51 @@
import type {MouseEvent} from 'react';
import {cn} from '@/lib/utils';
interface SwitchProps {
checked: boolean;
onCheckedChange: (checked: boolean) => void;
disabled?: boolean;
id?: string;
'aria-label'?: string;
className?: string;
}
export function Switch({
checked,
onCheckedChange,
disabled = false,
id,
className,
...props
}: SwitchProps) {
// 스위치는 클릭 가능한 행 안에 놓이는 일이 많다 — 토글이 행 선택까지 트리거하지 않게 막는다.
const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
event.stopPropagation();
if (!disabled) onCheckedChange(!checked);
};
return (
<button
id={id}
type="button"
role="switch"
aria-checked={checked}
aria-label={props['aria-label']}
disabled={disabled}
onClick={handleClick}
className={cn(
'relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-40',
checked ? 'bg-primary' : 'bg-border',
className,
)}
>
<span
aria-hidden
className={cn(
'pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200',
checked ? 'translate-x-4' : 'translate-x-0',
)}
/>
</button>
);
}