@betterstart/cli 0.1.82 → 0.1.83
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/dist/cli.js +161 -303
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/templates/init/components/data-table/data-table.tsx +1 -1
- package/templates/init/components/shared/page-header.tsx +5 -5
- package/templates/init/pages/dashboard-page.tsx +1 -1
- package/templates/init/pages/users/columns.tsx +13 -10
- package/templates/init/pages/users/users-page-content.tsx +9 -2
- package/templates/init/pages/users/users-page.tsx +1 -1
- package/templates/init/pages/users/users-table.tsx +2 -2
- package/templates/ui/badge.tsx +2 -2
- package/templates/ui/button.tsx +1 -1
- package/templates/ui/sidebar.tsx +2 -2
- package/templates/ui/table.tsx +10 -4
package/package.json
CHANGED
|
@@ -133,7 +133,7 @@ export function DataTable<TData, TValue>({
|
|
|
133
133
|
<div className="space-y-6">
|
|
134
134
|
<div className="bg-card border overflow-hidden rounded-lg corner-squircle">
|
|
135
135
|
<Table>
|
|
136
|
-
<TableHeader
|
|
136
|
+
<TableHeader>
|
|
137
137
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
138
138
|
<TableRow key={headerGroup.id}>
|
|
139
139
|
{headerGroup.headers.map((header) => (
|
|
@@ -8,16 +8,16 @@ interface PageHeaderProps {
|
|
|
8
8
|
|
|
9
9
|
export function PageHeader({ title, children, search, actions, back }: PageHeaderProps) {
|
|
10
10
|
return (
|
|
11
|
-
<
|
|
12
|
-
<div className="flex items-center justify-start gap-2 w-full">{back
|
|
13
|
-
<div className="flex items-center justify-center gap-2">
|
|
11
|
+
<header className="grid grid-cols-3 items-center h-14 px-6 border-b border-border fixed top-0 bg-background/60 backdrop-blur-md z-10 left-0 pl-[calc(var(--sidebar-width)+calc(var(--spacing)*6))] right-0 w-svw">
|
|
12
|
+
<div className="flex items-center justify-start gap-2 w-full">{back}</div>
|
|
13
|
+
<div className="flex items-center justify-center gap-2 w-full">
|
|
14
14
|
<h2 className="text-sm font-medium tracking-tight">{title}</h2>
|
|
15
15
|
</div>
|
|
16
|
-
<div className="flex items-center justify-end gap-2">
|
|
16
|
+
<div className="flex items-center justify-end gap-2 w-full">
|
|
17
17
|
{children && children}
|
|
18
18
|
{search && search}
|
|
19
19
|
{actions && actions}
|
|
20
20
|
</div>
|
|
21
|
-
</
|
|
21
|
+
</header>
|
|
22
22
|
)
|
|
23
23
|
}
|
|
@@ -28,7 +28,7 @@ const quickLinks = [
|
|
|
28
28
|
|
|
29
29
|
export default function DashboardPage() {
|
|
30
30
|
return (
|
|
31
|
-
<div className="flex flex-col">
|
|
31
|
+
<div className="flex flex-col pt-14">
|
|
32
32
|
<PageHeader title="Dashboard" />
|
|
33
33
|
<div className="p-6 space-y-6">
|
|
34
34
|
<div className="grid gap-4 md:grid-cols-3">
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
AlertDialogTitle,
|
|
13
13
|
AlertDialogTrigger,
|
|
14
14
|
} from '@cms/components/ui/alert-dialog'
|
|
15
|
-
import { Avatar, AvatarFallback } from '@cms/components/ui/avatar'
|
|
15
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@cms/components/ui/avatar'
|
|
16
16
|
import { Badge } from '@cms/components/ui/badge'
|
|
17
17
|
import { Button } from '@cms/components/ui/button'
|
|
18
18
|
import {
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import type { UserData } from '@cms/types/auth'
|
|
27
27
|
import { useQueryClient } from '@tanstack/react-query'
|
|
28
28
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
29
|
-
import { ArrowUpDown, Edit, MoreHorizontal, Trash } from 'lucide-react'
|
|
29
|
+
import { ArrowUpDown, Edit, MoreHorizontal, ShieldCheck, Trash } from 'lucide-react'
|
|
30
30
|
import React from 'react'
|
|
31
31
|
import { toast } from 'sonner'
|
|
32
32
|
import { EditRoleDialog } from './edit-role-dialog'
|
|
@@ -117,10 +117,10 @@ export const columns: ColumnDef<UserData>[] = [
|
|
|
117
117
|
<Button
|
|
118
118
|
variant="ghost"
|
|
119
119
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
120
|
-
className="hover:bg-
|
|
120
|
+
className="px-0 text-muted-foreground hover:text-foreground w-full hover:bg-transparent justify-start"
|
|
121
121
|
>
|
|
122
122
|
User
|
|
123
|
-
<ArrowUpDown className="size-
|
|
123
|
+
<ArrowUpDown className="size-3" />
|
|
124
124
|
</Button>
|
|
125
125
|
),
|
|
126
126
|
cell: ({ row }) => {
|
|
@@ -145,8 +145,9 @@ export const columns: ColumnDef<UserData>[] = [
|
|
|
145
145
|
cell: ({ row }) => {
|
|
146
146
|
const verified = row.getValue('emailVerified') as boolean
|
|
147
147
|
return (
|
|
148
|
-
<Badge variant=
|
|
149
|
-
|
|
148
|
+
<Badge variant="outline">
|
|
149
|
+
|
|
150
|
+
{verified ? <span className="flex items-center gap-1"><ShieldCheck className="size-3.5" />Verified</span> : <span className="flex items-center gap-1"><ShieldCheck className="size-3.5" />Unverified</span>}
|
|
150
151
|
</Badge>
|
|
151
152
|
)
|
|
152
153
|
},
|
|
@@ -174,8 +175,10 @@ export const columns: ColumnDef<UserData>[] = [
|
|
|
174
175
|
userName={row.original.name}
|
|
175
176
|
>
|
|
176
177
|
<Badge variant="outline" className="capitalize cursor-pointer">
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
<span className="flex items-center gap-1">
|
|
179
|
+
{role}
|
|
180
|
+
<Edit className="size-3" />
|
|
181
|
+
</span>
|
|
179
182
|
</Badge>
|
|
180
183
|
</EditRoleDialog>
|
|
181
184
|
)
|
|
@@ -187,10 +190,10 @@ export const columns: ColumnDef<UserData>[] = [
|
|
|
187
190
|
<Button
|
|
188
191
|
variant="ghost"
|
|
189
192
|
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
|
190
|
-
className="hover:bg-
|
|
193
|
+
className="px-0 text-muted-foreground hover:text-foreground w-full hover:bg-transparent justify-start"
|
|
191
194
|
>
|
|
192
195
|
Joined
|
|
193
|
-
<ArrowUpDown className="size-
|
|
196
|
+
<ArrowUpDown className="size-3" />
|
|
194
197
|
</Button>
|
|
195
198
|
),
|
|
196
199
|
cell: ({ row }) => {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import React from 'react'
|
|
3
4
|
import type { ColumnDef } from '@tanstack/react-table'
|
|
5
|
+
import { ChevronLeft } from 'lucide-react'
|
|
6
|
+
import { useRouter } from 'next/navigation'
|
|
4
7
|
import { PageHeader } from '@cms/components/shared/page-header'
|
|
5
8
|
import type { UserData } from '@cms/types/auth'
|
|
9
|
+
import { Button } from '@cms/components/ui/button'
|
|
6
10
|
import { CreateUserDialog } from './create-user-dialog'
|
|
7
11
|
import { UsersTable } from './users-table'
|
|
8
12
|
|
|
@@ -11,10 +15,13 @@ interface UsersPageContentProps<TValue> {
|
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export function UsersPageContent<TValue>({ columns }: UsersPageContentProps<TValue>) {
|
|
18
|
+
const router = useRouter()
|
|
19
|
+
|
|
14
20
|
return (
|
|
15
|
-
|
|
21
|
+
<React.Fragment>
|
|
16
22
|
<PageHeader
|
|
17
23
|
title="Users"
|
|
24
|
+
back={<Button variant="ghost" size="icon" onClick={() => router.back()}><ChevronLeft /></Button>}
|
|
18
25
|
actions={
|
|
19
26
|
<div className="flex items-center gap-2">
|
|
20
27
|
<CreateUserDialog />
|
|
@@ -24,6 +31,6 @@ export function UsersPageContent<TValue>({ columns }: UsersPageContentProps<TVal
|
|
|
24
31
|
<main className="space-y-6 p-6">
|
|
25
32
|
<UsersTable columns={columns} />
|
|
26
33
|
</main>
|
|
27
|
-
|
|
34
|
+
</React.Fragment>
|
|
28
35
|
)
|
|
29
36
|
}
|
|
@@ -126,7 +126,7 @@ export function UsersTable<TValue>({ columns }: UsersTableProps<TValue>) {
|
|
|
126
126
|
<div className="space-y-6">
|
|
127
127
|
<div className="bg-card border overflow-hidden rounded-lg">
|
|
128
128
|
<Table>
|
|
129
|
-
<TableHeader
|
|
129
|
+
<TableHeader>
|
|
130
130
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
131
131
|
<TableRow key={headerGroup.id}>
|
|
132
132
|
{headerGroup.headers.map((header) => (
|
|
@@ -180,7 +180,7 @@ export function UsersTable<TValue>({ columns }: UsersTableProps<TValue>) {
|
|
|
180
180
|
value={pageSize === -1 ? 'all' : String(pageSize)}
|
|
181
181
|
onValueChange={handlePageSizeChange}
|
|
182
182
|
>
|
|
183
|
-
<SelectTrigger className="w-
|
|
183
|
+
<SelectTrigger className="w-25 h-8">
|
|
184
184
|
<SelectValue />
|
|
185
185
|
</SelectTrigger>
|
|
186
186
|
<SelectContent>
|
package/templates/ui/badge.tsx
CHANGED
|
@@ -4,12 +4,12 @@ import { Slot } from 'radix-ui'
|
|
|
4
4
|
import type * as React from 'react'
|
|
5
5
|
|
|
6
6
|
const badgeVariants = cva(
|
|
7
|
-
'h-
|
|
7
|
+
'h-6 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge',
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80',
|
|
12
|
-
secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80',
|
|
12
|
+
secondary: 'bg-secondary border-border text-secondary-foreground [a]:hover:bg-secondary/80',
|
|
13
13
|
destructive:
|
|
14
14
|
'bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20',
|
|
15
15
|
outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground',
|
package/templates/ui/button.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const buttonVariants = cva(
|
|
|
11
11
|
variant: {
|
|
12
12
|
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
13
13
|
outline:
|
|
14
|
-
"border-border bg-
|
|
14
|
+
"border-border bg-white hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
15
15
|
secondary:
|
|
16
16
|
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
17
17
|
ghost:
|
package/templates/ui/sidebar.tsx
CHANGED
|
@@ -160,7 +160,7 @@ function Sidebar({
|
|
|
160
160
|
<div
|
|
161
161
|
data-slot="sidebar"
|
|
162
162
|
className={cn(
|
|
163
|
-
'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
|
|
163
|
+
'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col relative z-11',
|
|
164
164
|
className
|
|
165
165
|
)}
|
|
166
166
|
{...props}
|
|
@@ -198,7 +198,7 @@ function Sidebar({
|
|
|
198
198
|
|
|
199
199
|
return (
|
|
200
200
|
<div
|
|
201
|
-
className="group peer text-sidebar-foreground hidden md:block"
|
|
201
|
+
className="group peer text-sidebar-foreground hidden md:block z-11 relative"
|
|
202
202
|
data-state={state}
|
|
203
203
|
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
204
204
|
data-variant={variant}
|
package/templates/ui/table.tsx
CHANGED
|
@@ -16,7 +16,13 @@ function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
|
19
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<thead
|
|
21
|
+
data-slot="table-header"
|
|
22
|
+
className={cn('[&_tr]:border-b [&_tr:hover]:bg-transparent! bg-background [&_th]:text-muted-foreground', className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
|
@@ -33,7 +39,7 @@ function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
|
|
33
39
|
return (
|
|
34
40
|
<tfoot
|
|
35
41
|
data-slot="table-footer"
|
|
36
|
-
className={cn('bg-
|
|
42
|
+
className={cn('bg-background border-t font-medium [&>tr]:last:border-b-0', className)}
|
|
37
43
|
{...props}
|
|
38
44
|
/>
|
|
39
45
|
)
|
|
@@ -44,7 +50,7 @@ function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
|
|
44
50
|
<tr
|
|
45
51
|
data-slot="table-row"
|
|
46
52
|
className={cn(
|
|
47
|
-
'hover:bg-
|
|
53
|
+
'hover:bg-background data-[state=selected]:bg-background border-b transition-colors',
|
|
48
54
|
className
|
|
49
55
|
)}
|
|
50
56
|
{...props}
|
|
@@ -69,7 +75,7 @@ function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
|
|
69
75
|
return (
|
|
70
76
|
<td
|
|
71
77
|
data-slot="table-cell"
|
|
72
|
-
className={cn('px-4 py-
|
|
78
|
+
className={cn('px-4 py-3.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)}
|
|
73
79
|
{...props}
|
|
74
80
|
/>
|
|
75
81
|
)
|