@umituz/web-dashboard 7.3.0 → 7.4.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-dashboard",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.1",
|
|
4
4
|
"description": "Installable app skeleton for the fleet — layouts, analytics (dependency-free SVG charts), calendar, onboarding flow permissions/module registry; udb-* stylesheet on design-system tokens",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -165,7 +165,7 @@ export const DashboardLayout = ({
|
|
|
165
165
|
...config.sidebarGroups.map((group) => ({
|
|
166
166
|
heading: group.title,
|
|
167
167
|
items: group.items.map((item) => ({
|
|
168
|
-
id: `nav-${item.path}`,
|
|
168
|
+
id: `nav-${item.path.replace(/[^a-zA-Z0-9_-]/g, '_')}`,
|
|
169
169
|
label: item.label,
|
|
170
170
|
icon: <item.icon size={16} aria-hidden="true" />,
|
|
171
171
|
hint: item.path,
|
|
@@ -263,9 +263,11 @@ export const DashboardLayout = ({
|
|
|
263
263
|
</div>
|
|
264
264
|
|
|
265
265
|
) : (
|
|
266
|
-
<
|
|
267
|
-
<
|
|
268
|
-
|
|
266
|
+
<div className="udb-layout__page">
|
|
267
|
+
<Suspense fallback={contentFallback ?? null}>
|
|
268
|
+
<Outlet />
|
|
269
|
+
</Suspense>
|
|
270
|
+
</div>
|
|
269
271
|
)}
|
|
270
272
|
</main>
|
|
271
273
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { hitsToCommandItems } from './hitsToCommandItems';
|
|
3
|
+
import type { SearchHit } from './searchItems';
|
|
4
|
+
|
|
5
|
+
const HITS: SearchHit[] = [
|
|
6
|
+
{ id: 'c2', title: 'IELTS reading sprint', subtitle: 'Skimming strategies', category: 'C1', to: '/courses/c2' },
|
|
7
|
+
{ id: 'c1', title: 'Present perfect workshop', subtitle: 'Have you ever…', category: 'B1', to: '/courses/c1' },
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
describe('hitsToCommandItems', () => {
|
|
11
|
+
it('maps hits to palette entries with title as label and category as hint', () => {
|
|
12
|
+
const items = hitsToCommandItems(HITS, vi.fn());
|
|
13
|
+
expect(items).toHaveLength(2);
|
|
14
|
+
expect(items[0]).toMatchObject({ id: 'c2', label: 'IELTS reading sprint', hint: 'C1' });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('carries subtitle+category as keywords so body-only matches survive the palette filter', () => {
|
|
18
|
+
const items = hitsToCommandItems(HITS, vi.fn());
|
|
19
|
+
expect(items[0]?.keywords).toBe('Skimming strategies C1');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('navigates to the hit route on select', () => {
|
|
23
|
+
const navigate = vi.fn();
|
|
24
|
+
const items = hitsToCommandItems(HITS, navigate);
|
|
25
|
+
items[1]?.onSelect();
|
|
26
|
+
expect(navigate).toHaveBeenCalledWith('/courses/c1');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('omits the hint when the category is blank', () => {
|
|
30
|
+
const hits: SearchHit[] = [{ id: 'x', title: 'Note', subtitle: 'Body', category: '', to: '/notes/x' }];
|
|
31
|
+
const items = hitsToCommandItems(hits, vi.fn());
|
|
32
|
+
expect(items[0]?.hint).toBeUndefined();
|
|
33
|
+
expect(items[0]?.keywords).toBe('Body');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('returns an empty array for empty hits', () => {
|
|
37
|
+
expect(hitsToCommandItems([], vi.fn())).toEqual([]);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CommandItem } from '@umituz/web-design-system/organisms';
|
|
2
|
+
import type { SearchHit } from './searchItems';
|
|
3
|
+
|
|
4
|
+
export type NavigateFn = (to: string) => void;
|
|
5
|
+
|
|
6
|
+
export function hitsToCommandItems(hits: readonly SearchHit[], navigate: NavigateFn): CommandItem[] {
|
|
7
|
+
return hits.map((hit) => ({
|
|
8
|
+
id: hit.id,
|
|
9
|
+
label: hit.title,
|
|
10
|
+
hint: hit.category || undefined,
|
|
11
|
+
keywords: `${hit.subtitle} ${hit.category}`.trim(),
|
|
12
|
+
onSelect: () => navigate(hit.to),
|
|
13
|
+
}));
|
|
14
|
+
}
|
package/src/styles/chrome.css
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
--udb-sidebar-border: var(--color-border);
|
|
27
27
|
--udb-sidebar-accent: var(--color-muted);
|
|
28
28
|
--udb-sidebar-accent-text: var(--color-foreground);
|
|
29
|
+
--udb-content-max-width: none;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.udb-root,
|
|
@@ -123,6 +124,11 @@
|
|
|
123
124
|
overflow-y: auto;
|
|
124
125
|
padding: var(--udb-space-4);
|
|
125
126
|
}
|
|
127
|
+
.udb-layout__page {
|
|
128
|
+
width: 100%;
|
|
129
|
+
margin: 0 auto;
|
|
130
|
+
max-width: var(--udb-content-max-width, none);
|
|
131
|
+
}
|
|
126
132
|
@media (min-width: 768px) {
|
|
127
133
|
.udb-layout__sidebar {
|
|
128
134
|
display: flex;
|