@hed-hog/core 0.0.298 → 0.0.300

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.
Files changed (123) hide show
  1. package/dist/dashboard/dashboard/dashboard.controller.d.ts +9 -0
  2. package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -1
  3. package/dist/dashboard/dashboard/dashboard.service.d.ts +9 -0
  4. package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -1
  5. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +14 -1
  6. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -1
  7. package/dist/dashboard/dashboard-component/dashboard-component.controller.js +28 -3
  8. package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -1
  9. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +22 -1
  10. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -1
  11. package/dist/dashboard/dashboard-component/dashboard-component.service.js +185 -35
  12. package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -1
  13. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +1 -0
  14. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -1
  15. package/dist/dashboard/dashboard-component/dto/create.dto.js +5 -0
  16. package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -1
  17. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +1 -0
  18. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -1
  19. package/dist/dashboard/dashboard-component/dto/update.dto.js +5 -0
  20. package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -1
  21. package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +1 -0
  22. package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts.map +1 -1
  23. package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +1 -0
  24. package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts.map +1 -1
  25. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +72 -1
  26. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -1
  27. package/dist/dashboard/dashboard-core/dashboard-core.controller.js +111 -0
  28. package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -1
  29. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +76 -1
  30. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -1
  31. package/dist/dashboard/dashboard-core/dashboard-core.service.js +614 -23
  32. package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -1
  33. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +3 -0
  34. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -1
  35. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +3 -0
  36. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -1
  37. package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +2 -0
  38. package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts.map +1 -1
  39. package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +2 -0
  40. package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts.map +1 -1
  41. package/hedhog/data/dashboard.yaml +12 -6
  42. package/hedhog/data/dashboard_component_role.yaml +66 -0
  43. package/hedhog/data/dashboard_item.yaml +1 -1
  44. package/hedhog/data/dashboard_role.yaml +2 -8
  45. package/hedhog/data/route.yaml +84 -0
  46. package/hedhog/frontend/app/dashboard/[slug]/dashboard-content.tsx.ejs +457 -135
  47. package/hedhog/frontend/app/dashboard/[slug]/types.ts.ejs +3 -0
  48. package/hedhog/frontend/app/dashboard/[slug]/widget-renderer.tsx.ejs +365 -28
  49. package/hedhog/frontend/app/dashboard/components/add-widget-selector-dialog.tsx.ejs +376 -247
  50. package/hedhog/frontend/app/dashboard/components/draggable-grid.tsx.ejs +64 -18
  51. package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +1389 -0
  52. package/hedhog/frontend/app/dashboard/dashboard.css.ejs +37 -0
  53. package/hedhog/frontend/app/dashboard/management/page.tsx.ejs +1 -1
  54. package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +6 -6
  55. package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +8 -8
  56. package/hedhog/frontend/app/dashboard/management/tabs/items-tab.tsx.ejs +3 -3
  57. package/hedhog/frontend/app/dashboard/page.tsx.ejs +3 -25
  58. package/hedhog/frontend/messages/en.json +115 -2
  59. package/hedhog/frontend/messages/pt.json +114 -1
  60. package/hedhog/frontend/public/dashboard-previews/.gitkeep +12 -0
  61. package/hedhog/frontend/public/dashboard-previews/account-security.png +0 -0
  62. package/hedhog/frontend/public/dashboard-previews/active-users-card.png +0 -0
  63. package/hedhog/frontend/public/dashboard-previews/activity-timeline.png +0 -0
  64. package/hedhog/frontend/public/dashboard-previews/cash-balance-kpi.png +0 -0
  65. package/hedhog/frontend/public/dashboard-previews/cash-flow-chart.png +0 -0
  66. package/hedhog/frontend/public/dashboard-previews/default-kpi.png +0 -0
  67. package/hedhog/frontend/public/dashboard-previews/email-notifications.png +0 -0
  68. package/hedhog/frontend/public/dashboard-previews/financial-alerts.png +0 -0
  69. package/hedhog/frontend/public/dashboard-previews/login-history-chart.png +0 -0
  70. package/hedhog/frontend/public/dashboard-previews/mail-sent-card.png +0 -0
  71. package/hedhog/frontend/public/dashboard-previews/mail-sent-chart.png +0 -0
  72. package/hedhog/frontend/public/dashboard-previews/menus-card.png +0 -0
  73. package/hedhog/frontend/public/dashboard-previews/payable-30d-kpi.png +0 -0
  74. package/hedhog/frontend/public/dashboard-previews/permissions-card.png +0 -0
  75. package/hedhog/frontend/public/dashboard-previews/permissions-chart.png +0 -0
  76. package/hedhog/frontend/public/dashboard-previews/profile-card.png +0 -0
  77. package/hedhog/frontend/public/dashboard-previews/receivable-30d-kpi.png +0 -0
  78. package/hedhog/frontend/public/dashboard-previews/routes-card.png +0 -0
  79. package/hedhog/frontend/public/dashboard-previews/session-activity-chart.png +0 -0
  80. package/hedhog/frontend/public/dashboard-previews/sessions-today-card.png +0 -0
  81. package/hedhog/frontend/public/dashboard-previews/stat-access-level.png +0 -0
  82. package/hedhog/frontend/public/dashboard-previews/stat-actions-today.png +0 -0
  83. package/hedhog/frontend/public/dashboard-previews/stat-consecutive-days.png +0 -0
  84. package/hedhog/frontend/public/dashboard-previews/stat-online-time.png +0 -0
  85. package/hedhog/frontend/public/dashboard-previews/upcoming-payable.png +0 -0
  86. package/hedhog/frontend/public/dashboard-previews/upcoming-receivable.png +0 -0
  87. package/hedhog/frontend/public/dashboard-previews/user-growth-chart.png +0 -0
  88. package/hedhog/frontend/public/dashboard-previews/user-roles.png +0 -0
  89. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/account-security.tsx.ejs +34 -30
  90. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/active-users-card.tsx.ejs +2 -2
  91. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/activity-timeline.tsx.ejs +1 -1
  92. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/email-notifications.tsx.ejs +1 -1
  93. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/locale-config.tsx.ejs +1 -1
  94. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/login-history-chart.tsx.ejs +1 -1
  95. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-config.tsx.ejs +1 -1
  96. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-sent-card.tsx.ejs +2 -2
  97. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/mail-sent-chart.tsx.ejs +1 -1
  98. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/menus-card.tsx.ejs +2 -2
  99. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/oauth-config.tsx.ejs +1 -1
  100. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/permissions-card.tsx.ejs +2 -2
  101. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/permissions-chart.tsx.ejs +1 -1
  102. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/profile-card.tsx.ejs +1 -1
  103. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/routes-card.tsx.ejs +2 -2
  104. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/session-activity-chart.tsx.ejs +1 -1
  105. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/sessions-today-card.tsx.ejs +2 -2
  106. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-access-level.tsx.ejs +1 -1
  107. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-actions-today.tsx.ejs +1 -1
  108. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-consecutive-days.tsx.ejs +1 -1
  109. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/stat-online-time.tsx.ejs +1 -1
  110. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/storage-config.tsx.ejs +1 -1
  111. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/theme-config.tsx.ejs +1 -1
  112. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-growth-chart.tsx.ejs +1 -1
  113. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-roles.tsx.ejs +1 -1
  114. package/hedhog/frontend/{app/dashboard/components/widgets → widgets}/user-sessions.tsx.ejs +2 -2
  115. package/hedhog/table/dashboard.yaml +6 -0
  116. package/hedhog/table/dashboard_component.yaml +7 -0
  117. package/package.json +5 -5
  118. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +51 -14
  119. package/src/dashboard/dashboard-component/dashboard-component.service.ts +254 -43
  120. package/src/dashboard/dashboard-component/dto/create.dto.ts +4 -0
  121. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
  122. package/src/dashboard/dashboard-core/dashboard-core.controller.ts +112 -1
  123. package/src/dashboard/dashboard-core/dashboard-core.service.ts +782 -24
@@ -1,6 +1,4 @@
1
1
  'use client';
2
-
3
- import { Button } from '@/components/ui/button';
4
2
  import {
5
3
  Card,
6
4
  CardContent,
@@ -25,7 +23,7 @@ import { useEffect, useState } from 'react';
25
23
 
26
24
  import type { AccountSecurityData } from '@/types/widget-data';
27
25
  import { useRouter } from 'next/navigation';
28
- import { WidgetWrapper } from '../widget-wrapper';
26
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
29
27
 
30
28
  const ICON_MAP: Record<string, React.ElementType> = {
31
29
  password: Lock,
@@ -34,6 +32,13 @@ const ICON_MAP: Record<string, React.ElementType> = {
34
32
  sessions: AlertTriangle,
35
33
  };
36
34
 
35
+ const CHECK_ROUTE_MAP: Record<string, string> = {
36
+ password: '/core/account/password',
37
+ '2fa': '/core/account/2fa',
38
+ email: '/core/account/email',
39
+ sessions: '/core/account/sessions',
40
+ };
41
+
37
42
  function AccountSecurityContent({ data }: { data: AccountSecurityData }) {
38
43
  const t = useTranslations('core.DashboardPage.accountSecurity');
39
44
  const router = useRouter();
@@ -60,60 +65,66 @@ function AccountSecurityContent({ data }: { data: AccountSecurityData }) {
60
65
 
61
66
  return (
62
67
  <Card className="flex h-full min-h-0 flex-col overflow-hidden">
63
- <CardHeader className="shrink-0 pb-3">
68
+ <CardHeader className="shrink-0 px-4 pb-2 pt-4 sm:px-5">
64
69
  <div className="flex items-center gap-2">
65
70
  <ShieldCheck className="h-5 w-5 text-emerald-600 dark:text-emerald-400" />
66
71
  <div>
67
72
  <CardTitle className="text-base font-semibold">
68
73
  {t('title')}
69
74
  </CardTitle>
70
- <CardDescription>{t('description')}</CardDescription>
75
+ <CardDescription className="text-xs sm:text-sm">
76
+ {t('description')}
77
+ </CardDescription>
71
78
  </div>
72
79
  </div>
73
80
  </CardHeader>
74
- <CardContent className="flex min-h-0 flex-1 flex-col overflow-auto pt-0">
75
- <div className="mb-4 flex flex-col items-center gap-2.5 rounded-xl bg-muted/50 p-3 sm:mb-5 sm:gap-3 sm:p-5">
81
+ <CardContent className="flex min-h-0 flex-1 flex-col overflow-auto px-4 pb-3 pt-0 sm:px-5 sm:pb-4">
82
+ <div className="mb-2 flex flex-col items-center gap-1.5 rounded-xl bg-muted/50 p-2 sm:mb-3 sm:gap-2 sm:p-3">
76
83
  <div className="flex items-baseline gap-1">
77
84
  <span
78
- className={`text-4xl font-bold tracking-tight sm:text-5xl ${scoreColor}`}
85
+ className={`text-2xl font-bold tracking-tight sm:text-3xl ${scoreColor}`}
79
86
  >
80
87
  {score}
81
88
  </span>
82
- <span className="text-base text-muted-foreground sm:text-lg">
89
+ <span className="text-xs text-muted-foreground sm:text-sm">
83
90
  /100
84
91
  </span>
85
92
  </div>
86
93
  <Progress
87
94
  value={score}
88
- className="h-2.5 w-full max-w-xs"
95
+ className="h-1.5 w-full max-w-70"
89
96
  style={
90
97
  {
91
98
  '--progress-foreground': progressColor,
92
99
  } as any
93
100
  }
94
101
  />
95
- <p className="text-[11px] text-muted-foreground sm:text-xs">
102
+ <p className="text-[10px] text-muted-foreground sm:text-[11px]">
96
103
  {score >= 80 ? t('wellProtected') : t('recommendProtections')}
97
104
  </p>
98
105
  </div>
99
106
 
100
- <div className="flex flex-col gap-1.5">
107
+ <div className="flex flex-col gap-1">
101
108
  {data.checks.map((item) => {
102
109
  const Icon = ICON_MAP[item.id] ?? ShieldCheck;
103
110
  return (
104
- <div
111
+ <button
112
+ type="button"
105
113
  key={item.id}
106
- className="group flex flex-wrap items-start gap-2.5 rounded-lg p-2.5 transition-colors hover:bg-muted/50 sm:items-center sm:gap-3 sm:p-3"
114
+ onClick={() =>
115
+ router.push(CHECK_ROUTE_MAP[item.id] ?? '/core/account')
116
+ }
117
+ className="group flex w-full cursor-pointer flex-wrap items-start gap-2 rounded-lg p-2 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:items-center sm:gap-2.5 sm:p-2.5"
107
118
  >
108
119
  <div
109
- className={`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg sm:h-9 sm:w-9 ${
120
+ className={`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg sm:h-8 sm:w-8 ${
110
121
  item.enabled
111
122
  ? 'bg-emerald-50 dark:bg-emerald-950/40'
112
123
  : 'bg-muted'
113
124
  }`}
114
125
  >
115
126
  <Icon
116
- className={`h-3.5 w-3.5 sm:h-4 sm:w-4 ${
127
+ className={`h-3.5 w-3.5 ${
117
128
  item.enabled
118
129
  ? 'text-emerald-600 dark:text-emerald-400'
119
130
  : 'text-muted-foreground'
@@ -122,7 +133,7 @@ function AccountSecurityContent({ data }: { data: AccountSecurityData }) {
122
133
  </div>
123
134
  <div className="flex min-w-0 flex-1 flex-col">
124
135
  <div className="flex flex-wrap items-center gap-2">
125
- <span className="wrap-break-word text-[13px] font-medium text-foreground sm:text-sm">
136
+ <span className="wrap-break-word text-[12px] font-medium text-foreground sm:text-[13px]">
126
137
  {t(`labels.${item.labelKey}` as any) || item.labelKey}
127
138
  </span>
128
139
  {item.enabled ? (
@@ -131,23 +142,16 @@ function AccountSecurityContent({ data }: { data: AccountSecurityData }) {
131
142
  <AlertTriangle className="h-3.5 w-3.5 text-amber-500" />
132
143
  )}
133
144
  </div>
134
- <span className="text-[11px] text-muted-foreground sm:text-xs">
145
+ <span className="text-[10px] text-muted-foreground sm:text-[11px]">
135
146
  {t(`descriptions.${item.descriptionKey}` as any) ||
136
147
  item.descriptionKey}
137
148
  </span>
138
149
  </div>
139
- {!item.enabled && (
140
- <Button
141
- variant="ghost"
142
- size="sm"
143
- onClick={() => router.push('/core/account/2fa')}
144
- className="mt-1 w-full shrink-0 gap-1 text-xs sm:mt-0 sm:w-auto"
145
- >
146
- {t('activate')}
147
- <ChevronRight className="h-3 w-3" />
148
- </Button>
149
- )}
150
- </div>
150
+ <div className="mt-0.5 flex w-full shrink-0 items-center justify-end gap-1 text-[11px] font-medium text-foreground sm:mt-0 sm:w-auto sm:text-xs">
151
+ {!item.enabled && <span>{t('activate')}</span>}
152
+ <ChevronRight className="h-3 w-3" />
153
+ </div>
154
+ </button>
151
155
  );
152
156
  })}
153
157
  </div>
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { Users } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface ActiveUsersProps {
8
8
  widget?: any;
@@ -21,7 +21,7 @@ import {
21
21
  UserCheck,
22
22
  } from 'lucide-react';
23
23
  import { useTranslations } from 'next-intl';
24
- import { WidgetWrapper } from '../widget-wrapper';
24
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
25
25
 
26
26
  const typeIconMap: Record<string, React.ElementType> = {
27
27
  login: LogIn,
@@ -20,7 +20,7 @@ import type {
20
20
  import { Mail, MailCheck, MailWarning, MailX } from 'lucide-react';
21
21
  import { useTranslations } from 'next-intl';
22
22
  import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts';
23
- import { WidgetWrapper } from '../widget-wrapper';
23
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
24
24
 
25
25
  const defaultEmailNotificationsData: EmailNotificationsData = {
26
26
  cards: {
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@/types/widget-data';
16
16
  import { Calendar, Clock, Globe, Languages } from 'lucide-react';
17
17
  import { useTranslations } from 'next-intl';
18
- import { WidgetWrapper } from '../widget-wrapper';
18
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
19
19
 
20
20
  const defaultLocaleConfigData: LocaleConfigWidgetData = {
21
21
  status: {
@@ -17,7 +17,7 @@ import type { AllWidgetsData, LoginDay } from '@/types/widget-data';
17
17
  import { LogIn } from 'lucide-react';
18
18
  import { useTranslations } from 'next-intl';
19
19
  import { Bar, BarChart, CartesianGrid, XAxis, YAxis } from 'recharts';
20
- import { WidgetWrapper } from '../widget-wrapper';
20
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
21
21
 
22
22
  function LoginChart({ data }: { data: LoginDay[] }) {
23
23
  const t = useTranslations('core.DashboardPage.loginHistory');
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@/types/widget-data';
16
16
  import { CheckCircle2, Mail, Send, Server } from 'lucide-react';
17
17
  import { useTranslations } from 'next-intl';
18
- import { WidgetWrapper } from '../widget-wrapper';
18
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
19
19
 
20
20
  const defaultMailConfigData: MailConfigWidgetData = {
21
21
  status: {
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { Mail } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface MailSentProps {
8
8
  widget?: any;
@@ -19,7 +19,7 @@ import {
19
19
  XAxis,
20
20
  YAxis,
21
21
  } from 'recharts';
22
- import { WidgetWrapper } from '../widget-wrapper';
22
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
23
23
 
24
24
  function CustomTooltip({
25
25
  active,
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { LayoutList } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface MenusCardProps {
8
8
  widget?: any;
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@/types/widget-data';
16
16
  import { CheckCircle2, KeyRound, XCircle } from 'lucide-react';
17
17
  import { useTranslations } from 'next-intl';
18
- import { WidgetWrapper } from '../widget-wrapper';
18
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
19
19
 
20
20
  const defaultOAuthConfigData: OAuthConfigWidgetData = {
21
21
  status: {
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { Shield } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface PermissionsCardProps {
8
8
  widget?: any;
@@ -11,7 +11,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
11
11
  import { IconGripVertical } from '@tabler/icons-react';
12
12
  import { useTranslations } from 'next-intl';
13
13
  import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip } from 'recharts';
14
- import { WidgetWrapper } from '../widget-wrapper';
14
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
15
15
 
16
16
  function CustomTooltip({
17
17
  active,
@@ -21,7 +21,7 @@ import {
21
21
  } from 'lucide-react';
22
22
  import { useTranslations } from 'next-intl';
23
23
  import { useRouter } from 'next/navigation';
24
- import { WidgetWrapper } from '../widget-wrapper';
24
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
25
25
 
26
26
  function getInitials(name: string): string {
27
27
  return name
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { Route } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface RoutesCardProps {
8
8
  widget?: any;
@@ -19,7 +19,7 @@ import {
19
19
  XAxis,
20
20
  YAxis,
21
21
  } from 'recharts';
22
- import { WidgetWrapper } from '../widget-wrapper';
22
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
23
23
 
24
24
  function CustomTooltip({
25
25
  active,
@@ -1,8 +1,8 @@
1
1
  import { useWidgetData } from '@/hooks/use-widget-data';
2
2
  import { Activity } from 'lucide-react';
3
3
  import { useTranslations } from 'next-intl';
4
- import StatCard from '../stats';
5
- import { WidgetWrapper } from '../widget-wrapper';
4
+ import StatCard from '@/app/(app)/(libraries)/core/dashboard/components/stats';
5
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
6
6
 
7
7
  interface SessionsTodayProps {
8
8
  widget?: any;
@@ -5,7 +5,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
5
5
  import type { AllWidgetsData } from '@/types/widget-data';
6
6
  import { Zap } from 'lucide-react';
7
7
  import { useTranslations } from 'next-intl';
8
- import { WidgetWrapper } from '../widget-wrapper';
8
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
9
9
 
10
10
  interface StatAccessLevelProps {
11
11
  widget?: { name?: string };
@@ -5,7 +5,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
5
5
  import type { AllWidgetsData } from '@/types/widget-data';
6
6
  import { MousePointerClick } from 'lucide-react';
7
7
  import { useTranslations } from 'next-intl';
8
- import { WidgetWrapper } from '../widget-wrapper';
8
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
9
9
 
10
10
  interface StatActionsTodayProps {
11
11
  widget?: { name?: string };
@@ -5,7 +5,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
5
5
  import type { AllWidgetsData } from '@/types/widget-data';
6
6
  import { CalendarDays } from 'lucide-react';
7
7
  import { useTranslations } from 'next-intl';
8
- import { WidgetWrapper } from '../widget-wrapper';
8
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
9
9
 
10
10
  interface StatConsecutiveDaysProps {
11
11
  widget?: { name?: string };
@@ -5,7 +5,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
5
5
  import type { AllWidgetsData } from '@/types/widget-data';
6
6
  import { Clock } from 'lucide-react';
7
7
  import { useTranslations } from 'next-intl';
8
- import { WidgetWrapper } from '../widget-wrapper';
8
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
9
9
 
10
10
  interface StatOnlineTimeProps {
11
11
  widget?: { name?: string };
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@/types/widget-data';
16
16
  import { CheckCircle2, HardDrive } from 'lucide-react';
17
17
  import { useTranslations } from 'next-intl';
18
- import { WidgetWrapper } from '../widget-wrapper';
18
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
19
19
 
20
20
  const defaultStorageConfigData: StorageConfigWidgetData = {
21
21
  status: {
@@ -15,7 +15,7 @@ import type {
15
15
  } from '@/types/widget-data';
16
16
  import { Palette } from 'lucide-react';
17
17
  import { useTranslations } from 'next-intl';
18
- import { WidgetWrapper } from '../widget-wrapper';
18
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
19
19
 
20
20
  const emptyPaletteMode = {
21
21
  primary: null,
@@ -19,7 +19,7 @@ import {
19
19
  XAxis,
20
20
  YAxis,
21
21
  } from 'recharts';
22
- import { WidgetWrapper } from '../widget-wrapper';
22
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
23
23
 
24
24
  function CustomTooltip({
25
25
  active,
@@ -12,7 +12,7 @@ import { useWidgetData } from '@/hooks/use-widget-data';
12
12
  import type { AllWidgetsData, RoleData } from '@/types/widget-data';
13
13
  import { Crown, ShieldCheck } from 'lucide-react';
14
14
  import { useTranslations } from 'next-intl';
15
- import { WidgetWrapper } from '../widget-wrapper';
15
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
16
16
 
17
17
  const levelStyles = [
18
18
  {
@@ -29,7 +29,7 @@ import {
29
29
  } from 'lucide-react';
30
30
  import { useTranslations } from 'next-intl';
31
31
  import { useRouter } from 'next/navigation';
32
- import { WidgetWrapper } from '../widget-wrapper';
32
+ import { WidgetWrapper } from '@/app/(app)/(libraries)/core/dashboard/components';
33
33
 
34
34
  function detectDeviceType(ua: string): 'desktop' | 'mobile' | 'tablet' {
35
35
  const u = ua.toLowerCase();
@@ -112,7 +112,7 @@ function SessionsContent({ sessions }: { sessions: SessionData[] }) {
112
112
  </div>
113
113
  </CardHeader>
114
114
  <CardContent className="flex min-h-0 flex-1 overflow-auto pt-0">
115
- <div className="flex flex-col gap-2">
115
+ <div className="grid w-full items-start grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-2 sm:gap-3">
116
116
  {sessions.map((session, index) => {
117
117
  const ua = session.user_agent ?? '';
118
118
  const deviceType = detectDeviceType(ua);
@@ -1,11 +1,17 @@
1
1
  columns:
2
2
  - type: pk
3
3
  - type: slug
4
+ - name: icon
5
+ length: 255
6
+ isNullable: true
4
7
  - name: name
5
8
  type: locale_varchar
6
9
  length: 255
7
10
  locale:
8
11
  en: Name
9
12
  pt: Nome
13
+ - name: is_template
14
+ type: boolean
15
+ default: false
10
16
  - type: created_at
11
17
  - type: updated_at
@@ -4,6 +4,13 @@ columns:
4
4
  locale:
5
5
  en: Slug
6
6
  pt: Slug
7
+ - name: library_slug
8
+ type: varchar
9
+ length: 120
10
+ default: core
11
+ locale:
12
+ en: Library Slug
13
+ pt: Slug da Library
7
14
  - name: min_width
8
15
  type: int
9
16
  default: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/core",
3
- "version": "0.0.298",
3
+ "version": "0.0.300",
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.7",
34
+ "@hed-hog/api-mail": "0.0.9",
33
35
  "@hed-hog/api": "0.0.6",
34
- "@hed-hog/api-prisma": "0.0.6",
35
- "@hed-hog/api-types": "0.0.1",
36
36
  "@hed-hog/api-locale": "0.0.14",
37
- "@hed-hog/api-pagination": "0.0.7",
38
- "@hed-hog/api-mail": "0.0.9"
37
+ "@hed-hog/api-prisma": "0.0.6",
38
+ "@hed-hog/api-types": "0.0.1"
39
39
  },
40
40
  "exports": {
41
41
  ".": {
@@ -2,21 +2,26 @@ import { Role, User } from '@hed-hog/api';
2
2
  import { Locale } from '@hed-hog/api-locale';
3
3
  import { Pagination } from '@hed-hog/api-pagination';
4
4
  import {
5
- Body,
6
- Controller,
7
- Delete,
8
- Get,
9
- Inject,
10
- Param,
11
- ParseIntPipe,
12
- Patch,
13
- Post,
14
- forwardRef
5
+ BadRequestException,
6
+ Body,
7
+ Controller,
8
+ Delete,
9
+ Get,
10
+ Inject,
11
+ Param,
12
+ ParseIntPipe,
13
+ Patch,
14
+ Post,
15
+ Query,
16
+ UploadedFile,
17
+ UseInterceptors,
18
+ forwardRef
15
19
  } from '@nestjs/common';
20
+ import { FileInterceptor } from '@nestjs/platform-express';
16
21
  import { DashboardComponentService } from './dashboard-component.service';
17
22
  import {
18
- CreateDashboardComponentDTO,
19
- UpdateDashboardComponentDTO,
23
+ CreateDashboardComponentDTO,
24
+ UpdateDashboardComponentDTO,
20
25
  } from './dto';
21
26
 
22
27
  @Role()
@@ -33,8 +38,20 @@ export class DashboardComponentController {
33
38
  }
34
39
 
35
40
  @Get('user')
36
- getAllComponentsByUserRole(@Pagination() paginationParams, @User() { id }) {
37
- return this.dashboardComponentService.getAllComponentsByUserRole(paginationParams, id);
41
+ getAllComponentsByUserRole(
42
+ @Pagination() paginationParams,
43
+ @User() { id },
44
+ @Query('librarySlug') librarySlug?: string,
45
+ @Query('exclude') exclude?: string,
46
+ ) {
47
+ return this.dashboardComponentService.getAllComponentsByUserRole(
48
+ {
49
+ ...paginationParams,
50
+ librarySlug,
51
+ exclude,
52
+ },
53
+ id,
54
+ );
38
55
  }
39
56
 
40
57
  @Get(':id')
@@ -64,4 +81,24 @@ export class DashboardComponentController {
64
81
  deleteComponent(@Param('id', ParseIntPipe) id: number, @Locale() locale: string) {
65
82
  return this.dashboardComponentService.deleteComponent(id, locale);
66
83
  }
84
+
85
+ @Post(':id/preview')
86
+ @UseInterceptors(
87
+ FileInterceptor('file', {
88
+ fileFilter: (req, file, cb) => {
89
+ if (!file?.mimetype?.startsWith('image/')) {
90
+ return cb(new BadRequestException('Invalid image file'), false);
91
+ }
92
+
93
+ cb(null, true);
94
+ },
95
+ }),
96
+ )
97
+ savePreview(
98
+ @Param('id', ParseIntPipe) id: number,
99
+ @UploadedFile() file: MulterFile,
100
+ @Locale() locale: string,
101
+ ) {
102
+ return this.dashboardComponentService.savePreview(id, file, locale);
103
+ }
67
104
  }