@xynolog/react-ui 0.8.0 → 0.8.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/README.md +26 -46
- package/package.json +12 -9
- package/src/components/Button/Button.tsx +0 -188
- package/src/components/Button/__tests__/Button.test.tsx +0 -449
- package/src/components/CodeMirrorRenderer.tsx +0 -536
- package/src/components/DelegateProgress.tsx +0 -308
- package/src/components/ErrorBoundary.tsx +0 -174
- package/src/components/ItemFoundLog.tsx +0 -42
- package/src/components/LiveRegion.tsx +0 -261
- package/src/components/ProtectedErrorBoundary.tsx +0 -114
- package/src/components/ResizeHandle.tsx +0 -167
- package/src/components/ResourceTagsInline.tsx +0 -120
- package/src/components/SessionExpiryBanner.tsx +0 -74
- package/src/components/SessionTimer.tsx +0 -17
- package/src/components/StatusDisplay.tsx +0 -131
- package/src/components/Toast.tsx +0 -217
- package/src/components/Toolbar.tsx +0 -194
- package/src/components/UserMenuSkeleton.tsx +0 -13
- package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
- package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
- package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
- package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
- package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
- package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
- package/src/components/__tests__/SessionTimer.test.tsx +0 -199
- package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
- package/src/components/__tests__/Toast.test.tsx +0 -96
- package/src/components/__tests__/Toolbar.test.tsx +0 -111
- package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
- package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
- package/src/components/annotation/AnnotateToolbar.tsx +0 -531
- package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
- package/src/components/annotation-popups/JsonLdView.tsx +0 -127
- package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
- package/src/components/branding/XynologBranding.tsx +0 -41
- package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
- package/src/components/error-states/ResourceErrorState.tsx +0 -30
- package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
- package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
- package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
- package/src/components/layout/LeftSidebar.tsx +0 -150
- package/src/components/layout/PageLayout.tsx +0 -49
- package/src/components/layout/SkipLinks.tsx +0 -36
- package/src/components/layout/UnifiedHeader.tsx +0 -151
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
- package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
- package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
- package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
- package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
- package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
- package/src/components/modals/ComposeStep.tsx +0 -245
- package/src/components/modals/ConfigureGatherStep.tsx +0 -110
- package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
- package/src/components/modals/ConfigureSearchStep.tsx +0 -124
- package/src/components/modals/ContextSummary.tsx +0 -317
- package/src/components/modals/CorpusPane.tsx +0 -96
- package/src/components/modals/DiscardPrompt.tsx +0 -44
- package/src/components/modals/GatherContextStep.tsx +0 -480
- package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
- package/src/components/modals/PermissionDeniedModal.tsx +0 -207
- package/src/components/modals/ReferenceWizardModal.tsx +0 -656
- package/src/components/modals/ResourceGenerateModal.tsx +0 -457
- package/src/components/modals/SearchModal.tsx +0 -334
- package/src/components/modals/SearchResultsStep.tsx +0 -117
- package/src/components/modals/SessionEndedModal.tsx +0 -148
- package/src/components/modals/WizardFooter.tsx +0 -72
- package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
- package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
- package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
- package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
- package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
- package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
- package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
- package/src/components/navigation/NavigationMenu.tsx +0 -66
- package/src/components/navigation/ObservableLink.tsx +0 -90
- package/src/components/navigation/SimpleNavigation.tsx +0 -169
- package/src/components/navigation/SortableResourceTab.tsx +0 -122
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
- package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
- package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
- package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
- package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
- package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
- package/src/components/pdf-annotation/rects-for-page.ts +0 -50
- package/src/components/resource/AnnotateView.tsx +0 -373
- package/src/components/resource/AnnotationHistory.tsx +0 -169
- package/src/components/resource/BrowseView.tsx +0 -440
- package/src/components/resource/DownloadFileLink.tsx +0 -53
- package/src/components/resource/HistoryEvent.tsx +0 -186
- package/src/components/resource/ResourceViewer.tsx +0 -617
- package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
- package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
- package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
- package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
- package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
- package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
- package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
- package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
- package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
- package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
- package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
- package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
- package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
- package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
- package/src/components/resource/__tests__/download-link.test.tsx +0 -171
- package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
- package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
- package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
- package/src/components/resource/annotate-renderers.tsx +0 -186
- package/src/components/resource/browse-renderers.tsx +0 -133
- package/src/components/resource/event-formatting.ts +0 -393
- package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
- package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
- package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
- package/src/components/resource/panels/CommentEntry.tsx +0 -242
- package/src/components/resource/panels/CommentsPanel.tsx +0 -320
- package/src/components/resource/panels/DelegateSection.tsx +0 -282
- package/src/components/resource/panels/DelegateShell.tsx +0 -134
- package/src/components/resource/panels/HighlightEntry.tsx +0 -83
- package/src/components/resource/panels/HighlightPanel.tsx +0 -212
- package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
- package/src/components/resource/panels/PanelHeader.tsx +0 -22
- package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
- package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
- package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
- package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
- package/src/components/resource/panels/TagEntry.tsx +0 -87
- package/src/components/resource/panels/TaggingPanel.tsx +0 -554
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
- package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
- package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
- package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
- package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
- package/src/components/resource/panels/agent-label.ts +0 -35
- package/src/components/settings/SettingsPanel.tsx +0 -251
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
- package/src/components/viewers/ImageViewer.tsx +0 -18
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
- package/src/components/viewers/index.ts +0 -1
- package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
- package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
- package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
- package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
- package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
- package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
- package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
- package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
- package/src/features/resource-viewer/generation-params.ts +0 -23
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
DndContext,
|
|
6
|
-
closestCenter,
|
|
7
|
-
KeyboardSensor,
|
|
8
|
-
PointerSensor,
|
|
9
|
-
useSensor,
|
|
10
|
-
useSensors,
|
|
11
|
-
DragEndEvent,
|
|
12
|
-
DragStartEvent,
|
|
13
|
-
} from '@dnd-kit/core';
|
|
14
|
-
import {
|
|
15
|
-
SortableContext,
|
|
16
|
-
sortableKeyboardCoordinates,
|
|
17
|
-
verticalListSortingStrategy,
|
|
18
|
-
} from '@dnd-kit/sortable';
|
|
19
|
-
import { SortableResourceTab } from './SortableResourceTab';
|
|
20
|
-
import { useDragAnnouncements } from '../../hooks/useDragAnnouncements';
|
|
21
|
-
import { useTranslations } from '../../contexts/TranslationContext';
|
|
22
|
-
import { useXynolog } from '../../session/XynologProvider';
|
|
23
|
-
import type { CollapsibleResourceNavigationProps } from '../../types/collapsible-navigation';
|
|
24
|
-
import './CollapsibleResourceNavigation.css';
|
|
25
|
-
import type { ResourceId } from '@xynolog/core';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A comprehensive collapsible navigation component with fixed items and dynamic resource tabs.
|
|
29
|
-
* Supports drag and drop for resource reordering when expanded.
|
|
30
|
-
* Platform-agnostic design for use across different React environments.
|
|
31
|
-
*
|
|
32
|
-
* @emits tabs:reorder - Resource tab reordered. Payload: { oldIndex: number, newIndex: number }
|
|
33
|
-
* @emits tabs:close - Resource tab closed. Payload: { resourceId: ResourceId }
|
|
34
|
-
* @emits shell:sidebar-toggle - Toggle sidebar collapsed/expanded state. Payload: undefined
|
|
35
|
-
*/
|
|
36
|
-
export function CollapsibleResourceNavigation({
|
|
37
|
-
fixedItems,
|
|
38
|
-
resources,
|
|
39
|
-
isCollapsed,
|
|
40
|
-
currentPath,
|
|
41
|
-
Link,
|
|
42
|
-
onNavigate,
|
|
43
|
-
getResourceHref,
|
|
44
|
-
className = '',
|
|
45
|
-
translations = {},
|
|
46
|
-
icons,
|
|
47
|
-
navigationMenu,
|
|
48
|
-
}: CollapsibleResourceNavigationProps) {
|
|
49
|
-
const ChevronLeftIcon = icons.chevronLeft;
|
|
50
|
-
const BarsIcon = icons.bars;
|
|
51
|
-
|
|
52
|
-
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
53
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
announcePickup,
|
|
57
|
-
announceDrop,
|
|
58
|
-
announceKeyboardReorder,
|
|
59
|
-
announceCannotMove,
|
|
60
|
-
} = useDragAnnouncements();
|
|
61
|
-
const t = useTranslations('CollapsibleResourceNavigation');
|
|
62
|
-
const xynolog = useXynolog();
|
|
63
|
-
|
|
64
|
-
// A translation passed as a prop overrides the one from context
|
|
65
|
-
const mergedTranslations = {
|
|
66
|
-
title: translations?.title || t('title'),
|
|
67
|
-
collapseSidebar: translations?.collapseSidebar || t('collapseSidebar'),
|
|
68
|
-
expandSidebar: translations?.expandSidebar || t('expandSidebar'),
|
|
69
|
-
dragToReorder: translations?.dragToReorder || t('dragToReorder'),
|
|
70
|
-
dragToReorderDoc: translations?.dragToReorderDoc || t('dragToReorderDoc'),
|
|
71
|
-
closeResource: translations?.closeResource || t('closeResource'),
|
|
72
|
-
dragInstructions: translations?.dragInstructions || t('dragInstructions'),
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
76
|
-
const closeDropdown = () => setIsDropdownOpen(false);
|
|
77
|
-
|
|
78
|
-
// Close dropdown when clicking outside
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
81
|
-
if (
|
|
82
|
-
dropdownRef.current &&
|
|
83
|
-
!dropdownRef.current.contains(event.target as Node)
|
|
84
|
-
) {
|
|
85
|
-
closeDropdown();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
if (isDropdownOpen) {
|
|
90
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
91
|
-
return () =>
|
|
92
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
93
|
-
}
|
|
94
|
-
return undefined;
|
|
95
|
-
}, [isDropdownOpen]);
|
|
96
|
-
|
|
97
|
-
// Setup drag and drop sensors
|
|
98
|
-
const sensors = useSensors(
|
|
99
|
-
useSensor(PointerSensor, {
|
|
100
|
-
activationConstraint: {
|
|
101
|
-
distance: 8,
|
|
102
|
-
},
|
|
103
|
-
}),
|
|
104
|
-
useSensor(KeyboardSensor, {
|
|
105
|
-
coordinateGetter: sortableKeyboardCoordinates,
|
|
106
|
-
}),
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// Handle keyboard reordering (Alt+Up/Down arrows)
|
|
110
|
-
const handleKeyboardReorder = useCallback(
|
|
111
|
-
(resourceId: ResourceId, direction: 'up' | 'down') => {
|
|
112
|
-
const currentIndex = resources.findIndex((r) => r.id === resourceId);
|
|
113
|
-
if (currentIndex === -1) return;
|
|
114
|
-
|
|
115
|
-
const newIndex = direction === 'up' ? currentIndex - 1 : currentIndex + 1;
|
|
116
|
-
|
|
117
|
-
// Check bounds
|
|
118
|
-
if (newIndex < 0 || newIndex >= resources.length) {
|
|
119
|
-
announceCannotMove(direction);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Emit event
|
|
124
|
-
xynolog.emit('tabs:reorder', { oldIndex: currentIndex, newIndex });
|
|
125
|
-
|
|
126
|
-
// Announce the change
|
|
127
|
-
const resource = resources[currentIndex];
|
|
128
|
-
announceKeyboardReorder(
|
|
129
|
-
resource.name,
|
|
130
|
-
direction,
|
|
131
|
-
newIndex + 1,
|
|
132
|
-
resources.length,
|
|
133
|
-
);
|
|
134
|
-
},
|
|
135
|
-
[resources, xynolog],
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
// Handle resource close
|
|
139
|
-
const handleResourceClose = (resourceId: ResourceId, e: React.MouseEvent) => {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
e.stopPropagation();
|
|
142
|
-
|
|
143
|
-
// Emit event
|
|
144
|
-
xynolog.emit('tabs:close', { resourceId });
|
|
145
|
-
|
|
146
|
-
// If we're closing the currently viewed resource, navigate to first fixed item or trigger callback
|
|
147
|
-
const resourceHref = getResourceHref(resourceId);
|
|
148
|
-
if (currentPath === resourceHref && onNavigate && fixedItems.length > 0) {
|
|
149
|
-
onNavigate(fixedItems[0].href);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// Handle drag start
|
|
154
|
-
const handleDragStart = (event: DragStartEvent) => {
|
|
155
|
-
const { active } = event;
|
|
156
|
-
const resource = resources.find((r) => r.id === active.id);
|
|
157
|
-
if (resource) {
|
|
158
|
-
const index = resources.indexOf(resource);
|
|
159
|
-
announcePickup(resource.name, index + 1, resources.length);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// Handle drag end for resource reordering
|
|
164
|
-
const handleDragEnd = (event: DragEndEvent) => {
|
|
165
|
-
const { active, over } = event;
|
|
166
|
-
|
|
167
|
-
if (over && active.id !== over.id) {
|
|
168
|
-
const oldIndex = resources.findIndex(
|
|
169
|
-
(resource) => resource.id === active.id,
|
|
170
|
-
);
|
|
171
|
-
const newIndex = resources.findIndex(
|
|
172
|
-
(resource) => resource.id === over.id,
|
|
173
|
-
);
|
|
174
|
-
if (oldIndex !== -1 && newIndex !== -1) {
|
|
175
|
-
// Emit event
|
|
176
|
-
xynolog.emit('tabs:reorder', { oldIndex, newIndex });
|
|
177
|
-
const resource = resources[oldIndex];
|
|
178
|
-
announceDrop(resource.name, newIndex + 1, resources.length);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
<div className={`xynolog-collapsible-nav ${className}`}>
|
|
185
|
-
{/* Screen reader instructions for drag and drop */}
|
|
186
|
-
<div id="drag-instructions" className="sr-only" aria-live="polite">
|
|
187
|
-
{mergedTranslations.dragInstructions}
|
|
188
|
-
</div>
|
|
189
|
-
|
|
190
|
-
{/* Keyboard reordering instructions (announced once) */}
|
|
191
|
-
<div className="sr-only" role="status" aria-atomic="true">
|
|
192
|
-
Resources can be reordered using Alt+Up or Alt+Down arrow keys.
|
|
193
|
-
</div>
|
|
194
|
-
|
|
195
|
-
<div className="xynolog-collapsible-nav__container">
|
|
196
|
-
{/* Section header with collapse/expand button and optional dropdown */}
|
|
197
|
-
<div
|
|
198
|
-
style={{ position: 'relative' }}
|
|
199
|
-
ref={navigationMenu ? dropdownRef : undefined}
|
|
200
|
-
>
|
|
201
|
-
<div className="xynolog-nav-section__header">
|
|
202
|
-
{!isCollapsed && navigationMenu && (
|
|
203
|
-
<button
|
|
204
|
-
onClick={toggleDropdown}
|
|
205
|
-
className="xynolog-nav-section__header-text"
|
|
206
|
-
aria-expanded={isDropdownOpen}
|
|
207
|
-
aria-haspopup="true"
|
|
208
|
-
type="button"
|
|
209
|
-
>
|
|
210
|
-
{mergedTranslations.title}
|
|
211
|
-
</button>
|
|
212
|
-
)}
|
|
213
|
-
{!isCollapsed && !navigationMenu && (
|
|
214
|
-
<span className="xynolog-nav-section__header-text">
|
|
215
|
-
{mergedTranslations.title}
|
|
216
|
-
</span>
|
|
217
|
-
)}
|
|
218
|
-
<button
|
|
219
|
-
onClick={() => xynolog.emit('shell:sidebar-toggle', undefined)}
|
|
220
|
-
className="xynolog-nav-section__header-icon"
|
|
221
|
-
title={
|
|
222
|
-
isCollapsed
|
|
223
|
-
? mergedTranslations.expandSidebar
|
|
224
|
-
: mergedTranslations.collapseSidebar
|
|
225
|
-
}
|
|
226
|
-
aria-label={
|
|
227
|
-
isCollapsed
|
|
228
|
-
? mergedTranslations.expandSidebar
|
|
229
|
-
: mergedTranslations.collapseSidebar
|
|
230
|
-
}
|
|
231
|
-
type="button"
|
|
232
|
-
>
|
|
233
|
-
{!isCollapsed ? <ChevronLeftIcon /> : <BarsIcon />}
|
|
234
|
-
</button>
|
|
235
|
-
</div>
|
|
236
|
-
|
|
237
|
-
{isDropdownOpen && navigationMenu && !isCollapsed && (
|
|
238
|
-
<div className="xynolog-nav-section__dropdown">
|
|
239
|
-
{navigationMenu(closeDropdown)}
|
|
240
|
-
</div>
|
|
241
|
-
)}
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
{/* Fixed navigation tabs */}
|
|
245
|
-
{!isCollapsed && (
|
|
246
|
-
<nav className="xynolog-nav-tabs">
|
|
247
|
-
{fixedItems.map((item) => {
|
|
248
|
-
const isActive = currentPath === item.href;
|
|
249
|
-
return (
|
|
250
|
-
<Link
|
|
251
|
-
key={item.href}
|
|
252
|
-
href={item.href}
|
|
253
|
-
className={`xynolog-nav-tab ${isActive ? 'xynolog-nav-tab--active' : ''}`}
|
|
254
|
-
title={item.description || item.name}
|
|
255
|
-
aria-current={isActive ? 'page' : undefined}
|
|
256
|
-
>
|
|
257
|
-
<item.icon
|
|
258
|
-
className="xynolog-nav-tab__icon"
|
|
259
|
-
aria-hidden="true"
|
|
260
|
-
/>
|
|
261
|
-
<span className="xynolog-nav-tab__text">{item.name}</span>
|
|
262
|
-
</Link>
|
|
263
|
-
);
|
|
264
|
-
})}
|
|
265
|
-
</nav>
|
|
266
|
-
)}
|
|
267
|
-
|
|
268
|
-
{/* Collapsed state - show fixed items as icon-only */}
|
|
269
|
-
{isCollapsed && (
|
|
270
|
-
<nav className="xynolog-nav-tabs">
|
|
271
|
-
{fixedItems.map((item) => {
|
|
272
|
-
const isActive = currentPath === item.href;
|
|
273
|
-
return (
|
|
274
|
-
<Link
|
|
275
|
-
key={item.href}
|
|
276
|
-
href={item.href}
|
|
277
|
-
className={`xynolog-nav-tab ${isActive ? 'xynolog-nav-tab--active' : ''}`}
|
|
278
|
-
title={item.description || item.name}
|
|
279
|
-
aria-current={isActive ? 'page' : undefined}
|
|
280
|
-
aria-label={item.name}
|
|
281
|
-
>
|
|
282
|
-
<item.icon
|
|
283
|
-
className="xynolog-nav-tab__icon"
|
|
284
|
-
aria-hidden="true"
|
|
285
|
-
/>
|
|
286
|
-
</Link>
|
|
287
|
-
);
|
|
288
|
-
})}
|
|
289
|
-
</nav>
|
|
290
|
-
)}
|
|
291
|
-
|
|
292
|
-
{/* Resource tabs with drag and drop */}
|
|
293
|
-
<div
|
|
294
|
-
className="xynolog-resource-tabs"
|
|
295
|
-
role="tablist"
|
|
296
|
-
aria-label="Open resources"
|
|
297
|
-
>
|
|
298
|
-
{isCollapsed ? (
|
|
299
|
-
// When collapsed, dragging is disabled - just render simple tabs
|
|
300
|
-
resources.map((resource) => {
|
|
301
|
-
const resourceHref = getResourceHref(resource.id);
|
|
302
|
-
const isActive = currentPath === resourceHref;
|
|
303
|
-
|
|
304
|
-
return (
|
|
305
|
-
<SortableResourceTab
|
|
306
|
-
key={resource.id}
|
|
307
|
-
resource={resource}
|
|
308
|
-
isCollapsed={isCollapsed}
|
|
309
|
-
isActive={isActive}
|
|
310
|
-
href={resourceHref}
|
|
311
|
-
onClose={handleResourceClose}
|
|
312
|
-
Link={Link}
|
|
313
|
-
translations={{
|
|
314
|
-
dragToReorder: mergedTranslations.dragToReorder,
|
|
315
|
-
dragToReorderDoc: mergedTranslations.dragToReorderDoc,
|
|
316
|
-
closeResource: mergedTranslations.closeResource,
|
|
317
|
-
}}
|
|
318
|
-
/>
|
|
319
|
-
);
|
|
320
|
-
})
|
|
321
|
-
) : (
|
|
322
|
-
// When expanded, enable drag and drop
|
|
323
|
-
<DndContext
|
|
324
|
-
sensors={sensors}
|
|
325
|
-
collisionDetection={closestCenter}
|
|
326
|
-
onDragStart={handleDragStart}
|
|
327
|
-
onDragEnd={handleDragEnd}
|
|
328
|
-
>
|
|
329
|
-
<SortableContext
|
|
330
|
-
items={resources.map((resource) => resource.id)}
|
|
331
|
-
strategy={verticalListSortingStrategy}
|
|
332
|
-
>
|
|
333
|
-
{resources.map((resource, index) => {
|
|
334
|
-
const resourceHref = getResourceHref(resource.id);
|
|
335
|
-
const isActive = currentPath === resourceHref;
|
|
336
|
-
|
|
337
|
-
return (
|
|
338
|
-
<SortableResourceTab
|
|
339
|
-
key={resource.id}
|
|
340
|
-
resource={resource}
|
|
341
|
-
isCollapsed={isCollapsed}
|
|
342
|
-
isActive={isActive}
|
|
343
|
-
href={resourceHref}
|
|
344
|
-
onClose={handleResourceClose}
|
|
345
|
-
onReorder={handleKeyboardReorder}
|
|
346
|
-
index={index}
|
|
347
|
-
totalCount={resources.length}
|
|
348
|
-
Link={Link}
|
|
349
|
-
translations={{
|
|
350
|
-
dragToReorder: mergedTranslations.dragToReorder,
|
|
351
|
-
dragToReorderDoc: mergedTranslations.dragToReorderDoc,
|
|
352
|
-
closeResource: mergedTranslations.closeResource,
|
|
353
|
-
}}
|
|
354
|
-
/>
|
|
355
|
-
);
|
|
356
|
-
})}
|
|
357
|
-
</SortableContext>
|
|
358
|
-
</DndContext>
|
|
359
|
-
)}
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</div>
|
|
363
|
-
);
|
|
364
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import type {
|
|
5
|
-
RouteBuilder,
|
|
6
|
-
LinkComponentProps,
|
|
7
|
-
} from '../../contexts/RoutingContext';
|
|
8
|
-
import type { TranslateFn } from '../../types/translation';
|
|
9
|
-
import './NavigationMenu.css';
|
|
10
|
-
|
|
11
|
-
interface NavigationMenuProps {
|
|
12
|
-
Link: React.ComponentType<LinkComponentProps>;
|
|
13
|
-
routes: Partial<RouteBuilder>;
|
|
14
|
-
t: TranslateFn;
|
|
15
|
-
brandingLink?: string;
|
|
16
|
-
onItemClick?: () => void;
|
|
17
|
-
className?: string;
|
|
18
|
-
currentPath?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function NavigationMenu({
|
|
22
|
-
Link,
|
|
23
|
-
routes,
|
|
24
|
-
t,
|
|
25
|
-
onItemClick,
|
|
26
|
-
className = '',
|
|
27
|
-
currentPath,
|
|
28
|
-
}: NavigationMenuProps) {
|
|
29
|
-
const navClassName = className
|
|
30
|
-
? `xynolog-navigation-menu ${className}`
|
|
31
|
-
: 'xynolog-navigation-menu';
|
|
32
|
-
|
|
33
|
-
// Helper to check if a path is current
|
|
34
|
-
const isCurrentPage = (path: string) => {
|
|
35
|
-
if (!currentPath) return false;
|
|
36
|
-
// Exact match or starts with path followed by /
|
|
37
|
-
return currentPath === path || currentPath.startsWith(path + '/');
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<nav className={navClassName} aria-label="Main navigation">
|
|
42
|
-
<Link
|
|
43
|
-
href={routes.knowledge?.() || '/know'}
|
|
44
|
-
{...(onItemClick && { onClick: onItemClick })}
|
|
45
|
-
className="xynolog-navigation-menu__link"
|
|
46
|
-
aria-current={
|
|
47
|
-
isCurrentPage(routes.knowledge?.() || '/know') ? 'page' : undefined
|
|
48
|
-
}
|
|
49
|
-
>
|
|
50
|
-
{t('know')}
|
|
51
|
-
</Link>
|
|
52
|
-
|
|
53
|
-
<hr className="xynolog-navigation-menu__divider" />
|
|
54
|
-
<Link
|
|
55
|
-
href={routes.moderate?.() || '/moderate'}
|
|
56
|
-
{...(onItemClick && { onClick: onItemClick })}
|
|
57
|
-
className="xynolog-navigation-menu__link"
|
|
58
|
-
aria-current={
|
|
59
|
-
isCurrentPage(routes.moderate?.() || '/moderate') ? 'page' : undefined
|
|
60
|
-
}
|
|
61
|
-
>
|
|
62
|
-
{t('moderate')}
|
|
63
|
-
</Link>
|
|
64
|
-
</nav>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useRef, useEffect } from 'react';
|
|
4
|
-
import { useXynolog } from '../../session/XynologProvider';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Props for ObservableLink component
|
|
8
|
-
*
|
|
9
|
-
* Accepts any props that a standard anchor element accepts,
|
|
10
|
-
* plus optional navigation metadata for event emission.
|
|
11
|
-
*/
|
|
12
|
-
export interface ObservableLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
13
|
-
/** The URL to navigate to */
|
|
14
|
-
href: string;
|
|
15
|
-
/** Optional label for the link (used in event metadata) */
|
|
16
|
-
label?: string;
|
|
17
|
-
/** Children to render inside the link */
|
|
18
|
-
children: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Link component that emits navigation events for observability
|
|
23
|
-
*
|
|
24
|
-
* Use this instead of Next.js <Link> when you want link clicks to be
|
|
25
|
-
* observable through the NavigationEventBus. This is useful for:
|
|
26
|
-
* - Analytics tracking
|
|
27
|
-
* - State coordination before navigation
|
|
28
|
-
* - Logging navigation flows
|
|
29
|
-
*
|
|
30
|
-
* The component emits 'nav:link-clicked' event before allowing
|
|
31
|
-
* the browser to follow the link.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* <ObservableLink
|
|
36
|
-
* href="/know/discover"
|
|
37
|
-
* label="Discover"
|
|
38
|
-
* >
|
|
39
|
-
* Discover Resources
|
|
40
|
-
* </ObservableLink>
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @example With Next.js Link integration
|
|
44
|
-
* ```typescript
|
|
45
|
-
* import Link from 'next/link';
|
|
46
|
-
*
|
|
47
|
-
* <Link href="/know/discover" legacyBehavior passHref>
|
|
48
|
-
* <ObservableLink label="Discover">
|
|
49
|
-
* Discover Resources
|
|
50
|
-
* </ObservableLink>
|
|
51
|
-
* </Link>
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @emits nav:link-clicked - Link clicked by user. Payload: { href: string, label?: string }
|
|
55
|
-
*/
|
|
56
|
-
export function ObservableLink({
|
|
57
|
-
href,
|
|
58
|
-
label,
|
|
59
|
-
onClick,
|
|
60
|
-
children,
|
|
61
|
-
...anchorProps
|
|
62
|
-
}: ObservableLinkProps) {
|
|
63
|
-
const xynolog = useXynolog();
|
|
64
|
-
|
|
65
|
-
// Store callback in ref to avoid including in dependency arrays
|
|
66
|
-
const onClickRef = useRef(onClick);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
onClickRef.current = onClick;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const handleClick = useCallback(
|
|
72
|
-
(e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
73
|
-
// Emit event for observability
|
|
74
|
-
xynolog.emit('nav:link-clicked', {
|
|
75
|
-
href,
|
|
76
|
-
label,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Call original onClick if provided
|
|
80
|
-
onClickRef.current?.(e);
|
|
81
|
-
},
|
|
82
|
-
[href, label, xynolog],
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<a href={href} onClick={handleClick} {...anchorProps}>
|
|
87
|
-
{children}
|
|
88
|
-
</a>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { useXynolog } from '../../session/XynologProvider';
|
|
5
|
-
import type { LinkComponentProps } from '../../contexts/RoutingContext';
|
|
6
|
-
|
|
7
|
-
export interface SimpleNavigationItem {
|
|
8
|
-
name: string;
|
|
9
|
-
href: string;
|
|
10
|
-
icon: React.ComponentType<{ className?: string }>;
|
|
11
|
-
description?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface SimpleNavigationProps {
|
|
15
|
-
title: string;
|
|
16
|
-
items: SimpleNavigationItem[];
|
|
17
|
-
currentPath: string;
|
|
18
|
-
Link: React.ComponentType<LinkComponentProps>;
|
|
19
|
-
dropdownContent?: (onClose: () => void) => React.ReactNode;
|
|
20
|
-
isCollapsed: boolean;
|
|
21
|
-
icons: {
|
|
22
|
-
chevronLeft: React.ComponentType<{ className?: string }>;
|
|
23
|
-
bars: React.ComponentType<{ className?: string }>;
|
|
24
|
-
};
|
|
25
|
-
collapseSidebarLabel: string;
|
|
26
|
-
expandSidebarLabel: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Simple navigation component for Admin and Moderation modes.
|
|
31
|
-
* Renders a section header with optional dropdown and static navigation tabs.
|
|
32
|
-
*
|
|
33
|
-
* @emits shell:sidebar-toggle - Toggle sidebar collapsed/expanded state. Payload: undefined
|
|
34
|
-
*/
|
|
35
|
-
export function SimpleNavigation({
|
|
36
|
-
title,
|
|
37
|
-
items,
|
|
38
|
-
currentPath,
|
|
39
|
-
Link,
|
|
40
|
-
dropdownContent,
|
|
41
|
-
isCollapsed,
|
|
42
|
-
icons,
|
|
43
|
-
collapseSidebarLabel,
|
|
44
|
-
expandSidebarLabel,
|
|
45
|
-
}: SimpleNavigationProps) {
|
|
46
|
-
const ChevronLeftIcon = icons.chevronLeft;
|
|
47
|
-
const BarsIcon = icons.bars;
|
|
48
|
-
|
|
49
|
-
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
50
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
51
|
-
const xynolog = useXynolog();
|
|
52
|
-
|
|
53
|
-
const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
|
|
54
|
-
const closeDropdown = () => setIsDropdownOpen(false);
|
|
55
|
-
|
|
56
|
-
// Close dropdown when clicking outside
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const handleClickOutside = (event: MouseEvent) => {
|
|
59
|
-
if (
|
|
60
|
-
dropdownRef.current &&
|
|
61
|
-
!dropdownRef.current.contains(event.target as Node)
|
|
62
|
-
) {
|
|
63
|
-
closeDropdown();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
if (isDropdownOpen) {
|
|
68
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
69
|
-
return () =>
|
|
70
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
71
|
-
}
|
|
72
|
-
return undefined;
|
|
73
|
-
}, [isDropdownOpen]);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<div className="xynolog-simple-nav">
|
|
77
|
-
{/* Section header with collapse/expand button and optional dropdown */}
|
|
78
|
-
<div
|
|
79
|
-
style={{ position: 'relative' }}
|
|
80
|
-
ref={dropdownContent ? dropdownRef : undefined}
|
|
81
|
-
>
|
|
82
|
-
<div className="xynolog-nav-section__header">
|
|
83
|
-
{dropdownContent ? (
|
|
84
|
-
<button
|
|
85
|
-
onClick={toggleDropdown}
|
|
86
|
-
className="xynolog-nav-section__header-button"
|
|
87
|
-
aria-expanded={isDropdownOpen}
|
|
88
|
-
aria-haspopup="true"
|
|
89
|
-
type="button"
|
|
90
|
-
>
|
|
91
|
-
{!isCollapsed && (
|
|
92
|
-
<span className="xynolog-nav-section__header-text">
|
|
93
|
-
{title}
|
|
94
|
-
</span>
|
|
95
|
-
)}
|
|
96
|
-
</button>
|
|
97
|
-
) : (
|
|
98
|
-
!isCollapsed && (
|
|
99
|
-
<span className="xynolog-nav-section__header-text">{title}</span>
|
|
100
|
-
)
|
|
101
|
-
)}
|
|
102
|
-
<button
|
|
103
|
-
onClick={() => xynolog.emit('shell:sidebar-toggle', undefined)}
|
|
104
|
-
className="xynolog-nav-section__header-icon"
|
|
105
|
-
title={isCollapsed ? expandSidebarLabel : collapseSidebarLabel}
|
|
106
|
-
aria-label={isCollapsed ? expandSidebarLabel : collapseSidebarLabel}
|
|
107
|
-
type="button"
|
|
108
|
-
>
|
|
109
|
-
{!isCollapsed ? <ChevronLeftIcon /> : <BarsIcon />}
|
|
110
|
-
</button>
|
|
111
|
-
</div>
|
|
112
|
-
|
|
113
|
-
{isDropdownOpen && dropdownContent && !isCollapsed && (
|
|
114
|
-
<div className="xynolog-nav-section__dropdown">
|
|
115
|
-
{dropdownContent(closeDropdown)}
|
|
116
|
-
</div>
|
|
117
|
-
)}
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
{/* Static navigation tabs */}
|
|
121
|
-
{!isCollapsed && (
|
|
122
|
-
<nav className="xynolog-nav-tabs">
|
|
123
|
-
{items.map((item) => {
|
|
124
|
-
const isActive = currentPath === item.href;
|
|
125
|
-
return (
|
|
126
|
-
<Link
|
|
127
|
-
key={item.href}
|
|
128
|
-
href={item.href}
|
|
129
|
-
className={`xynolog-nav-tab ${isActive ? 'xynolog-nav-tab--active' : ''}`}
|
|
130
|
-
title={item.description || item.name}
|
|
131
|
-
aria-current={isActive ? 'page' : undefined}
|
|
132
|
-
>
|
|
133
|
-
<item.icon
|
|
134
|
-
className="xynolog-nav-tab__icon"
|
|
135
|
-
aria-hidden="true"
|
|
136
|
-
/>
|
|
137
|
-
<span className="xynolog-nav-tab__text">{item.name}</span>
|
|
138
|
-
</Link>
|
|
139
|
-
);
|
|
140
|
-
})}
|
|
141
|
-
</nav>
|
|
142
|
-
)}
|
|
143
|
-
|
|
144
|
-
{/* Collapsed state - show icon-only tabs */}
|
|
145
|
-
{isCollapsed && (
|
|
146
|
-
<nav className="xynolog-nav-tabs">
|
|
147
|
-
{items.map((item) => {
|
|
148
|
-
const isActive = currentPath === item.href;
|
|
149
|
-
return (
|
|
150
|
-
<Link
|
|
151
|
-
key={item.href}
|
|
152
|
-
href={item.href}
|
|
153
|
-
className={`xynolog-nav-tab ${isActive ? 'xynolog-nav-tab--active' : ''}`}
|
|
154
|
-
title={item.description || item.name}
|
|
155
|
-
aria-current={isActive ? 'page' : undefined}
|
|
156
|
-
aria-label={item.name}
|
|
157
|
-
>
|
|
158
|
-
<item.icon
|
|
159
|
-
className="xynolog-nav-tab__icon"
|
|
160
|
-
aria-hidden="true"
|
|
161
|
-
/>
|
|
162
|
-
</Link>
|
|
163
|
-
);
|
|
164
|
-
})}
|
|
165
|
-
</nav>
|
|
166
|
-
)}
|
|
167
|
-
</div>
|
|
168
|
-
);
|
|
169
|
-
}
|