이름: 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:
1 parent
06f6438d9b
commit
c85c577349
480 files changed
+22
-22
No files matched your search
@@ -0,0 +1,224 @@
|
||||
import {useEffect, useRef} from 'react';
|
||||
import {ArrowLeft, ExternalLink, Loader2, TriangleAlert} from 'lucide-react';
|
||||
import {Link, useSearchParams} from 'react-router';
|
||||
import {SiteStatus} from '@o2o/shared';
|
||||
import {AppShell} from '@/components/layout/AppShell';
|
||||
import {
|
||||
Step1Industry,
|
||||
Step2PlaceSearch,
|
||||
Step3DataReview,
|
||||
Step4Template,
|
||||
Step5Generating,
|
||||
} from '@/features/onboarding';
|
||||
import {EditorLayout} from '@/features/builder';
|
||||
import {useDevAutoLogin} from '@/hooks/useDevAutoLogin';
|
||||
import {usePlaceSync} from '@/hooks/usePlaceSync';
|
||||
import {EDITOR_STEP, useBuilderStore} from '@/stores/builder';
|
||||
|
||||
/** 발행 사이트 렌더러의 개발 서버. 프로덕션에서는 실제 발행 주소로 바뀐다. */
|
||||
const SITE_PREVIEW_URL = import.meta.env.VITE_SITE_PREVIEW_URL ?? window.location.origin;
|
||||
|
||||
/**
|
||||
* "발행본 사이트 열기" 가 향할 주소.
|
||||
*
|
||||
* ★ 예전엔 서버 루트(:3001)만 열었다. 사이트가 하나뿐이던 시절의 흔적인데, 지금은
|
||||
* 여러 사이트가 `/s/<주소>` 아래 놓여서 루트를 열면 아무것도 안 나온다.
|
||||
* 사장님이 정한 주소(sites.domain)가 있으면 그 사이트로 보낸다.
|
||||
* ★ 도메인이 없으면 null 이다 — 예전엔 서버 루트로 떨어뜨렸는데, 그건 발행 전에도
|
||||
* 버튼이 열려 있고 누르면 빈 화면이 뜬다는 뜻이었다. 열 곳이 없으면 열지 않는다.
|
||||
*/
|
||||
function siteUrl(domain: string | null | undefined): string | null {
|
||||
return domain ? `${SITE_PREVIEW_URL}/s/${domain}` : null;
|
||||
}
|
||||
|
||||
export function BuilderPage() {
|
||||
/**
|
||||
* 어떤 사업장을 편집할지는 쿼리스트링으로 받는다 — `/builder?placeId=<uuid>`.
|
||||
*
|
||||
* ★ 라우트(`/builder/:placeId`)로 받지 않는 이유: 빌더는 로그인 없이 도는 데모 경로이고
|
||||
* (router.tsx 주석), placeId 는 있을 수도 없을 수도 있는 선택값이다. 쿼리스트링이면
|
||||
* 라우트를 하나도 안 건드리고 두 경우를 같은 화면이 받는다.
|
||||
* placeId 가 없으면 아래 훅은 네트워크를 한 번도 타지 않는다 — 데모는 지금 그대로다.
|
||||
*/
|
||||
// 개발 서버에서는 세션을 조용히 확보한다 — 위저드 앞에 로그인 화면을 세우지 않기 위해서다.
|
||||
useDevAutoLogin();
|
||||
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const urlPlaceId = searchParams.get('placeId');
|
||||
|
||||
/**
|
||||
* `?new=1` 로 들어오면 위저드를 1단계(업종 선택)부터 시작한다.
|
||||
*
|
||||
* ★ 저장된 상태를 그대로 두면 지난번 에디터가 복원된다 — 새 가게를 만들러 온 사람에게는
|
||||
* 자기가 만든 적 없는 화면이 뜨는 셈이다. 비운 뒤에는 주소창에서 플래그를 지워,
|
||||
* 새로고침할 때마다 작업하던 내용이 날아가지 않게 한다.
|
||||
*/
|
||||
const reset = useBuilderStore((s) => s.reset);
|
||||
const isNew = searchParams.get('new') === '1';
|
||||
useEffect(() => {
|
||||
if (!isNew) return;
|
||||
reset();
|
||||
setSearchParams({}, {replace: true});
|
||||
}, [isNew, reset, setSearchParams]);
|
||||
/**
|
||||
* 위저드 2단계에서 확정한 사업장. 주소창에 placeId 가 없어도 이걸로 배선한다.
|
||||
*
|
||||
* ★ 이게 없으면 위저드를 끝까지 걸어온 사장님이 에디터에서 **업종 예시값**을 본다 —
|
||||
* 방금 27건을 확인해 놓고 '독채 3개 동' 같은 남의 가게 값이 뜬다. 실제로 그랬다.
|
||||
* 딥링크(/builder?placeId=...)가 우선이다 — 사업장 목록에서 다른 가게를 열 수 있어야 한다.
|
||||
*/
|
||||
const wizardPlaceId = useBuilderStore((s) => s.confirmedIdentity?.placeId ?? null);
|
||||
const placeId = urlPlaceId ?? wizardPlaceId;
|
||||
/**
|
||||
* 에디터로 바로 들어갈지.
|
||||
*
|
||||
* ★ **처음 들어온 순간**의 주소창만 본다. 위저드 2단계가 확정 뒤에 `?placeId=` 를 붙이는데
|
||||
* (새로고침 복원용), 그걸 실시간으로 보면 "URL 붙여넣고 확인 → 곧장 에디터" 가 된다 —
|
||||
* 수집 결과를 보여주는 3·4·5단계가 통째로 건너뛰어진다. 실제로 그렇게 됐다.
|
||||
* 사업장 목록에서 딥링크로 들어온 경우(이미 만든 가게를 여는 것)만 에디터로 보낸다.
|
||||
*/
|
||||
const enteredWithPlace = useRef(
|
||||
Boolean(urlPlaceId) && searchParams.get('flow') !== 'onboarding',
|
||||
).current;
|
||||
const sync = usePlaceSync(placeId, {enterEditor: enteredWithPlace});
|
||||
|
||||
const step = useBuilderStore((s) => s.step);
|
||||
const storeName = useBuilderStore((s) => s.storeName);
|
||||
// 배지는 주소창이 아니라 스토어가 기준이다 — [처음부터]로 데모로 돌아간 뒤에도
|
||||
// 주소창에는 placeId 가 남아 있어서, 그걸 믿으면 데모를 실사업장이라고 표시한다.
|
||||
const wiredPlaceId = useBuilderStore((s) => s.placeId);
|
||||
|
||||
/**
|
||||
* 발행본이 실제로 존재하는가.
|
||||
*
|
||||
* ★ 주소(domain)만으로는 부족하다 — 주소는 발행 **전에** 예약된다(PublishModal 이
|
||||
* 빌드보다 먼저 잡아 둔다). 주소만 보고 버튼을 열면 아직 굽지 않은 사이트로
|
||||
* 보내 404 를 띄운다. 사이트 상태가 PUBLISHED 인 것까지 확인한다.
|
||||
*/
|
||||
const publishedUrl =
|
||||
sync.site?.status === SiteStatus.PUBLISHED ? siteUrl(sync.site.domain) : null;
|
||||
|
||||
// 실사업장을 열었는데 아직 못 읽었다 — 이 동안 데모(달빛스테이)를 그리면
|
||||
// 사장님은 남의 가게를 자기 가게로 오해한다. 차라리 아무것도 안 그린다.
|
||||
if (placeId && sync.isLoading) {
|
||||
return (
|
||||
<BuilderNotice title="사업장을 불러오는 중입니다" description={placeId} isLoading />
|
||||
);
|
||||
}
|
||||
|
||||
if (placeId && (sync.isError || sync.isNotFound)) {
|
||||
return (
|
||||
<BuilderNotice
|
||||
title={sync.isNotFound ? '사업장을 찾지 못했습니다' : '사업장을 불러오지 못했습니다'}
|
||||
description={
|
||||
sync.isNotFound
|
||||
? '주소의 placeId 가 맞는지 확인해 주세요.'
|
||||
: ((sync.error as Error)?.message ??
|
||||
'로그인이 필요한 데이터입니다. 백엔드가 떠 있는지, 로그인돼 있는지 확인해 주세요.')
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (step === EDITOR_STEP) {
|
||||
return (
|
||||
<div className="relative flex h-screen w-screen flex-col overflow-hidden">
|
||||
<div className="z-40 flex items-center justify-between gap-2 border-b border-border bg-foreground px-4 py-1.5 text-[11px] text-background">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<span className="rounded bg-white/10 px-2 py-0.5 font-mono text-[10px] font-semibold">
|
||||
AI-FOR-WEB BUILDER
|
||||
</span>
|
||||
{/* 지금 화면이 실제 사업장인지 시연용 데모인지 한눈에 구분되게 둔다. */}
|
||||
{wiredPlaceId ? (
|
||||
<>
|
||||
<span className="truncate rounded bg-success/20 px-2 py-0.5 font-semibold text-success">
|
||||
실사업장 · {storeName}
|
||||
</span>
|
||||
{/* ★ 예전엔 여기 [사업장 목록] 링크가 있었다. 그 화면은 내부 운영 앱(admin)으로
|
||||
나갔고, 사장님 앱에는 그 경로가 없다 — 남겨두면 404 다. admin 은 빌더를
|
||||
새 탭으로 열므로(admin/src/lib/solutionUrl.ts) 돌아가는 길은 탭 닫기다.
|
||||
사장님용 "내 사이트 관리"가 생기면 그때 이 자리에 잇는다. */}
|
||||
</>
|
||||
) : (
|
||||
<span className="truncate opacity-80">
|
||||
편집한 내용은 [사이트 발행] 을 눌러야 실제 페이지로 구워집니다.
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{/* 캔버스는 미리보기다. 진짜 발행본은 별도 렌더러(site)가 굽는다 —
|
||||
같은 화면을 두 번 구현하지 않고, 그쪽을 새 탭으로 연다.
|
||||
★ 발행 전에는 열지 않는다 — 굽지 않은 주소를 열면 404 다. */}
|
||||
{publishedUrl ? (
|
||||
<a
|
||||
href={publishedUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex shrink-0 items-center gap-1 rounded-md bg-warning px-2.5 py-1 font-bold text-black transition-all hover:opacity-90"
|
||||
>
|
||||
<ExternalLink className="size-3" />
|
||||
<span>발행본 사이트 열기</span>
|
||||
</a>
|
||||
) : (
|
||||
<span
|
||||
title="아직 발행 전입니다 — [사이트 발행] 을 마치면 열립니다."
|
||||
aria-disabled="true"
|
||||
className="flex shrink-0 cursor-not-allowed items-center gap-1 rounded-md bg-white/10 px-2.5 py-1 font-bold text-background/50"
|
||||
>
|
||||
<ExternalLink className="size-3" />
|
||||
<span>발행본 사이트 열기</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="min-h-0 flex-1">
|
||||
<EditorLayout />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// 위저드는 관리자 화면의 일부다 — 사이드바(로고·사업장·로그아웃)를 그대로 쓴다.
|
||||
// 에디터(EDITOR_STEP)만 전체 화면이라 위에서 먼저 빠져나간다.
|
||||
return (
|
||||
<AppShell>
|
||||
<div className="flex h-full min-h-full flex-col">
|
||||
{step === 1 && <Step1Industry />}
|
||||
{step === 2 && <Step2PlaceSearch />}
|
||||
{step === 3 && <Step3DataReview />}
|
||||
{step === 4 && <Step4Template />}
|
||||
{step === 5 && <Step5Generating />}
|
||||
</div>
|
||||
</AppShell>
|
||||
);
|
||||
}
|
||||
|
||||
/** 실사업장을 못 읽었을 때의 전체 화면. 데모로 돌아갈 길을 항상 같이 준다. */
|
||||
function BuilderNotice({
|
||||
title,
|
||||
description,
|
||||
isLoading,
|
||||
}: {
|
||||
title: string;
|
||||
description: string;
|
||||
isLoading?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex h-screen w-screen flex-col items-center justify-center gap-3 bg-muted px-6 text-center">
|
||||
{isLoading ? (
|
||||
<Loader2 className="size-6 animate-spin text-muted-foreground" />
|
||||
) : (
|
||||
<TriangleAlert className="size-6 text-warning" />
|
||||
)}
|
||||
<p className="text-sm font-bold">{title}</p>
|
||||
<p className="max-w-md break-all text-xs text-muted-foreground">{description}</p>
|
||||
{!isLoading && (
|
||||
<Link
|
||||
to="/builder"
|
||||
className="mt-1 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium transition-colors hover:bg-background"
|
||||
>
|
||||
데모로 열기
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,703 @@
|
||||
/**
|
||||
* 개발용 컴포넌트 쇼케이스 — "어떤 디자인이 있나"를 한 화면에서 본다.
|
||||
*
|
||||
* 왼쪽: 섹션 타입 · 배리에이션 목록 가운데: 목업 데이터로 실제 렌더(드래그 카로셀) 오른쪽: 디자인 토큰 그룹
|
||||
*
|
||||
* ★ 빌더 스토어를 건드리지 않는다. 여기서 색을 바꿔도 사장님이 편집 중이던 사이트는 그대로다.
|
||||
* ★ 개발 빌드에서만 열린다(router 에서 import.meta.env.DEV 로 막는다).
|
||||
*/
|
||||
import {useMemo, useState} from 'react';
|
||||
import type {CSSProperties} from 'react';
|
||||
import {Layers, Monitor, Palette, Plus, Smartphone, Tablet, Trash2} from 'lucide-react';
|
||||
import type {IndustryType, ViewportMode} from '@o2o/shared';
|
||||
import {INDUSTRY_CONFIGS} from '@/data/industryData';
|
||||
import {SECTION_VARIANTS, variantsFor} from '@/features/builder/canvas/registry';
|
||||
import {VariantThumb} from '@/features/builder/canvas/thumbs';
|
||||
import {DragCarousel} from '@/features/dev/DragCarousel';
|
||||
import {derivePalette, parsePalette} from '@/features/dev/palette';
|
||||
import {mockPropsFor} from '@/features/dev/mockProps';
|
||||
import {
|
||||
autoForkOf,
|
||||
builtinGroups,
|
||||
deleteCustomGroup,
|
||||
duplicateGroup,
|
||||
FONT_PRESETS,
|
||||
fontPresetId,
|
||||
loadCustomGroups,
|
||||
saveCustomGroup,
|
||||
TOKEN_AWARE_VARIANT_IDS,
|
||||
TOKEN_COLOR_KEYS,
|
||||
tokenCssVars,
|
||||
type TokenColors,
|
||||
type TokenFonts,
|
||||
type TokenGroup,
|
||||
} from '@/features/dev/tokenGroups';
|
||||
import {cn} from '@/lib/utils';
|
||||
|
||||
const VIEWPORTS: {id: ViewportMode; label: string; icon: typeof Monitor; frame: string}[] = [
|
||||
{id: 'pc', label: 'PC', icon: Monitor, frame: 'w-full max-w-[1120px]'},
|
||||
{id: 'tablet', label: '태블릿', icon: Tablet, frame: 'w-[768px] max-w-full'},
|
||||
{id: 'mobile', label: '모바일', icon: Smartphone, frame: 'w-[390px] max-w-full'},
|
||||
];
|
||||
|
||||
const INDUSTRIES = Object.keys(INDUSTRY_CONFIGS) as IndustryType[];
|
||||
const SECTION_TYPES = Object.keys(SECTION_VARIANTS);
|
||||
|
||||
export function DevShowcasePage() {
|
||||
const [industry, setIndustry] = useState<IndustryType>('stay');
|
||||
const [sectionType, setSectionType] = useState<string>(SECTION_TYPES[0]);
|
||||
const [variantIndex, setVariantIndex] = useState(0);
|
||||
const [viewport, setViewport] = useState<ViewportMode>('pc');
|
||||
|
||||
const presets = useMemo(builtinGroups, []);
|
||||
const [customs, setCustoms] = useState<TokenGroup[]>(loadCustomGroups);
|
||||
const [groupId, setGroupId] = useState<string>(presets[0].id);
|
||||
|
||||
const allGroups = useMemo(() => [...presets, ...customs], [presets, customs]);
|
||||
const group = allGroups.find((g) => g.id === groupId) ?? presets[0];
|
||||
|
||||
// 업종 제한이 걸린 배리에이션은 걸러진다 — 캔버스가 고를 수 있는 것과 같은 목록을 본다.
|
||||
const variants = variantsFor(sectionType, industry);
|
||||
const safeIndex = Math.min(variantIndex, Math.max(0, variants.length - 1));
|
||||
|
||||
const pickSection = (type: string) => {
|
||||
setSectionType(type);
|
||||
setVariantIndex(0);
|
||||
};
|
||||
|
||||
/**
|
||||
* 토큰을 고친다.
|
||||
*
|
||||
* ★ 내장 그룹은 읽기 전용이지만, **컨트롤을 막지 않는다.** 예전에는 막아 놨더니
|
||||
* "색을 눌러도 아무 일이 없다" 가 됐다 — 페이지를 열면 내장 그룹이 기본 선택이라
|
||||
* 사실상 항상 그 상태였다. 지금은 만지는 순간 편집본이 자동으로 생기고 그쪽으로 옮겨간다.
|
||||
*/
|
||||
const editGroup = (mutate: (g: TokenGroup) => TokenGroup) => {
|
||||
const target = group.builtin ? autoForkOf(group) : group;
|
||||
const next = mutate(target);
|
||||
setCustoms(saveCustomGroup(next));
|
||||
if (next.id !== groupId) setGroupId(next.id);
|
||||
};
|
||||
|
||||
const updateColor = (key: keyof TokenColors, value: string) =>
|
||||
editGroup((g) => ({...g, colors: {...g.colors, [key]: value}}));
|
||||
|
||||
const updateRadius = (radius: number) => editGroup((g) => ({...g, radius}));
|
||||
|
||||
const updateFont = (slot: keyof TokenFonts, stack: string) =>
|
||||
editGroup((g) => ({...g, fonts: {...g.fonts, [slot]: stack}}));
|
||||
|
||||
/** 팔레트(colorhunt URL 또는 hex 목록) 한 방에 적용. 못 읽으면 false. */
|
||||
const applyPalette = (raw: string): boolean => {
|
||||
const derived = derivePalette(parsePalette(raw));
|
||||
if (!derived) return false;
|
||||
editGroup((g) => ({
|
||||
...g,
|
||||
colors: {
|
||||
primary: derived.primary,
|
||||
secondary: derived.secondary,
|
||||
bg: derived.bg,
|
||||
card: derived.card,
|
||||
text: derived.text,
|
||||
accent: derived.accent,
|
||||
},
|
||||
surfaces: {
|
||||
surface: derived.surface,
|
||||
surfaceAlt: derived.surfaceAlt,
|
||||
inverse: derived.inverse,
|
||||
border: derived.border,
|
||||
},
|
||||
}));
|
||||
return true;
|
||||
};
|
||||
|
||||
const forkGroup = () => {
|
||||
const copy = duplicateGroup(group, `${group.name} 복제`);
|
||||
setCustoms(saveCustomGroup(copy));
|
||||
setGroupId(copy.id);
|
||||
};
|
||||
|
||||
const removeGroup = (id: string) => {
|
||||
setCustoms(deleteCustomGroup(id));
|
||||
if (groupId === id) setGroupId(presets[0].id);
|
||||
};
|
||||
|
||||
const frame = VIEWPORTS.find((v) => v.id === viewport) ?? VIEWPORTS[0];
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col bg-muted/40 text-foreground">
|
||||
<Header
|
||||
industry={industry}
|
||||
onIndustry={(i) => {
|
||||
setIndustry(i);
|
||||
setVariantIndex(0);
|
||||
}}
|
||||
viewport={viewport}
|
||||
onViewport={setViewport}
|
||||
/>
|
||||
|
||||
<div className="flex min-h-0 flex-1">
|
||||
<SectionListPane
|
||||
sectionType={sectionType}
|
||||
onPick={pickSection}
|
||||
industry={industry}
|
||||
variants={variants}
|
||||
variantIndex={safeIndex}
|
||||
onPickVariant={setVariantIndex}
|
||||
/>
|
||||
|
||||
{/* ── 가운데: 목업 데이터로 실제 렌더. 커서로 끌어 배리에이션을 넘긴다. ── */}
|
||||
<main className="flex min-w-0 flex-1 flex-col overflow-y-auto p-6">
|
||||
{variants.length === 0 ? (
|
||||
<EmptyPreview sectionType={sectionType} industry={industry} />
|
||||
) : (
|
||||
<>
|
||||
<PreviewCaption
|
||||
variant={variants[safeIndex]}
|
||||
position={`${safeIndex + 1} / ${variants.length}`}
|
||||
/>
|
||||
|
||||
<div className="mx-auto w-full" style={{maxWidth: '100%'}}>
|
||||
<div className={cn('mx-auto', frame.frame)}>
|
||||
<DragCarousel
|
||||
label={`${sectionType} 배리에이션`}
|
||||
slides={variants.map((variant) => (
|
||||
<div
|
||||
key={variant.id}
|
||||
style={tokenCssVars(group) as CSSProperties}
|
||||
// ★ bg-* 유틸리티를 붙이면 안 된다 — .site-canvas 의 토큰 배경(--tpl-bg)을 덮어써서
|
||||
// 팔레트를 바꿔도 배경이 안 변한다.
|
||||
className="site-canvas overflow-hidden rounded-lg border border-border shadow-sm"
|
||||
>
|
||||
<variant.Component
|
||||
{...mockPropsFor(sectionType, variant, industry, group)}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
index={safeIndex}
|
||||
onIndexChange={setVariantIndex}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="mt-3 text-center text-xs text-muted-foreground">
|
||||
좌우로 끌어서 넘기세요 — 방향키 · 화살표 버튼 · 아래 점도 됩니다.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
|
||||
<TokenPane
|
||||
groups={allGroups}
|
||||
group={group}
|
||||
onSelect={setGroupId}
|
||||
onColor={updateColor}
|
||||
onRadius={updateRadius}
|
||||
onFont={updateFont}
|
||||
onPalette={applyPalette}
|
||||
onFork={forkGroup}
|
||||
onDelete={removeGroup}
|
||||
currentVariantId={variants[safeIndex]?.id}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Header({
|
||||
industry,
|
||||
onIndustry,
|
||||
viewport,
|
||||
onViewport,
|
||||
}: {
|
||||
industry: IndustryType;
|
||||
onIndustry: (i: IndustryType) => void;
|
||||
viewport: ViewportMode;
|
||||
onViewport: (v: ViewportMode) => void;
|
||||
}) {
|
||||
return (
|
||||
<header className="flex shrink-0 items-center justify-between gap-4 border-b border-border bg-card px-4 py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Layers className="size-4" />
|
||||
<span className="text-sm font-semibold">컴포넌트 쇼케이스</span>
|
||||
<span className="rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground">
|
||||
dev only
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<SegmentedControl
|
||||
items={INDUSTRIES.map((i) => ({id: i, label: INDUSTRY_CONFIGS[i].name}))}
|
||||
value={industry}
|
||||
onChange={(v) => onIndustry(v as IndustryType)}
|
||||
/>
|
||||
<SegmentedControl
|
||||
items={VIEWPORTS.map((v) => ({id: v.id, label: v.label, icon: v.icon}))}
|
||||
value={viewport}
|
||||
onChange={(v) => onViewport(v as ViewportMode)}
|
||||
/>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function SegmentedControl({
|
||||
items,
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
items: {id: string; label: string; icon?: typeof Monitor}[];
|
||||
value: string;
|
||||
onChange: (id: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center gap-0.5 rounded border border-border bg-muted p-0.5">
|
||||
{items.map(({id, label, icon: Icon}) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
onClick={() => onChange(id)}
|
||||
aria-pressed={value === id}
|
||||
className={cn(
|
||||
'flex cursor-pointer items-center gap-1 rounded px-2.5 py-1 text-xs transition-colors',
|
||||
value === id
|
||||
? 'bg-card font-semibold text-foreground shadow-xs'
|
||||
: 'text-muted-foreground hover:text-foreground',
|
||||
)}
|
||||
>
|
||||
{Icon && <Icon className="size-3.5" />}
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SectionListPane({
|
||||
sectionType,
|
||||
onPick,
|
||||
industry,
|
||||
variants,
|
||||
variantIndex,
|
||||
onPickVariant,
|
||||
}: {
|
||||
sectionType: string;
|
||||
onPick: (t: string) => void;
|
||||
industry: IndustryType;
|
||||
variants: ReturnType<typeof variantsFor>;
|
||||
variantIndex: number;
|
||||
onPickVariant: (i: number) => void;
|
||||
}) {
|
||||
return (
|
||||
<aside className="flex w-60 shrink-0 flex-col overflow-y-auto border-r border-border bg-card">
|
||||
<PaneTitle>섹션 타입</PaneTitle>
|
||||
<div className="px-2 pb-3">
|
||||
{SECTION_TYPES.map((type) => {
|
||||
const count = variantsFor(type, industry).length;
|
||||
return (
|
||||
<button
|
||||
key={type}
|
||||
type="button"
|
||||
onClick={() => onPick(type)}
|
||||
className={cn(
|
||||
'flex w-full cursor-pointer items-center justify-between rounded px-2 py-1.5 text-left text-xs transition-colors',
|
||||
type === sectionType
|
||||
? 'bg-foreground font-semibold text-background'
|
||||
: 'hover:bg-muted',
|
||||
)}
|
||||
>
|
||||
<span className="font-mono">{type}</span>
|
||||
<span className={cn('text-[10px]', type === sectionType ? 'opacity-70' : 'text-muted-foreground')}>
|
||||
{count}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<PaneTitle>배리에이션</PaneTitle>
|
||||
<div className="space-y-1 px-2 pb-6">
|
||||
{variants.map((v, i) => (
|
||||
<button
|
||||
key={v.id}
|
||||
type="button"
|
||||
onClick={() => onPickVariant(i)}
|
||||
className={cn(
|
||||
'flex w-full cursor-pointer items-start gap-2 rounded border p-2 text-left transition-colors',
|
||||
i === variantIndex
|
||||
? 'border-foreground bg-muted'
|
||||
: 'border-transparent hover:border-border hover:bg-muted/60',
|
||||
)}
|
||||
>
|
||||
<VariantThumb thumb={v.thumb} className="mt-0.5 size-8 shrink-0" />
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="flex items-center gap-1">
|
||||
<span className="truncate text-xs font-semibold">{v.name}</span>
|
||||
{v.isDefault && (
|
||||
<span className="shrink-0 rounded bg-muted px-1 text-[9px] text-muted-foreground">
|
||||
기본
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="mt-0.5 block truncate font-mono text-[10px] text-muted-foreground">
|
||||
{v.id}
|
||||
</span>
|
||||
<TokenBadge variantId={v.id} />
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
/** 이 배리에이션이 토큰 그룹에 반응하는가. 반응하지 않는 게 다수라 눈에 보이게 표시한다. */
|
||||
function TokenBadge({variantId}: {variantId: string}) {
|
||||
const aware = TOKEN_AWARE_VARIANT_IDS.has(variantId);
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
'mt-1 inline-block rounded px-1 text-[9px]',
|
||||
aware ? 'bg-success/15 text-success' : 'bg-muted text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{aware ? '토큰 반응' : '색 하드코딩'}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function PaneTitle({children}: {children: React.ReactNode}) {
|
||||
return (
|
||||
<div className="sticky top-0 z-10 bg-card px-3 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PreviewCaption({
|
||||
variant,
|
||||
position,
|
||||
}: {
|
||||
variant: {id: string; name: string; description: string};
|
||||
position: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="mx-auto mb-3 flex w-full max-w-[1120px] items-start justify-between gap-4">
|
||||
<div className="min-w-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<h2 className="truncate text-sm font-semibold">{variant.name}</h2>
|
||||
<span className="shrink-0 rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground">
|
||||
{variant.id}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 truncate text-xs text-muted-foreground">{variant.description}</p>
|
||||
</div>
|
||||
<span className="shrink-0 font-mono text-xs text-muted-foreground">{position}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EmptyPreview({sectionType, industry}: {sectionType: string; industry: IndustryType}) {
|
||||
return (
|
||||
<div className="m-auto max-w-sm text-center text-sm text-muted-foreground">
|
||||
<p className="font-semibold text-foreground">배리에이션이 없습니다</p>
|
||||
<p className="mt-1 text-xs">
|
||||
<span className="font-mono">{sectionType}</span> 은(는){' '}
|
||||
{INDUSTRY_CONFIGS[industry].name} 업종에서 쓸 수 있는 배리에이션이 없습니다. 업종을 바꿔
|
||||
보세요.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function TokenPane({
|
||||
groups,
|
||||
group,
|
||||
onSelect,
|
||||
onColor,
|
||||
onRadius,
|
||||
onFont,
|
||||
onPalette,
|
||||
onFork,
|
||||
onDelete,
|
||||
currentVariantId,
|
||||
}: {
|
||||
groups: TokenGroup[];
|
||||
group: TokenGroup;
|
||||
onSelect: (id: string) => void;
|
||||
onColor: (key: keyof TokenColors, value: string) => void;
|
||||
onRadius: (radius: number) => void;
|
||||
onFont: (slot: keyof TokenFonts, stack: string) => void;
|
||||
onPalette: (raw: string) => boolean;
|
||||
onFork: () => void;
|
||||
onDelete: (id: string) => void;
|
||||
currentVariantId?: string;
|
||||
}) {
|
||||
const builtins = groups.filter((g) => g.builtin);
|
||||
const customs = groups.filter((g) => !g.builtin);
|
||||
const applies = currentVariantId ? TOKEN_AWARE_VARIANT_IDS.has(currentVariantId) : false;
|
||||
|
||||
return (
|
||||
<aside className="flex w-72 shrink-0 flex-col overflow-y-auto border-l border-border bg-card">
|
||||
<PaneTitle>
|
||||
<span className="flex items-center gap-1">
|
||||
<Palette className="size-3" /> 디자인 토큰 그룹
|
||||
</span>
|
||||
</PaneTitle>
|
||||
|
||||
<div className="space-y-4 px-3 pb-6">
|
||||
<GroupList title="내장" groups={builtins} activeId={group.id} onSelect={onSelect} />
|
||||
<GroupList
|
||||
title="저장한 그룹"
|
||||
groups={customs}
|
||||
activeId={group.id}
|
||||
onSelect={onSelect}
|
||||
onDelete={onDelete}
|
||||
emptyHint="아직 없습니다. 아래 [복제해서 편집] 으로 만듭니다."
|
||||
/>
|
||||
|
||||
<PaletteInput onApply={onPalette} />
|
||||
|
||||
<div className="space-y-2 rounded border border-border p-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="truncate text-xs font-semibold">{group.name}</span>
|
||||
{group.builtin && (
|
||||
<span className="shrink-0 rounded bg-muted px-1 text-[9px] text-muted-foreground">
|
||||
내장 · 만지면 사본 생성
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{TOKEN_COLOR_KEYS.map(({key, label, hint}) => (
|
||||
<label key={key} className="flex items-center gap-2">
|
||||
<input
|
||||
type="color"
|
||||
value={group.colors[key]}
|
||||
onChange={(e) => onColor(key, e.target.value)}
|
||||
className="size-6 shrink-0 cursor-pointer rounded border border-border bg-transparent"
|
||||
/>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block text-[11px] font-medium">{label}</span>
|
||||
<span className="block truncate text-[10px] text-muted-foreground">{hint}</span>
|
||||
</span>
|
||||
<span className="shrink-0 font-mono text-[10px] text-muted-foreground">
|
||||
{group.colors[key]}
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
|
||||
<label className="block pt-1">
|
||||
<span className="flex items-center justify-between text-[11px] font-medium">
|
||||
<span>모서리 반경</span>
|
||||
<span className="font-mono text-muted-foreground">{group.radius}px</span>
|
||||
</span>
|
||||
<input
|
||||
type="range"
|
||||
min={0}
|
||||
max={24}
|
||||
value={group.radius}
|
||||
onChange={(e) => onRadius(Number(e.target.value))}
|
||||
className="mt-1 w-full cursor-pointer"
|
||||
/>
|
||||
</label>
|
||||
|
||||
{/* 서체도 토큰이다 — 색만 바꿔서는 템플릿 인상이 안 바뀐다. */}
|
||||
{(
|
||||
[
|
||||
{slot: 'heading', label: '제목 서체', hint: '히어로·섹션 제목'},
|
||||
{slot: 'body', label: '본문 서체', hint: '문단·표·목록'},
|
||||
] as const
|
||||
).map(({slot, label, hint}) => (
|
||||
<label key={slot} className="block">
|
||||
<span className="flex items-center justify-between text-[11px] font-medium">
|
||||
<span>{label}</span>
|
||||
<span className="text-[10px] text-muted-foreground">{hint}</span>
|
||||
</span>
|
||||
<select
|
||||
value={fontPresetId(group.fonts[slot])}
|
||||
onChange={(e) => {
|
||||
const preset = FONT_PRESETS.find((f) => f.id === e.target.value);
|
||||
if (preset) onFont(slot, preset.stack);
|
||||
}}
|
||||
style={{fontFamily: group.fonts[slot]}}
|
||||
className="mt-1 w-full cursor-pointer rounded border border-border bg-card px-1.5 py-1 text-xs"
|
||||
>
|
||||
{FONT_PRESETS.map((f) => (
|
||||
<option key={f.id} value={f.id} style={{fontFamily: f.stack}}>
|
||||
{f.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
))}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={onFork}
|
||||
className="flex w-full cursor-pointer items-center justify-center gap-1 rounded bg-foreground px-2 py-1.5 text-xs font-semibold text-background hover:opacity-90"
|
||||
>
|
||||
<Plus className="size-3" /> 복제해서 편집
|
||||
</button>
|
||||
<p className="text-[10px] leading-relaxed text-muted-foreground">
|
||||
내장 그룹을 만지면 <b>편집본이 자동으로 생기고</b> 그쪽으로 옮겨갑니다. 원본은 그대로
|
||||
남습니다. 편집한 값은 브라우저(localStorage)에 바로 저장됩니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* ★ 토큰을 바꿨는데 화면이 그대로인 걸 버그로 오해하지 않게. */}
|
||||
<div
|
||||
className={cn(
|
||||
'rounded border p-2 text-[10px] leading-relaxed',
|
||||
applies
|
||||
? 'border-success/30 bg-success/10 text-success'
|
||||
: 'border-amber-300/50 bg-amber-50 text-amber-900',
|
||||
)}
|
||||
>
|
||||
{applies ? (
|
||||
<>
|
||||
이 배리에이션은 토큰 그룹을 읽습니다 — 색을 바꾸면 즉시 반영됩니다.
|
||||
<br />
|
||||
단 <b>섹션 배경 톤 · 카드 면 · 외부 브랜드 색(네이버/카카오/YouTube) ·
|
||||
경고 배지는 일부러 토큰에서 뺐습니다</b> — 토큰을 따르게 하면 섹션 구분이
|
||||
사라지거나 대비가 무너집니다.
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<b>이 배리에이션은 색이 하드코딩돼 있습니다.</b> 토큰 그룹을 바꿔도 거의 안
|
||||
변합니다. 토큰 반응을 늘리려면 <code>stone-*</code> 색을{' '}
|
||||
<code>template.colors</code> 로 바꿔야 합니다.
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 팔레트 붙여넣기 — colorhunt 링크나 hex 목록 하나로 토큰 전체를 갈아끼운다.
|
||||
*
|
||||
* ★ 색을 6개+4개 따로 고르게 하면 아무도 안 쓴다. 팔레트 사이트에서 고른 걸
|
||||
* 그대로 붙여넣는 게 실제 작업 흐름이다.
|
||||
*/
|
||||
function PaletteInput({onApply}: {onApply: (raw: string) => boolean}) {
|
||||
const [raw, setRaw] = useState('');
|
||||
const [failed, setFailed] = useState(false);
|
||||
const parsed = parsePalette(raw);
|
||||
|
||||
const submit = () => {
|
||||
if (!onApply(raw)) {
|
||||
setFailed(true);
|
||||
return;
|
||||
}
|
||||
setFailed(false);
|
||||
setRaw('');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-1.5 rounded border border-border p-2">
|
||||
<p className="text-[11px] font-semibold">팔레트 붙여넣기</p>
|
||||
<p className="text-[10px] leading-relaxed text-muted-foreground">
|
||||
colorhunt 링크나 hex 를 붙여넣으면 섹션 바탕 · 카드 · 글자색까지 한 번에 바뀝니다.
|
||||
</p>
|
||||
<input
|
||||
value={raw}
|
||||
onChange={(e) => {
|
||||
setRaw(e.target.value);
|
||||
setFailed(false);
|
||||
}}
|
||||
onKeyDown={(e) => e.key === 'Enter' && submit()}
|
||||
placeholder="colorhunt.co/palette/… 또는 #222831 #393E46 …"
|
||||
className="w-full rounded border border-border bg-card px-1.5 py-1 font-mono text-[10px]"
|
||||
/>
|
||||
{parsed.length > 0 && (
|
||||
<div className="flex items-center gap-1">
|
||||
{parsed.map((hex) => (
|
||||
<span
|
||||
key={hex}
|
||||
title={hex}
|
||||
className="size-4 rounded-sm border border-black/10"
|
||||
style={{backgroundColor: hex}}
|
||||
/>
|
||||
))}
|
||||
<span className="ml-1 text-[10px] text-muted-foreground">{parsed.length}색</span>
|
||||
</div>
|
||||
)}
|
||||
{failed && (
|
||||
<p className="text-[10px] text-destructive">
|
||||
색을 못 읽었습니다 — hex 2개 이상이 필요합니다.
|
||||
</p>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={submit}
|
||||
disabled={parsed.length < 2}
|
||||
className="w-full cursor-pointer rounded bg-foreground px-2 py-1 text-xs font-semibold text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
>
|
||||
적용
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function GroupList({
|
||||
title,
|
||||
groups,
|
||||
activeId,
|
||||
onSelect,
|
||||
onDelete,
|
||||
emptyHint,
|
||||
}: {
|
||||
title: string;
|
||||
groups: TokenGroup[];
|
||||
activeId: string;
|
||||
onSelect: (id: string) => void;
|
||||
onDelete?: (id: string) => void;
|
||||
emptyHint?: string;
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<p className="mb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">
|
||||
{title}
|
||||
</p>
|
||||
{groups.length === 0 && emptyHint && (
|
||||
<p className="text-[10px] text-muted-foreground">{emptyHint}</p>
|
||||
)}
|
||||
<div className="space-y-1">
|
||||
{groups.map((g) => (
|
||||
<div key={g.id} className="flex items-center gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onSelect(g.id)}
|
||||
className={cn(
|
||||
'flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded border p-1.5 text-left transition-colors',
|
||||
g.id === activeId ? 'border-foreground bg-muted' : 'border-transparent hover:bg-muted/60',
|
||||
)}
|
||||
>
|
||||
<span className="flex shrink-0 gap-0.5">
|
||||
{TOKEN_COLOR_KEYS.slice(0, 4).map(({key}) => (
|
||||
<span
|
||||
key={key}
|
||||
className="size-3 rounded-sm border border-black/10"
|
||||
style={{backgroundColor: g.colors[key]}}
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
<span className="truncate text-[11px]">{g.name}</span>
|
||||
</button>
|
||||
{onDelete && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onDelete(g.id)}
|
||||
aria-label={`${g.name} 삭제`}
|
||||
className="shrink-0 cursor-pointer rounded p-1 text-muted-foreground hover:bg-muted hover:text-destructive"
|
||||
>
|
||||
<Trash2 className="size-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import {useState, type FormEvent} from 'react';
|
||||
import {Navigate, useLocation, useNavigate} from 'react-router';
|
||||
import {LogIn} from 'lucide-react';
|
||||
import {login, me, UserRole} from '@/api';
|
||||
import {Button} from '@/components/ui/button';
|
||||
import {Input} from '@/components/ui/input';
|
||||
import {notifyApiError} from '@/lib/notify';
|
||||
import {toAuthUser, useAuthStore} from '@/stores/auth';
|
||||
|
||||
export function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const user = useAuthStore((s) => s.user);
|
||||
const signIn = useAuthStore((s) => s.signIn);
|
||||
|
||||
const [id, setId] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
// ★ 기본 도착지를 '/' 로 둔다. 앱마다 홈이 다르고(사장님 → 빌더, 내부 → 사업장 목록)
|
||||
// 각 라우터의 '/' 리다이렉트가 이미 그걸 안다. 여기 경로를 박으면 한쪽에서 404 다.
|
||||
const from = (location.state as {from?: string} | null)?.from ?? '/';
|
||||
|
||||
if (user) return <Navigate to={from} replace />;
|
||||
|
||||
const handleSubmit = async (event: FormEvent) => {
|
||||
event.preventDefault();
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
const res = await login({id, password});
|
||||
if (res.result?.success === false) {
|
||||
notifyApiError({data: res}, '아이디 또는 비밀번호를 확인해 주세요.');
|
||||
return;
|
||||
}
|
||||
// ★ RemoveNoneResponse 라 성공 응답에서도 토큰 필드가 빠져 올 수 있다.
|
||||
// 빈 토큰으로 로그인 상태를 만들면 이후 모든 요청이 401 로 흐른다 — 여기서 끊는다.
|
||||
if (!res.access_token || !res.refresh_token) {
|
||||
notifyApiError({data: res}, '로그인 응답에 토큰이 없습니다.');
|
||||
return;
|
||||
}
|
||||
const tokens = {accessToken: res.access_token, refreshToken: res.refresh_token};
|
||||
|
||||
// 토큰을 먼저 심어야 뒤이은 me() 가 Authorization 을 달고 나간다.
|
||||
signIn(tokens, {userId: '', id, role: UserRole.USER});
|
||||
|
||||
const meRes = await me();
|
||||
// 신원이 안 왔으면 방금 심은 임시 사용자를 그대로 둔다 — 토큰은 유효하므로 화면은 진행시킨다.
|
||||
if (meRes.user_id && meRes.id) signIn(tokens, toAuthUser(meRes));
|
||||
navigate(from, {replace: true});
|
||||
} catch (error) {
|
||||
notifyApiError(error, '로그인에 실패했습니다.');
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-muted/30 px-4">
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="w-full max-w-sm space-y-4 rounded-2xl border border-border bg-card p-7"
|
||||
>
|
||||
<div className="space-y-1 text-center">
|
||||
<img
|
||||
src="/brand/web4ai-wordmark.svg"
|
||||
alt="Web4Ai"
|
||||
className="mx-auto mb-3 h-9 w-auto"
|
||||
/>
|
||||
<h1 className="text-sm font-medium text-muted-foreground">관리자</h1>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
사업장·정보 확인·발행을 관리합니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label htmlFor="login-id" className="mb-1.5 block text-xs font-semibold">
|
||||
아이디
|
||||
</label>
|
||||
<Input
|
||||
id="login-id"
|
||||
value={id}
|
||||
onChange={(e) => setId(e.target.value)}
|
||||
autoComplete="username"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="login-pw" className="mb-1.5 block text-xs font-semibold">
|
||||
비밀번호
|
||||
</label>
|
||||
<Input
|
||||
id="login-pw"
|
||||
type="password"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
autoComplete="current-password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button type="submit" variant="primary" className="w-full" isLoading={isSubmitting}>
|
||||
<LogIn />
|
||||
<span>로그인</span>
|
||||
</Button>
|
||||
|
||||
<p className="text-center text-[11px] leading-relaxed text-muted-foreground">
|
||||
빌더는 로그인 없이도 사용할 수 있습니다.{' '}
|
||||
<a href="/builder" className="font-medium text-primary underline-offset-2 hover:underline">
|
||||
빌더로 이동
|
||||
</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import {Link} from 'react-router';
|
||||
|
||||
export function NotFoundPage() {
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col items-center justify-center gap-3 bg-muted/30 px-4 text-center">
|
||||
<p className="font-mono text-xs text-muted-foreground">404</p>
|
||||
<h1 className="text-lg font-semibold">없는 화면입니다</h1>
|
||||
<Link
|
||||
to="/builder"
|
||||
className="inline-flex h-9 items-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
||||
>
|
||||
빌더로 이동
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user