[feat] negodata/front: 프론트 초기 구축 (Vite+React, orval API 클라이언트, 견적/상품/협력사 페이지)
- 라우팅 react-router v7, 서버상태 TanStack Query - orval 자동 생성 API 클라이언트(src/api/generated) - 견적/상품/협력사/견적설정 페이지, shadcn UI, 토큰(tokens.css) - 실행: 루트 docker compose (front :3001), README 그에 맞게 정리 - AI Studio 스캐폴드 잔재 제거(metadata.json, 중복 DESIGN_TOKENS.md), 타이틀 NegoData, vite.config 죽은코드 제거 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a6731dcb07
commit
87524bf6e8
288 files changed
+26363
-1
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import {StrictMode} from 'react';
|
||||
import {createRoot} from 'react-dom/client';
|
||||
import {RouterProvider} from 'react-router';
|
||||
import {router} from './router';
|
||||
import {Providers} from './provider';
|
||||
import '../index.css';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<Providers>
|
||||
<RouterProvider router={router} />
|
||||
</Providers>
|
||||
</StrictMode>,
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
||||
import {useState, type ReactNode} from 'react';
|
||||
import {Toaster} from 'sonner';
|
||||
|
||||
export function Providers({children}: {children: ReactNode}) {
|
||||
const [queryClient] = useState(
|
||||
() =>
|
||||
new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
retry: 1,
|
||||
refetchOnWindowFocus: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{children}
|
||||
<Toaster richColors position="top-center" />
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import {createBrowserRouter, redirect} from 'react-router';
|
||||
import {initAuth} from '../features/auth/service';
|
||||
import {isLoggedIn} from '../stores/auth';
|
||||
import AuthenticatedLayout from '@/components/layout/AuthenticatedLayout';
|
||||
import LoginPage from '../pages/login';
|
||||
import ForbiddenPage from '../pages/forbidden';
|
||||
import ProductsPage from '../pages/products';
|
||||
import PartnersPage from '../pages/partners';
|
||||
import QuotationPage from '../pages/quotation';
|
||||
import CardsPage from '../pages/cards';
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
// dev 전용: import.meta.env.DEV가 false인 프로덕션 빌드에선 이 배열 항목과
|
||||
// 내부 import()가 통째로 트리셰이킹되어 번들/라우트에 포함되지 않는다.
|
||||
...(import.meta.env.DEV
|
||||
? [
|
||||
{
|
||||
path: 'dev/design',
|
||||
lazy: async () => ({
|
||||
Component: (await import('../pages/dev/dev-design')).default,
|
||||
}),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
index: true,
|
||||
loader: () => redirect('/products'),
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
loader: async () => {
|
||||
await initAuth();
|
||||
if (isLoggedIn()) return redirect('/products');
|
||||
return null;
|
||||
},
|
||||
Component: LoginPage,
|
||||
},
|
||||
{
|
||||
path: 'forbidden',
|
||||
Component: ForbiddenPage,
|
||||
},
|
||||
{
|
||||
loader: async ({request}) => {
|
||||
await initAuth();
|
||||
if (!isLoggedIn()) {
|
||||
const url = new URL(request.url);
|
||||
const from = encodeURIComponent(url.pathname + url.search);
|
||||
return redirect(`/login?redirect=${from}`);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
Component: AuthenticatedLayout,
|
||||
children: [
|
||||
{path: 'products', Component: ProductsPage},
|
||||
{path: 'partners', Component: PartnersPage},
|
||||
{path: 'quotation', Component: QuotationPage},
|
||||
{path: 'cards', Component: CardsPage},
|
||||
],
|
||||
},
|
||||
]);
|
||||
Reference in new issue
Block a user