@umituz/web-dashboard 1.0.2 → 1.0.7
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.d.ts +403 -8
- package/dist/index.js +57 -73
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
- package/dist/domain/theme/index.d.ts +0 -45
- package/dist/domain/theme/index.js +0 -180
- package/dist/domain/theme/index.js.map +0 -1
- package/dist/domain/types/index.d.ts +0 -167
- package/dist/domain/types/index.js +0 -2
- package/dist/domain/types/index.js.map +0 -1
- package/dist/infrastructure/hooks/index.d.ts +0 -36
- package/dist/infrastructure/hooks/index.js +0 -57
- package/dist/infrastructure/hooks/index.js.map +0 -1
- package/dist/infrastructure/utils/index.d.ts +0 -57
- package/dist/infrastructure/utils/index.js +0 -44
- package/dist/infrastructure/utils/index.js.map +0 -1
- package/dist/presentation/index.d.ts +0 -109
- package/dist/presentation/index.js +0 -497
- package/dist/presentation/index.js.map +0 -1
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { LucideIcon } from 'lucide-react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Dashboard Types
|
|
5
|
-
*
|
|
6
|
-
* Core type definitions for the dashboard layout system
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Single sidebar menu item
|
|
11
|
-
*/
|
|
12
|
-
interface SidebarItem {
|
|
13
|
-
/** Display label (can be i18n key) */
|
|
14
|
-
label: string;
|
|
15
|
-
/** Icon from lucide-react */
|
|
16
|
-
icon: LucideIcon;
|
|
17
|
-
/** Route path */
|
|
18
|
-
path: string;
|
|
19
|
-
/** Filter by app type (optional) */
|
|
20
|
-
requiredApp?: 'mobile' | 'web';
|
|
21
|
-
/** Enable/disable this item (default: true) */
|
|
22
|
-
enabled?: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Group of sidebar items with a title
|
|
26
|
-
*/
|
|
27
|
-
interface SidebarGroup {
|
|
28
|
-
/** Group title (can be i18n key) */
|
|
29
|
-
title: string;
|
|
30
|
-
/** Items in this group */
|
|
31
|
-
items: SidebarItem[];
|
|
32
|
-
/** Optional: Route to title mapping for page headers */
|
|
33
|
-
titleMap?: Record<string, string>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Dashboard header props
|
|
37
|
-
*/
|
|
38
|
-
interface DashboardHeaderProps {
|
|
39
|
-
/** Whether sidebar is collapsed */
|
|
40
|
-
collapsed: boolean;
|
|
41
|
-
/** Toggle sidebar collapsed state */
|
|
42
|
-
setCollapsed: (collapsed: boolean) => void;
|
|
43
|
-
/** Toggle mobile menu open state */
|
|
44
|
-
setMobileOpen: (open: boolean) => void;
|
|
45
|
-
/** Current page title */
|
|
46
|
-
title: string;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Dashboard sidebar props
|
|
50
|
-
*/
|
|
51
|
-
interface DashboardSidebarProps {
|
|
52
|
-
/** Whether sidebar is collapsed */
|
|
53
|
-
collapsed: boolean;
|
|
54
|
-
/** Toggle sidebar collapsed state */
|
|
55
|
-
setCollapsed: (collapsed: boolean) => void;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Dashboard layout configuration
|
|
59
|
-
*/
|
|
60
|
-
interface DashboardLayoutConfig {
|
|
61
|
-
/** Sidebar groups */
|
|
62
|
-
sidebarGroups: SidebarGroup[];
|
|
63
|
-
/** Extra title mappings for routes */
|
|
64
|
-
extraTitleMap?: Record<string, string>;
|
|
65
|
-
/** Brand name */
|
|
66
|
-
brandName?: string;
|
|
67
|
-
/** Brand tagline */
|
|
68
|
-
brandTagline?: string;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Dashboard theme configuration
|
|
72
|
-
* Extends CSS variables for customization
|
|
73
|
-
*/
|
|
74
|
-
interface DashboardTheme {
|
|
75
|
-
/** Primary color (CSS variable compatible) */
|
|
76
|
-
primary?: string;
|
|
77
|
-
/** Secondary color */
|
|
78
|
-
secondary?: string;
|
|
79
|
-
/** Sidebar background */
|
|
80
|
-
sidebarBackground?: string;
|
|
81
|
-
/** Sidebar foreground */
|
|
82
|
-
sidebarForeground?: string;
|
|
83
|
-
/** Sidebar border */
|
|
84
|
-
sidebarBorder?: string;
|
|
85
|
-
/** Header background */
|
|
86
|
-
headerBackground?: string;
|
|
87
|
-
/** Background color */
|
|
88
|
-
background?: string;
|
|
89
|
-
/** Foreground color */
|
|
90
|
-
foreground?: string;
|
|
91
|
-
/** Border color */
|
|
92
|
-
border?: string;
|
|
93
|
-
/** Accent color */
|
|
94
|
-
accent?: string;
|
|
95
|
-
/** Accent foreground */
|
|
96
|
-
accentForeground?: string;
|
|
97
|
-
/** Destructive color */
|
|
98
|
-
destructive?: string;
|
|
99
|
-
/** Destructive foreground */
|
|
100
|
-
destructiveForeground?: string;
|
|
101
|
-
/** Muted background */
|
|
102
|
-
muted?: string;
|
|
103
|
-
/** Muted foreground */
|
|
104
|
-
mutedForeground?: string;
|
|
105
|
-
/** Card background */
|
|
106
|
-
card?: string;
|
|
107
|
-
/** Card foreground */
|
|
108
|
-
cardForeground?: string;
|
|
109
|
-
/** Popover background */
|
|
110
|
-
popover?: string;
|
|
111
|
-
/** Popover foreground */
|
|
112
|
-
popoverForeground?: string;
|
|
113
|
-
/** Radius (border-radius) */
|
|
114
|
-
radius?: string;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Theme preset for quick setup
|
|
118
|
-
*/
|
|
119
|
-
interface DashboardThemePreset {
|
|
120
|
-
/** Preset name */
|
|
121
|
-
name: string;
|
|
122
|
-
/** Theme configuration */
|
|
123
|
-
theme: DashboardTheme;
|
|
124
|
-
/** Whether this is a dark theme */
|
|
125
|
-
dark?: boolean;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Notification item
|
|
129
|
-
*/
|
|
130
|
-
interface DashboardNotification {
|
|
131
|
-
/** Unique ID */
|
|
132
|
-
id: string;
|
|
133
|
-
/** Notification text */
|
|
134
|
-
text: string;
|
|
135
|
-
/** Whether notification is read */
|
|
136
|
-
read: boolean;
|
|
137
|
-
/** Creation timestamp */
|
|
138
|
-
createdAt: Date | string | number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* User profile info for header
|
|
142
|
-
*/
|
|
143
|
-
interface DashboardUser {
|
|
144
|
-
/** User ID */
|
|
145
|
-
id: string;
|
|
146
|
-
/** Display name */
|
|
147
|
-
name?: string;
|
|
148
|
-
/** Email address */
|
|
149
|
-
email?: string;
|
|
150
|
-
/** Avatar URL */
|
|
151
|
-
avatar?: string;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Navigation item for user menu
|
|
155
|
-
*/
|
|
156
|
-
interface UserNavMenuItem {
|
|
157
|
-
/** Display label */
|
|
158
|
-
label: string;
|
|
159
|
-
/** Icon component */
|
|
160
|
-
icon: React.ComponentType<{
|
|
161
|
-
className?: string;
|
|
162
|
-
}>;
|
|
163
|
-
/** Route path */
|
|
164
|
-
path: string;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export type { DashboardHeaderProps, DashboardLayoutConfig, DashboardNotification, DashboardSidebarProps, DashboardTheme, DashboardThemePreset, DashboardUser, SidebarGroup, SidebarItem, UserNavMenuItem };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { DashboardNotification } from '../../domain/types/index.js';
|
|
3
|
-
import 'lucide-react';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Use Notifications Hook
|
|
7
|
-
*
|
|
8
|
-
* Manages notification state and actions
|
|
9
|
-
*
|
|
10
|
-
* @param initialNotifications - Initial notification list
|
|
11
|
-
* @returns Notification state and actions
|
|
12
|
-
*/
|
|
13
|
-
declare function useNotifications(initialNotifications?: DashboardNotification[]): {
|
|
14
|
-
notifications: DashboardNotification[];
|
|
15
|
-
markAllRead: () => void;
|
|
16
|
-
dismiss: (id: string) => void;
|
|
17
|
-
add: (notification: Omit<DashboardNotification, "id">) => void;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Use Sidebar Hook
|
|
21
|
-
*
|
|
22
|
-
* Manages sidebar state
|
|
23
|
-
*
|
|
24
|
-
* @returns Sidebar state and actions
|
|
25
|
-
*/
|
|
26
|
-
declare function useSidebar(initialCollapsed?: boolean): {
|
|
27
|
-
collapsed: boolean;
|
|
28
|
-
setCollapsed: react.Dispatch<react.SetStateAction<boolean>>;
|
|
29
|
-
toggle: () => void;
|
|
30
|
-
mobileOpen: boolean;
|
|
31
|
-
setMobileOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
32
|
-
openMobile: () => void;
|
|
33
|
-
closeMobile: () => void;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export { useNotifications, useSidebar };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/infrastructure/hooks/index.ts
|
|
4
|
-
import { useState, useCallback } from "react";
|
|
5
|
-
function useNotifications(initialNotifications = []) {
|
|
6
|
-
const [notifications, setNotifications] = useState(initialNotifications);
|
|
7
|
-
const markAllRead = useCallback(() => {
|
|
8
|
-
setNotifications(
|
|
9
|
-
(prev) => prev.map((n) => ({ ...n, read: true }))
|
|
10
|
-
);
|
|
11
|
-
}, []);
|
|
12
|
-
const dismiss = useCallback((id) => {
|
|
13
|
-
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
14
|
-
}, []);
|
|
15
|
-
const add = useCallback((notification) => {
|
|
16
|
-
const newNotification = {
|
|
17
|
-
...notification,
|
|
18
|
-
id: Math.random().toString(36).substring(7),
|
|
19
|
-
read: false,
|
|
20
|
-
createdAt: /* @__PURE__ */ new Date()
|
|
21
|
-
};
|
|
22
|
-
setNotifications((prev) => [newNotification, ...prev]);
|
|
23
|
-
}, []);
|
|
24
|
-
return {
|
|
25
|
-
notifications,
|
|
26
|
-
markAllRead,
|
|
27
|
-
dismiss,
|
|
28
|
-
add
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function useSidebar(initialCollapsed = false) {
|
|
32
|
-
const [collapsed, setCollapsed] = useState(initialCollapsed);
|
|
33
|
-
const [mobileOpen, setMobileOpen] = useState(false);
|
|
34
|
-
const toggle = useCallback(() => {
|
|
35
|
-
setCollapsed((prev) => !prev);
|
|
36
|
-
}, []);
|
|
37
|
-
const openMobile = useCallback(() => {
|
|
38
|
-
setMobileOpen(true);
|
|
39
|
-
}, []);
|
|
40
|
-
const closeMobile = useCallback(() => {
|
|
41
|
-
setMobileOpen(false);
|
|
42
|
-
}, []);
|
|
43
|
-
return {
|
|
44
|
-
collapsed,
|
|
45
|
-
setCollapsed,
|
|
46
|
-
toggle,
|
|
47
|
-
mobileOpen,
|
|
48
|
-
setMobileOpen,
|
|
49
|
-
openMobile,
|
|
50
|
-
closeMobile
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
54
|
-
useNotifications,
|
|
55
|
-
useSidebar
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infrastructure/hooks/index.ts"],"sourcesContent":["/**\n * Dashboard Hooks\n *\n * Custom React hooks for dashboard functionality\n */\n\nimport { useState, useCallback } from \"react\";\nimport type { DashboardNotification } from \"../../domain/types\";\n\n/**\n * Use Notifications Hook\n *\n * Manages notification state and actions\n *\n * @param initialNotifications - Initial notification list\n * @returns Notification state and actions\n */\nexport function useNotifications(initialNotifications: DashboardNotification[] = []) {\n const [notifications, setNotifications] = useState<DashboardNotification[]>(initialNotifications);\n\n const markAllRead = useCallback(() => {\n setNotifications((prev) =>\n prev.map((n) => ({ ...n, read: true }))\n );\n }, []);\n\n const dismiss = useCallback((id: string) => {\n setNotifications((prev) => prev.filter((n) => n.id !== id));\n }, []);\n\n const add = useCallback((notification: Omit<DashboardNotification, \"id\">) => {\n const newNotification: DashboardNotification = {\n ...notification,\n id: Math.random().toString(36).substring(7),\n read: false,\n createdAt: new Date(),\n };\n setNotifications((prev) => [newNotification, ...prev]);\n }, []);\n\n return {\n notifications,\n markAllRead,\n dismiss,\n add,\n };\n}\n\n/**\n * Use Sidebar Hook\n *\n * Manages sidebar state\n *\n * @returns Sidebar state and actions\n */\nexport function useSidebar(initialCollapsed = false) {\n const [collapsed, setCollapsed] = useState(initialCollapsed);\n const [mobileOpen, setMobileOpen] = useState(false);\n\n const toggle = useCallback(() => {\n setCollapsed((prev) => !prev);\n }, []);\n\n const openMobile = useCallback(() => {\n setMobileOpen(true);\n }, []);\n\n const closeMobile = useCallback(() => {\n setMobileOpen(false);\n }, []);\n\n return {\n collapsed,\n setCollapsed,\n toggle,\n mobileOpen,\n setMobileOpen: setMobileOpen,\n openMobile,\n closeMobile,\n };\n}\n"],"mappings":";;;AAMA,SAAS,UAAU,mBAAmB;AAW/B,SAAS,iBAAiB,uBAAgD,CAAC,GAAG;AACnF,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAkC,oBAAoB;AAEhG,QAAM,cAAc,YAAY,MAAM;AACpC;AAAA,MAAiB,CAAC,SAChB,KAAK,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,KAAK,EAAE;AAAA,IACxC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,YAAY,CAAC,OAAe;AAC1C,qBAAiB,CAAC,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AAAA,EAC5D,GAAG,CAAC,CAAC;AAEL,QAAM,MAAM,YAAY,CAAC,iBAAoD;AAC3E,UAAM,kBAAyC;AAAA,MAC7C,GAAG;AAAA,MACH,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC;AAAA,MAC1C,MAAM;AAAA,MACN,WAAW,oBAAI,KAAK;AAAA,IACtB;AACA,qBAAiB,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAAA,EACvD,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AASO,SAAS,WAAW,mBAAmB,OAAO;AACnD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,gBAAgB;AAC3D,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,SAAS,YAAY,MAAM;AAC/B,iBAAa,CAAC,SAAS,CAAC,IAAI;AAAA,EAC9B,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,YAAY,MAAM;AACnC,kBAAc,IAAI;AAAA,EACpB,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,YAAY,MAAM;AACpC,kBAAc,KAAK;AAAA,EACrB,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard Utilities
|
|
3
|
-
*
|
|
4
|
-
* Utility functions for dashboard operations
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Format notification timestamp to relative time
|
|
8
|
-
*
|
|
9
|
-
* @param createdAt - Notification creation timestamp
|
|
10
|
-
* @param t - i18n translation function
|
|
11
|
-
* @returns Formatted time string
|
|
12
|
-
*/
|
|
13
|
-
declare function formatNotificationTime(createdAt: Date | string | number, t: (key: string, params?: Record<string, unknown>) => string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Check if a path is active
|
|
16
|
-
*
|
|
17
|
-
* @param currentPath - Current location pathname
|
|
18
|
-
* @param targetPath - Target path to check
|
|
19
|
-
* @returns True if paths match
|
|
20
|
-
*/
|
|
21
|
-
declare function isPathActive(currentPath: string, targetPath: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Get page title from sidebar configuration
|
|
24
|
-
*
|
|
25
|
-
* @param pathname - Current pathname
|
|
26
|
-
* @param sidebarGroups - Sidebar groups configuration
|
|
27
|
-
* @param extraTitleMap - Extra title mappings
|
|
28
|
-
* @returns Page title or null
|
|
29
|
-
*/
|
|
30
|
-
declare function getPageTitle(pathname: string, sidebarGroups: Array<{
|
|
31
|
-
items: Array<{
|
|
32
|
-
path: string;
|
|
33
|
-
label: string;
|
|
34
|
-
}>;
|
|
35
|
-
}>, extraTitleMap?: Record<string, string>): string | null;
|
|
36
|
-
/**
|
|
37
|
-
* Filter sidebar items by app type and enabled status
|
|
38
|
-
*
|
|
39
|
-
* @param items - Sidebar items to filter
|
|
40
|
-
* @param user - Current user object
|
|
41
|
-
* @returns Filtered items
|
|
42
|
-
*/
|
|
43
|
-
declare function filterSidebarItems<T extends {
|
|
44
|
-
enabled?: boolean;
|
|
45
|
-
requiredApp?: "mobile" | "web";
|
|
46
|
-
}>(items: T[], user?: {
|
|
47
|
-
hasMobileApp?: boolean;
|
|
48
|
-
hasWebApp?: boolean;
|
|
49
|
-
}): T[];
|
|
50
|
-
/**
|
|
51
|
-
* Generate notification ID
|
|
52
|
-
*
|
|
53
|
-
* @returns Unique notification ID
|
|
54
|
-
*/
|
|
55
|
-
declare function generateNotificationId(): string;
|
|
56
|
-
|
|
57
|
-
export { filterSidebarItems, formatNotificationTime, generateNotificationId, getPageTitle, isPathActive };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/infrastructure/utils/index.ts
|
|
4
|
-
function formatNotificationTime(createdAt, t) {
|
|
5
|
-
const date = new Date(createdAt);
|
|
6
|
-
const secs = Math.floor((Date.now() - date.getTime()) / 1e3);
|
|
7
|
-
if (secs < 60) return t("dashboard.activityFeed.times.justNow");
|
|
8
|
-
if (secs < 3600) return t("dashboard.activityFeed.times.minutesAgo", { val: Math.floor(secs / 60) });
|
|
9
|
-
if (secs < 86400) return t("dashboard.activityFeed.times.hoursAgo", { val: Math.floor(secs / 3600) });
|
|
10
|
-
return t("dashboard.activityFeed.times.daysAgo", { val: Math.floor(secs / 86400) });
|
|
11
|
-
}
|
|
12
|
-
function isPathActive(currentPath, targetPath) {
|
|
13
|
-
return currentPath === targetPath;
|
|
14
|
-
}
|
|
15
|
-
function getPageTitle(pathname, sidebarGroups, extraTitleMap) {
|
|
16
|
-
for (const group of sidebarGroups) {
|
|
17
|
-
const item = group.items.find((i) => i.path === pathname);
|
|
18
|
-
if (item) return item.label;
|
|
19
|
-
}
|
|
20
|
-
if (extraTitleMap?.[pathname]) {
|
|
21
|
-
return extraTitleMap[pathname];
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
function filterSidebarItems(items, user) {
|
|
26
|
-
return items.filter((item) => {
|
|
27
|
-
if (item.enabled === false) return false;
|
|
28
|
-
if (!item.requiredApp) return true;
|
|
29
|
-
if (item.requiredApp === "mobile") return user?.hasMobileApp ?? false;
|
|
30
|
-
if (item.requiredApp === "web") return user?.hasWebApp ?? false;
|
|
31
|
-
return true;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function generateNotificationId() {
|
|
35
|
-
return `${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
filterSidebarItems,
|
|
39
|
-
formatNotificationTime,
|
|
40
|
-
generateNotificationId,
|
|
41
|
-
getPageTitle,
|
|
42
|
-
isPathActive
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/infrastructure/utils/index.ts"],"sourcesContent":["/**\n * Dashboard Utilities\n *\n * Utility functions for dashboard operations\n */\n\nimport type { DashboardNotification } from \"../../domain/types\";\n\n/**\n * Format notification timestamp to relative time\n *\n * @param createdAt - Notification creation timestamp\n * @param t - i18n translation function\n * @returns Formatted time string\n */\nexport function formatNotificationTime(\n createdAt: Date | string | number,\n t: (key: string, params?: Record<string, unknown>) => string\n): string {\n const date = new Date(createdAt);\n const secs = Math.floor((Date.now() - date.getTime()) / 1000);\n\n if (secs < 60) return t(\"dashboard.activityFeed.times.justNow\");\n if (secs < 3600) return t(\"dashboard.activityFeed.times.minutesAgo\", { val: Math.floor(secs / 60) });\n if (secs < 86400) return t(\"dashboard.activityFeed.times.hoursAgo\", { val: Math.floor(secs / 3600) });\n return t(\"dashboard.activityFeed.times.daysAgo\", { val: Math.floor(secs / 86400) });\n}\n\n/**\n * Check if a path is active\n *\n * @param currentPath - Current location pathname\n * @param targetPath - Target path to check\n * @returns True if paths match\n */\nexport function isPathActive(currentPath: string, targetPath: string): boolean {\n return currentPath === targetPath;\n}\n\n/**\n * Get page title from sidebar configuration\n *\n * @param pathname - Current pathname\n * @param sidebarGroups - Sidebar groups configuration\n * @param extraTitleMap - Extra title mappings\n * @returns Page title or null\n */\nexport function getPageTitle(\n pathname: string,\n sidebarGroups: Array<{ items: Array<{ path: string; label: string }> }>,\n extraTitleMap?: Record<string, string>\n): string | null {\n // Search in sidebar groups\n for (const group of sidebarGroups) {\n const item = group.items.find((i) => i.path === pathname);\n if (item) return item.label;\n }\n\n // Search in extra title map\n if (extraTitleMap?.[pathname]) {\n return extraTitleMap[pathname];\n }\n\n return null;\n}\n\n/**\n * Filter sidebar items by app type and enabled status\n *\n * @param items - Sidebar items to filter\n * @param user - Current user object\n * @returns Filtered items\n */\nexport function filterSidebarItems<T extends { enabled?: boolean; requiredApp?: \"mobile\" | \"web\" }>(\n items: T[],\n user?: { hasMobileApp?: boolean; hasWebApp?: boolean }\n): T[] {\n return items.filter((item) => {\n // Skip disabled items\n if (item.enabled === false) return false;\n\n // Skip items that require specific app types\n if (!item.requiredApp) return true;\n if (item.requiredApp === \"mobile\") return user?.hasMobileApp ?? false;\n if (item.requiredApp === \"web\") return user?.hasWebApp ?? false;\n\n return true;\n });\n}\n\n/**\n * Generate notification ID\n *\n * @returns Unique notification ID\n */\nexport function generateNotificationId(): string {\n return `${Date.now()}-${Math.random().toString(36).substring(7)}`;\n}\n"],"mappings":";;;AAeO,SAAS,uBACd,WACA,GACQ;AACR,QAAM,OAAO,IAAI,KAAK,SAAS;AAC/B,QAAM,OAAO,KAAK,OAAO,KAAK,IAAI,IAAI,KAAK,QAAQ,KAAK,GAAI;AAE5D,MAAI,OAAO,GAAI,QAAO,EAAE,sCAAsC;AAC9D,MAAI,OAAO,KAAM,QAAO,EAAE,2CAA2C,EAAE,KAAK,KAAK,MAAM,OAAO,EAAE,EAAE,CAAC;AACnG,MAAI,OAAO,MAAO,QAAO,EAAE,yCAAyC,EAAE,KAAK,KAAK,MAAM,OAAO,IAAI,EAAE,CAAC;AACpG,SAAO,EAAE,wCAAwC,EAAE,KAAK,KAAK,MAAM,OAAO,KAAK,EAAE,CAAC;AACpF;AASO,SAAS,aAAa,aAAqB,YAA6B;AAC7E,SAAO,gBAAgB;AACzB;AAUO,SAAS,aACd,UACA,eACA,eACe;AAEf,aAAW,SAAS,eAAe;AACjC,UAAM,OAAO,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,QAAQ;AACxD,QAAI,KAAM,QAAO,KAAK;AAAA,EACxB;AAGA,MAAI,gBAAgB,QAAQ,GAAG;AAC7B,WAAO,cAAc,QAAQ;AAAA,EAC/B;AAEA,SAAO;AACT;AASO,SAAS,mBACd,OACA,MACK;AACL,SAAO,MAAM,OAAO,CAAC,SAAS;AAE5B,QAAI,KAAK,YAAY,MAAO,QAAO;AAGnC,QAAI,CAAC,KAAK,YAAa,QAAO;AAC9B,QAAI,KAAK,gBAAgB,SAAU,QAAO,MAAM,gBAAgB;AAChE,QAAI,KAAK,gBAAgB,MAAO,QAAO,MAAM,aAAa;AAE1D,WAAO;AAAA,EACT,CAAC;AACH;AAOO,SAAS,yBAAiC;AAC/C,SAAO,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,CAAC;AACjE;","names":[]}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { DashboardLayoutConfig, DashboardUser, DashboardNotification, DashboardHeaderProps, DashboardSidebarProps, SidebarGroup } from '../domain/types/index.js';
|
|
3
|
-
import 'lucide-react';
|
|
4
|
-
|
|
5
|
-
interface DashboardLayoutProps {
|
|
6
|
-
/** Layout configuration */
|
|
7
|
-
config: DashboardLayoutConfig;
|
|
8
|
-
/** Auth user */
|
|
9
|
-
user?: DashboardUser;
|
|
10
|
-
/** Auth loading state */
|
|
11
|
-
authLoading?: boolean;
|
|
12
|
-
/** Authenticated state */
|
|
13
|
-
isAuthenticated?: boolean;
|
|
14
|
-
/** Notifications */
|
|
15
|
-
notifications?: DashboardNotification[];
|
|
16
|
-
/** Logout function */
|
|
17
|
-
onLogout?: () => Promise<void>;
|
|
18
|
-
/** Mark all as read function */
|
|
19
|
-
onMarkAllRead?: () => void;
|
|
20
|
-
/** Dismiss notification function */
|
|
21
|
-
onDismissNotification?: (id: string) => void;
|
|
22
|
-
/** Login route for redirect */
|
|
23
|
-
loginRoute?: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Dashboard Layout Component
|
|
27
|
-
*
|
|
28
|
-
* Main layout wrapper for dashboard pages.
|
|
29
|
-
* Provides sidebar, header, and content area with responsive design.
|
|
30
|
-
*
|
|
31
|
-
* Features:
|
|
32
|
-
* - Collapsible sidebar
|
|
33
|
-
* - Mobile menu overlay
|
|
34
|
-
* - Breadcrumb page titles
|
|
35
|
-
* - Loading skeletons
|
|
36
|
-
* - Auth protection
|
|
37
|
-
*
|
|
38
|
-
* @param props - Dashboard layout props
|
|
39
|
-
*/
|
|
40
|
-
declare const DashboardLayout: ({ config, user, authLoading, isAuthenticated, notifications, onLogout, onMarkAllRead, onDismissNotification, loginRoute, }: DashboardLayoutProps) => react_jsx_runtime.JSX.Element | null;
|
|
41
|
-
|
|
42
|
-
interface DashboardHeaderPropsExtended extends DashboardHeaderProps {
|
|
43
|
-
/** Auth user */
|
|
44
|
-
user?: DashboardUser;
|
|
45
|
-
/** Notifications */
|
|
46
|
-
notifications?: DashboardNotification[];
|
|
47
|
-
/** Logout function */
|
|
48
|
-
onLogout?: () => Promise<void>;
|
|
49
|
-
/** Mark all as read function */
|
|
50
|
-
onMarkAllRead?: () => void;
|
|
51
|
-
/** Dismiss notification function */
|
|
52
|
-
onDismissNotification?: (id: string) => void;
|
|
53
|
-
/** Format date function */
|
|
54
|
-
formatDate?: (date: Date | string | number) => string;
|
|
55
|
-
/** Settings route */
|
|
56
|
-
settingsRoute?: string;
|
|
57
|
-
/** Profile route */
|
|
58
|
-
profileRoute?: string;
|
|
59
|
-
/** Billing route */
|
|
60
|
-
billingRoute?: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Dashboard Header Component
|
|
64
|
-
*
|
|
65
|
-
* Displays top navigation bar with theme toggle, notifications,
|
|
66
|
-
* user menu, and organisation selector.
|
|
67
|
-
*
|
|
68
|
-
* @param props - Dashboard header props
|
|
69
|
-
*/
|
|
70
|
-
declare const DashboardHeader: ({ collapsed, setCollapsed, setMobileOpen, title, user, notifications, onLogout, onMarkAllRead, onDismissNotification, formatDate, settingsRoute, profileRoute, billingRoute, }: DashboardHeaderPropsExtended) => react_jsx_runtime.JSX.Element;
|
|
71
|
-
|
|
72
|
-
interface DashboardSidebarPropsExtended extends DashboardSidebarProps {
|
|
73
|
-
/** Sidebar groups configuration */
|
|
74
|
-
sidebarGroups: SidebarGroup[];
|
|
75
|
-
/** Brand name */
|
|
76
|
-
brandName?: string;
|
|
77
|
-
/** Brand tagline */
|
|
78
|
-
brandTagline?: string;
|
|
79
|
-
/** Create post route */
|
|
80
|
-
createPostRoute?: string;
|
|
81
|
-
/** Auth user */
|
|
82
|
-
user?: DashboardUser;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Dashboard Sidebar Component
|
|
86
|
-
*
|
|
87
|
-
* Displays collapsible sidebar with navigation menu items.
|
|
88
|
-
* Supports app-based filtering (mobile/web) and collapsible groups.
|
|
89
|
-
*
|
|
90
|
-
* @param props - Dashboard sidebar props
|
|
91
|
-
*/
|
|
92
|
-
declare const DashboardSidebar: ({ collapsed, setCollapsed, sidebarGroups, brandName, brandTagline, createPostRoute, user, }: DashboardSidebarPropsExtended) => react_jsx_runtime.JSX.Element;
|
|
93
|
-
|
|
94
|
-
interface BrandLogoProps {
|
|
95
|
-
className?: string;
|
|
96
|
-
size?: number;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* BrandLogo Component
|
|
100
|
-
*
|
|
101
|
-
* Displays the application brand logo as an SVG.
|
|
102
|
-
* Supports custom sizing and styling through className.
|
|
103
|
-
*
|
|
104
|
-
* @param className - Optional CSS classes for styling
|
|
105
|
-
* @param size - Width and height in pixels (default: 32)
|
|
106
|
-
*/
|
|
107
|
-
declare const BrandLogo: ({ className, size }: BrandLogoProps) => react_jsx_runtime.JSX.Element;
|
|
108
|
-
|
|
109
|
-
export { BrandLogo, DashboardHeader, DashboardLayout, DashboardSidebar };
|