@hed-hog/catalog 0.0.278 → 0.0.279

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,4 @@
1
1
  'use client';
2
-
3
- import { CatalogNav } from '../_components/catalog-nav';
4
2
  import {
5
3
  catalogKpiResources,
6
4
  catalogQuickActionResources,
@@ -66,10 +64,11 @@ const chartTooltipStyle = {
66
64
 
67
65
  export default function CatalogDashboardPage() {
68
66
  const t = useTranslations('catalog');
69
- const { request } = useApp();
67
+ const { accessToken, currentLocaleCode, request } = useApp();
68
+ const isAppReady = accessToken.trim().length > 0;
70
69
 
71
70
  const { data, isLoading, refetch } = useQuery<CatalogStats[]>({
72
- queryKey: ['catalog-dashboard-stats'],
71
+ queryKey: ['catalog-dashboard-stats', accessToken, currentLocaleCode],
73
72
  queryFn: async () => {
74
73
  const responses = await Promise.allSettled(
75
74
  catalogResources.map(async (resource) => {
@@ -102,10 +101,9 @@ export default function CatalogDashboardPage() {
102
101
  }
103
102
  );
104
103
  },
105
- initialData: [],
104
+ enabled: isAppReady,
106
105
  });
107
-
108
- const dashboardStats = data as CatalogStats[];
106
+ const dashboardStats = (data ?? []) as CatalogStats[];
109
107
 
110
108
  const statsMap = new Map(dashboardStats.map((item) => [item.resource, item]));
111
109
  const totalRecords = dashboardStats.reduce(
@@ -255,8 +253,6 @@ export default function CatalogDashboardPage() {
255
253
  </CardContent>
256
254
  </Card>
257
255
 
258
- <CatalogNav currentHref="/catalog/dashboard" />
259
-
260
256
  <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
261
257
  {kpiCards.map(({ resource, total, active }) => {
262
258
  const Icon = resource.icon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/catalog",
3
- "version": "0.0.278",
3
+ "version": "0.0.279",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -11,12 +11,12 @@
11
11
  "@nestjs/mapped-types": "*",
12
12
  "@hed-hog/api-pagination": "0.0.6",
13
13
  "@hed-hog/api-locale": "0.0.13",
14
- "@hed-hog/core": "0.0.278",
15
14
  "@hed-hog/api": "0.0.4",
16
- "@hed-hog/category": "0.0.278",
17
15
  "@hed-hog/api-prisma": "0.0.5",
18
- "@hed-hog/content": "0.0.278",
19
- "@hed-hog/tag": "0.0.278"
16
+ "@hed-hog/core": "0.0.279",
17
+ "@hed-hog/tag": "0.0.279",
18
+ "@hed-hog/category": "0.0.279",
19
+ "@hed-hog/content": "0.0.279"
20
20
  },
21
21
  "exports": {
22
22
  ".": {
@@ -1,85 +0,0 @@
1
- 'use client';
2
-
3
- import { Badge } from '@/components/ui/badge';
4
- import { cn } from '@/lib/utils';
5
- import Link from 'next/link';
6
- import { useTranslations } from 'next-intl';
7
- import {
8
- catalogDashboardHref,
9
- catalogModuleIcon,
10
- catalogResources,
11
- } from '../_lib/catalog-resources';
12
-
13
- type CatalogNavProps = {
14
- currentHref: string;
15
- };
16
-
17
- export function CatalogNav({ currentHref }: CatalogNavProps) {
18
- const t = useTranslations('catalog');
19
- const ModuleIcon = catalogModuleIcon;
20
-
21
- const items = [
22
- {
23
- href: catalogDashboardHref,
24
- label: t('dashboard.title'),
25
- description: t('dashboard.subtitle'),
26
- icon: ModuleIcon,
27
- },
28
- ...catalogResources.map((resource) => ({
29
- href: resource.href,
30
- label: t(`resources.${resource.translationKey}.title`),
31
- description: t(`resources.${resource.translationKey}.description`),
32
- icon: resource.icon,
33
- })),
34
- ];
35
-
36
- return (
37
- <div className="min-w-0">
38
- <div className="flex gap-2 overflow-x-auto pb-2 md:pb-1 lg:grid lg:grid-cols-2 lg:overflow-visible xl:grid-cols-3 2xl:grid-cols-4">
39
- {items.map((item) => {
40
- const active = currentHref === item.href;
41
- const Icon = item.icon;
42
-
43
- return (
44
- <Link
45
- key={item.href}
46
- href={item.href}
47
- className={cn(
48
- 'group flex w-[280px] max-w-[85vw] shrink-0 snap-start items-start gap-3 rounded-2xl border px-4 py-3 transition-all lg:min-w-0 lg:max-w-none lg:w-full',
49
- active
50
- ? 'border-orange-300 bg-orange-50 text-orange-950 shadow-sm'
51
- : 'border-border/70 bg-card hover:-translate-y-0.5 hover:border-orange-200 hover:bg-orange-50/40'
52
- )}
53
- >
54
- <div
55
- className={cn(
56
- 'mt-0.5 rounded-xl p-2 transition-colors',
57
- active
58
- ? 'bg-orange-500 text-white'
59
- : 'bg-muted text-muted-foreground group-hover:bg-orange-100 group-hover:text-orange-700'
60
- )}
61
- >
62
- <Icon className="size-4" />
63
- </div>
64
- <div className="min-w-0 space-y-1">
65
- <div className="flex min-w-0 items-center gap-2">
66
- <span className="truncate text-sm font-semibold">
67
- {item.label}
68
- </span>
69
- {active ? (
70
- <Badge className="rounded-full bg-orange-500 px-2 py-0 text-[10px] text-white hover:bg-orange-500">
71
- {t('navigation.current')}
72
- </Badge>
73
- ) : null}
74
- </div>
75
- <p className="line-clamp-2 text-xs text-muted-foreground">
76
- {item.description}
77
- </p>
78
- </div>
79
- </Link>
80
- );
81
- })}
82
- </div>
83
- </div>
84
- );
85
- }