@hed-hog/core 0.0.294 → 0.0.295

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.
@@ -42,8 +42,8 @@ export declare class MailController {
42
42
  created_at: Date;
43
43
  updated_at: Date;
44
44
  locale_id: number;
45
- mail_id: number;
46
45
  subject: string;
46
+ mail_id: number;
47
47
  }[];
48
48
  mail_var: {
49
49
  name: string;
@@ -69,8 +69,8 @@ export declare class MailController {
69
69
  created_at: Date;
70
70
  updated_at: Date;
71
71
  locale_id: number;
72
- mail_id: number;
73
72
  subject: string;
73
+ mail_id: number;
74
74
  }[];
75
75
  mail_var: {
76
76
  name: string;
@@ -57,8 +57,8 @@ export declare class MailService {
57
57
  created_at: Date;
58
58
  updated_at: Date;
59
59
  locale_id: number;
60
- mail_id: number;
61
60
  subject: string;
61
+ mail_id: number;
62
62
  }[];
63
63
  mail_var: {
64
64
  name: string;
@@ -83,8 +83,8 @@ export declare class MailService {
83
83
  created_at: Date;
84
84
  updated_at: Date;
85
85
  locale_id: number;
86
- mail_id: number;
87
86
  subject: string;
87
+ mail_id: number;
88
88
  }[];
89
89
  mail_var: {
90
90
  name: string;
@@ -20,8 +20,8 @@ export declare class MailSentController {
20
20
  from: string;
21
21
  created_at: Date;
22
22
  updated_at: Date;
23
- mail_id: number;
24
23
  subject: string;
24
+ mail_id: number;
25
25
  to: string | null;
26
26
  cc: string | null;
27
27
  bcc: string | null;
@@ -32,8 +32,8 @@ export declare class MailSentController {
32
32
  from: string;
33
33
  created_at: Date;
34
34
  updated_at: Date;
35
- mail_id: number;
36
35
  subject: string;
36
+ mail_id: number;
37
37
  to: string | null;
38
38
  cc: string | null;
39
39
  bcc: string | null;
@@ -44,8 +44,8 @@ export declare class MailSentController {
44
44
  from: string;
45
45
  created_at: Date;
46
46
  updated_at: Date;
47
- mail_id: number;
48
47
  subject: string;
48
+ mail_id: number;
49
49
  to: string | null;
50
50
  cc: string | null;
51
51
  bcc: string | null;
@@ -22,8 +22,8 @@ export declare class MailSentService {
22
22
  from: string;
23
23
  created_at: Date;
24
24
  updated_at: Date;
25
- mail_id: number;
26
25
  subject: string;
26
+ mail_id: number;
27
27
  to: string | null;
28
28
  cc: string | null;
29
29
  bcc: string | null;
@@ -34,8 +34,8 @@ export declare class MailSentService {
34
34
  from: string;
35
35
  created_at: Date;
36
36
  updated_at: Date;
37
- mail_id: number;
38
37
  subject: string;
38
+ mail_id: number;
39
39
  to: string | null;
40
40
  cc: string | null;
41
41
  bcc: string | null;
@@ -49,8 +49,8 @@ export declare class MailSentService {
49
49
  from: string;
50
50
  created_at: Date;
51
51
  updated_at: Date;
52
- mail_id: number;
53
52
  subject: string;
53
+ mail_id: number;
54
54
  to: string | null;
55
55
  cc: string | null;
56
56
  bcc: string | null;
@@ -1,223 +1,223 @@
1
- - component_id:
2
- where:
3
- slug: active-users-card
4
- role_id:
5
- where:
6
- slug: admin-access
7
- - component_id:
8
- where:
9
- slug: mail-sent-card
10
- role_id:
11
- where:
12
- slug: admin-access
13
- - component_id:
14
- where:
15
- slug: mail-sent-chart
16
- role_id:
17
- where:
18
- slug: admin-access
19
- - component_id:
20
- where:
21
- slug: permissions-card
22
- role_id:
23
- where:
24
- slug: admin-access
25
- - component_id:
26
- where:
27
- slug: permissions-chart
28
- role_id:
29
- where:
30
- slug: admin-access
31
- - component_id:
32
- where:
33
- slug: session-activity-chart
34
- role_id:
35
- where:
36
- slug: admin-access
37
- - component_id:
38
- where:
39
- slug: sessions-today-card
40
- role_id:
41
- where:
42
- slug: admin-access
43
- - component_id:
44
- where:
45
- slug: menus-card
46
- role_id:
47
- where:
48
- slug: admin-access
49
- - component_id:
50
- where:
51
- slug: routes-card
52
- role_id:
53
- where:
54
- slug: admin-access
55
- - component_id:
56
- where:
57
- slug: user-growth-chart
58
- role_id:
59
- where:
60
- slug: admin-access
61
- - component_id:
62
- where:
63
- slug: account-security
64
- role_id:
65
- where:
66
- slug: user
67
- - component_id:
68
- where:
69
- slug: account-security
70
- role_id:
71
- where:
72
- slug: admin-access
73
- - component_id:
74
- where:
75
- slug: activity-timeline
76
- role_id:
77
- where:
78
- slug: user
79
- - component_id:
80
- where:
81
- slug: activity-timeline
82
- role_id:
83
- where:
84
- slug: admin-access
85
- - component_id:
86
- where:
87
- slug: email-notifications
88
- role_id:
89
- where:
90
- slug: user
91
- - component_id:
92
- where:
93
- slug: email-notifications
94
- role_id:
95
- where:
96
- slug: admin-access
97
- - component_id:
98
- where:
99
- slug: login-history-chart
100
- role_id:
101
- where:
102
- slug: user
103
- - component_id:
104
- where:
105
- slug: login-history-chart
106
- role_id:
107
- where:
108
- slug: admin-access
109
- - component_id:
110
- where:
111
- slug: profile-card
112
- role_id:
113
- where:
114
- slug: user
115
- - component_id:
116
- where:
117
- slug: profile-card
118
- role_id:
119
- where:
120
- slug: admin-access
121
- - component_id:
122
- where:
123
- slug: stat-online-time
124
- role_id:
125
- where:
126
- slug: user
127
- - component_id:
128
- where:
129
- slug: stat-online-time
130
- role_id:
131
- where:
132
- slug: admin-access
133
- - component_id:
134
- where:
135
- slug: stat-actions-today
136
- role_id:
137
- where:
138
- slug: user
139
- - component_id:
140
- where:
141
- slug: stat-actions-today
142
- role_id:
143
- where:
144
- slug: admin-access
145
- - component_id:
146
- where:
147
- slug: stat-consecutive-days
148
- role_id:
149
- where:
150
- slug: user
151
- - component_id:
152
- where:
153
- slug: stat-consecutive-days
154
- role_id:
155
- where:
156
- slug: admin-access
157
- - component_id:
158
- where:
159
- slug: stat-access-level
160
- role_id:
161
- where:
162
- slug: user
163
- - component_id:
164
- where:
165
- slug: stat-access-level
166
- role_id:
167
- where:
168
- slug: admin-access
169
- - component_id:
170
- where:
171
- slug: user-roles
172
- role_id:
173
- where:
174
- slug: user
175
- - component_id:
176
- where:
177
- slug: user-roles
178
- role_id:
179
- where:
180
- slug: admin-access
181
- - component_id:
182
- where:
183
- slug: user-sessions
184
- role_id:
185
- where:
186
- slug: user
187
- - component_id:
188
- where:
189
- slug: user-sessions
190
- role_id:
191
- where:
192
- slug: admin-access
193
-
194
- - component_id:
195
- where:
196
- slug: mail-config
197
- role_id:
198
- where:
199
- slug: admin
200
- - component_id:
201
- where:
202
- slug: locale-config
203
- role_id:
204
- where:
205
- slug: admin
206
- - component_id:
207
- where:
208
- slug: oauth-config
209
- role_id:
210
- where:
211
- slug: admin
212
- - component_id:
213
- where:
214
- slug: storage-config
215
- role_id:
216
- where:
217
- slug: admin
218
- - component_id:
219
- where:
220
- slug: theme-config
221
- role_id:
222
- where:
223
- slug: admin
1
+ - component_id:
2
+ where:
3
+ slug: active-users-card
4
+ role_id:
5
+ where:
6
+ slug: admin-access
7
+ - component_id:
8
+ where:
9
+ slug: mail-sent-card
10
+ role_id:
11
+ where:
12
+ slug: admin-access
13
+ - component_id:
14
+ where:
15
+ slug: mail-sent-chart
16
+ role_id:
17
+ where:
18
+ slug: admin-access
19
+ - component_id:
20
+ where:
21
+ slug: permissions-card
22
+ role_id:
23
+ where:
24
+ slug: admin-access
25
+ - component_id:
26
+ where:
27
+ slug: permissions-chart
28
+ role_id:
29
+ where:
30
+ slug: admin-access
31
+ - component_id:
32
+ where:
33
+ slug: session-activity-chart
34
+ role_id:
35
+ where:
36
+ slug: admin-access
37
+ - component_id:
38
+ where:
39
+ slug: sessions-today-card
40
+ role_id:
41
+ where:
42
+ slug: admin-access
43
+ - component_id:
44
+ where:
45
+ slug: menus-card
46
+ role_id:
47
+ where:
48
+ slug: admin-access
49
+ - component_id:
50
+ where:
51
+ slug: routes-card
52
+ role_id:
53
+ where:
54
+ slug: admin-access
55
+ - component_id:
56
+ where:
57
+ slug: user-growth-chart
58
+ role_id:
59
+ where:
60
+ slug: admin-access
61
+ - component_id:
62
+ where:
63
+ slug: account-security
64
+ role_id:
65
+ where:
66
+ slug: user
67
+ - component_id:
68
+ where:
69
+ slug: account-security
70
+ role_id:
71
+ where:
72
+ slug: admin-access
73
+ - component_id:
74
+ where:
75
+ slug: activity-timeline
76
+ role_id:
77
+ where:
78
+ slug: user
79
+ - component_id:
80
+ where:
81
+ slug: activity-timeline
82
+ role_id:
83
+ where:
84
+ slug: admin-access
85
+ - component_id:
86
+ where:
87
+ slug: email-notifications
88
+ role_id:
89
+ where:
90
+ slug: user
91
+ - component_id:
92
+ where:
93
+ slug: email-notifications
94
+ role_id:
95
+ where:
96
+ slug: admin-access
97
+ - component_id:
98
+ where:
99
+ slug: login-history-chart
100
+ role_id:
101
+ where:
102
+ slug: user
103
+ - component_id:
104
+ where:
105
+ slug: login-history-chart
106
+ role_id:
107
+ where:
108
+ slug: admin-access
109
+ - component_id:
110
+ where:
111
+ slug: profile-card
112
+ role_id:
113
+ where:
114
+ slug: user
115
+ - component_id:
116
+ where:
117
+ slug: profile-card
118
+ role_id:
119
+ where:
120
+ slug: admin-access
121
+ - component_id:
122
+ where:
123
+ slug: stat-online-time
124
+ role_id:
125
+ where:
126
+ slug: user
127
+ - component_id:
128
+ where:
129
+ slug: stat-online-time
130
+ role_id:
131
+ where:
132
+ slug: admin-access
133
+ - component_id:
134
+ where:
135
+ slug: stat-actions-today
136
+ role_id:
137
+ where:
138
+ slug: user
139
+ - component_id:
140
+ where:
141
+ slug: stat-actions-today
142
+ role_id:
143
+ where:
144
+ slug: admin-access
145
+ - component_id:
146
+ where:
147
+ slug: stat-consecutive-days
148
+ role_id:
149
+ where:
150
+ slug: user
151
+ - component_id:
152
+ where:
153
+ slug: stat-consecutive-days
154
+ role_id:
155
+ where:
156
+ slug: admin-access
157
+ - component_id:
158
+ where:
159
+ slug: stat-access-level
160
+ role_id:
161
+ where:
162
+ slug: user
163
+ - component_id:
164
+ where:
165
+ slug: stat-access-level
166
+ role_id:
167
+ where:
168
+ slug: admin-access
169
+ - component_id:
170
+ where:
171
+ slug: user-roles
172
+ role_id:
173
+ where:
174
+ slug: user
175
+ - component_id:
176
+ where:
177
+ slug: user-roles
178
+ role_id:
179
+ where:
180
+ slug: admin-access
181
+ - component_id:
182
+ where:
183
+ slug: user-sessions
184
+ role_id:
185
+ where:
186
+ slug: user
187
+ - component_id:
188
+ where:
189
+ slug: user-sessions
190
+ role_id:
191
+ where:
192
+ slug: admin-access
193
+
194
+ - component_id:
195
+ where:
196
+ slug: mail-config
197
+ role_id:
198
+ where:
199
+ slug: admin
200
+ - component_id:
201
+ where:
202
+ slug: locale-config
203
+ role_id:
204
+ where:
205
+ slug: admin
206
+ - component_id:
207
+ where:
208
+ slug: oauth-config
209
+ role_id:
210
+ where:
211
+ slug: admin
212
+ - component_id:
213
+ where:
214
+ slug: storage-config
215
+ role_id:
216
+ where:
217
+ slug: admin
218
+ - component_id:
219
+ where:
220
+ slug: theme-config
221
+ role_id:
222
+ where:
223
+ slug: admin
@@ -4,21 +4,21 @@
4
4
  role_id:
5
5
  where:
6
6
  slug: admin-access
7
- - dashboard_id:
8
- where:
9
- slug: user
10
- role_id:
11
- where:
12
- slug: user
13
- - dashboard_id:
14
- where:
15
- slug: user
16
- role_id:
17
- where:
18
- slug: admin-access
19
- - dashboard_id:
20
- where:
21
- slug: config
22
- role_id:
23
- where:
24
- slug: admin
7
+ - dashboard_id:
8
+ where:
9
+ slug: user
10
+ role_id:
11
+ where:
12
+ slug: user
13
+ - dashboard_id:
14
+ where:
15
+ slug: user
16
+ role_id:
17
+ where:
18
+ slug: admin-access
19
+ - dashboard_id:
20
+ where:
21
+ slug: config
22
+ role_id:
23
+ where:
24
+ slug: admin
@@ -37,24 +37,24 @@ function CustomTooltip({
37
37
  );
38
38
  }
39
39
 
40
- interface PermissionsChartProps {
41
- widget?: {
42
- name?: string;
43
- } | null;
44
- onRemove?: () => void;
45
- }
46
-
47
- interface PermissionDistributionItem {
48
- name: string;
49
- value: number;
50
- color: string;
51
- }
52
-
53
- interface UserStatsData {
54
- charts?: {
55
- permissionDistribution?: PermissionDistributionItem[];
56
- };
57
- }
40
+ interface PermissionsChartProps {
41
+ widget?: {
42
+ name?: string;
43
+ } | null;
44
+ onRemove?: () => void;
45
+ }
46
+
47
+ interface PermissionDistributionItem {
48
+ name: string;
49
+ value: number;
50
+ color: string;
51
+ }
52
+
53
+ interface UserStatsData {
54
+ charts?: {
55
+ permissionDistribution?: PermissionDistributionItem[];
56
+ };
57
+ }
58
58
 
59
59
  export default function PermissionsChart({
60
60
  widget,
@@ -70,10 +70,10 @@ export default function PermissionsChart({
70
70
  } = useWidgetData<UserStatsData>({
71
71
  endpoint: '/dashboard-core/stats/overview/users',
72
72
  queryKey: 'dashboard-stats-users',
73
- });
74
-
75
- const data = statsData?.charts?.permissionDistribution || [];
76
- const total = data.reduce((sum, item) => sum + item.value, 0);
73
+ });
74
+
75
+ const data = statsData?.charts?.permissionDistribution || [];
76
+ const total = data.reduce((sum, item) => sum + item.value, 0);
77
77
 
78
78
  return (
79
79
  <WidgetWrapper
@@ -90,19 +90,19 @@ export default function PermissionsChart({
90
90
  >
91
91
  <IconGripVertical className="text-muted-foreground/50 size-4 shrink-0" />
92
92
  </div>
93
- <CardHeader className="pb-2 pt-4 pl-10">
94
- <CardTitle className="text-base font-semibold">
95
- {t('permissionsDistributionTitle')}
96
- </CardTitle>
93
+ <CardHeader className="pb-2 pt-4 pl-10">
94
+ <CardTitle className="text-base font-semibold">
95
+ {t('permissionsDistributionTitle')}
96
+ </CardTitle>
97
97
  <CardDescription>
98
98
  {t('permissionsDistributionDescription')}
99
99
  </CardDescription>
100
- </CardHeader>
101
- <CardContent className="flex-1 pt-0">
102
- <div className="flex h-full items-center justify-between gap-4 overflow-hidden">
103
- <div className="relative h-[280px] w-[280px] shrink-0">
104
- <ResponsiveContainer width="100%" height="100%">
105
- <PieChart>
100
+ </CardHeader>
101
+ <CardContent className="flex-1 pt-0">
102
+ <div className="flex h-full items-center justify-between gap-4 overflow-hidden">
103
+ <div className="relative h-[280px] w-[280px] shrink-0">
104
+ <ResponsiveContainer width="100%" height="100%">
105
+ <PieChart>
106
106
  <Pie
107
107
  data={data}
108
108
  cx="50%"
@@ -110,14 +110,14 @@ export default function PermissionsChart({
110
110
  innerRadius={70}
111
111
  outerRadius={110}
112
112
  paddingAngle={4}
113
- dataKey="value"
114
- animationDuration={1200}
115
- strokeWidth={0}
116
- >
117
- {data.map((entry, index: number) => (
118
- <Cell key={`cell-${index}`} fill={entry.color} />
119
- ))}
120
- </Pie>
113
+ dataKey="value"
114
+ animationDuration={1200}
115
+ strokeWidth={0}
116
+ >
117
+ {data.map((entry, index: number) => (
118
+ <Cell key={`cell-${index}`} fill={entry.color} />
119
+ ))}
120
+ </Pie>
121
121
  <Tooltip content={<CustomTooltip />} />
122
122
  </PieChart>
123
123
  </ResponsiveContainer>
@@ -125,28 +125,28 @@ export default function PermissionsChart({
125
125
  <span className="text-2xl font-bold text-foreground">
126
126
  {total}
127
127
  </span>
128
- <span className="text-[10px] text-muted-foreground">
129
- {t('total')}
130
- </span>
131
- </div>
132
- </div>
133
- <div className="grid max-h-[280px] min-w-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-2 overflow-y-auto pr-2">
134
- {data.map((item) => (
135
- <div key={item.name} className="flex min-w-0 items-start gap-2.5">
136
- <div
137
- className="mt-1 h-2.5 w-2.5 shrink-0 rounded-sm"
138
- style={{ backgroundColor: item.color }}
139
- />
140
- <div className="flex min-w-0 flex-col">
141
- <span className="break-words text-xs font-medium leading-tight text-foreground">
142
- {item.name}
143
- </span>
144
- <span className="text-[11px] text-muted-foreground">
145
- {item.value} ({total ? Math.round((item.value / total) * 100) : 0}%)
146
- </span>
147
- </div>
148
- </div>
149
- ))}
128
+ <span className="text-[10px] text-muted-foreground">
129
+ {t('total')}
130
+ </span>
131
+ </div>
132
+ </div>
133
+ <div className="grid max-h-[280px] min-w-0 flex-1 grid-cols-2 content-start gap-x-4 gap-y-2 overflow-y-auto pr-2">
134
+ {data.map((item) => (
135
+ <div key={item.name} className="flex min-w-0 items-start gap-2.5">
136
+ <div
137
+ className="mt-1 h-2.5 w-2.5 shrink-0 rounded-sm"
138
+ style={{ backgroundColor: item.color }}
139
+ />
140
+ <div className="flex min-w-0 flex-col">
141
+ <span className="break-words text-xs font-medium leading-tight text-foreground">
142
+ {item.name}
143
+ </span>
144
+ <span className="text-[11px] text-muted-foreground">
145
+ {item.value} ({total ? Math.round((item.value / total) * 100) : 0}%)
146
+ </span>
147
+ </div>
148
+ </div>
149
+ ))}
150
150
  </div>
151
151
  </div>
152
152
  </CardContent>
@@ -1,29 +1,29 @@
1
- 'use client';
2
-
3
- import { Dashboard } from '@hed-hog/api-types';
4
- import { useApp, useQuery } from '@hed-hog/next-app-provider';
5
- import { useRouter } from 'next/navigation';
6
- import { useEffect } from 'react';
7
-
8
- export default function DashboardRedirectPage() {
9
- const router = useRouter();
10
- const { request, currentLocaleCode } = useApp();
11
-
12
- const { data: dashboardData, isLoading } = useQuery<Dashboard | null>({
13
- queryKey: ['dashboard-home-redirect', currentLocaleCode],
14
- queryFn: async () => {
15
- const response = await request<Dashboard>({
16
- url: '/dashboard-core/home',
17
- });
18
- return response.data ?? null;
19
- },
20
- });
21
-
22
- useEffect(() => {
23
- if (isLoading) return;
24
-
25
- router.replace(`/core/dashboard/${dashboardData?.slug ?? 'default'}`);
26
- }, [dashboardData?.slug, isLoading, router]);
27
-
28
- return null;
29
- }
1
+ 'use client';
2
+
3
+ import { Dashboard } from '@hed-hog/api-types';
4
+ import { useApp, useQuery } from '@hed-hog/next-app-provider';
5
+ import { useRouter } from 'next/navigation';
6
+ import { useEffect } from 'react';
7
+
8
+ export default function DashboardRedirectPage() {
9
+ const router = useRouter();
10
+ const { request, currentLocaleCode } = useApp();
11
+
12
+ const { data: dashboardData, isLoading } = useQuery<Dashboard | null>({
13
+ queryKey: ['dashboard-home-redirect', currentLocaleCode],
14
+ queryFn: async () => {
15
+ const response = await request<Dashboard>({
16
+ url: '/dashboard-core/home',
17
+ });
18
+ return response.data ?? null;
19
+ },
20
+ });
21
+
22
+ useEffect(() => {
23
+ if (isLoading) return;
24
+
25
+ router.replace(`/core/dashboard/${dashboardData?.slug ?? 'default'}`);
26
+ }, [dashboardData?.slug, isLoading, router]);
27
+
28
+ return null;
29
+ }
@@ -17,30 +17,30 @@ import { useApp, useQuery } from '@hed-hog/next-app-provider';
17
17
  import { zodResolver } from '@hookform/resolvers/zod';
18
18
  import { Loader } from 'lucide-react';
19
19
  import { useTranslations } from 'next-intl';
20
- import { useForm } from 'react-hook-form';
21
- import { z } from 'zod';
22
-
23
- const THEME_SOURCE_STORAGE_KEY = 'theme-source';
24
-
25
- const getStoredThemeSource = (): 'explicit' | 'fallback' | null => {
26
- if (typeof window === 'undefined') return null;
27
-
28
- const rawThemeSource = window.localStorage.getItem(THEME_SOURCE_STORAGE_KEY);
29
- if (rawThemeSource === null) return null;
30
-
31
- try {
32
- const parsedThemeSource = JSON.parse(rawThemeSource);
33
- return parsedThemeSource === 'explicit' || parsedThemeSource === 'fallback'
34
- ? parsedThemeSource
35
- : null;
36
- } catch {
37
- return rawThemeSource === 'explicit' || rawThemeSource === 'fallback'
38
- ? rawThemeSource
39
- : null;
40
- }
41
- };
42
-
43
- export default function PreferencesPage() {
20
+ import { useForm } from 'react-hook-form';
21
+ import { z } from 'zod';
22
+
23
+ const THEME_SOURCE_STORAGE_KEY = 'theme-source';
24
+
25
+ const getStoredThemeSource = (): 'explicit' | 'fallback' | null => {
26
+ if (typeof window === 'undefined') return null;
27
+
28
+ const rawThemeSource = window.localStorage.getItem(THEME_SOURCE_STORAGE_KEY);
29
+ if (rawThemeSource === null) return null;
30
+
31
+ try {
32
+ const parsedThemeSource = JSON.parse(rawThemeSource);
33
+ return parsedThemeSource === 'explicit' || parsedThemeSource === 'fallback'
34
+ ? parsedThemeSource
35
+ : null;
36
+ } catch {
37
+ return rawThemeSource === 'explicit' || rawThemeSource === 'fallback'
38
+ ? rawThemeSource
39
+ : null;
40
+ }
41
+ };
42
+
43
+ export default function PreferencesPage() {
44
44
  const {
45
45
  currentTheme,
46
46
  setCurrentTheme,
@@ -93,32 +93,32 @@ export default function PreferencesPage() {
93
93
  theme: '',
94
94
  },
95
95
  });
96
-
97
- const handleThemeChange = async (value: 'light' | 'dark' | 'system') => {
98
- const previousTheme = currentTheme;
99
- const previousThemeSource = getStoredThemeSource();
100
- setCurrentTheme(value);
101
-
102
- try {
96
+
97
+ const handleThemeChange = async (value: 'light' | 'dark' | 'system') => {
98
+ const previousTheme = currentTheme;
99
+ const previousThemeSource = getStoredThemeSource();
100
+ setCurrentTheme(value);
101
+
102
+ try {
103
103
  await request({
104
104
  url: '/profile/preferences',
105
105
  method: 'PUT',
106
106
  data: { theme: value },
107
107
  });
108
108
  await refetchUser();
109
- } catch {
110
- setCurrentTheme(previousTheme);
111
-
112
- if (
113
- typeof window !== 'undefined' &&
114
- previousThemeSource !== 'explicit'
115
- ) {
116
- window.localStorage.removeItem(THEME_SOURCE_STORAGE_KEY);
117
- }
118
-
119
- await refetchUser();
120
- showToastHandler(
121
- 'error',
109
+ } catch {
110
+ setCurrentTheme(previousTheme);
111
+
112
+ if (
113
+ typeof window !== 'undefined' &&
114
+ previousThemeSource !== 'explicit'
115
+ ) {
116
+ window.localStorage.removeItem(THEME_SOURCE_STORAGE_KEY);
117
+ }
118
+
119
+ await refetchUser();
120
+ showToastHandler(
121
+ 'error',
122
122
  t('themeUpdateError') || 'Failed to update theme'
123
123
  );
124
124
  }
@@ -132,7 +132,7 @@ export default function PreferencesPage() {
132
132
  data: { language: code },
133
133
  });
134
134
  await refetchUser();
135
- } catch {
135
+ } catch {
136
136
  showToastHandler(
137
137
  'error',
138
138
  t('languageUpdateError') || 'Failed to update language'
@@ -148,7 +148,7 @@ export default function PreferencesPage() {
148
148
  'success',
149
149
  t('dateFormatUpdated') || 'Date format updated successfully'
150
150
  );
151
- } catch {
151
+ } catch {
152
152
  showToastHandler(
153
153
  'error',
154
154
  t('dateFormatUpdateError') || 'Failed to update date format'
@@ -163,7 +163,7 @@ export default function PreferencesPage() {
163
163
  'success',
164
164
  t('timeFormatUpdated') || 'Time format updated successfully'
165
165
  );
166
- } catch {
166
+ } catch {
167
167
  showToastHandler(
168
168
  'error',
169
169
  t('timeFormatUpdateError') || 'Failed to update time format'
@@ -178,7 +178,7 @@ export default function PreferencesPage() {
178
178
  'success',
179
179
  t('timezoneUpdated') || 'Timezone updated successfully'
180
180
  );
181
- } catch {
181
+ } catch {
182
182
  showToastHandler(
183
183
  'error',
184
184
  t('timezoneUpdateError') || 'Failed to update timezone'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/core",
3
- "version": "0.0.294",
3
+ "version": "0.0.295",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -30,12 +30,12 @@
30
30
  "sharp": "^0.34.2",
31
31
  "speakeasy": "^2.0.0",
32
32
  "uuid": "^11.1.0",
33
- "@hed-hog/api-pagination": "0.0.6",
34
33
  "@hed-hog/api-locale": "0.0.13",
34
+ "@hed-hog/api-mail": "0.0.8",
35
35
  "@hed-hog/api": "0.0.4",
36
+ "@hed-hog/api-prisma": "0.0.5",
36
37
  "@hed-hog/api-types": "0.0.1",
37
- "@hed-hog/api-mail": "0.0.8",
38
- "@hed-hog/api-prisma": "0.0.5"
38
+ "@hed-hog/api-pagination": "0.0.6"
39
39
  },
40
40
  "exports": {
41
41
  ".": {
@@ -1,5 +1,5 @@
1
- import { PaginationDTO } from '@hed-hog/api-pagination';
2
- import { Prisma, PrismaService } from '@hed-hog/api-prisma';
1
+ import { PaginationDTO } from '@hed-hog/api-pagination';
2
+ import { Prisma, PrismaService } from '@hed-hog/api-prisma';
3
3
  import {
4
4
  BadRequestException,
5
5
  forwardRef,
@@ -8,7 +8,7 @@ import {
8
8
  Logger,
9
9
  NotFoundException,
10
10
  } from '@nestjs/common';
11
- import axios from 'axios';
11
+ import axios from 'axios';
12
12
  import { createHash } from 'crypto';
13
13
  import pdfParse from 'pdf-parse';
14
14
  import { DeleteDTO } from '../dto/delete.dto';
@@ -1,19 +1,19 @@
1
1
  import { Public, Role, User, UserOptional } from '@hed-hog/api';
2
2
  import { Locale } from '@hed-hog/api-locale';
3
- import {
4
- BadRequestException,
5
- Body,
6
- Controller,
7
- forwardRef,
3
+ import {
4
+ BadRequestException,
5
+ Body,
6
+ Controller,
7
+ forwardRef,
8
8
  Get,
9
9
  Headers,
10
10
  Inject,
11
- Ip,
12
- Post,
13
- Req,
14
- Res,
15
- UnauthorizedException,
16
- } from '@nestjs/common';
11
+ Ip,
12
+ Post,
13
+ Req,
14
+ Res,
15
+ UnauthorizedException,
16
+ } from '@nestjs/common';
17
17
  import { TokenService } from '../token/token.service';
18
18
  import { CreateWithEmailAndPasswordDTO } from '../user/dto/create-with-email-and-password.dto';
19
19
  import { UserService } from '../user/user.service';
@@ -1,14 +1,14 @@
1
1
  import { getLocaleText } from '@hed-hog/api-locale';
2
2
  import { PrismaService } from '@hed-hog/api-prisma';
3
3
  import { User } from '@hed-hog/api-types';
4
- import {
5
- BadRequestException,
6
- forwardRef,
7
- Inject,
8
- Injectable,
9
- NotFoundException,
10
- UnauthorizedException,
11
- } from '@nestjs/common';
4
+ import {
5
+ BadRequestException,
6
+ forwardRef,
7
+ Inject,
8
+ Injectable,
9
+ NotFoundException,
10
+ UnauthorizedException,
11
+ } from '@nestjs/common';
12
12
  import { ChallengeService } from '../challenge/challenge.service';
13
13
  import { MailService as MailManagerService } from '../mail/mail.service';
14
14
  import { SecurityService } from '../security/security.service';
@@ -1,7 +1,7 @@
1
- import { Prisma, PrismaService } from '@hed-hog/api-prisma';
2
- import { Injectable, Logger } from '@nestjs/common';
3
- import { Cron, CronExpression } from '@nestjs/schedule';
4
- import { SettingService } from '../setting/setting.service';
1
+ import { Prisma, PrismaService } from '@hed-hog/api-prisma';
2
+ import { Injectable, Logger } from '@nestjs/common';
3
+ import { Cron, CronExpression } from '@nestjs/schedule';
4
+ import { SettingService } from '../setting/setting.service';
5
5
 
6
6
  @Injectable()
7
7
  export class TasksService {
@@ -225,4 +225,4 @@ export class TasksService {
225
225
  `Unverified MFA with expired challenges cleaned up in ${Date.now() - startAt}ms`,
226
226
  );
227
227
  }
228
- }
228
+ }