@hed-hog/core 0.0.279 → 0.0.285

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.
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import {
4
+ EmptyState,
5
+ Page,
4
6
  PageHeader,
5
7
  PaginationFooter,
6
8
  SearchBar,
@@ -25,13 +27,6 @@ import {
25
27
  CardHeader,
26
28
  CardTitle,
27
29
  } from '@/components/ui/card';
28
- import {
29
- Dialog,
30
- DialogContent,
31
- DialogDescription,
32
- DialogHeader,
33
- DialogTitle,
34
- } from '@/components/ui/dialog';
35
30
  import {
36
31
  Form,
37
32
  FormControl,
@@ -422,7 +417,7 @@ export default function UserPage() {
422
417
  ];
423
418
 
424
419
  return (
425
- <div className="flex flex-col h-screen px-4">
420
+ <Page>
426
421
  <PageHeader
427
422
  breadcrumbs={[{ label: 'Home', href: '/' }, { label: t('users') }]}
428
423
  actions={[
@@ -487,10 +482,9 @@ export default function UserPage() {
487
482
  { label: t('filterOptionBlocked'), value: 'blocked' },
488
483
  ],
489
484
  }}
490
- className="mt-4"
491
485
  />
492
486
 
493
- <div className="flex-1 pt-4">
487
+ <div className="flex-1 ">
494
488
  {isLoading && (
495
489
  <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
496
490
  {Array.from({ length: 3 }).map((_, i) => (
@@ -522,7 +516,13 @@ export default function UserPage() {
522
516
  )}
523
517
 
524
518
  {(paginate?.data?.length || 0) === 0 ? (
525
- <p className="text-sm text-muted-foreground">{t('noUsersFound')}</p>
519
+ <EmptyState
520
+ icon={<Users className="h-12 w-12" />}
521
+ title={t('noUsersFound')}
522
+ description={t('description')}
523
+ actionLabel={t('buttonAddUser')}
524
+ onAction={() => setIsDialogOpen(true)}
525
+ />
526
526
  ) : (
527
527
  <div className="grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-3">
528
528
  {paginate?.data?.map((user: User) => (
@@ -1157,36 +1157,29 @@ export default function UserPage() {
1157
1157
  </Button>
1158
1158
  </div>
1159
1159
 
1160
- <Dialog
1160
+ <AlertDialog
1161
1161
  open={openDeleteModal}
1162
1162
  onOpenChange={setOpenDeleteModal}
1163
1163
  >
1164
- <DialogContent className="sm:max-w-lg">
1165
- <DialogHeader>
1166
- <DialogTitle>{t('dialogDeleteUserTitle')}</DialogTitle>
1167
- <DialogDescription>
1164
+ <AlertDialogContent>
1165
+ <AlertDialogHeader>
1166
+ <AlertDialogTitle>
1167
+ {t('dialogDeleteUserTitle')}
1168
+ </AlertDialogTitle>
1169
+ <AlertDialogDescription>
1168
1170
  {t('dialogDeleteUserDescription')}
1169
- </DialogDescription>
1170
- </DialogHeader>
1171
- <hr className="mt-4" />
1172
- <div className="flex justify-end">
1173
- <Button
1174
- type="button"
1175
- className="px-4 w-28 h-12 py-2 bg-gray-300 text-black hover:bg-gray-300 hover:text-black rounded-sm mr-2 text-md"
1176
- onClick={() => setOpenDeleteModal(false)}
1177
- >
1171
+ </AlertDialogDescription>
1172
+ </AlertDialogHeader>
1173
+ <AlertDialogFooter>
1174
+ <AlertDialogCancel>
1178
1175
  {t('deleteUserCancel')}
1179
- </Button>
1180
- <Button
1181
- onClick={onDelete}
1182
- variant="destructive"
1183
- className="px-4 w-32 h-12 py-2 text-white hover:text-white rounded-sm text-md cursor-pointer"
1184
- >
1176
+ </AlertDialogCancel>
1177
+ <AlertDialogAction onClick={onDelete}>
1185
1178
  {t('deleteUserConfirm')}
1186
- </Button>
1187
- </div>
1188
- </DialogContent>
1189
- </Dialog>
1179
+ </AlertDialogAction>
1180
+ </AlertDialogFooter>
1181
+ </AlertDialogContent>
1182
+ </AlertDialog>
1190
1183
  </TabsContent>
1191
1184
 
1192
1185
  <TabsContent value="edit" className="space-y-4 mt-4 p-4 pt-0">
@@ -1232,27 +1225,29 @@ export default function UserPage() {
1232
1225
  value="credentials"
1233
1226
  className="space-y-4 mt-4 p-4 pt-0"
1234
1227
  >
1235
- <Card className="border-amber-200 bg-amber-50/50">
1236
- <CardHeader className="pb-2">
1237
- <CardTitle className="text-sm">
1228
+ <div className="space-y-3 rounded-lg border p-4">
1229
+ <div>
1230
+ <h4 className="text-sm font-semibold">
1238
1231
  {t('passwordResetTitle')}
1239
- </CardTitle>
1240
- <CardDescription>
1232
+ </h4>
1233
+ <p className="text-xs text-muted-foreground mt-1">
1241
1234
  {t('passwordResetDescription')}
1242
- </CardDescription>
1243
- </CardHeader>
1244
- <CardContent className="flex flex-col gap-3">
1245
- <div className="text-xs text-muted-foreground">
1246
- {t('passwordResetNotice')}
1247
- </div>
1248
- <div>
1249
- <Button type="button" onClick={openResetPasswordDialog}>
1250
- <RefreshCcw className="h-4 w-4 mr-2" />
1251
- {t('buttonResetPassword')}
1252
- </Button>
1253
- </div>
1254
- </CardContent>
1255
- </Card>
1235
+ </p>
1236
+ </div>
1237
+ <p className="text-xs text-muted-foreground">
1238
+ {t('passwordResetNotice')}
1239
+ </p>
1240
+ <div className="flex flex-col gap-2">
1241
+ <Button
1242
+ type="button"
1243
+ onClick={openResetPasswordDialog}
1244
+ className="w-full sm:w-fit"
1245
+ >
1246
+ <RefreshCcw className="h-4 w-4 mr-2" />
1247
+ {t('buttonResetPassword')}
1248
+ </Button>
1249
+ </div>
1250
+ </div>
1256
1251
 
1257
1252
  <div className="space-y-3">
1258
1253
  <h4 className="text-sm font-medium">
@@ -1422,7 +1417,7 @@ export default function UserPage() {
1422
1417
  </AlertDialogContent>
1423
1418
  </AlertDialog>
1424
1419
 
1425
- <Dialog
1420
+ <AlertDialog
1426
1421
  open={isResetResultDialogOpen}
1427
1422
  onOpenChange={(open) => {
1428
1423
  setIsResetResultDialogOpen(open);
@@ -1432,13 +1427,15 @@ export default function UserPage() {
1432
1427
  }
1433
1428
  }}
1434
1429
  >
1435
- <DialogContent className="sm:max-w-lg">
1436
- <DialogHeader>
1437
- <DialogTitle>{t('passwordResultTitle')}</DialogTitle>
1438
- <DialogDescription>
1430
+ <AlertDialogContent>
1431
+ <AlertDialogHeader>
1432
+ <AlertDialogTitle>
1433
+ {t('passwordResultTitle')}
1434
+ </AlertDialogTitle>
1435
+ <AlertDialogDescription>
1439
1436
  {t('passwordResultDescription')}
1440
- </DialogDescription>
1441
- </DialogHeader>
1437
+ </AlertDialogDescription>
1438
+ </AlertDialogHeader>
1442
1439
 
1443
1440
  <div className="space-y-3">
1444
1441
  <div className="relative">
@@ -1484,8 +1481,8 @@ export default function UserPage() {
1484
1481
  </Button>
1485
1482
  </div>
1486
1483
  </div>
1487
- </DialogContent>
1488
- </Dialog>
1484
+ </AlertDialogContent>
1485
+ </AlertDialog>
1489
1486
  </TabsContent>
1490
1487
 
1491
1488
  <TabsContent
@@ -1573,6 +1570,6 @@ export default function UserPage() {
1573
1570
  </Sheet>
1574
1571
  )}
1575
1572
  </div>
1576
- </div>
1573
+ </Page>
1577
1574
  );
1578
1575
  }
@@ -329,6 +329,9 @@
329
329
  "newTemplate": "New Template",
330
330
  "title": "Email Templates",
331
331
  "description": "Manage your email templates",
332
+ "searchPlaceholder": "Search templates by slug or subject...",
333
+ "noTemplatesFound": "No templates found",
334
+ "noTemplatesHint": "Create your first template to start sending emails.",
332
335
  "tableSlug": "Slug",
333
336
  "tableSubject": "Subject",
334
337
  "tableVariables": "Variables",
@@ -849,6 +852,8 @@
849
852
  "noLogsFound": "No email logs found",
850
853
  "adjustSearch": "Try adjusting your search terms",
851
854
  "noEmailsSent": "No emails have been sent yet",
855
+ "clearSearch": "Clear search",
856
+ "refreshList": "Refresh list",
852
857
  "viewDetails": "View Details",
853
858
  "emailDetails": "Email Details",
854
859
  "detailsDescription": "Complete information about the sent email",
@@ -329,6 +329,9 @@
329
329
  "newTemplate": "Novo Template",
330
330
  "title": "Templates de E-mail",
331
331
  "description": "Gerencie seus templates de e-mail",
332
+ "searchPlaceholder": "Buscar templates por slug ou assunto...",
333
+ "noTemplatesFound": "Nenhum template encontrado",
334
+ "noTemplatesHint": "Crie o primeiro template para começar a enviar e-mails.",
332
335
  "tableSlug": "Slug",
333
336
  "tableSubject": "Assunto",
334
337
  "tableVariables": "Variáveis",
@@ -852,6 +855,8 @@
852
855
  "noLogsFound": "Nenhum log de e-mail encontrado",
853
856
  "adjustSearch": "Tente ajustar seus termos de busca",
854
857
  "noEmailsSent": "Nenhum e-mail foi enviado ainda",
858
+ "clearSearch": "Limpar busca",
859
+ "refreshList": "Atualizar lista",
855
860
  "viewDetails": "Ver Detalhes",
856
861
  "emailDetails": "Detalhes do E-mail",
857
862
  "detailsDescription": "Informações completas sobre o e-mail enviado",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/core",
3
- "version": "0.0.279",
3
+ "version": "0.0.285",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -32,10 +32,10 @@
32
32
  "uuid": "^11.1.0",
33
33
  "@hed-hog/api-pagination": "0.0.6",
34
34
  "@hed-hog/api-types": "0.0.1",
35
- "@hed-hog/api-locale": "0.0.13",
35
+ "@hed-hog/api": "0.0.4",
36
36
  "@hed-hog/api-mail": "0.0.8",
37
37
  "@hed-hog/api-prisma": "0.0.5",
38
- "@hed-hog/api": "0.0.4"
38
+ "@hed-hog/api-locale": "0.0.13"
39
39
  },
40
40
  "exports": {
41
41
  ".": {
@@ -2,13 +2,14 @@ import { IS_PUBLIC_KEY, WITH_ROLE } from '@hed-hog/api';
2
2
  import { getLocaleText } from '@hed-hog/api-locale';
3
3
  import { PrismaService } from '@hed-hog/api-prisma';
4
4
  import {
5
- CanActivate,
6
- ExecutionContext,
7
- forwardRef,
8
- Inject,
9
- Injectable,
10
- RequestMethod,
11
- UnauthorizedException,
5
+ CanActivate,
6
+ ExecutionContext,
7
+ ForbiddenException,
8
+ forwardRef,
9
+ Inject,
10
+ Injectable,
11
+ RequestMethod,
12
+ UnauthorizedException,
12
13
  } from '@nestjs/common';
13
14
  import { METHOD_METADATA } from '@nestjs/common/constants';
14
15
  import { Reflector } from '@nestjs/core';
@@ -130,7 +131,7 @@ export class RoleGuard implements CanActivate {
130
131
  .replace('{{method}}', httpMethod)
131
132
  .replace('{{path}}', fullPath);
132
133
 
133
- throw new UnauthorizedException(message);
134
+ throw new ForbiddenException(message);
134
135
  }
135
136
 
136
137
  const hasPendingPasswordReset = await this.prisma.user_credential.findFirst({