@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,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
interface MarqueeProps {
|
|
7
|
+
grayscale?: boolean;
|
|
8
|
+
direction?: "left" | "right";
|
|
9
|
+
pauseOnHover?: boolean;
|
|
10
|
+
fade?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function Marquee({
|
|
16
|
+
grayscale = false,
|
|
17
|
+
direction = "left",
|
|
18
|
+
pauseOnHover = true,
|
|
19
|
+
fade = true,
|
|
20
|
+
children,
|
|
21
|
+
className
|
|
22
|
+
}: MarqueeProps) {
|
|
23
|
+
const content = React.Children.toArray(children);
|
|
24
|
+
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
25
|
+
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
const container = containerRef.current;
|
|
28
|
+
if (!container) return;
|
|
29
|
+
const preventScroll = (e: Event) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
container.scrollLeft = 0;
|
|
33
|
+
};
|
|
34
|
+
container.addEventListener("scroll", preventScroll, { passive: false });
|
|
35
|
+
container.addEventListener("wheel", preventScroll, { passive: false });
|
|
36
|
+
container.addEventListener("touchmove", preventScroll, { passive: false });
|
|
37
|
+
return () => {
|
|
38
|
+
container.removeEventListener("scroll", preventScroll);
|
|
39
|
+
container.removeEventListener("wheel", preventScroll);
|
|
40
|
+
container.removeEventListener("touchmove", preventScroll);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const animationClass =
|
|
45
|
+
direction === "left" ? "marquee-inner" : "marquee-inner-reverse";
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="relative overflow-hidden">
|
|
49
|
+
<style dangerouslySetInnerHTML={{__html: `
|
|
50
|
+
.marquee-container::-webkit-scrollbar {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.marquee-inner {
|
|
55
|
+
animation: marquee-anim 20s linear infinite;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.marquee-inner-reverse {
|
|
59
|
+
animation: marquee-anim-reverse 20s linear infinite;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.marquee-container:hover .marquee-inner,
|
|
63
|
+
.marquee-container:hover .marquee-inner-reverse {
|
|
64
|
+
animation-play-state: paused !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes marquee-anim {
|
|
68
|
+
from {
|
|
69
|
+
transform: translateX(0);
|
|
70
|
+
}
|
|
71
|
+
to {
|
|
72
|
+
transform: translateX(-50%);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes marquee-anim-reverse {
|
|
77
|
+
from {
|
|
78
|
+
transform: translateX(-50%);
|
|
79
|
+
}
|
|
80
|
+
to {
|
|
81
|
+
transform: translateX(0);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`}} />
|
|
85
|
+
|
|
86
|
+
<div
|
|
87
|
+
ref={containerRef}
|
|
88
|
+
className={cn(
|
|
89
|
+
"flex w-full p-2 [--gap:3rem] select-none cursor-default marquee-container",
|
|
90
|
+
grayscale &&
|
|
91
|
+
"grayscale brightness-0 dark:invert opacity-80 transition-opacity",
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
style={{
|
|
95
|
+
maskImage: fade
|
|
96
|
+
? "linear-gradient(90deg, transparent 0%, rgba(0,0,0,1) 8%, rgba(0,0,0,1) 92%, transparent 100%)"
|
|
97
|
+
: "none",
|
|
98
|
+
WebkitMaskImage: fade
|
|
99
|
+
? "linear-gradient(90deg, transparent 0%, rgba(0,0,0,1) 8%, rgba(0,0,0,1) 92%, transparent 100%)"
|
|
100
|
+
: "none",
|
|
101
|
+
userSelect: "none",
|
|
102
|
+
WebkitUserSelect: "none",
|
|
103
|
+
pointerEvents: pauseOnHover ? "auto" : "none",
|
|
104
|
+
overflow: "hidden",
|
|
105
|
+
scrollbarWidth: "none",
|
|
106
|
+
msOverflowStyle: "none"
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<div
|
|
110
|
+
className={cn(
|
|
111
|
+
"flex shrink-0 items-center will-change-transform",
|
|
112
|
+
animationClass
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
{Array.from({ length: 4 }).map((_, i) => (
|
|
116
|
+
<div
|
|
117
|
+
key={i}
|
|
118
|
+
className="flex shrink-0 items-center gap-(--gap) pr-(--gap)"
|
|
119
|
+
>
|
|
120
|
+
{content.map((item, index) => (
|
|
121
|
+
<div
|
|
122
|
+
key={index}
|
|
123
|
+
className="flex shrink-0 items-center justify-center"
|
|
124
|
+
>
|
|
125
|
+
{item}
|
|
126
|
+
</div>
|
|
127
|
+
))}
|
|
128
|
+
</div>
|
|
129
|
+
))}
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Children,
|
|
5
|
+
createContext,
|
|
6
|
+
HTMLAttributes,
|
|
7
|
+
isValidElement,
|
|
8
|
+
type ReactElement,
|
|
9
|
+
useContext
|
|
10
|
+
} from "react";
|
|
11
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
12
|
+
import { cva, VariantProps } from "class-variance-authority";
|
|
13
|
+
|
|
14
|
+
type PartitionBarContextType = {
|
|
15
|
+
total: number;
|
|
16
|
+
size: VariantProps<typeof partitionBarVariants>["size"];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const PartitionBarCtxt = createContext<PartitionBarContextType | null>(null);
|
|
20
|
+
|
|
21
|
+
function usePartitionBarContext(): PartitionBarContextType {
|
|
22
|
+
const context = useContext(PartitionBarCtxt);
|
|
23
|
+
if (!context) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
"usePartitionBarContext must be used within a PartitionBarProvider"
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return context;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
32
|
+
|
|
33
|
+
const partitionBarVariants = cva("flex flex-row", {
|
|
34
|
+
variants: {
|
|
35
|
+
size: {
|
|
36
|
+
sm: "text-xs",
|
|
37
|
+
md: "text-sm",
|
|
38
|
+
lg: "text-md"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
size: "md"
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
interface PartitionBar
|
|
47
|
+
extends HTMLAttributes<HTMLUListElement>,
|
|
48
|
+
VariantProps<typeof partitionBarVariants> {
|
|
49
|
+
children?:
|
|
50
|
+
| ReactElement<PartitionBarSegment>
|
|
51
|
+
| ReactElement<PartitionBarSegment>[];
|
|
52
|
+
gap?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default function PartitionBar({
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
gap = 1,
|
|
59
|
+
size,
|
|
60
|
+
...props
|
|
61
|
+
}: PartitionBar) {
|
|
62
|
+
const total = Children.toArray(children).reduce<number>(
|
|
63
|
+
(sum, child) =>
|
|
64
|
+
isValidElement(child)
|
|
65
|
+
? sum + ((child.props as PartitionBarSegment).num || 0)
|
|
66
|
+
: sum,
|
|
67
|
+
0
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<PartitionBarCtxt.Provider value={{ total, size }}>
|
|
72
|
+
<ul
|
|
73
|
+
className={cn("w-full", partitionBarVariants({ size }), className)}
|
|
74
|
+
style={{
|
|
75
|
+
gap: `${gap * 4}px`
|
|
76
|
+
}}
|
|
77
|
+
{...props}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</ul>
|
|
81
|
+
</PartitionBarCtxt.Provider>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
////////////////////////////////////////////////////////////////////////////
|
|
86
|
+
|
|
87
|
+
const partitionBarLineVariants = cva("", {
|
|
88
|
+
variants: {
|
|
89
|
+
variant: {
|
|
90
|
+
default: "bg-primary",
|
|
91
|
+
secondary: "bg-primary/60",
|
|
92
|
+
destructive: "bg-destructive",
|
|
93
|
+
outline: "border border-input bg-background",
|
|
94
|
+
muted: "bg-primary/40"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
defaultVariants: {
|
|
98
|
+
variant: "default"
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const partitionBarTitleVariants = cva("", {
|
|
103
|
+
variants: {
|
|
104
|
+
variant: {
|
|
105
|
+
default: "text-primary",
|
|
106
|
+
secondary: "text-primary/60",
|
|
107
|
+
destructive: "text-destructive",
|
|
108
|
+
outline: "text-foreground",
|
|
109
|
+
muted: "text-primary/40"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
defaultVariants: {
|
|
113
|
+
variant: "default"
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
interface PartitionBarSegment
|
|
118
|
+
extends HTMLAttributes<HTMLLIElement>,
|
|
119
|
+
VariantProps<typeof partitionBarLineVariants> {
|
|
120
|
+
children?: React.ReactNode;
|
|
121
|
+
num?: number;
|
|
122
|
+
variant?: VariantProps<typeof partitionBarLineVariants>["variant"];
|
|
123
|
+
alignment?: "left" | "center" | "right";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function PartitionBarSegment({
|
|
127
|
+
children,
|
|
128
|
+
num = 0,
|
|
129
|
+
variant = "default",
|
|
130
|
+
alignment = "center",
|
|
131
|
+
className,
|
|
132
|
+
...props
|
|
133
|
+
}: PartitionBarSegment) {
|
|
134
|
+
const { total, size } = usePartitionBarContext();
|
|
135
|
+
|
|
136
|
+
const widthPercent = total > 0 ? (num / total) * 100 : 0;
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<li
|
|
140
|
+
className="flex flex-col min-w-0"
|
|
141
|
+
style={{
|
|
142
|
+
flexBasis: `${widthPercent}%`,
|
|
143
|
+
flexGrow: 0,
|
|
144
|
+
flexShrink: 0
|
|
145
|
+
}}
|
|
146
|
+
{...props}
|
|
147
|
+
>
|
|
148
|
+
<div
|
|
149
|
+
className={cn(
|
|
150
|
+
partitionBarLineVariants({ variant }),
|
|
151
|
+
"rounded-full w-full shrink-0",
|
|
152
|
+
size === "sm" ? "h-2" : size === "md" ? "h-3" : "h-4",
|
|
153
|
+
className
|
|
154
|
+
)}
|
|
155
|
+
/>
|
|
156
|
+
<div
|
|
157
|
+
className={cn(
|
|
158
|
+
partitionBarTitleVariants({ variant }),
|
|
159
|
+
"w-full whitespace-normal flex flex-col",
|
|
160
|
+
size === "sm" ? "mt-2" : size === "md" ? "mt-3" : "mt-4",
|
|
161
|
+
alignment === "left" && "items-start",
|
|
162
|
+
alignment === "center" && "items-center",
|
|
163
|
+
alignment === "right" && "items-end"
|
|
164
|
+
)}
|
|
165
|
+
>
|
|
166
|
+
{children}
|
|
167
|
+
</div>
|
|
168
|
+
</li>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
173
|
+
|
|
174
|
+
interface PartitionBarSegmentTitle extends HTMLAttributes<HTMLDivElement> {
|
|
175
|
+
children: React.ReactNode;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function PartitionBarSegmentTitle({
|
|
179
|
+
children,
|
|
180
|
+
className
|
|
181
|
+
}: PartitionBarSegmentTitle) {
|
|
182
|
+
return <div className={cn("w-fit font-semibold", className)}>{children}</div>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface PartitionBarSegmentValue extends HTMLAttributes<HTMLDivElement> {
|
|
186
|
+
children: React.ReactNode;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function PartitionBarSegmentValue({
|
|
190
|
+
children,
|
|
191
|
+
className
|
|
192
|
+
}: PartitionBarSegmentValue) {
|
|
193
|
+
return (
|
|
194
|
+
<div className={cn("w-fit text-muted-foreground text-[80%]", className)}>
|
|
195
|
+
{children}
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef, useState, useLayoutEffect } from "react";
|
|
4
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
5
|
+
|
|
6
|
+
type ScrollAxis = "horizontal" | "vertical" | "both";
|
|
7
|
+
|
|
8
|
+
interface ScrollFadeProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
hideScrollbar?: boolean;
|
|
12
|
+
axis?: ScrollAxis;
|
|
13
|
+
intensity?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function ScrollFade({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
hideScrollbar = true,
|
|
20
|
+
axis = "horizontal",
|
|
21
|
+
intensity = 1
|
|
22
|
+
}: ScrollFadeProps) {
|
|
23
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
24
|
+
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
25
|
+
|
|
26
|
+
const [showLeft, setShowLeft] = useState(false);
|
|
27
|
+
const [showRight, setShowRight] = useState(false);
|
|
28
|
+
const [showTop, setShowTop] = useState(false);
|
|
29
|
+
const [showBottom, setShowBottom] = useState(false);
|
|
30
|
+
|
|
31
|
+
const fadeIntensity = Math.min(Math.max(intensity, 0), 1);
|
|
32
|
+
const checkScroll = () => {
|
|
33
|
+
const el = containerRef.current;
|
|
34
|
+
if (!el) return;
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
scrollLeft,
|
|
38
|
+
scrollTop,
|
|
39
|
+
scrollWidth,
|
|
40
|
+
scrollHeight,
|
|
41
|
+
clientWidth,
|
|
42
|
+
clientHeight
|
|
43
|
+
} = el;
|
|
44
|
+
|
|
45
|
+
if (axis === "horizontal" || axis === "both") {
|
|
46
|
+
setShowLeft(scrollLeft > 0);
|
|
47
|
+
setShowRight(
|
|
48
|
+
Math.ceil(scrollLeft + clientWidth) < Math.floor(scrollWidth - 1)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (axis === "vertical" || axis === "both") {
|
|
53
|
+
setShowTop(scrollTop > 0);
|
|
54
|
+
setShowBottom(
|
|
55
|
+
Math.ceil(scrollTop + clientHeight) < Math.floor(scrollHeight - 1)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
useLayoutEffect(() => {
|
|
61
|
+
requestAnimationFrame(checkScroll);
|
|
62
|
+
}, [axis]);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const container = containerRef.current;
|
|
66
|
+
if (!container) return;
|
|
67
|
+
|
|
68
|
+
const onScroll = () => checkScroll();
|
|
69
|
+
container.addEventListener("scroll", onScroll, { passive: true });
|
|
70
|
+
|
|
71
|
+
const ro = new ResizeObserver(() => checkScroll());
|
|
72
|
+
if (contentRef.current) ro.observe(contentRef.current);
|
|
73
|
+
ro.observe(container);
|
|
74
|
+
|
|
75
|
+
const onResize = () => checkScroll();
|
|
76
|
+
window.addEventListener("resize", onResize);
|
|
77
|
+
|
|
78
|
+
const raf = requestAnimationFrame(checkScroll);
|
|
79
|
+
|
|
80
|
+
return () => {
|
|
81
|
+
container.removeEventListener("scroll", onScroll);
|
|
82
|
+
window.removeEventListener("resize", onResize);
|
|
83
|
+
ro.disconnect();
|
|
84
|
+
cancelAnimationFrame(raf);
|
|
85
|
+
};
|
|
86
|
+
}, [axis]);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div className="relative">
|
|
90
|
+
<div
|
|
91
|
+
ref={containerRef}
|
|
92
|
+
className={cn(
|
|
93
|
+
hideScrollbar &&
|
|
94
|
+
"[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
95
|
+
axis === "horizontal" && "w-full overflow-x-auto overflow-y-hidden",
|
|
96
|
+
axis === "vertical" && "h-full overflow-y-auto overflow-x-hidden",
|
|
97
|
+
axis === "both" && "overflow-auto",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
>
|
|
101
|
+
<div
|
|
102
|
+
ref={contentRef}
|
|
103
|
+
className={cn(
|
|
104
|
+
axis === "horizontal" && "w-fit min-w-full",
|
|
105
|
+
axis === "vertical" && "h-fit min-h-full",
|
|
106
|
+
axis === "both" && "min-w-full min-h-full w-fit h-fit"
|
|
107
|
+
)}
|
|
108
|
+
>
|
|
109
|
+
{children}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
{(axis === "horizontal" || axis === "both") && showLeft && (
|
|
114
|
+
<div
|
|
115
|
+
aria-hidden
|
|
116
|
+
className="pointer-events-none absolute left-0 top-0 h-full w-10 z-10"
|
|
117
|
+
style={{
|
|
118
|
+
opacity: fadeIntensity,
|
|
119
|
+
background: `linear-gradient(to right, var(--background), transparent)`
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
{(axis === "horizontal" || axis === "both") && showRight && (
|
|
125
|
+
<div
|
|
126
|
+
aria-hidden
|
|
127
|
+
className="pointer-events-none absolute right-0 top-0 h-full w-10 z-10"
|
|
128
|
+
style={{
|
|
129
|
+
opacity: fadeIntensity,
|
|
130
|
+
background: `linear-gradient(to left, var(--background), transparent)`
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
|
|
135
|
+
{(axis === "vertical" || axis === "both") && showTop && (
|
|
136
|
+
<div
|
|
137
|
+
aria-hidden
|
|
138
|
+
className="pointer-events-none absolute top-0 left-0 w-full h-10 z-10"
|
|
139
|
+
style={{
|
|
140
|
+
opacity: fadeIntensity,
|
|
141
|
+
background: `linear-gradient(to bottom, var(--background), transparent)`
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
|
|
146
|
+
{(axis === "vertical" || axis === "both") && showBottom && (
|
|
147
|
+
<div
|
|
148
|
+
aria-hidden
|
|
149
|
+
className="pointer-events-none absolute bottom-0 left-0 w-full h-10 z-10"
|
|
150
|
+
style={{
|
|
151
|
+
opacity: fadeIntensity,
|
|
152
|
+
background: `linear-gradient(to top, var(--background), transparent)`
|
|
153
|
+
}}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
3
|
+
|
|
4
|
+
interface StatusIndicatorProps {
|
|
5
|
+
state: "active" | "down" | "fixing" | "idle";
|
|
6
|
+
color?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const getStateColors = (state: StatusIndicatorProps["state"]) => {
|
|
14
|
+
switch (state) {
|
|
15
|
+
case "active":
|
|
16
|
+
return { dot: "bg-green-500", ping: "bg-green-300" };
|
|
17
|
+
case "down":
|
|
18
|
+
return { dot: "bg-red-500", ping: "bg-red-300" };
|
|
19
|
+
case "fixing":
|
|
20
|
+
return { dot: "bg-yellow-500", ping: "bg-yellow-300" };
|
|
21
|
+
case "idle":
|
|
22
|
+
default:
|
|
23
|
+
return { dot: "bg-muted-foreground", ping: "bg-muted-foreground/40" };
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getSizeClasses = (size: StatusIndicatorProps["size"]) => {
|
|
28
|
+
switch (size) {
|
|
29
|
+
case "sm":
|
|
30
|
+
return { dot: "h-2 w-2", ping: "h-2 w-2" };
|
|
31
|
+
case "lg":
|
|
32
|
+
return { dot: "h-4 w-4", ping: "h-4 w-4" };
|
|
33
|
+
case "md":
|
|
34
|
+
default:
|
|
35
|
+
return { dot: "h-3 w-3", ping: "h-3 w-3" };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const StatusIndicator: React.FC<StatusIndicatorProps> = ({
|
|
40
|
+
state = "idle",
|
|
41
|
+
color,
|
|
42
|
+
label,
|
|
43
|
+
className,
|
|
44
|
+
size = "md",
|
|
45
|
+
labelClassName
|
|
46
|
+
}) => {
|
|
47
|
+
const shouldAnimate =
|
|
48
|
+
state === "active" || state === "fixing" || state === "down";
|
|
49
|
+
const colors = getStateColors(state);
|
|
50
|
+
const sizeClasses = getSizeClasses(size);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className={cn("flex items-center gap-2", className)}>
|
|
54
|
+
<div className="relative flex items-center">
|
|
55
|
+
{shouldAnimate && (
|
|
56
|
+
<span
|
|
57
|
+
className={cn(
|
|
58
|
+
"absolute inline-flex rounded-full opacity-75 animate-ping",
|
|
59
|
+
sizeClasses.ping,
|
|
60
|
+
colors.ping
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
<span
|
|
65
|
+
className={cn(
|
|
66
|
+
"relative inline-flex rounded-full",
|
|
67
|
+
sizeClasses.dot,
|
|
68
|
+
colors.dot
|
|
69
|
+
)}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
{label && (
|
|
73
|
+
<p
|
|
74
|
+
className={cn(
|
|
75
|
+
"text-sm text-muted-foreground",
|
|
76
|
+
labelClassName
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{label}
|
|
80
|
+
</p>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default StatusIndicator;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
interface SystemBannerProps {
|
|
2
|
+
text?: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
5
|
+
show?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const sizeClasses: Record<NonNullable<SystemBannerProps["size"]>, string> = {
|
|
9
|
+
xs: "text-[10px] px-1 py-0.5",
|
|
10
|
+
sm: "text-xs px-2 py-0.5",
|
|
11
|
+
md: "text-sm px-3 py-1",
|
|
12
|
+
lg: "text-base px-4 py-1.5"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function SystemBanner({
|
|
16
|
+
text = "Development Mode",
|
|
17
|
+
color = "bg-orange-500",
|
|
18
|
+
size = "xs",
|
|
19
|
+
show = true
|
|
20
|
+
}: SystemBannerProps) {
|
|
21
|
+
if (!show) return null;
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={`
|
|
25
|
+
fixed top-0 left-0 w-full h-0.5 z-50 flex justify-center
|
|
26
|
+
${typeof color === "string" && color.startsWith("#") ? "" : color}
|
|
27
|
+
`}
|
|
28
|
+
style={
|
|
29
|
+
typeof color === "string" && color.startsWith("#")
|
|
30
|
+
? { backgroundColor: color }
|
|
31
|
+
: undefined
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
className={`
|
|
36
|
+
absolute -bottom-4 text-white font-bold rounded shadow-md
|
|
37
|
+
${sizeClasses[size]}
|
|
38
|
+
${typeof color === "string" && color.startsWith("#") ? "" : color}
|
|
39
|
+
`}
|
|
40
|
+
style={
|
|
41
|
+
typeof color === "string" && color.startsWith("#")
|
|
42
|
+
? { backgroundColor: color }
|
|
43
|
+
: undefined
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
{text}
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|