doo-boilerplate 0.2.5 → 0.2.6
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/index.js +2 -1
- package/package.json +1 -1
- package/templates/template-vite/src/components/common/error-page.tsx +1 -1
- package/templates/template-vite/src/components/data-table/data-table-faceted-filter.tsx +1 -1
- package/templates/template-vite/src/features/dashboard/components/overview-chart.tsx +12 -12
- package/templates/template-vite/src/features/tasks/components/tasks-table-columns.tsx +1 -1
- package/templates/template-vite/src/lib/api-client.ts +3 -2
- package/templates/template-vite/src/stores/auth-store.ts +4 -1
- /package/templates/template-vite/{package.json → _package.json} +0 -0
package/dist/index.js
CHANGED
|
@@ -112,7 +112,8 @@ var FILE_RENAMES = [
|
|
|
112
112
|
["_gitignore", ".gitignore"],
|
|
113
113
|
["_env.example", ".env.example"],
|
|
114
114
|
["_prettierrc", ".prettierrc"],
|
|
115
|
-
["_prettierignore", ".prettierignore"]
|
|
115
|
+
["_prettierignore", ".prettierignore"],
|
|
116
|
+
["_package.json", "package.json"]
|
|
116
117
|
];
|
|
117
118
|
async function scaffold(options, destDir) {
|
|
118
119
|
const templateSymlink = path2.join(__dirname2, "..", "templates", "template-vite");
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export function ErrorPage({ code, title, description, showBack = true }: ErrorPa
|
|
|
20
20
|
<p className='max-w-md text-muted-foreground'>{description}</p>
|
|
21
21
|
<div className='mt-4 flex gap-3'>
|
|
22
22
|
{showBack && (
|
|
23
|
-
<Button variant='outline' onClick={() => history.back()}>Go Back</Button>
|
|
23
|
+
<Button variant='outline' onClick={() => window.history.back()}>Go Back</Button>
|
|
24
24
|
)}
|
|
25
25
|
<Button asChild>
|
|
26
26
|
<Link to='/dashboard'>Go to Dashboard</Link>
|
|
@@ -35,7 +35,7 @@ export function DataTableFacetedFilter<TData, TValue>({
|
|
|
35
35
|
options,
|
|
36
36
|
}: DataTableFacetedFilterProps<TData, TValue>) {
|
|
37
37
|
const facets = column?.getFacetedUniqueValues()
|
|
38
|
-
const selectedValues = new Set(column?.getFilterValue() as string[])
|
|
38
|
+
const selectedValues = new Set((column?.getFilterValue() as string[] | undefined) ?? [])
|
|
39
39
|
|
|
40
40
|
return (
|
|
41
41
|
<Popover>
|
|
@@ -3,18 +3,18 @@ import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YA
|
|
|
3
3
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
|
4
4
|
|
|
5
5
|
const data = [
|
|
6
|
-
{ month: 'Jan', revenue: 18000
|
|
7
|
-
{ month: 'Feb', revenue: 22000
|
|
8
|
-
{ month: 'Mar', revenue: 19500
|
|
9
|
-
{ month: 'Apr', revenue: 28000
|
|
10
|
-
{ month: 'May', revenue: 24000
|
|
11
|
-
{ month: 'Jun', revenue: 32000
|
|
12
|
-
{ month: 'Jul', revenue: 35000
|
|
13
|
-
{ month: 'Aug', revenue: 29000
|
|
14
|
-
{ month: 'Sep', revenue: 38000
|
|
15
|
-
{ month: 'Oct', revenue: 42000
|
|
16
|
-
{ month: 'Nov', revenue: 39000
|
|
17
|
-
{ month: 'Dec', revenue: 45000
|
|
6
|
+
{ month: 'Jan', revenue: 18000 },
|
|
7
|
+
{ month: 'Feb', revenue: 22000 },
|
|
8
|
+
{ month: 'Mar', revenue: 19500 },
|
|
9
|
+
{ month: 'Apr', revenue: 28000 },
|
|
10
|
+
{ month: 'May', revenue: 24000 },
|
|
11
|
+
{ month: 'Jun', revenue: 32000 },
|
|
12
|
+
{ month: 'Jul', revenue: 35000 },
|
|
13
|
+
{ month: 'Aug', revenue: 29000 },
|
|
14
|
+
{ month: 'Sep', revenue: 38000 },
|
|
15
|
+
{ month: 'Oct', revenue: 42000 },
|
|
16
|
+
{ month: 'Nov', revenue: 39000 },
|
|
17
|
+
{ month: 'Dec', revenue: 45000 },
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
export function OverviewChart() {
|
|
@@ -38,7 +38,7 @@ export function getTaskColumns({ onEdit, onDelete }: ActionsCallbacks): ColumnDe
|
|
|
38
38
|
id: 'select',
|
|
39
39
|
header: ({ table }) => (
|
|
40
40
|
<Checkbox
|
|
41
|
-
checked={table.getIsAllPageRowsSelected()}
|
|
41
|
+
checked={table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate')}
|
|
42
42
|
onCheckedChange={(v) => table.toggleAllPageRowsSelected(!!v)}
|
|
43
43
|
aria-label='Select all'
|
|
44
44
|
/>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
|
+
import { AUTH_STORAGE_KEY } from '@/stores/auth-store'
|
|
2
3
|
|
|
3
4
|
// Axios instance configured with base URL from Vite env
|
|
4
5
|
const apiClient = axios.create({
|
|
@@ -10,7 +11,7 @@ const apiClient = axios.create({
|
|
|
10
11
|
// Attach Bearer token from auth storage on each request
|
|
11
12
|
apiClient.interceptors.request.use((config) => {
|
|
12
13
|
try {
|
|
13
|
-
const stored = localStorage.getItem(
|
|
14
|
+
const stored = localStorage.getItem(AUTH_STORAGE_KEY)
|
|
14
15
|
if (stored) {
|
|
15
16
|
const { state } = JSON.parse(stored)
|
|
16
17
|
if (state?.accessToken) {
|
|
@@ -28,7 +29,7 @@ apiClient.interceptors.response.use(
|
|
|
28
29
|
(response) => response,
|
|
29
30
|
(error) => {
|
|
30
31
|
if (error.response?.status === 401) {
|
|
31
|
-
localStorage.removeItem(
|
|
32
|
+
localStorage.removeItem(AUTH_STORAGE_KEY)
|
|
32
33
|
window.location.href = '/sign-in'
|
|
33
34
|
}
|
|
34
35
|
return Promise.reject(error)
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** Shared storage key used by auth store and api-client interceptor */
|
|
2
|
+
export const AUTH_STORAGE_KEY = 'auth-storage'
|
|
3
|
+
|
|
1
4
|
import { create } from 'zustand'
|
|
2
5
|
import { persist } from 'zustand/middleware'
|
|
3
6
|
import { jwtDecode } from 'jwt-decode'
|
|
@@ -51,6 +54,6 @@ export const useAuthStore = create<AuthState>()(
|
|
|
51
54
|
hasRole: (role) => get().user?.roles.includes(role) ?? false,
|
|
52
55
|
hasPermission: (permission) => get().user?.permissions.includes(permission) ?? false,
|
|
53
56
|
}),
|
|
54
|
-
{ name:
|
|
57
|
+
{ name: AUTH_STORAGE_KEY }
|
|
55
58
|
)
|
|
56
59
|
)
|
|
File without changes
|