create-quadrokit 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/biome.monorepo.json +67 -0
- package/dist/index.js +239 -0
- package/package.json +11 -4
- package/templates/README.md +37 -0
- package/templates/admin-shell/.cursor/rules/commitlint-conventional.mdc +47 -0
- package/templates/admin-shell/.env.example +2 -0
- package/templates/admin-shell/biome.json +12 -0
- package/templates/admin-shell/index.html +12 -0
- package/templates/admin-shell/package.json +45 -0
- package/templates/admin-shell/postcss.config.js +6 -0
- package/templates/admin-shell/src/components/AppShell.tsx +68 -0
- package/templates/admin-shell/src/i18n.ts +12 -0
- package/templates/admin-shell/src/lib/quadro-client.ts +4 -0
- package/templates/admin-shell/src/locales/en.json +15 -0
- package/templates/admin-shell/src/main.tsx +15 -0
- package/templates/admin-shell/src/pages/AgenciesPage.tsx +69 -0
- package/templates/admin-shell/src/pages/HomePage.tsx +67 -0
- package/templates/admin-shell/src/router.tsx +15 -0
- package/templates/admin-shell/src/stores/useSidebarHint.ts +12 -0
- package/templates/admin-shell/src/vite-env.d.ts +9 -0
- package/templates/admin-shell/tailwind.config.ts +7 -0
- package/templates/admin-shell/tsconfig.app.json +16 -0
- package/templates/admin-shell/tsconfig.json +4 -0
- package/templates/admin-shell/tsconfig.node.json +10 -0
- package/templates/admin-shell/vite.config.ts +25 -0
- package/templates/dashboard/.cursor/rules/commitlint-conventional.mdc +47 -0
- package/templates/dashboard/.env.example +2 -0
- package/templates/dashboard/biome.json +12 -0
- package/templates/dashboard/index.html +12 -0
- package/templates/dashboard/package.json +45 -0
- package/templates/dashboard/postcss.config.js +6 -0
- package/templates/dashboard/src/components/AppShell.tsx +44 -0
- package/templates/dashboard/src/i18n.ts +12 -0
- package/templates/dashboard/src/lib/quadro-client.ts +4 -0
- package/templates/dashboard/src/locales/en.json +15 -0
- package/templates/dashboard/src/main.tsx +15 -0
- package/templates/dashboard/src/pages/AgenciesPage.tsx +69 -0
- package/templates/dashboard/src/pages/HomePage.tsx +67 -0
- package/templates/dashboard/src/router.tsx +15 -0
- package/templates/dashboard/src/stores/useSidebarHint.ts +12 -0
- package/templates/dashboard/src/vite-env.d.ts +9 -0
- package/templates/dashboard/tailwind.config.ts +7 -0
- package/templates/dashboard/tsconfig.app.json +16 -0
- package/templates/dashboard/tsconfig.json +4 -0
- package/templates/dashboard/tsconfig.node.json +10 -0
- package/templates/dashboard/vite.config.ts +25 -0
- package/templates/ecommerce/.cursor/rules/commitlint-conventional.mdc +47 -0
- package/templates/ecommerce/.env.example +2 -0
- package/templates/ecommerce/biome.json +12 -0
- package/templates/ecommerce/index.html +12 -0
- package/templates/ecommerce/package.json +45 -0
- package/templates/ecommerce/postcss.config.js +6 -0
- package/templates/ecommerce/src/components/AppShell.tsx +44 -0
- package/templates/ecommerce/src/i18n.ts +12 -0
- package/templates/ecommerce/src/lib/quadro-client.ts +4 -0
- package/templates/ecommerce/src/locales/en.json +20 -0
- package/templates/ecommerce/src/main.tsx +15 -0
- package/templates/ecommerce/src/pages/AgenciesPage.tsx +69 -0
- package/templates/ecommerce/src/pages/HomePage.tsx +52 -0
- package/templates/ecommerce/src/router.tsx +15 -0
- package/templates/ecommerce/src/stores/useSidebarHint.ts +12 -0
- package/templates/ecommerce/src/vite-env.d.ts +9 -0
- package/templates/ecommerce/tailwind.config.ts +7 -0
- package/templates/ecommerce/tsconfig.app.json +16 -0
- package/templates/ecommerce/tsconfig.json +4 -0
- package/templates/ecommerce/tsconfig.node.json +10 -0
- package/templates/ecommerce/vite.config.ts +25 -0
- package/templates/website/.cursor/rules/commitlint-conventional.mdc +47 -0
- package/templates/website/.env.example +2 -0
- package/templates/website/biome.json +12 -0
- package/templates/website/index.html +12 -0
- package/templates/website/package.json +45 -0
- package/templates/website/postcss.config.js +6 -0
- package/templates/website/src/components/AppShell.tsx +44 -0
- package/templates/website/src/i18n.ts +12 -0
- package/templates/website/src/lib/quadro-client.ts +4 -0
- package/templates/website/src/locales/en.json +21 -0
- package/templates/website/src/main.tsx +15 -0
- package/templates/website/src/pages/AgenciesPage.tsx +69 -0
- package/templates/website/src/pages/HomePage.tsx +83 -0
- package/templates/website/src/router.tsx +15 -0
- package/templates/website/src/stores/useSidebarHint.ts +12 -0
- package/templates/website/src/vite-env.d.ts +9 -0
- package/templates/website/tailwind.config.ts +7 -0
- package/templates/website/tsconfig.app.json +16 -0
- package/templates/website/tsconfig.json +4 -0
- package/templates/website/tsconfig.node.json +10 -0
- package/templates/website/vite.config.ts +25 -0
- package/vendor/generated/client.gen.ts +2725 -0
- package/vendor/generated/meta.json +5 -0
- package/vendor/generated/types.gen.ts +991 -0
- package/src/index.ts +0 -237
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ThemeToolbar } from '@quadrokit/ui'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
import { Link, NavLink, Outlet } from 'react-router-dom'
|
|
4
|
+
|
|
5
|
+
export function AppShell() {
|
|
6
|
+
const { t } = useTranslation()
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className="min-h-dvh bg-background text-foreground">
|
|
10
|
+
<header className="border-b border-border bg-card/40 backdrop-blur">
|
|
11
|
+
<div className="mx-auto flex max-w-5xl flex-col gap-3 px-4 py-4 sm:flex-row sm:items-center sm:justify-between">
|
|
12
|
+
<div className="flex items-center gap-6">
|
|
13
|
+
<Link to="/" className="text-lg font-semibold tracking-tight">
|
|
14
|
+
{t('app.title')}
|
|
15
|
+
</Link>
|
|
16
|
+
<nav className="flex gap-3 text-sm text-muted-foreground">
|
|
17
|
+
<NavLink
|
|
18
|
+
to="/"
|
|
19
|
+
end
|
|
20
|
+
className={({ isActive }) =>
|
|
21
|
+
isActive ? 'font-medium text-foreground' : 'hover:text-foreground'
|
|
22
|
+
}
|
|
23
|
+
>
|
|
24
|
+
{t('app.nav_home')}
|
|
25
|
+
</NavLink>
|
|
26
|
+
<NavLink
|
|
27
|
+
to="/agencies"
|
|
28
|
+
className={({ isActive }) =>
|
|
29
|
+
isActive ? 'font-medium text-foreground' : 'hover:text-foreground'
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
{t('app.nav_agencies')}
|
|
33
|
+
</NavLink>
|
|
34
|
+
</nav>
|
|
35
|
+
</div>
|
|
36
|
+
<ThemeToolbar />
|
|
37
|
+
</div>
|
|
38
|
+
</header>
|
|
39
|
+
<main className="mx-auto max-w-5xl px-4 py-8">
|
|
40
|
+
<Outlet />
|
|
41
|
+
</main>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import i18n from 'i18next'
|
|
2
|
+
import { initReactI18next } from 'react-i18next'
|
|
3
|
+
import en from './locales/en.json'
|
|
4
|
+
|
|
5
|
+
void i18n.use(initReactI18next).init({
|
|
6
|
+
resources: { en: { translation: en } },
|
|
7
|
+
lng: 'en',
|
|
8
|
+
fallbackLng: 'en',
|
|
9
|
+
interpolation: { escapeValue: false },
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export default i18n
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": {
|
|
3
|
+
"title": "QuadroKit",
|
|
4
|
+
"tagline": "Marketing-style template — same stack, lighter chrome.",
|
|
5
|
+
"nav_home": "Home",
|
|
6
|
+
"nav_agencies": "Agencies",
|
|
7
|
+
"session_cookie": "Expected 4D session cookie: {{name}}"
|
|
8
|
+
},
|
|
9
|
+
"hero": {
|
|
10
|
+
"headline": "Ship a public site on top of your 4D datastore.",
|
|
11
|
+
"sub": "QuadroKit keeps REST, auth cookies, and typed clients consistent across templates.",
|
|
12
|
+
"cta_primary": "Get started",
|
|
13
|
+
"cta_secondary": "View sample data"
|
|
14
|
+
},
|
|
15
|
+
"form": {
|
|
16
|
+
"demo_title": "react-hook-form + zod",
|
|
17
|
+
"label": "Label",
|
|
18
|
+
"placeholder": "Type something…",
|
|
19
|
+
"submit": "Submit"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StrictMode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import { RouterProvider } from 'react-router-dom'
|
|
4
|
+
import '@quadrokit/ui/styles.css'
|
|
5
|
+
import './i18n'
|
|
6
|
+
import { ThemeProvider } from '@quadrokit/ui'
|
|
7
|
+
import { router } from './router'
|
|
8
|
+
|
|
9
|
+
createRoot(document.getElementById('root')!).render(
|
|
10
|
+
<StrictMode>
|
|
11
|
+
<ThemeProvider>
|
|
12
|
+
<RouterProvider router={router} />
|
|
13
|
+
</ThemeProvider>
|
|
14
|
+
</StrictMode>
|
|
15
|
+
)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@quadrokit/ui'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
|
+
import { quadro } from '@/lib/quadro-client'
|
|
4
|
+
|
|
5
|
+
export function AgenciesPage() {
|
|
6
|
+
const [names, setNames] = useState<string[]>([])
|
|
7
|
+
const [error, setError] = useState<string | null>(null)
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let cancelled = false
|
|
11
|
+
;(async () => {
|
|
12
|
+
try {
|
|
13
|
+
const list = quadro.Agency.all({
|
|
14
|
+
page: 1,
|
|
15
|
+
pageSize: 20,
|
|
16
|
+
select: ['name'],
|
|
17
|
+
})
|
|
18
|
+
const acc: string[] = []
|
|
19
|
+
for await (const a of list) {
|
|
20
|
+
acc.push(a.name ?? '')
|
|
21
|
+
}
|
|
22
|
+
if (!cancelled) {
|
|
23
|
+
setNames(acc)
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (!cancelled) {
|
|
27
|
+
setError(e instanceof Error ? e.message : String(e))
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})()
|
|
31
|
+
return () => {
|
|
32
|
+
cancelled = true
|
|
33
|
+
}
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="space-y-6">
|
|
38
|
+
<div>
|
|
39
|
+
<h1 className="text-2xl font-semibold">Agencies</h1>
|
|
40
|
+
<p className="text-sm text-muted-foreground">
|
|
41
|
+
Sample list from 4D REST (requires running server + auth cookie).
|
|
42
|
+
</p>
|
|
43
|
+
</div>
|
|
44
|
+
{error && (
|
|
45
|
+
<Card className="border-destructive/50">
|
|
46
|
+
<CardHeader>
|
|
47
|
+
<CardTitle className="text-destructive">Request failed</CardTitle>
|
|
48
|
+
<CardDescription>{error}</CardDescription>
|
|
49
|
+
</CardHeader>
|
|
50
|
+
</Card>
|
|
51
|
+
)}
|
|
52
|
+
<Card>
|
|
53
|
+
<CardHeader>
|
|
54
|
+
<CardTitle>Names</CardTitle>
|
|
55
|
+
<CardDescription>
|
|
56
|
+
{names.length ? `${names.length} loaded` : 'No data yet'}
|
|
57
|
+
</CardDescription>
|
|
58
|
+
</CardHeader>
|
|
59
|
+
<CardContent>
|
|
60
|
+
<ul className="list-inside list-disc space-y-1 text-sm">
|
|
61
|
+
{names.map((n) => (
|
|
62
|
+
<li key={n}>{n || '(empty)'}</li>
|
|
63
|
+
))}
|
|
64
|
+
</ul>
|
|
65
|
+
</CardContent>
|
|
66
|
+
</Card>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { zodResolver } from '@hookform/resolvers/zod'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardDescription,
|
|
7
|
+
CardHeader,
|
|
8
|
+
CardTitle,
|
|
9
|
+
Input,
|
|
10
|
+
Label,
|
|
11
|
+
} from '@quadrokit/ui'
|
|
12
|
+
import { useForm } from 'react-hook-form'
|
|
13
|
+
import { useTranslation } from 'react-i18next'
|
|
14
|
+
import { z } from 'zod'
|
|
15
|
+
import { quadro } from '@/lib/quadro-client'
|
|
16
|
+
import { useSidebarHint } from '@/stores/useSidebarHint'
|
|
17
|
+
|
|
18
|
+
const schema = z.object({
|
|
19
|
+
label: z.string().min(1, 'Required'),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
type FormValues = z.infer<typeof schema>
|
|
23
|
+
|
|
24
|
+
export function HomePage() {
|
|
25
|
+
const { t } = useTranslation()
|
|
26
|
+
const note = useSidebarHint((s) => s.note)
|
|
27
|
+
const setNote = useSidebarHint((s) => s.setNote)
|
|
28
|
+
|
|
29
|
+
const form = useForm<FormValues>({
|
|
30
|
+
resolver: zodResolver(schema),
|
|
31
|
+
defaultValues: { label: '' },
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className="space-y-12">
|
|
36
|
+
<section className="rounded-2xl border border-border bg-gradient-to-br from-primary/15 via-background to-background p-10 shadow-sm">
|
|
37
|
+
<p className="text-sm font-medium uppercase tracking-widest text-primary">
|
|
38
|
+
{t('app.title')}
|
|
39
|
+
</p>
|
|
40
|
+
<h1 className="mt-3 max-w-xl text-4xl font-semibold tracking-tight">
|
|
41
|
+
{t('hero.headline')}
|
|
42
|
+
</h1>
|
|
43
|
+
<p className="mt-4 max-w-2xl text-lg text-muted-foreground">{t('hero.sub')}</p>
|
|
44
|
+
<div className="mt-8 flex flex-wrap gap-3">
|
|
45
|
+
<Button asChild>
|
|
46
|
+
<a href="#contact">{t('hero.cta_primary')}</a>
|
|
47
|
+
</Button>
|
|
48
|
+
<Button variant="outline" asChild>
|
|
49
|
+
<a href="/agencies">{t('hero.cta_secondary')}</a>
|
|
50
|
+
</Button>
|
|
51
|
+
</div>
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<div>
|
|
55
|
+
<p className="text-sm text-muted-foreground">
|
|
56
|
+
{t('app.session_cookie', { name: quadro.sessionCookieName })}
|
|
57
|
+
</p>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<Card id="contact">
|
|
61
|
+
<CardHeader>
|
|
62
|
+
<CardTitle>{t('form.demo_title')}</CardTitle>
|
|
63
|
+
<CardDescription>Zustand note: {note || '—'}</CardDescription>
|
|
64
|
+
</CardHeader>
|
|
65
|
+
<CardContent>
|
|
66
|
+
<form
|
|
67
|
+
className="flex max-w-md flex-col gap-4"
|
|
68
|
+
onSubmit={form.handleSubmit((v) => setNote(v.label))}
|
|
69
|
+
>
|
|
70
|
+
<div className="space-y-2">
|
|
71
|
+
<Label htmlFor="label">{t('form.label')}</Label>
|
|
72
|
+
<Input id="label" placeholder={t('form.placeholder')} {...form.register('label')} />
|
|
73
|
+
{form.formState.errors.label?.message && (
|
|
74
|
+
<p className="text-sm text-destructive">{form.formState.errors.label.message}</p>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
<Button type="submit">{t('form.submit')}</Button>
|
|
78
|
+
</form>
|
|
79
|
+
</CardContent>
|
|
80
|
+
</Card>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createBrowserRouter } from 'react-router-dom'
|
|
2
|
+
import { AppShell } from './components/AppShell'
|
|
3
|
+
import { AgenciesPage } from './pages/AgenciesPage'
|
|
4
|
+
import { HomePage } from './pages/HomePage'
|
|
5
|
+
|
|
6
|
+
export const router = createBrowserRouter([
|
|
7
|
+
{
|
|
8
|
+
path: '/',
|
|
9
|
+
element: <AppShell />,
|
|
10
|
+
children: [
|
|
11
|
+
{ index: true, element: <HomePage /> },
|
|
12
|
+
{ path: 'agencies', element: <AgenciesPage /> },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
])
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { create } from 'zustand'
|
|
2
|
+
|
|
3
|
+
/** Minimal Zustand example — optional UI preference. */
|
|
4
|
+
interface SidebarHintState {
|
|
5
|
+
note: string
|
|
6
|
+
setNote: (s: string) => void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const useSidebarHint = create<SidebarHintState>((set) => ({
|
|
10
|
+
note: '',
|
|
11
|
+
setNote: (note) => set({ note }),
|
|
12
|
+
}))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"jsx": "react-jsx",
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
"paths": {
|
|
12
|
+
"@/*": ["./src/*"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"types": ["node"]
|
|
8
|
+
},
|
|
9
|
+
"include": ["vite.config.ts", "tailwind.config.ts"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
4
|
+
|
|
5
|
+
export default defineConfig(({ mode }) => {
|
|
6
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
7
|
+
const target4d = env.VITE_4D_ORIGIN ?? 'http://127.0.0.1:7080'
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
plugins: [react()],
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: {
|
|
13
|
+
'@': path.resolve(__dirname, 'src'),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
server: {
|
|
17
|
+
proxy: {
|
|
18
|
+
'/rest': {
|
|
19
|
+
target: target4d,
|
|
20
|
+
changeOrigin: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
})
|