@liorian/sdk 0.28.0-alpha.56010ca
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 +483 -0
- package/package.json +94 -0
- package/schemas/module.schema.json +818 -0
- package/src/application/index.ts +3 -0
- package/src/application/module-instance.ts +36 -0
- package/src/application/service/auth-api-service.ts +291 -0
- package/src/application/service/auth-user.service.ts +108 -0
- package/src/application/service/index.ts +12 -0
- package/src/application/service/module-activation-api.service.ts +105 -0
- package/src/application/service/notifications-api-service.ts +38 -0
- package/src/application/service/notifications-push.service.ts +299 -0
- package/src/application/service/notifications-socket-service.ts +76 -0
- package/src/application/service/organizations-api-service.ts +104 -0
- package/src/application/service/otp-api-service.ts +11 -0
- package/src/application/service/storage-api-service.ts +77 -0
- package/src/application/service/storefront-api.service.ts +72 -0
- package/src/application/service/user-preferences-api.service.ts +57 -0
- package/src/domain/config/app.config.ts +35 -0
- package/src/domain/config/auth.config.ts +30 -0
- package/src/domain/config/index.ts +4 -0
- package/src/domain/config/logo.config.ts +17 -0
- package/src/domain/entities/activities.interface.ts +18 -0
- package/src/domain/entities/catalog.interface.ts +96 -0
- package/src/domain/entities/index.ts +13 -0
- package/src/domain/entities/media.ts +22 -0
- package/src/domain/entities/module-activation.interface.ts +173 -0
- package/src/domain/entities/module.interface.ts +101 -0
- package/src/domain/entities/notification.interface.ts +23 -0
- package/src/domain/entities/objectable.type.ts +3 -0
- package/src/domain/entities/organization.interface.ts +81 -0
- package/src/domain/entities/user-auth.interface.ts +17 -0
- package/src/domain/entities/user-phone.interface.ts +11 -0
- package/src/domain/entities/user-profile.interface.ts +23 -0
- package/src/domain/entities/user.interface.ts +79 -0
- package/src/domain/enums/coloring.enum.ts +6 -0
- package/src/domain/enums/domains.enum.ts +282 -0
- package/src/domain/enums/index.ts +8 -0
- package/src/domain/enums/module-category.enum.ts +57 -0
- package/src/domain/enums/module.enum.ts +97 -0
- package/src/domain/enums/routine.enum.ts +12 -0
- package/src/domain/enums/user-profile.enum.ts +25 -0
- package/src/domain/enums/user-status.enum.ts +7 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/typing/auth-caches.ts +12 -0
- package/src/domain/typing/auth-oauth.types.ts +172 -0
- package/src/domain/typing/devise.ts +2 -0
- package/src/domain/typing/index.ts +10 -0
- package/src/domain/typing/response.ts +30 -0
- package/src/domain/typing/routine.types.ts +113 -0
- package/src/domain/typing/session.interface.ts +28 -0
- package/src/domain/typing/statisticals.ts +11 -0
- package/src/domain/typing/user-media-upload.ts +9 -0
- package/src/domain/typing/values.ts +6 -0
- package/src/index.tsx +168 -0
- package/src/infrastructure/capabilities/cache-storage/capability.ts +129 -0
- package/src/infrastructure/capabilities/cache-storage/enum.ts +5 -0
- package/src/infrastructure/capabilities/cache-storage/index.ts +4 -0
- package/src/infrastructure/capabilities/cache-storage/types.ts +13 -0
- package/src/infrastructure/capabilities/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/capability.ts +55 -0
- package/src/infrastructure/capabilities/stackable/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/types.ts +24 -0
- package/src/infrastructure/common-classname.constant.ts +4 -0
- package/src/infrastructure/data/countries.ts +208 -0
- package/src/infrastructure/data/gender.ts +5 -0
- package/src/infrastructure/data/index.ts +3 -0
- package/src/infrastructure/dataset/index.ts +3 -0
- package/src/infrastructure/dataset/sign-in.dataset.ts +21 -0
- package/src/infrastructure/dataset/sign-up.dataset.ts +64 -0
- package/src/infrastructure/hooks/index.ts +10 -0
- package/src/infrastructure/hooks/use-activity-lock-draft.ts +69 -0
- package/src/infrastructure/hooks/use-auth.ts +24 -0
- package/src/infrastructure/hooks/use-elastic-interaction.ts +180 -0
- package/src/infrastructure/hooks/use-is-desktop.ts +25 -0
- package/src/infrastructure/hooks/use-is-tauri.ts +17 -0
- package/src/infrastructure/hooks/use-mobile.ts +19 -0
- package/src/infrastructure/hooks/use-notifications.ts +128 -0
- package/src/infrastructure/hooks/use-recent-colors.ts +113 -0
- package/src/infrastructure/hooks/use-recent-modules.ts +76 -0
- package/src/infrastructure/index.tsx +11 -0
- package/src/infrastructure/library/design-system.ts +95 -0
- package/src/infrastructure/library/index.tsx +5 -0
- package/src/infrastructure/library/motion-utils.ts +77 -0
- package/src/infrastructure/library/motion.tsx +31 -0
- package/src/infrastructure/library/scroll-progress.tsx +93 -0
- package/src/infrastructure/providers/auth-guard.provider.tsx +47 -0
- package/src/infrastructure/providers/auth.provider.tsx +168 -0
- package/src/infrastructure/providers/index.tsx +8 -0
- package/src/infrastructure/providers/module-usage.provider.tsx +95 -0
- package/src/infrastructure/providers/modules-guard.provider.tsx +64 -0
- package/src/infrastructure/providers/modules-routines.provider.tsx +33 -0
- package/src/infrastructure/providers/modules-switcher.provider.tsx +25 -0
- package/src/infrastructure/providers/query.provider.tsx +27 -0
- package/src/infrastructure/routines/__tests__/routine.test.ts +368 -0
- package/src/infrastructure/routines/index.tsx +3 -0
- package/src/infrastructure/routines/routine.hook.ts +121 -0
- package/src/infrastructure/routines/routine.ts +283 -0
- package/src/infrastructure/routines/routine.tsx +283 -0
- package/src/infrastructure/stores/activity-lock.store.ts +22 -0
- package/src/infrastructure/stores/auth-user-connected.store.ts +24 -0
- package/src/infrastructure/stores/dataset.store.ts +106 -0
- package/src/infrastructure/stores/index.ts +6 -0
- package/src/infrastructure/stores/module.store.ts +266 -0
- package/src/infrastructure/stores/upload.store.ts +198 -0
- package/src/infrastructure/utilities/access-label.util.ts +158 -0
- package/src/infrastructure/utilities/activities.util.tsx +54 -0
- package/src/infrastructure/utilities/activity-lock.service.ts +263 -0
- package/src/infrastructure/utilities/activity-tracker.service.ts +205 -0
- package/src/infrastructure/utilities/api-service.ts +237 -0
- package/src/infrastructure/utilities/auth-logout.util.ts +23 -0
- package/src/infrastructure/utilities/classname.util.ts +7 -0
- package/src/infrastructure/utilities/encryption.service.ts +125 -0
- package/src/infrastructure/utilities/form-snapshot.service.ts +304 -0
- package/src/infrastructure/utilities/format.util.ts +40 -0
- package/src/infrastructure/utilities/index.tsx +23 -0
- package/src/infrastructure/utilities/media-label.service.ts +47 -0
- package/src/infrastructure/utilities/modules.ts +11 -0
- package/src/infrastructure/utilities/permission.util.ts +22 -0
- package/src/infrastructure/utilities/push-permission.util.ts +43 -0
- package/src/infrastructure/utilities/route-access.ts +38 -0
- package/src/infrastructure/utilities/socket-service.ts +123 -0
- package/src/infrastructure/utilities/sso-auth.util.ts +188 -0
- package/src/infrastructure/utilities/stringable.util.ts +16 -0
- package/src/infrastructure/utilities/strings.util.ts +18 -0
- package/src/infrastructure/utilities/tauri.util.ts +15 -0
- package/src/infrastructure/utilities/utils.ts +6 -0
- package/src/infrastructure/utilities/values.ts +5 -0
- package/src/presentation/8starlabs-ui/button.tsx +94 -0
- package/src/presentation/8starlabs-ui/flip-clock.tsx +368 -0
- package/src/presentation/8starlabs-ui/heatmap.tsx +430 -0
- package/src/presentation/8starlabs-ui/hooks/index.tsx +2 -0
- package/src/presentation/8starlabs-ui/hooks/use-mobile.ts +21 -0
- package/src/presentation/8starlabs-ui/index.tsx +20 -0
- package/src/presentation/8starlabs-ui/json-viewer.tsx +972 -0
- package/src/presentation/8starlabs-ui/marquee.tsx +134 -0
- package/src/presentation/8starlabs-ui/partition-bar.tsx +198 -0
- package/src/presentation/8starlabs-ui/scroll-fade.tsx +158 -0
- package/src/presentation/8starlabs-ui/status-indicator.tsx +86 -0
- package/src/presentation/8starlabs-ui/system-banner.tsx +50 -0
- package/src/presentation/8starlabs-ui/timeline.tsx +576 -0
- package/src/presentation/8starlabs-ui/transport-badge.tsx +249 -0
- package/src/presentation/8starlabs-ui/ui/copy-button.tsx +60 -0
- package/src/presentation/8starlabs-ui/ui/index.tsx +2 -0
- package/src/presentation/analytics-section.tsx +85 -0
- package/src/presentation/app-sidebar.tsx +234 -0
- package/src/presentation/charts/area-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/area-widget.chart.tsx +128 -0
- package/src/presentation/charts/chart-widgets.types.ts +81 -0
- package/src/presentation/charts/index.tsx +16 -0
- package/src/presentation/charts/line-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/line-widget.chart.tsx +105 -0
- package/src/presentation/charts/pie-widget.chart-skeleton.tsx +56 -0
- package/src/presentation/charts/pie-widget.chart.tsx +168 -0
- package/src/presentation/charts/radar-widget.chart-skeleton.tsx +67 -0
- package/src/presentation/charts/radar-widget.chart.tsx +80 -0
- package/src/presentation/charts/radial-stacked-widget.chart-skeleton.tsx +66 -0
- package/src/presentation/charts/radial-stacked-widget.chart.tsx +120 -0
- package/src/presentation/charts/radial-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/radial-widget.chart.tsx +87 -0
- package/src/presentation/charts/tooltip-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/tooltip-widget.chart.tsx +89 -0
- package/src/presentation/components/activity-actions.tsx +20 -0
- package/src/presentation/components/activity-container.tsx +55 -0
- package/src/presentation/components/activity-content.tsx +20 -0
- package/src/presentation/components/activity-descriptor-parser.tsx +37 -0
- package/src/presentation/components/activity-header.tsx +20 -0
- package/src/presentation/components/activity-loader.tsx +19 -0
- package/src/presentation/components/activity-title.tsx +32 -0
- package/src/presentation/components/activity.tsx +22 -0
- package/src/presentation/components/auth/index.tsx +4 -0
- package/src/presentation/components/auth/sso-callback.view.tsx +44 -0
- package/src/presentation/components/auth/sso-disconnect.view.tsx +41 -0
- package/src/presentation/components/auth/sso-sign-in.view.tsx +29 -0
- package/src/presentation/components/auth-lock-screen.tsx +309 -0
- package/src/presentation/components/auth-session.view.tsx +17 -0
- package/src/presentation/components/data-table.tsx +814 -0
- package/src/presentation/components/dynamic-icon.tsx +16 -0
- package/src/presentation/components/floating-upload.tsx +291 -0
- package/src/presentation/components/index.tsx +40 -0
- package/src/presentation/components/local-time.tsx +170 -0
- package/src/presentation/components/markdown-parser.tsx +201 -0
- package/src/presentation/components/message-scroller.tsx +131 -0
- package/src/presentation/components/module-first-access-config.view.tsx +181 -0
- package/src/presentation/components/module-first-access-pending.view.tsx +38 -0
- package/src/presentation/components/module-guard.tsx +34 -0
- package/src/presentation/components/modules-first-access.guard.tsx +88 -0
- package/src/presentation/components/modules-guard-forbidden.tsx +46 -0
- package/src/presentation/components/notification-details.modal.tsx +145 -0
- package/src/presentation/components/notification-item.tsx +127 -0
- package/src/presentation/components/notifications-popover.tsx +128 -0
- package/src/presentation/components/push-notifications.provider.tsx +65 -0
- package/src/presentation/components/upload-progress-dialog.tsx +140 -0
- package/src/presentation/components/waiting-bar.tsx +22 -0
- package/src/presentation/components/waiting-section.tsx +15 -0
- package/src/presentation/components/waiting.tsx +14 -0
- package/src/presentation/data-grid/data-grid-empty.tsx +24 -0
- package/src/presentation/data-grid/data-grid-search-engine.tsx +32 -0
- package/src/presentation/data-grid/data-grid.tsx +892 -0
- package/src/presentation/data-grid/index.tsx +4 -0
- package/src/presentation/form-screen.tsx +95 -0
- package/src/presentation/icons/custom.tsx +20 -0
- package/src/presentation/icons/glyphIcons.tsx +53 -0
- package/src/presentation/icons/icons.enum.ts +4 -0
- package/src/presentation/icons/icons.util.ts +6 -0
- package/src/presentation/icons/index.tsx +8 -0
- package/src/presentation/icons/lucide.tsx +17 -0
- package/src/presentation/icons/remix.tsx +33 -0
- package/src/presentation/icons/types.ts +27 -0
- package/src/presentation/index.tsx +45 -0
- package/src/presentation/modals/components/ModalBox.tsx +74 -0
- package/src/presentation/modals/components/ModalPortal.tsx +31 -0
- package/src/presentation/modals/components/ModalStepper.tsx +319 -0
- package/src/presentation/modals/components/ModalWrapper.tsx +65 -0
- package/src/presentation/modals/components/index.tsx +5 -0
- package/src/presentation/modals/hooks/index.ts +2 -0
- package/src/presentation/modals/hooks/useModal.ts +38 -0
- package/src/presentation/modals/index.tsx +5 -0
- package/src/presentation/modals/stores/index.ts +2 -0
- package/src/presentation/modals/stores/useModalStore.ts +90 -0
- package/src/presentation/modals/types/index.ts +2 -0
- package/src/presentation/modals/types/modal.type.ts +33 -0
- package/src/presentation/module-menubar.tsx +300 -0
- package/src/presentation/module-widget.tsx +233 -0
- package/src/presentation/nav-documents.tsx +89 -0
- package/src/presentation/nav-main.tsx +62 -0
- package/src/presentation/nav-secondary.tsx +41 -0
- package/src/presentation/nav-user.tsx +109 -0
- package/src/presentation/permission-action-badge.tsx +35 -0
- package/src/presentation/reui/index.tsx +3 -0
- package/src/presentation/reui/stepper.tsx +508 -0
- package/src/presentation/reui/timeline.tsx +226 -0
- package/src/presentation/sheets/index.tsx +2 -0
- package/src/presentation/sheets/legacy-sheet-header.tsx +0 -0
- package/src/presentation/sheets/legacy-sheet.tsx +37 -0
- package/src/presentation/size.enum.ts +19 -0
- package/src/presentation/system/index.tsx +3 -0
- package/src/presentation/system/logo.theme.tsx +21 -0
- package/src/presentation/system/types.ts +10 -0
- package/src/presentation/theme/index.tsx +6 -0
- package/src/presentation/theme/prefer-color-scheme.tsx +50 -0
- package/src/presentation/theme/switch-color-scheme.tsx +16 -0
- package/src/presentation/theme/theme-switcher-button.tsx +20 -0
- package/src/presentation/theme/theme.enum.ts +4 -0
- package/src/presentation/theme/theme.store.ts +87 -0
- package/src/presentation/themes/index.tsx +2 -0
- package/src/presentation/themes/katon/dashboard-layout.tsx +1080 -0
- package/src/presentation/themes/katon/edge-section.tsx +19 -0
- package/src/presentation/themes/katon/header-menubar.tsx +270 -0
- package/src/presentation/themes/katon/header-modules-available.tsx +44 -0
- package/src/presentation/themes/katon/header-modules-recents.tsx +52 -0
- package/src/presentation/themes/katon/header-modules-store.tsx +25 -0
- package/src/presentation/themes/katon/header-options.tsx +13 -0
- package/src/presentation/themes/katon/header-organization-select.tsx +146 -0
- package/src/presentation/themes/katon/header-routines.tsx +74 -0
- package/src/presentation/themes/katon/header-tasks-connected-user.tsx +150 -0
- package/src/presentation/themes/katon/index.tsx +16 -0
- package/src/presentation/themes/katon/main-wrapper.tsx +34 -0
- package/src/presentation/themes/katon/module-item-link.tsx +32 -0
- package/src/presentation/themes/katon/view-frame.tsx +25 -0
- package/src/presentation/themes/katon/view-helmet.tsx +53 -0
- package/src/presentation/themes/katon/view-status.tsx +32 -0
- package/src/presentation/themes/katon/view-wrapper.tsx +15 -0
- package/src/presentation/themes/katon/view.tsx +42 -0
- package/src/presentation/ui/accordion-multiselect.tsx +206 -0
- package/src/presentation/ui/accordion.tsx +81 -0
- package/src/presentation/ui/alert-dialog.tsx +199 -0
- package/src/presentation/ui/alert.tsx +76 -0
- package/src/presentation/ui/aspect-ratio.tsx +11 -0
- package/src/presentation/ui/attachment.tsx +204 -0
- package/src/presentation/ui/avatar.tsx +112 -0
- package/src/presentation/ui/badge.tsx +49 -0
- package/src/presentation/ui/breadcrumb.tsx +122 -0
- package/src/presentation/ui/bubble.tsx +125 -0
- package/src/presentation/ui/button-group.tsx +83 -0
- package/src/presentation/ui/button.tsx +87 -0
- package/src/presentation/ui/calendar.tsx +222 -0
- package/src/presentation/ui/card.tsx +106 -0
- package/src/presentation/ui/carousel.tsx +242 -0
- package/src/presentation/ui/chart.tsx +373 -0
- package/src/presentation/ui/checkbox.tsx +33 -0
- package/src/presentation/ui/clickable.tsx +58 -0
- package/src/presentation/ui/collapsible.tsx +33 -0
- package/src/presentation/ui/color-swatch-selector.tsx +81 -0
- package/src/presentation/ui/combobox.tsx +299 -0
- package/src/presentation/ui/command.tsx +195 -0
- package/src/presentation/ui/context-menu.tsx +263 -0
- package/src/presentation/ui/dialog.tsx +168 -0
- package/src/presentation/ui/direction.tsx +22 -0
- package/src/presentation/ui/drawer.tsx +134 -0
- package/src/presentation/ui/dropdown-menu.tsx +269 -0
- package/src/presentation/ui/empty.tsx +104 -0
- package/src/presentation/ui/field.tsx +238 -0
- package/src/presentation/ui/granularity-selector.tsx +58 -0
- package/src/presentation/ui/hover-card.tsx +44 -0
- package/src/presentation/ui/index.tsx +74 -0
- package/src/presentation/ui/input-group.tsx +156 -0
- package/src/presentation/ui/input-otp.tsx +87 -0
- package/src/presentation/ui/input.tsx +19 -0
- package/src/presentation/ui/item.tsx +196 -0
- package/src/presentation/ui/kpi-card.tsx +203 -0
- package/src/presentation/ui/label-selector.tsx +100 -0
- package/src/presentation/ui/label.tsx +24 -0
- package/src/presentation/ui/legacy-birth-date-input.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/index.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.content.tsx +37 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.context.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.hex-input.tsx +97 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.picker.tsx +266 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.presets.ts +22 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.quick-list.tsx +49 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.recent.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.swatches.tsx +111 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.trigger.tsx +128 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.tsx +110 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.types.ts +1 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.utils.ts +114 -0
- package/src/presentation/ui/legacy-country-input.tsx +171 -0
- package/src/presentation/ui/legacy-gender-input.tsx +22 -0
- package/src/presentation/ui/legacy-input.tsx +106 -0
- package/src/presentation/ui/legacy-phone-input.tsx +213 -0
- package/src/presentation/ui/legacy-select-input.tsx +114 -0
- package/src/presentation/ui/legacy-text-area.tsx +111 -0
- package/src/presentation/ui/list-items.tsx +59 -0
- package/src/presentation/ui/marker.tsx +69 -0
- package/src/presentation/ui/media-player/index.tsx +12 -0
- package/src/presentation/ui/media-player/media-player.context.tsx +36 -0
- package/src/presentation/ui/media-player/media-player.tsx +167 -0
- package/src/presentation/ui/media-player/player-controls.tsx +207 -0
- package/src/presentation/ui/media-player/players/audio-player.tsx +78 -0
- package/src/presentation/ui/media-player/players/index.tsx +4 -0
- package/src/presentation/ui/media-player/players/video-player.tsx +193 -0
- package/src/presentation/ui/media-player/players/voice-note-player.tsx +108 -0
- package/src/presentation/ui/media-player/use-media-player.hook.ts +263 -0
- package/src/presentation/ui/menubar.tsx +281 -0
- package/src/presentation/ui/message.tsx +92 -0
- package/src/presentation/ui/navigation-menu.tsx +172 -0
- package/src/presentation/ui/pagination.tsx +129 -0
- package/src/presentation/ui/popover.tsx +89 -0
- package/src/presentation/ui/progress.tsx +31 -0
- package/src/presentation/ui/resizable.tsx +50 -0
- package/src/presentation/ui/select.tsx +192 -0
- package/src/presentation/ui/separator.tsx +28 -0
- package/src/presentation/ui/sheet.tsx +147 -0
- package/src/presentation/ui/sidebar.tsx +702 -0
- package/src/presentation/ui/skeleton.tsx +13 -0
- package/src/presentation/ui/slide-to-confirm.tsx +129 -0
- package/src/presentation/ui/slider.tsx +59 -0
- package/src/presentation/ui/sonner.tsx +58 -0
- package/src/presentation/ui/switch.tsx +33 -0
- package/src/presentation/ui/table.tsx +116 -0
- package/src/presentation/ui/tabs.tsx +90 -0
- package/src/presentation/ui/text-gradient.tsx +84 -0
- package/src/presentation/ui/textarea.tsx +18 -0
- package/src/presentation/ui/timeline-steps.tsx +235 -0
- package/src/presentation/ui/toggle-group.tsx +89 -0
- package/src/presentation/ui/toggle.tsx +47 -0
- package/src/presentation/ui/tooltip.tsx +57 -0
- package/src/presentation/uploading/index.tsx +3 -0
- package/src/presentation/uploading/media-upload-field.tsx +152 -0
- package/src/presentation/uploading/storage-media.tsx +210 -0
- package/src/styles.css +403 -0
- package/src/themes.css +1038 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
3
|
+
|
|
4
|
+
const SYSTEMS = {
|
|
5
|
+
SG: {
|
|
6
|
+
NS: {
|
|
7
|
+
name: "North South Line",
|
|
8
|
+
short: "NS",
|
|
9
|
+
long: "NSL",
|
|
10
|
+
bg: "#e22726",
|
|
11
|
+
fg: "#FFF"
|
|
12
|
+
},
|
|
13
|
+
EW: {
|
|
14
|
+
name: "East West Line",
|
|
15
|
+
short: "EW",
|
|
16
|
+
long: "EWL",
|
|
17
|
+
bg: "#00964e",
|
|
18
|
+
fg: "#FFF"
|
|
19
|
+
},
|
|
20
|
+
NE: {
|
|
21
|
+
name: "North East Line",
|
|
22
|
+
short: "NE",
|
|
23
|
+
long: "NEL",
|
|
24
|
+
bg: "#8f4299",
|
|
25
|
+
fg: "#FFF"
|
|
26
|
+
},
|
|
27
|
+
CE: {
|
|
28
|
+
name: "Circle Line",
|
|
29
|
+
short: "CE",
|
|
30
|
+
long: "CCL",
|
|
31
|
+
bg: "#f99d26",
|
|
32
|
+
fg: "#000"
|
|
33
|
+
},
|
|
34
|
+
DT: {
|
|
35
|
+
name: "Downtown Line",
|
|
36
|
+
short: "DT",
|
|
37
|
+
long: "DTL",
|
|
38
|
+
bg: "#005ea8",
|
|
39
|
+
fg: "#fff"
|
|
40
|
+
},
|
|
41
|
+
TE: {
|
|
42
|
+
name: "Thomson-East Coast Line",
|
|
43
|
+
short: "TE",
|
|
44
|
+
long: "TEL",
|
|
45
|
+
bg: "#9d5b26",
|
|
46
|
+
fg: "#FFF"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
// Add more systems here in the future
|
|
50
|
+
HK: {
|
|
51
|
+
// Hong Kong MTR
|
|
52
|
+
KT: {
|
|
53
|
+
name: "Kwun Tong Line",
|
|
54
|
+
short: "KT",
|
|
55
|
+
long: "KTL",
|
|
56
|
+
bg: "#399e48",
|
|
57
|
+
fg: "#FFF"
|
|
58
|
+
},
|
|
59
|
+
AE: {
|
|
60
|
+
name: "Airport Express Line",
|
|
61
|
+
short: "AE",
|
|
62
|
+
long: "AEL",
|
|
63
|
+
bg: "#39858d",
|
|
64
|
+
fg: "#FFF"
|
|
65
|
+
},
|
|
66
|
+
TO: {
|
|
67
|
+
name: "Tseung Kwan O Line",
|
|
68
|
+
short: "TO",
|
|
69
|
+
long: "TKOL",
|
|
70
|
+
bg: "#7a3d90",
|
|
71
|
+
fg: "#000"
|
|
72
|
+
},
|
|
73
|
+
SI: {
|
|
74
|
+
name: "South Island Line",
|
|
75
|
+
short: "SI",
|
|
76
|
+
long: "SIL",
|
|
77
|
+
bg: "#c7d536",
|
|
78
|
+
fg: "#FFF"
|
|
79
|
+
},
|
|
80
|
+
TW: {
|
|
81
|
+
name: "Tsuen Wan Line",
|
|
82
|
+
short: "TW",
|
|
83
|
+
long: "TWL",
|
|
84
|
+
bg: "#d5371f",
|
|
85
|
+
fg: "#FFF"
|
|
86
|
+
},
|
|
87
|
+
IS: {
|
|
88
|
+
name: "Island Line",
|
|
89
|
+
short: "IS",
|
|
90
|
+
long: "ISL",
|
|
91
|
+
bg: "#3d6fbe",
|
|
92
|
+
fg: "#FFF"
|
|
93
|
+
},
|
|
94
|
+
TC: {
|
|
95
|
+
name: "Tung Chung Line",
|
|
96
|
+
short: "TC",
|
|
97
|
+
long: "TCL",
|
|
98
|
+
bg: "#e6a03e",
|
|
99
|
+
fg: "#000"
|
|
100
|
+
},
|
|
101
|
+
DR: {
|
|
102
|
+
name: "Disneyland Resort Line",
|
|
103
|
+
short: "DR",
|
|
104
|
+
long: "DRL",
|
|
105
|
+
bg: "#df76a4",
|
|
106
|
+
fg: "#000"
|
|
107
|
+
},
|
|
108
|
+
ER: {
|
|
109
|
+
name: "East Rail Line",
|
|
110
|
+
short: "ER",
|
|
111
|
+
long: "ERL",
|
|
112
|
+
bg: "#78b2e5",
|
|
113
|
+
fg: "#000"
|
|
114
|
+
},
|
|
115
|
+
TM: {
|
|
116
|
+
name: "Tuen Ma Line",
|
|
117
|
+
short: "TM",
|
|
118
|
+
long: "TML",
|
|
119
|
+
bg: "#913a0e",
|
|
120
|
+
fg: "#FFF"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} as const;
|
|
124
|
+
|
|
125
|
+
type SystemKey = keyof typeof SYSTEMS;
|
|
126
|
+
type BadgeSize = "xs" | "sm" | "md" | "lg";
|
|
127
|
+
const sizeClasses: Record<BadgeSize, string> = {
|
|
128
|
+
xs: "px-1 py-0.5 text-[10px]",
|
|
129
|
+
sm: "px-1.5 py-0.5 text-xs",
|
|
130
|
+
md: "px-2 py-0.5 text-sm",
|
|
131
|
+
lg: "px-3 py-1 text-base"
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
interface TransportBadgeProps {
|
|
135
|
+
stationCode: string | string[];
|
|
136
|
+
system: SystemKey;
|
|
137
|
+
className?: string;
|
|
138
|
+
stationName?: string;
|
|
139
|
+
showStationName?: boolean;
|
|
140
|
+
size?: BadgeSize;
|
|
141
|
+
}
|
|
142
|
+
// Defined Linedata type
|
|
143
|
+
type LineData = {
|
|
144
|
+
name: string;
|
|
145
|
+
short: string;
|
|
146
|
+
long: string;
|
|
147
|
+
bg: string;
|
|
148
|
+
fg: string;
|
|
149
|
+
} | null;
|
|
150
|
+
|
|
151
|
+
const getLineDataFromStationCode = (
|
|
152
|
+
code: string,
|
|
153
|
+
system: SystemKey
|
|
154
|
+
): LineData => {
|
|
155
|
+
// Added return type LineData, so TS knows all lines share a common structure
|
|
156
|
+
const match = code.match(/^[A-Z]+/);
|
|
157
|
+
if (!match) return null;
|
|
158
|
+
const prefix = match[0] as string;
|
|
159
|
+
const lines = SYSTEMS[system] as Record<string, LineData>;
|
|
160
|
+
if (lines && prefix in lines) {
|
|
161
|
+
return lines[prefix];
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export const TransportBadge = ({
|
|
167
|
+
stationCode,
|
|
168
|
+
system,
|
|
169
|
+
className,
|
|
170
|
+
stationName,
|
|
171
|
+
showStationName = false,
|
|
172
|
+
size = "md"
|
|
173
|
+
}: TransportBadgeProps) => {
|
|
174
|
+
const codes = Array.isArray(stationCode) ? stationCode : [stationCode];
|
|
175
|
+
const isMulti = codes.length > 1;
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<span className={cn("inline-flex items-center", className)}>
|
|
179
|
+
<span className={cn("inline-flex", isMulti ? "gap-0" : "gap-1")}>
|
|
180
|
+
{codes.map((code, idx) => {
|
|
181
|
+
const line = getLineDataFromStationCode(code, system);
|
|
182
|
+
if (!line) {
|
|
183
|
+
return (
|
|
184
|
+
<span
|
|
185
|
+
key={code}
|
|
186
|
+
className={cn(
|
|
187
|
+
"inline-flex items-center rounded font-semibold bg-muted text-muted-foreground",
|
|
188
|
+
sizeClasses[size]
|
|
189
|
+
)}
|
|
190
|
+
>
|
|
191
|
+
Unknown
|
|
192
|
+
</span>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const radius = isMulti
|
|
197
|
+
? idx === 0
|
|
198
|
+
? "rounded-l"
|
|
199
|
+
: idx === codes.length - 1
|
|
200
|
+
? "rounded-r"
|
|
201
|
+
: "rounded-none"
|
|
202
|
+
: "rounded";
|
|
203
|
+
|
|
204
|
+
const border =
|
|
205
|
+
isMulti && idx > 0
|
|
206
|
+
? "border-l border-white/40 dark:border-black/40"
|
|
207
|
+
: "";
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<span
|
|
211
|
+
key={code}
|
|
212
|
+
className={cn(
|
|
213
|
+
"inline-flex items-center font-semibold",
|
|
214
|
+
sizeClasses[size],
|
|
215
|
+
radius,
|
|
216
|
+
border
|
|
217
|
+
)}
|
|
218
|
+
style={{
|
|
219
|
+
backgroundColor: line.bg,
|
|
220
|
+
color: line.fg
|
|
221
|
+
}}
|
|
222
|
+
title={line.name}
|
|
223
|
+
>
|
|
224
|
+
<span className="font-bold">
|
|
225
|
+
{line.short}
|
|
226
|
+
{code.replace(/^[A-Z]+/, "")}
|
|
227
|
+
</span>
|
|
228
|
+
</span>
|
|
229
|
+
);
|
|
230
|
+
})}
|
|
231
|
+
</span>
|
|
232
|
+
{showStationName && stationName && (
|
|
233
|
+
<span
|
|
234
|
+
className={cn(
|
|
235
|
+
"ml-2 font-medium text-muted-foreground",
|
|
236
|
+
size === "xs" && "text-[10px]",
|
|
237
|
+
size === "sm" && "text-xs",
|
|
238
|
+
size === "md" && "text-sm",
|
|
239
|
+
size === "lg" && "text-base"
|
|
240
|
+
)}
|
|
241
|
+
>
|
|
242
|
+
{stationName}
|
|
243
|
+
</span>
|
|
244
|
+
)}
|
|
245
|
+
</span>
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export default TransportBadge;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { IconCheck, IconCopy } from "@tabler/icons-react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../../infrastructure/utilities/utils";
|
|
7
|
+
import { Button } from "../button";
|
|
8
|
+
import {
|
|
9
|
+
Tooltip,
|
|
10
|
+
TooltipContent,
|
|
11
|
+
TooltipTrigger
|
|
12
|
+
} from "../../ui/tooltip";
|
|
13
|
+
|
|
14
|
+
export function CopyButton({
|
|
15
|
+
value,
|
|
16
|
+
className,
|
|
17
|
+
variant = "ghost",
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof Button> & {
|
|
20
|
+
value: string;
|
|
21
|
+
src?: string;
|
|
22
|
+
}) {
|
|
23
|
+
const [hasCopied, setHasCopied] = React.useState(false);
|
|
24
|
+
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
if (!hasCopied) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const timer = setTimeout(() => setHasCopied(false), 2000);
|
|
31
|
+
return () => clearTimeout(timer);
|
|
32
|
+
}, [hasCopied]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip>
|
|
36
|
+
<TooltipTrigger asChild>
|
|
37
|
+
<Button
|
|
38
|
+
data-slot="copy-button"
|
|
39
|
+
size="icon"
|
|
40
|
+
variant={variant}
|
|
41
|
+
className={cn(
|
|
42
|
+
"absolute top-2 right-2 z-10 size-7 opacity-70 hover:opacity-100 focus-visible:opacity-100",
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
onClick={() => {
|
|
46
|
+
navigator.clipboard.writeText(value);
|
|
47
|
+
setHasCopied(true);
|
|
48
|
+
}}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
<span className="sr-only">Copy</span>
|
|
52
|
+
{hasCopied ? <IconCheck /> : <IconCopy />}
|
|
53
|
+
</Button>
|
|
54
|
+
</TooltipTrigger>
|
|
55
|
+
<TooltipContent>
|
|
56
|
+
{hasCopied ? "Copied" : "Copy to Clipboard"}
|
|
57
|
+
</TooltipContent>
|
|
58
|
+
</Tooltip>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {cn} from "../infrastructure/utilities/utils";
|
|
2
|
+
import {Card, CardAction, CardDescription, CardFooter, CardHeader, CardTitle} from "./ui/card";
|
|
3
|
+
import {Badge} from "./ui/badge";
|
|
4
|
+
import {EqualApproximatelyIcon, TrendingDownIcon, TrendingUpIcon} from "lucide-react";
|
|
5
|
+
import React from "react";
|
|
6
|
+
|
|
7
|
+
export interface AnalyticSectionItemProps {
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
value?: React.ReactNode;
|
|
10
|
+
actions?: React.ReactNode;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
description?: React.ReactNode;
|
|
13
|
+
trend?: number;
|
|
14
|
+
colspan?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AnalyticSectionProps {
|
|
18
|
+
className?: string;
|
|
19
|
+
direction?: "horizontal" | "vertical";
|
|
20
|
+
items: AnalyticSectionItemProps[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function AnalyticsSection({className, direction = "horizontal", items}: AnalyticSectionProps) {
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
className={cn(
|
|
27
|
+
"grid gap-6 *:data-[slot=card]:bg-gradient-to-t *:data-[slot=card]:from-primary/5 *:data-[slot=card]:to-card *:data-[slot=card]:shadow-xs dark:*:data-[slot=card]:bg-card",
|
|
28
|
+
direction === "horizontal"
|
|
29
|
+
? "grid-cols-1 md:grid-cols-4 @xl/main:grid-cols-2 @5xl/main:grid-cols-4"
|
|
30
|
+
: "grid-cols-1 auto-rows-fr",
|
|
31
|
+
className)}>
|
|
32
|
+
{items.map((item, index) => (
|
|
33
|
+
<Card
|
|
34
|
+
key={index}
|
|
35
|
+
className={cn(
|
|
36
|
+
"@container/card",
|
|
37
|
+
direction === "vertical"
|
|
38
|
+
? cn(
|
|
39
|
+
item.colspan === 2 && "row-span-2",
|
|
40
|
+
item.colspan === 3 && "row-span-3",
|
|
41
|
+
item.colspan === 4 && "row-span-4",
|
|
42
|
+
)
|
|
43
|
+
: cn(
|
|
44
|
+
item.colspan === 2 && "md:col-span-2 @xl/main:col-span-2",
|
|
45
|
+
item.colspan === 3 && "md:col-span-3 @xl/main:col-span-2 @5xl/main:col-span-3",
|
|
46
|
+
item.colspan === 4 && "md:col-span-4 @xl/main:col-span-2 @5xl/main:col-span-4",
|
|
47
|
+
),
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<CardHeader>
|
|
51
|
+
<CardDescription>{item.label}</CardDescription>
|
|
52
|
+
<CardTitle className="text-2xl font-semibold tabular-nums @[250px]/card:text-3xl">
|
|
53
|
+
{item.value}
|
|
54
|
+
</CardTitle>
|
|
55
|
+
<CardAction>
|
|
56
|
+
{/*{item.actions}*/}
|
|
57
|
+
{item.trend && (
|
|
58
|
+
<Badge variant="outline">
|
|
59
|
+
{item.trend > 0 && <TrendingUpIcon/>}
|
|
60
|
+
{item.trend < 0 && <TrendingDownIcon/>}
|
|
61
|
+
{item.trend == 0 && <EqualApproximatelyIcon/>}
|
|
62
|
+
</Badge>)
|
|
63
|
+
}
|
|
64
|
+
</CardAction>
|
|
65
|
+
</CardHeader>
|
|
66
|
+
<div className="flex-auto"></div>
|
|
67
|
+
{(item.title || item.description) && (
|
|
68
|
+
<CardFooter className="flex-col items-start gap-1.5 text-sm">
|
|
69
|
+
{item.title && (
|
|
70
|
+
<div className="line-clamp-1 flex gap-2 font-medium">
|
|
71
|
+
{item.title}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
{item.description && (
|
|
75
|
+
<div className="text-muted-foreground">
|
|
76
|
+
{item.description}
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</CardFooter>
|
|
80
|
+
)}
|
|
81
|
+
</Card>
|
|
82
|
+
))}
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
|
|
5
|
+
import { NavDocuments } from "./nav-documents"
|
|
6
|
+
import { NavMain } from "./nav-main"
|
|
7
|
+
import { NavSecondary } from "./nav-secondary"
|
|
8
|
+
import { NavUser } from "./nav-user"
|
|
9
|
+
import {
|
|
10
|
+
Sidebar,
|
|
11
|
+
SidebarContent,
|
|
12
|
+
SidebarFooter,
|
|
13
|
+
SidebarHeader,
|
|
14
|
+
SidebarMenu,
|
|
15
|
+
SidebarMenuButton,
|
|
16
|
+
SidebarMenuItem,
|
|
17
|
+
} from "./ui/sidebar"
|
|
18
|
+
import {
|
|
19
|
+
LayoutDashboardIcon,
|
|
20
|
+
ListIcon,
|
|
21
|
+
ChartBarIcon,
|
|
22
|
+
FolderIcon,
|
|
23
|
+
UsersIcon,
|
|
24
|
+
CameraIcon,
|
|
25
|
+
FileTextIcon,
|
|
26
|
+
Settings2Icon,
|
|
27
|
+
CircleHelpIcon,
|
|
28
|
+
SearchIcon,
|
|
29
|
+
DatabaseIcon,
|
|
30
|
+
FileChartColumnIcon,
|
|
31
|
+
FileIcon,
|
|
32
|
+
CommandIcon,
|
|
33
|
+
VideoIcon, GalleryHorizontalIcon, FilesIcon, ShieldIcon
|
|
34
|
+
} from "lucide-react"
|
|
35
|
+
import {ThemeLogo} from "./system/logo.theme";
|
|
36
|
+
import {useModuleStore} from "../infrastructure/stores/module.store";
|
|
37
|
+
import {DynamicIcon} from "./components/dynamic-icon";
|
|
38
|
+
import {ComponentIcon} from "lucide-react";
|
|
39
|
+
import {useAuth} from "../infrastructure/hooks/use-auth";
|
|
40
|
+
|
|
41
|
+
const data = {
|
|
42
|
+
user: {
|
|
43
|
+
name: "shadcn",
|
|
44
|
+
email: "m@example.com",
|
|
45
|
+
avatar: "/avatars/shadcn.jpg",
|
|
46
|
+
},
|
|
47
|
+
navMain: [],
|
|
48
|
+
navClouds: [
|
|
49
|
+
{
|
|
50
|
+
title: "Capture",
|
|
51
|
+
icon: (
|
|
52
|
+
<CameraIcon
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
isActive: true,
|
|
56
|
+
url: "#",
|
|
57
|
+
items: [
|
|
58
|
+
{
|
|
59
|
+
title: "Active Proposals",
|
|
60
|
+
url: "#",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: "Archived",
|
|
64
|
+
url: "#",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: "Proposal",
|
|
70
|
+
icon: (
|
|
71
|
+
<FileTextIcon
|
|
72
|
+
/>
|
|
73
|
+
),
|
|
74
|
+
url: "#",
|
|
75
|
+
items: [
|
|
76
|
+
{
|
|
77
|
+
title: "Active Proposals",
|
|
78
|
+
url: "#",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: "Archived",
|
|
82
|
+
url: "#",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: "Prompts",
|
|
88
|
+
icon: (
|
|
89
|
+
<FileTextIcon
|
|
90
|
+
/>
|
|
91
|
+
),
|
|
92
|
+
url: "#",
|
|
93
|
+
items: [
|
|
94
|
+
{
|
|
95
|
+
title: "Active Proposals",
|
|
96
|
+
url: "#",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: "Archived",
|
|
100
|
+
url: "#",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
navSecondary: [
|
|
106
|
+
{
|
|
107
|
+
title: "Settings",
|
|
108
|
+
url: "#",
|
|
109
|
+
icon: (
|
|
110
|
+
<Settings2Icon
|
|
111
|
+
/>
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: "Get Help",
|
|
116
|
+
url: "#",
|
|
117
|
+
icon: (
|
|
118
|
+
<CircleHelpIcon
|
|
119
|
+
/>
|
|
120
|
+
),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
title: "Search",
|
|
124
|
+
url: "#",
|
|
125
|
+
icon: (
|
|
126
|
+
<SearchIcon
|
|
127
|
+
/>
|
|
128
|
+
),
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
documents: [
|
|
132
|
+
{
|
|
133
|
+
name: "Vidéos",
|
|
134
|
+
url: "/media-library/videos",
|
|
135
|
+
icon: (
|
|
136
|
+
<VideoIcon
|
|
137
|
+
/>
|
|
138
|
+
),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "Images",
|
|
142
|
+
url: "/media-library/images",
|
|
143
|
+
icon: (
|
|
144
|
+
<GalleryHorizontalIcon
|
|
145
|
+
/>
|
|
146
|
+
),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "Documents",
|
|
150
|
+
url: "/media-library/documents",
|
|
151
|
+
icon: (
|
|
152
|
+
<FilesIcon
|
|
153
|
+
/>
|
|
154
|
+
),
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "Rapports",
|
|
158
|
+
url: "/reports",
|
|
159
|
+
icon: (
|
|
160
|
+
<FileChartColumnIcon
|
|
161
|
+
/>
|
|
162
|
+
),
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
168
|
+
const { modules } = useModuleStore();
|
|
169
|
+
const { user: authUser } = useAuth();
|
|
170
|
+
const [mounted, setMounted] = React.useState(false);
|
|
171
|
+
|
|
172
|
+
const user = React.useMemo(() => ({
|
|
173
|
+
name: authUser?.username || authUser?.userData?.firstname || "Utilisateur",
|
|
174
|
+
email: authUser?.email || "No email",
|
|
175
|
+
avatar: "/avatars/shadcn.jpg", // Fallback avatar
|
|
176
|
+
}), [authUser]);
|
|
177
|
+
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
setMounted(true);
|
|
180
|
+
}, []);
|
|
181
|
+
|
|
182
|
+
const dynamicNavMain = React.useMemo(() => {
|
|
183
|
+
const modulesToUse = mounted ? modules : [];
|
|
184
|
+
return modulesToUse
|
|
185
|
+
.filter((m) => m.isEnabled)
|
|
186
|
+
.map((m) => ({
|
|
187
|
+
title: m.name,
|
|
188
|
+
url: m.uri,
|
|
189
|
+
icon: <DynamicIcon name={m.icon} />,
|
|
190
|
+
}));
|
|
191
|
+
}, [modules, mounted]);
|
|
192
|
+
|
|
193
|
+
const navSecondaryWithModules = React.useMemo(() => {
|
|
194
|
+
const items = [...data.navSecondary];
|
|
195
|
+
if (!items.find(i => i.title === "Store")) {
|
|
196
|
+
items.push({
|
|
197
|
+
title: "Store",
|
|
198
|
+
url: "/store/explorer",
|
|
199
|
+
icon: (
|
|
200
|
+
<ComponentIcon
|
|
201
|
+
/>
|
|
202
|
+
),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return items;
|
|
206
|
+
}, [modules]);
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<Sidebar collapsible="offcanvas" {...props}>
|
|
210
|
+
<SidebarHeader>
|
|
211
|
+
<SidebarMenu>
|
|
212
|
+
<SidebarMenuItem>
|
|
213
|
+
<SidebarMenuButton size={"lg"}
|
|
214
|
+
asChild
|
|
215
|
+
className="data-[slot=sidebar-menu-button]:p-2!"
|
|
216
|
+
>
|
|
217
|
+
<a href="#">
|
|
218
|
+
<ThemeLogo variant={'banner'} className="h-18 w-auto" />
|
|
219
|
+
</a>
|
|
220
|
+
</SidebarMenuButton>
|
|
221
|
+
</SidebarMenuItem>
|
|
222
|
+
</SidebarMenu>
|
|
223
|
+
</SidebarHeader>
|
|
224
|
+
<SidebarContent>
|
|
225
|
+
<NavMain items={dynamicNavMain} />
|
|
226
|
+
<NavDocuments items={data.documents} />
|
|
227
|
+
<NavSecondary items={navSecondaryWithModules} className="mt-auto" />
|
|
228
|
+
</SidebarContent>
|
|
229
|
+
<SidebarFooter>
|
|
230
|
+
<NavUser user={user} />
|
|
231
|
+
</SidebarFooter>
|
|
232
|
+
</Sidebar>
|
|
233
|
+
)
|
|
234
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "../ui/card";
|
|
4
|
+
import {Skeleton} from "../ui/skeleton";
|
|
5
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
6
|
+
|
|
7
|
+
export interface AreaWidgetChartSkeletonProps {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
footerTitle?: string
|
|
11
|
+
footerDescription?: string
|
|
12
|
+
className?: string
|
|
13
|
+
hideCard?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function AreaWidgetChartSkeleton(
|
|
17
|
+
{
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
footerTitle,
|
|
21
|
+
footerDescription,
|
|
22
|
+
className,
|
|
23
|
+
hideCard = false,
|
|
24
|
+
}: AreaWidgetChartSkeletonProps
|
|
25
|
+
) {
|
|
26
|
+
const content = (
|
|
27
|
+
<>
|
|
28
|
+
{(title || description) && !hideCard && (
|
|
29
|
+
<CardHeader>
|
|
30
|
+
<CardTitle>
|
|
31
|
+
<Skeleton className="h-5 w-48"/>
|
|
32
|
+
</CardTitle>
|
|
33
|
+
{description && (
|
|
34
|
+
<CardDescription>
|
|
35
|
+
<Skeleton className="h-4 w-64"/>
|
|
36
|
+
</CardDescription>
|
|
37
|
+
)}
|
|
38
|
+
</CardHeader>
|
|
39
|
+
)}
|
|
40
|
+
<CardContent className={cn("w-full h-full", hideCard ? "p-0" : "flex-1")}>
|
|
41
|
+
<Skeleton className={cn("w-full h-full min-h-52", hideCard && className)}/>
|
|
42
|
+
</CardContent>
|
|
43
|
+
{(footerTitle || footerDescription) && !hideCard && (
|
|
44
|
+
<CardFooter className="flex-col items-start gap-2 text-sm">
|
|
45
|
+
{footerTitle && <Skeleton className="h-4 w-40"/>}
|
|
46
|
+
{footerDescription && <Skeleton className="h-4 w-56"/>}
|
|
47
|
+
</CardFooter>
|
|
48
|
+
)}
|
|
49
|
+
</>
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
if (hideCard) {
|
|
53
|
+
return content
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Card className={className}>
|
|
58
|
+
{content}
|
|
59
|
+
</Card>
|
|
60
|
+
)
|
|
61
|
+
}
|