@cogito.ai/cli 0.4.2 → 0.4.4
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 +29 -22
- package/dist/index.js +9 -15
- package/dist/templates/web-nextjs/.github/copilot-instructions.md +5 -6
- package/dist/templates/web-nextjs/README.md +25 -24
- package/dist/templates/web-nextjs/apps/docs/.source/browser.ts +1 -1
- package/dist/templates/web-nextjs/apps/docs/.source/server.ts +6 -6
- package/dist/templates/web-nextjs/apps/docs/app/docs/[[...slug]]/page.tsx +1 -6
- package/dist/templates/web-nextjs/apps/docs/app/docs/layout.tsx +1 -4
- package/dist/templates/web-nextjs/apps/docs/app/llms-full.txt/route.ts +3 -1
- package/dist/templates/web-nextjs/apps/docs/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/.env.example +35 -0
- package/dist/templates/web-nextjs/apps/web/.github/copilot-instructions.md +53 -6
- package/dist/templates/web-nextjs/apps/web/.github/skills/impeccable/SKILL.md +55 -0
- package/dist/templates/web-nextjs/apps/web/DESIGN.md +65 -0
- package/dist/templates/web-nextjs/apps/web/messages/en.json +151 -5
- package/dist/templates/web-nextjs/apps/web/messages/zh.json +151 -5
- package/dist/templates/web-nextjs/apps/web/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/next.config.ts +3 -3
- package/dist/templates/web-nextjs/apps/web/package.json +4 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/forgot-password/page.tsx +167 -38
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/login/page.tsx +13 -3
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/reset-password/page.tsx +4 -1
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/signup/page.tsx +18 -17
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/dashboard/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/payment/[paymentId]/page.tsx +88 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/payment/checkout/page.tsx +170 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/pricing/page.tsx +120 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/layout.tsx +45 -2
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/profile/page.tsx +2 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/subscription/page.tsx +128 -0
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/about/page.tsx +3 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/globals.css +17 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/help/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/layout.tsx +10 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/page.tsx +22 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/privacy/page.tsx +3 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/terms/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/alipay/create/route.ts +43 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/alipay/notify/route.ts +105 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/alipay/query/route.ts +54 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/alipay/return/route.ts +20 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/create/route.ts +52 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/wechat/create/route.ts +58 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/wechat/notify/route.ts +92 -0
- package/dist/templates/web-nextjs/apps/web/src/app/api/payments/wechat/query/route.ts +54 -0
- package/dist/templates/web-nextjs/apps/web/src/app/auth/callback/route.ts +2 -3
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/app-sidebar.tsx +13 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/chart-area-interactive.tsx +122 -146
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/data-table.tsx +84 -149
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-documents.tsx +7 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-main.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-secondary.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-user.tsx +12 -21
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/page.tsx +10 -13
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/section-cards.tsx +5 -9
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/site-header.tsx +6 -7
- package/dist/templates/web-nextjs/apps/web/src/components/landing/features.tsx +63 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/footer.tsx +48 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/header.tsx +97 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/hero.tsx +45 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/how-it-works.tsx +35 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/pricing-teaser.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/profile/profile-form.tsx +6 -4
- package/dist/templates/web-nextjs/apps/web/src/components/providers/theme-provider.tsx +16 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert-dialog.tsx +32 -49
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert.tsx +16 -23
- package/dist/templates/web-nextjs/apps/web/src/components/ui/avatar.tsx +25 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/badge.tsx +16 -18
- package/dist/templates/web-nextjs/apps/web/src/components/ui/breadcrumb.tsx +19 -26
- package/dist/templates/web-nextjs/apps/web/src/components/ui/button.tsx +23 -24
- package/dist/templates/web-nextjs/apps/web/src/components/ui/card.tsx +19 -36
- package/dist/templates/web-nextjs/apps/web/src/components/ui/chart.tsx +60 -94
- package/dist/templates/web-nextjs/apps/web/src/components/ui/checkbox.tsx +8 -11
- package/dist/templates/web-nextjs/apps/web/src/components/ui/collapsible.tsx +5 -17
- package/dist/templates/web-nextjs/apps/web/src/components/ui/command.tsx +25 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dialog.tsx +21 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/drawer.tsx +24 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dropdown-menu.tsx +26 -55
- package/dist/templates/web-nextjs/apps/web/src/components/ui/field.tsx +62 -76
- package/dist/templates/web-nextjs/apps/web/src/components/ui/form.tsx +19 -34
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input-otp.tsx +13 -20
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/label.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/pagination.tsx +21 -42
- package/dist/templates/web-nextjs/apps/web/src/components/ui/popover.tsx +16 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/progress.tsx +5 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/radio-group.tsx +8 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/scroll-area.tsx +10 -12
- package/dist/templates/web-nextjs/apps/web/src/components/ui/select.tsx +26 -41
- package/dist/templates/web-nextjs/apps/web/src/components/ui/separator.tsx +7 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sheet.tsx +29 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sidebar.tsx +157 -189
- package/dist/templates/web-nextjs/apps/web/src/components/ui/skeleton.tsx +3 -3
- package/dist/templates/web-nextjs/apps/web/src/components/ui/slider.tsx +10 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sonner.tsx +13 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/switch.tsx +9 -9
- package/dist/templates/web-nextjs/apps/web/src/components/ui/table.tsx +24 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tabs.tsx +21 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/textarea.tsx +5 -5
- package/dist/templates/web-nextjs/apps/web/src/components/ui/theme-toggle.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle-group.tsx +15 -16
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tooltip.tsx +8 -12
- package/dist/templates/web-nextjs/apps/web/src/core/repositories/IAuthRepository.ts +2 -0
- package/dist/templates/web-nextjs/apps/web/src/core/types/auth.ts +1 -3
- package/dist/templates/web-nextjs/apps/web/src/features/auth/actions.ts +57 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/index.ts +2 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/alipay/client.ts +36 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/alipay/server.ts +83 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/components/index.ts +4 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/components/pro-badge.tsx +9 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/components/pro-feature-comparison.tsx +70 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/components/quota-warning-banner.tsx +37 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/components/upgrade-button.tsx +42 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/hooks.ts +141 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/payment-helpers.ts +27 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/payment-service.ts +56 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/service.ts +55 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/types.ts +73 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/wechat/client.ts +33 -0
- package/dist/templates/web-nextjs/apps/web/src/features/subscription/wechat/server.ts +147 -0
- package/dist/templates/web-nextjs/apps/web/src/hooks/use-mobile.ts +4 -4
- package/dist/templates/web-nextjs/apps/web/src/i18n/config.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/src/infra/db/SupabaseAuthRepository.ts +48 -4
- package/dist/templates/web-nextjs/apps/web/src/infra/db/client.ts +1 -4
- package/dist/templates/web-nextjs/apps/web/src/lib/supabase/admin.ts +23 -0
- package/dist/templates/web-nextjs/apps/web/src/lib/utils.ts +2 -2
- package/dist/templates/web-nextjs/apps/web/src/lib/validations/auth.ts +13 -0
- package/dist/templates/web-nextjs/apps/web/src/lib/wechat-pay/client.ts +66 -0
- package/dist/templates/web-nextjs/apps/web/src/lib/wechat-pay/crypto.ts +99 -0
- package/dist/templates/web-nextjs/apps/web/src/lib/wechat-pay/types.ts +10 -0
- package/dist/templates/web-nextjs/apps/web/src/styles/tokens.css +58 -0
- package/dist/templates/web-nextjs/pnpm-lock.yaml +319 -0
- package/dist/templates/web-nextjs/supabase/migrations/20250608_add_subscription_tables.sql +125 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
3
|
+
import * as React from 'react'
|
|
4
4
|
import {
|
|
5
5
|
closestCenter,
|
|
6
6
|
DndContext,
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
useSensors,
|
|
12
12
|
type DragEndEvent,
|
|
13
13
|
type UniqueIdentifier,
|
|
14
|
-
} from
|
|
15
|
-
import { restrictToVerticalAxis } from
|
|
14
|
+
} from '@dnd-kit/core'
|
|
15
|
+
import { restrictToVerticalAxis } from '@dnd-kit/modifiers'
|
|
16
16
|
import {
|
|
17
17
|
arrayMove,
|
|
18
18
|
SortableContext,
|
|
19
19
|
useSortable,
|
|
20
20
|
verticalListSortingStrategy,
|
|
21
|
-
} from
|
|
22
|
-
import { CSS } from
|
|
21
|
+
} from '@dnd-kit/sortable'
|
|
22
|
+
import { CSS } from '@dnd-kit/utilities'
|
|
23
23
|
import {
|
|
24
24
|
IconChevronDown,
|
|
25
25
|
IconChevronLeft,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
IconLoader,
|
|
34
34
|
IconPlus,
|
|
35
35
|
IconTrendingUp,
|
|
36
|
-
} from
|
|
36
|
+
} from '@tabler/icons-react'
|
|
37
37
|
import {
|
|
38
38
|
flexRender,
|
|
39
39
|
getCoreRowModel,
|
|
@@ -48,21 +48,21 @@ import {
|
|
|
48
48
|
type Row,
|
|
49
49
|
type SortingState,
|
|
50
50
|
type VisibilityState,
|
|
51
|
-
} from
|
|
52
|
-
import { Area, AreaChart, CartesianGrid, XAxis } from
|
|
53
|
-
import { toast } from
|
|
54
|
-
import { z } from
|
|
51
|
+
} from '@tanstack/react-table'
|
|
52
|
+
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts'
|
|
53
|
+
import { toast } from 'sonner'
|
|
54
|
+
import { z } from 'zod'
|
|
55
55
|
|
|
56
|
-
import { useIsMobile } from
|
|
57
|
-
import { Badge } from
|
|
58
|
-
import { Button } from
|
|
56
|
+
import { useIsMobile } from '@/hooks/use-mobile'
|
|
57
|
+
import { Badge } from '@/components/ui/badge'
|
|
58
|
+
import { Button } from '@/components/ui/button'
|
|
59
59
|
import {
|
|
60
60
|
ChartContainer,
|
|
61
61
|
ChartTooltip,
|
|
62
62
|
ChartTooltipContent,
|
|
63
63
|
type ChartConfig,
|
|
64
|
-
} from
|
|
65
|
-
import { Checkbox } from
|
|
64
|
+
} from '@/components/ui/chart'
|
|
65
|
+
import { Checkbox } from '@/components/ui/checkbox'
|
|
66
66
|
import {
|
|
67
67
|
Drawer,
|
|
68
68
|
DrawerClose,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
DrawerHeader,
|
|
73
73
|
DrawerTitle,
|
|
74
74
|
DrawerTrigger,
|
|
75
|
-
} from
|
|
75
|
+
} from '@/components/ui/drawer'
|
|
76
76
|
import {
|
|
77
77
|
DropdownMenu,
|
|
78
78
|
DropdownMenuCheckboxItem,
|
|
@@ -80,17 +80,17 @@ import {
|
|
|
80
80
|
DropdownMenuItem,
|
|
81
81
|
DropdownMenuSeparator,
|
|
82
82
|
DropdownMenuTrigger,
|
|
83
|
-
} from
|
|
84
|
-
import { Input } from
|
|
85
|
-
import { Label } from
|
|
83
|
+
} from '@/components/ui/dropdown-menu'
|
|
84
|
+
import { Input } from '@/components/ui/input'
|
|
85
|
+
import { Label } from '@/components/ui/label'
|
|
86
86
|
import {
|
|
87
87
|
Select,
|
|
88
88
|
SelectContent,
|
|
89
89
|
SelectItem,
|
|
90
90
|
SelectTrigger,
|
|
91
91
|
SelectValue,
|
|
92
|
-
} from
|
|
93
|
-
import { Separator } from
|
|
92
|
+
} from '@/components/ui/select'
|
|
93
|
+
import { Separator } from '@/components/ui/separator'
|
|
94
94
|
import {
|
|
95
95
|
Table,
|
|
96
96
|
TableBody,
|
|
@@ -98,13 +98,8 @@ import {
|
|
|
98
98
|
TableHead,
|
|
99
99
|
TableHeader,
|
|
100
100
|
TableRow,
|
|
101
|
-
} from
|
|
102
|
-
import {
|
|
103
|
-
Tabs,
|
|
104
|
-
TabsContent,
|
|
105
|
-
TabsList,
|
|
106
|
-
TabsTrigger,
|
|
107
|
-
} from "@/components/ui/tabs"
|
|
101
|
+
} from '@/components/ui/table'
|
|
102
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
|
108
103
|
|
|
109
104
|
export const schema = z.object({
|
|
110
105
|
id: z.number(),
|
|
@@ -138,18 +133,18 @@ function DragHandle({ id }: { id: number }) {
|
|
|
138
133
|
|
|
139
134
|
const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
140
135
|
{
|
|
141
|
-
id:
|
|
136
|
+
id: 'drag',
|
|
142
137
|
header: () => null,
|
|
143
138
|
cell: ({ row }) => <DragHandle id={row.original.id} />,
|
|
144
139
|
},
|
|
145
140
|
{
|
|
146
|
-
id:
|
|
141
|
+
id: 'select',
|
|
147
142
|
header: ({ table }) => (
|
|
148
143
|
<div className="flex items-center justify-center">
|
|
149
144
|
<Checkbox
|
|
150
145
|
checked={
|
|
151
146
|
table.getIsAllPageRowsSelected() ||
|
|
152
|
-
(table.getIsSomePageRowsSelected() &&
|
|
147
|
+
(table.getIsSomePageRowsSelected() && 'indeterminate')
|
|
153
148
|
}
|
|
154
149
|
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
|
155
150
|
aria-label="Select all"
|
|
@@ -169,16 +164,16 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
169
164
|
enableHiding: false,
|
|
170
165
|
},
|
|
171
166
|
{
|
|
172
|
-
accessorKey:
|
|
173
|
-
header:
|
|
167
|
+
accessorKey: 'header',
|
|
168
|
+
header: 'Header',
|
|
174
169
|
cell: ({ row }) => {
|
|
175
170
|
return <TableCellViewer item={row.original} />
|
|
176
171
|
},
|
|
177
172
|
enableHiding: false,
|
|
178
173
|
},
|
|
179
174
|
{
|
|
180
|
-
accessorKey:
|
|
181
|
-
header:
|
|
175
|
+
accessorKey: 'type',
|
|
176
|
+
header: 'Section Type',
|
|
182
177
|
cell: ({ row }) => (
|
|
183
178
|
<div className="w-32">
|
|
184
179
|
<Badge variant="outline" className="px-1.5 text-muted-foreground">
|
|
@@ -188,11 +183,11 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
188
183
|
),
|
|
189
184
|
},
|
|
190
185
|
{
|
|
191
|
-
accessorKey:
|
|
192
|
-
header:
|
|
186
|
+
accessorKey: 'status',
|
|
187
|
+
header: 'Status',
|
|
193
188
|
cell: ({ row }) => (
|
|
194
189
|
<Badge variant="outline" className="px-1.5 text-muted-foreground">
|
|
195
|
-
{row.original.status ===
|
|
190
|
+
{row.original.status === 'Done' ? (
|
|
196
191
|
<IconCircleCheckFilled className="fill-green-500 dark:fill-green-400" />
|
|
197
192
|
) : (
|
|
198
193
|
<IconLoader />
|
|
@@ -202,7 +197,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
202
197
|
),
|
|
203
198
|
},
|
|
204
199
|
{
|
|
205
|
-
accessorKey:
|
|
200
|
+
accessorKey: 'target',
|
|
206
201
|
header: () => <div className="w-full text-right">Target</div>,
|
|
207
202
|
cell: ({ row }) => (
|
|
208
203
|
<form
|
|
@@ -210,8 +205,8 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
210
205
|
e.preventDefault()
|
|
211
206
|
toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), {
|
|
212
207
|
loading: `Saving ${row.original.header}`,
|
|
213
|
-
success:
|
|
214
|
-
error:
|
|
208
|
+
success: 'Done',
|
|
209
|
+
error: 'Error',
|
|
215
210
|
})
|
|
216
211
|
}}
|
|
217
212
|
>
|
|
@@ -227,7 +222,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
227
222
|
),
|
|
228
223
|
},
|
|
229
224
|
{
|
|
230
|
-
accessorKey:
|
|
225
|
+
accessorKey: 'limit',
|
|
231
226
|
header: () => <div className="w-full text-right">Limit</div>,
|
|
232
227
|
cell: ({ row }) => (
|
|
233
228
|
<form
|
|
@@ -235,8 +230,8 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
235
230
|
e.preventDefault()
|
|
236
231
|
toast.promise(new Promise((resolve) => setTimeout(resolve, 1000)), {
|
|
237
232
|
loading: `Saving ${row.original.header}`,
|
|
238
|
-
success:
|
|
239
|
-
error:
|
|
233
|
+
success: 'Done',
|
|
234
|
+
error: 'Error',
|
|
240
235
|
})
|
|
241
236
|
}}
|
|
242
237
|
>
|
|
@@ -252,10 +247,10 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
252
247
|
),
|
|
253
248
|
},
|
|
254
249
|
{
|
|
255
|
-
accessorKey:
|
|
256
|
-
header:
|
|
250
|
+
accessorKey: 'reviewer',
|
|
251
|
+
header: 'Reviewer',
|
|
257
252
|
cell: ({ row }) => {
|
|
258
|
-
const isAssigned = row.original.reviewer !==
|
|
253
|
+
const isAssigned = row.original.reviewer !== 'Assign reviewer'
|
|
259
254
|
|
|
260
255
|
if (isAssigned) {
|
|
261
256
|
return row.original.reviewer
|
|
@@ -276,9 +271,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
276
271
|
</SelectTrigger>
|
|
277
272
|
<SelectContent align="end">
|
|
278
273
|
<SelectItem value="Eddie Lake">Eddie Lake</SelectItem>
|
|
279
|
-
<SelectItem value="Jamik Tashpulatov">
|
|
280
|
-
Jamik Tashpulatov
|
|
281
|
-
</SelectItem>
|
|
274
|
+
<SelectItem value="Jamik Tashpulatov">Jamik Tashpulatov</SelectItem>
|
|
282
275
|
</SelectContent>
|
|
283
276
|
</Select>
|
|
284
277
|
</>
|
|
@@ -286,7 +279,7 @@ const columns: ColumnDef<z.infer<typeof schema>>[] = [
|
|
|
286
279
|
},
|
|
287
280
|
},
|
|
288
281
|
{
|
|
289
|
-
id:
|
|
282
|
+
id: 'actions',
|
|
290
283
|
cell: () => (
|
|
291
284
|
<DropdownMenu>
|
|
292
285
|
<DropdownMenuTrigger asChild>
|
|
@@ -318,7 +311,7 @@ function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
|
|
|
318
311
|
|
|
319
312
|
return (
|
|
320
313
|
<TableRow
|
|
321
|
-
data-state={row.getIsSelected() &&
|
|
314
|
+
data-state={row.getIsSelected() && 'selected'}
|
|
322
315
|
data-dragging={isDragging}
|
|
323
316
|
ref={setNodeRef}
|
|
324
317
|
className="relative z-0 data-[dragging=true]:z-10 data-[dragging=true]:opacity-80"
|
|
@@ -336,18 +329,11 @@ function DraggableRow({ row }: { row: Row<z.infer<typeof schema>> }) {
|
|
|
336
329
|
)
|
|
337
330
|
}
|
|
338
331
|
|
|
339
|
-
export function DataTable({
|
|
340
|
-
data: initialData,
|
|
341
|
-
}: {
|
|
342
|
-
data: z.infer<typeof schema>[]
|
|
343
|
-
}) {
|
|
332
|
+
export function DataTable({ data: initialData }: { data: z.infer<typeof schema>[] }) {
|
|
344
333
|
const [data, setData] = React.useState(() => initialData)
|
|
345
334
|
const [rowSelection, setRowSelection] = React.useState({})
|
|
346
|
-
const [columnVisibility, setColumnVisibility] =
|
|
347
|
-
|
|
348
|
-
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
|
349
|
-
[]
|
|
350
|
-
)
|
|
335
|
+
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({})
|
|
336
|
+
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([])
|
|
351
337
|
const [sorting, setSorting] = React.useState<SortingState>([])
|
|
352
338
|
const [pagination, setPagination] = React.useState({
|
|
353
339
|
pageIndex: 0,
|
|
@@ -357,13 +343,10 @@ export function DataTable({
|
|
|
357
343
|
const sensors = useSensors(
|
|
358
344
|
useSensor(MouseSensor, {}),
|
|
359
345
|
useSensor(TouchSensor, {}),
|
|
360
|
-
useSensor(KeyboardSensor, {})
|
|
346
|
+
useSensor(KeyboardSensor, {}),
|
|
361
347
|
)
|
|
362
348
|
|
|
363
|
-
const dataIds = React.useMemo<UniqueIdentifier[]>(
|
|
364
|
-
() => data?.map(({ id }) => id) || [],
|
|
365
|
-
[data]
|
|
366
|
-
)
|
|
349
|
+
const dataIds = React.useMemo<UniqueIdentifier[]>(() => data?.map(({ id }) => id) || [], [data])
|
|
367
350
|
|
|
368
351
|
const table = useReactTable({
|
|
369
352
|
data,
|
|
@@ -402,20 +385,13 @@ export function DataTable({
|
|
|
402
385
|
}
|
|
403
386
|
|
|
404
387
|
return (
|
|
405
|
-
<Tabs
|
|
406
|
-
defaultValue="outline"
|
|
407
|
-
className="w-full flex-col justify-start gap-6"
|
|
408
|
-
>
|
|
388
|
+
<Tabs defaultValue="outline" className="w-full flex-col justify-start gap-6">
|
|
409
389
|
<div className="flex items-center justify-between px-4 lg:px-6">
|
|
410
390
|
<Label htmlFor="view-selector" className="sr-only">
|
|
411
391
|
View
|
|
412
392
|
</Label>
|
|
413
393
|
<Select defaultValue="outline">
|
|
414
|
-
<SelectTrigger
|
|
415
|
-
className="flex w-fit @4xl/main:hidden"
|
|
416
|
-
size="sm"
|
|
417
|
-
id="view-selector"
|
|
418
|
-
>
|
|
394
|
+
<SelectTrigger className="flex w-fit @4xl/main:hidden" size="sm" id="view-selector">
|
|
419
395
|
<SelectValue placeholder="Select a view" />
|
|
420
396
|
</SelectTrigger>
|
|
421
397
|
<SelectContent>
|
|
@@ -448,20 +424,14 @@ export function DataTable({
|
|
|
448
424
|
<DropdownMenuContent align="end" className="w-56">
|
|
449
425
|
{table
|
|
450
426
|
.getAllColumns()
|
|
451
|
-
.filter(
|
|
452
|
-
(column) =>
|
|
453
|
-
typeof column.accessorFn !== "undefined" &&
|
|
454
|
-
column.getCanHide()
|
|
455
|
-
)
|
|
427
|
+
.filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())
|
|
456
428
|
.map((column) => {
|
|
457
429
|
return (
|
|
458
430
|
<DropdownMenuCheckboxItem
|
|
459
431
|
key={column.id}
|
|
460
432
|
className="capitalize"
|
|
461
433
|
checked={column.getIsVisible()}
|
|
462
|
-
onCheckedChange={(value) =>
|
|
463
|
-
column.toggleVisibility(!!value)
|
|
464
|
-
}
|
|
434
|
+
onCheckedChange={(value) => column.toggleVisibility(!!value)}
|
|
465
435
|
>
|
|
466
436
|
{column.id}
|
|
467
437
|
</DropdownMenuCheckboxItem>
|
|
@@ -496,10 +466,7 @@ export function DataTable({
|
|
|
496
466
|
<TableHead key={header.id} colSpan={header.colSpan}>
|
|
497
467
|
{header.isPlaceholder
|
|
498
468
|
? null
|
|
499
|
-
: flexRender(
|
|
500
|
-
header.column.columnDef.header,
|
|
501
|
-
header.getContext()
|
|
502
|
-
)}
|
|
469
|
+
: flexRender(header.column.columnDef.header, header.getContext())}
|
|
503
470
|
</TableHead>
|
|
504
471
|
)
|
|
505
472
|
})}
|
|
@@ -508,20 +475,14 @@ export function DataTable({
|
|
|
508
475
|
</TableHeader>
|
|
509
476
|
<TableBody className="**:data-[slot=table-cell]:first:w-8">
|
|
510
477
|
{table.getRowModel().rows?.length ? (
|
|
511
|
-
<SortableContext
|
|
512
|
-
items={dataIds}
|
|
513
|
-
strategy={verticalListSortingStrategy}
|
|
514
|
-
>
|
|
478
|
+
<SortableContext items={dataIds} strategy={verticalListSortingStrategy}>
|
|
515
479
|
{table.getRowModel().rows.map((row) => (
|
|
516
480
|
<DraggableRow key={row.id} row={row} />
|
|
517
481
|
))}
|
|
518
482
|
</SortableContext>
|
|
519
483
|
) : (
|
|
520
484
|
<TableRow>
|
|
521
|
-
<TableCell
|
|
522
|
-
colSpan={columns.length}
|
|
523
|
-
className="h-24 text-center"
|
|
524
|
-
>
|
|
485
|
+
<TableCell colSpan={columns.length} className="h-24 text-center">
|
|
525
486
|
No results.
|
|
526
487
|
</TableCell>
|
|
527
488
|
</TableRow>
|
|
@@ -532,7 +493,7 @@ export function DataTable({
|
|
|
532
493
|
</div>
|
|
533
494
|
<div className="flex items-center justify-between px-4">
|
|
534
495
|
<div className="hidden flex-1 text-sm text-muted-foreground lg:flex">
|
|
535
|
-
{table.getFilteredSelectedRowModel().rows.length} of{
|
|
496
|
+
{table.getFilteredSelectedRowModel().rows.length} of{' '}
|
|
536
497
|
{table.getFilteredRowModel().rows.length} row(s) selected.
|
|
537
498
|
</div>
|
|
538
499
|
<div className="flex w-full items-center gap-8 lg:w-fit">
|
|
@@ -547,9 +508,7 @@ export function DataTable({
|
|
|
547
508
|
}}
|
|
548
509
|
>
|
|
549
510
|
<SelectTrigger size="sm" className="w-20" id="rows-per-page">
|
|
550
|
-
<SelectValue
|
|
551
|
-
placeholder={table.getState().pagination.pageSize}
|
|
552
|
-
/>
|
|
511
|
+
<SelectValue placeholder={table.getState().pagination.pageSize} />
|
|
553
512
|
</SelectTrigger>
|
|
554
513
|
<SelectContent side="top">
|
|
555
514
|
{[10, 20, 30, 40, 50].map((pageSize) => (
|
|
@@ -561,8 +520,7 @@ export function DataTable({
|
|
|
561
520
|
</Select>
|
|
562
521
|
</div>
|
|
563
522
|
<div className="flex w-fit items-center justify-center text-sm font-medium">
|
|
564
|
-
Page {table.getState().pagination.pageIndex + 1} of{
|
|
565
|
-
{table.getPageCount()}
|
|
523
|
+
Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
|
|
566
524
|
</div>
|
|
567
525
|
<div className="ml-auto flex items-center gap-2 lg:ml-0">
|
|
568
526
|
<Button
|
|
@@ -608,19 +566,13 @@ export function DataTable({
|
|
|
608
566
|
</div>
|
|
609
567
|
</div>
|
|
610
568
|
</TabsContent>
|
|
611
|
-
<TabsContent
|
|
612
|
-
value="past-performance"
|
|
613
|
-
className="flex flex-col px-4 lg:px-6"
|
|
614
|
-
>
|
|
569
|
+
<TabsContent value="past-performance" className="flex flex-col px-4 lg:px-6">
|
|
615
570
|
<div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
|
|
616
571
|
</TabsContent>
|
|
617
572
|
<TabsContent value="key-personnel" className="flex flex-col px-4 lg:px-6">
|
|
618
573
|
<div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
|
|
619
574
|
</TabsContent>
|
|
620
|
-
<TabsContent
|
|
621
|
-
value="focus-documents"
|
|
622
|
-
className="flex flex-col px-4 lg:px-6"
|
|
623
|
-
>
|
|
575
|
+
<TabsContent value="focus-documents" className="flex flex-col px-4 lg:px-6">
|
|
624
576
|
<div className="aspect-video w-full flex-1 rounded-lg border border-dashed"></div>
|
|
625
577
|
</TabsContent>
|
|
626
578
|
</Tabs>
|
|
@@ -628,22 +580,22 @@ export function DataTable({
|
|
|
628
580
|
}
|
|
629
581
|
|
|
630
582
|
const chartData = [
|
|
631
|
-
{ month:
|
|
632
|
-
{ month:
|
|
633
|
-
{ month:
|
|
634
|
-
{ month:
|
|
635
|
-
{ month:
|
|
636
|
-
{ month:
|
|
583
|
+
{ month: 'January', desktop: 186, mobile: 80 },
|
|
584
|
+
{ month: 'February', desktop: 305, mobile: 200 },
|
|
585
|
+
{ month: 'March', desktop: 237, mobile: 120 },
|
|
586
|
+
{ month: 'April', desktop: 73, mobile: 190 },
|
|
587
|
+
{ month: 'May', desktop: 209, mobile: 130 },
|
|
588
|
+
{ month: 'June', desktop: 214, mobile: 140 },
|
|
637
589
|
]
|
|
638
590
|
|
|
639
591
|
const chartConfig = {
|
|
640
592
|
desktop: {
|
|
641
|
-
label:
|
|
642
|
-
color:
|
|
593
|
+
label: 'Desktop',
|
|
594
|
+
color: 'var(--primary)',
|
|
643
595
|
},
|
|
644
596
|
mobile: {
|
|
645
|
-
label:
|
|
646
|
-
color:
|
|
597
|
+
label: 'Mobile',
|
|
598
|
+
color: 'var(--primary)',
|
|
647
599
|
},
|
|
648
600
|
} satisfies ChartConfig
|
|
649
601
|
|
|
@@ -651,7 +603,7 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
651
603
|
const isMobile = useIsMobile()
|
|
652
604
|
|
|
653
605
|
return (
|
|
654
|
-
<Drawer direction={isMobile ?
|
|
606
|
+
<Drawer direction={isMobile ? 'bottom' : 'right'}>
|
|
655
607
|
<DrawerTrigger asChild>
|
|
656
608
|
<Button variant="link" className="w-fit px-0 text-left text-foreground">
|
|
657
609
|
{item.header}
|
|
@@ -660,9 +612,7 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
660
612
|
<DrawerContent>
|
|
661
613
|
<DrawerHeader className="gap-1">
|
|
662
614
|
<DrawerTitle>{item.header}</DrawerTitle>
|
|
663
|
-
<DrawerDescription>
|
|
664
|
-
Showing total visitors for the last 6 months
|
|
665
|
-
</DrawerDescription>
|
|
615
|
+
<DrawerDescription>Showing total visitors for the last 6 months</DrawerDescription>
|
|
666
616
|
</DrawerHeader>
|
|
667
617
|
<div className="flex flex-col gap-4 overflow-y-auto px-4 text-sm">
|
|
668
618
|
{!isMobile && (
|
|
@@ -685,10 +635,7 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
685
635
|
tickFormatter={(value) => value.slice(0, 3)}
|
|
686
636
|
hide
|
|
687
637
|
/>
|
|
688
|
-
<ChartTooltip
|
|
689
|
-
cursor={false}
|
|
690
|
-
content={<ChartTooltipContent indicator="dot" />}
|
|
691
|
-
/>
|
|
638
|
+
<ChartTooltip cursor={false} content={<ChartTooltipContent indicator="dot" />} />
|
|
692
639
|
<Area
|
|
693
640
|
dataKey="mobile"
|
|
694
641
|
type="natural"
|
|
@@ -710,13 +657,11 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
710
657
|
<Separator />
|
|
711
658
|
<div className="grid gap-2">
|
|
712
659
|
<div className="flex gap-2 leading-none font-medium">
|
|
713
|
-
Trending up by 5.2% this month
|
|
714
|
-
<IconTrendingUp className="size-4" />
|
|
660
|
+
Trending up by 5.2% this month <IconTrendingUp className="size-4" />
|
|
715
661
|
</div>
|
|
716
662
|
<div className="text-muted-foreground">
|
|
717
|
-
Showing total visitors for the last 6 months. This is just
|
|
718
|
-
|
|
719
|
-
and should wrap around.
|
|
663
|
+
Showing total visitors for the last 6 months. This is just some random text to
|
|
664
|
+
test the layout. It spans multiple lines and should wrap around.
|
|
720
665
|
</div>
|
|
721
666
|
</div>
|
|
722
667
|
<Separator />
|
|
@@ -735,20 +680,12 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
735
680
|
<SelectValue placeholder="Select a type" />
|
|
736
681
|
</SelectTrigger>
|
|
737
682
|
<SelectContent>
|
|
738
|
-
<SelectItem value="Table of Contents">
|
|
739
|
-
|
|
740
|
-
</SelectItem>
|
|
741
|
-
<SelectItem value="Executive Summary">
|
|
742
|
-
Executive Summary
|
|
743
|
-
</SelectItem>
|
|
744
|
-
<SelectItem value="Technical Approach">
|
|
745
|
-
Technical Approach
|
|
746
|
-
</SelectItem>
|
|
683
|
+
<SelectItem value="Table of Contents">Table of Contents</SelectItem>
|
|
684
|
+
<SelectItem value="Executive Summary">Executive Summary</SelectItem>
|
|
685
|
+
<SelectItem value="Technical Approach">Technical Approach</SelectItem>
|
|
747
686
|
<SelectItem value="Design">Design</SelectItem>
|
|
748
687
|
<SelectItem value="Capabilities">Capabilities</SelectItem>
|
|
749
|
-
<SelectItem value="Focus Documents">
|
|
750
|
-
Focus Documents
|
|
751
|
-
</SelectItem>
|
|
688
|
+
<SelectItem value="Focus Documents">Focus Documents</SelectItem>
|
|
752
689
|
<SelectItem value="Narrative">Narrative</SelectItem>
|
|
753
690
|
<SelectItem value="Cover Page">Cover Page</SelectItem>
|
|
754
691
|
</SelectContent>
|
|
@@ -786,9 +723,7 @@ function TableCellViewer({ item }: { item: z.infer<typeof schema> }) {
|
|
|
786
723
|
</SelectTrigger>
|
|
787
724
|
<SelectContent>
|
|
788
725
|
<SelectItem value="Eddie Lake">Eddie Lake</SelectItem>
|
|
789
|
-
<SelectItem value="Jamik Tashpulatov">
|
|
790
|
-
Jamik Tashpulatov
|
|
791
|
-
</SelectItem>
|
|
726
|
+
<SelectItem value="Jamik Tashpulatov">Jamik Tashpulatov</SelectItem>
|
|
792
727
|
<SelectItem value="Emily Whalen">Emily Whalen</SelectItem>
|
|
793
728
|
</SelectContent>
|
|
794
729
|
</Select>
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
IconDots,
|
|
5
|
-
IconFolder,
|
|
6
|
-
IconShare3,
|
|
7
|
-
IconTrash,
|
|
8
|
-
type Icon,
|
|
9
|
-
} from "@tabler/icons-react"
|
|
3
|
+
import { IconDots, IconFolder, IconShare3, IconTrash, type Icon } from '@tabler/icons-react'
|
|
10
4
|
|
|
11
5
|
import {
|
|
12
6
|
DropdownMenu,
|
|
@@ -14,7 +8,7 @@ import {
|
|
|
14
8
|
DropdownMenuItem,
|
|
15
9
|
DropdownMenuSeparator,
|
|
16
10
|
DropdownMenuTrigger,
|
|
17
|
-
} from
|
|
11
|
+
} from '@/components/ui/dropdown-menu'
|
|
18
12
|
import {
|
|
19
13
|
SidebarGroup,
|
|
20
14
|
SidebarGroupLabel,
|
|
@@ -23,7 +17,7 @@ import {
|
|
|
23
17
|
SidebarMenuButton,
|
|
24
18
|
SidebarMenuItem,
|
|
25
19
|
useSidebar,
|
|
26
|
-
} from
|
|
20
|
+
} from '@/components/ui/sidebar'
|
|
27
21
|
|
|
28
22
|
export function NavDocuments({
|
|
29
23
|
items,
|
|
@@ -50,18 +44,15 @@ export function NavDocuments({
|
|
|
50
44
|
</SidebarMenuButton>
|
|
51
45
|
<DropdownMenu>
|
|
52
46
|
<DropdownMenuTrigger asChild>
|
|
53
|
-
<SidebarMenuAction
|
|
54
|
-
showOnHover
|
|
55
|
-
className="rounded-sm data-[state=open]:bg-accent"
|
|
56
|
-
>
|
|
47
|
+
<SidebarMenuAction showOnHover className="rounded-sm data-[state=open]:bg-accent">
|
|
57
48
|
<IconDots />
|
|
58
49
|
<span className="sr-only">More</span>
|
|
59
50
|
</SidebarMenuAction>
|
|
60
51
|
</DropdownMenuTrigger>
|
|
61
52
|
<DropdownMenuContent
|
|
62
53
|
className="w-24 rounded-lg"
|
|
63
|
-
side={isMobile ?
|
|
64
|
-
align={isMobile ?
|
|
54
|
+
side={isMobile ? 'bottom' : 'right'}
|
|
55
|
+
align={isMobile ? 'end' : 'start'}
|
|
65
56
|
>
|
|
66
57
|
<DropdownMenuItem>
|
|
67
58
|
<IconFolder />
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import { IconCirclePlusFilled, IconMail, type Icon } from
|
|
3
|
+
import { IconCirclePlusFilled, IconMail, type Icon } from '@tabler/icons-react'
|
|
4
4
|
|
|
5
|
-
import { Button } from
|
|
5
|
+
import { Button } from '@/components/ui/button'
|
|
6
6
|
import {
|
|
7
7
|
SidebarGroup,
|
|
8
8
|
SidebarGroupContent,
|
|
9
9
|
SidebarMenu,
|
|
10
10
|
SidebarMenuButton,
|
|
11
11
|
SidebarMenuItem,
|
|
12
|
-
} from
|
|
12
|
+
} from '@/components/ui/sidebar'
|
|
13
13
|
|
|
14
14
|
export function NavMain({
|
|
15
15
|
items,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
|
|
3
|
-
import * as React from
|
|
4
|
-
import { type Icon } from
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { type Icon } from '@tabler/icons-react'
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
SidebarGroup,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
SidebarMenu,
|
|
10
10
|
SidebarMenuButton,
|
|
11
11
|
SidebarMenuItem,
|
|
12
|
-
} from
|
|
12
|
+
} from '@/components/ui/sidebar'
|
|
13
13
|
|
|
14
14
|
export function NavSecondary({
|
|
15
15
|
items,
|