@flamingo-stack/openframe-frontend-core 0.0.825 → 0.0.826
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/export-map.json +1 -1
- package/dist/{case-study-card-IZBMHA6R.cjs → case-study-card-O4IQCJAX.cjs} +5 -5
- package/dist/{chunk-QOAA7ZHB.cjs → chunk-2HQNXX2K.cjs} +2 -2
- package/dist/{chunk-2U7GXE3T.cjs → chunk-2TQJSB62.cjs} +2157 -811
- package/dist/{chunk-NONMZ5WJ.cjs → chunk-2VLPXUQK.cjs} +14 -83
- package/dist/{chunk-7DJWIVQC.cjs → chunk-37OYBX7W.cjs} +36 -36
- package/dist/{chunk-OBQ5WUNG.cjs → chunk-3B6ZE4EZ.cjs} +29 -29
- package/dist/{chunk-AO6YVNAH.cjs → chunk-5AQKXEMI.cjs} +979 -1357
- package/dist/{chunk-25HBH4J6.cjs → chunk-5BM7X4GA.cjs} +2 -2
- package/dist/{chunk-47SHKOCY.cjs → chunk-63T2KKDZ.cjs} +86 -86
- package/dist/{chunk-MHR4C465.cjs → chunk-6G4WRMEM.cjs} +3 -3
- package/dist/{chunk-AUBR3FGY.cjs → chunk-74GWFGH2.cjs} +28 -28
- package/dist/{chunk-467T3LCG.cjs → chunk-7PZQ7SHB.cjs} +49 -32
- package/dist/{chunk-6LVJKPR3.cjs → chunk-AJM4YZTW.cjs} +8 -8
- package/dist/{chunk-2XLPRW7V.cjs → chunk-BIG3O33P.cjs} +6 -2
- package/dist/chunk-BMQLM2NU.cjs +40 -0
- package/dist/{chunk-DVHSYPDB.cjs → chunk-DAKGX2WF.cjs} +2 -2
- package/dist/{chunk-2IWAHBCC.cjs → chunk-DRSFR5AC.cjs} +159 -159
- package/dist/{chunk-IJCSQFLD.cjs → chunk-DU6AF77X.cjs} +83 -121
- package/dist/{chunk-NL34HKLS.cjs → chunk-EJNDTSKY.cjs} +91 -91
- package/dist/{chunk-SBFBNOKU.cjs → chunk-ENMPSEEQ.cjs} +4 -4
- package/dist/{chunk-ZECG6GU5.cjs → chunk-F2J5WN6U.cjs} +2 -2
- package/dist/{chunk-BOS7OIC4.cjs → chunk-GRHF5SWL.cjs} +5 -2
- package/dist/{chunk-Z7BLMJEI.cjs → chunk-GZAPOCKS.cjs} +54 -54
- package/dist/{chunk-5S2GW6YG.cjs → chunk-HJAPXKWK.cjs} +17 -17
- package/dist/{chunk-P25RVNGX.cjs → chunk-HQ4FKHOO.cjs} +249 -108
- package/dist/{chunk-ZRDVFADQ.cjs → chunk-IBD2FPSX.cjs} +75 -9
- package/dist/{chunk-T266OITJ.cjs → chunk-IKWQW3YJ.cjs} +45 -45
- package/dist/{chunk-B7NSH7IK.cjs → chunk-IWQ2LJGW.cjs} +5 -5
- package/dist/{chunk-MALCUN2G.cjs → chunk-JDR72QFU.cjs} +12 -14
- package/dist/{chunk-EHANO6UE.cjs → chunk-K34TTZAE.cjs} +9 -129
- package/dist/{chunk-QDDBOCG3.cjs → chunk-KPGKTEEB.cjs} +2 -2
- package/dist/{chunk-4IY5FKYL.cjs → chunk-MDEOCOIE.cjs} +23 -23
- package/dist/chunk-OEP5KAT6.cjs +56 -0
- package/dist/chunk-OT6P57ZS.cjs +94 -0
- package/dist/{chunk-QQT23JJ7.cjs → chunk-PBHP3FHO.cjs} +4 -4
- package/dist/{chunk-IMMTH3F3.cjs → chunk-PJY3SYCS.cjs} +29 -27
- package/dist/{chunk-N7IDLF2G.cjs → chunk-PWAKRRRO.cjs} +1283 -268
- package/dist/{chunk-UEULXVW2.cjs → chunk-QS6AKUUL.cjs} +22 -22
- package/dist/{chunk-BN7QENV7.cjs → chunk-QYJZDEG7.cjs} +6 -6
- package/dist/{chunk-NPNZAAOB.cjs → chunk-S6UJEW4G.cjs} +2 -2
- package/dist/{chunk-XJMLZ63Y.cjs → chunk-TJG2BJ5J.cjs} +4 -4
- package/dist/{chunk-QOOMUGF2.cjs → chunk-TYJ73DHW.cjs} +15 -15
- package/dist/{chunk-A34UNP5V.cjs → chunk-W4VEDSAX.cjs} +80 -11
- package/dist/{chunk-DNZCSPMU.cjs → chunk-WGMU45NV.cjs} +20 -20
- package/dist/{chunk-APTFXX2C.cjs → chunk-XDHQC4XH.cjs} +46 -46
- package/dist/{cloud-tenants-M4VFFN33.cjs → cloud-tenants-F67KQ5GC.cjs} +108 -106
- package/dist/components/case-studies/index.cjs +124 -122
- package/dist/components/chat/approval-batch-message.d.ts.map +1 -1
- package/dist/components/chat/approval-batch-message.js +2 -2
- package/dist/components/chat/chat-archive-page.d.ts +7 -0
- package/dist/components/chat/chat-archive-page.d.ts.map +1 -1
- package/dist/components/chat/chat-archive-page.js +9 -0
- package/dist/components/chat/chat-composer.d.ts +24 -4
- package/dist/components/chat/chat-composer.d.ts.map +1 -1
- package/dist/components/chat/chat-composer.js +90 -48
- package/dist/components/chat/chat-context-memory-bar.d.ts +4 -1
- package/dist/components/chat/chat-context-memory-bar.d.ts.map +1 -1
- package/dist/components/chat/chat-context-memory-bar.js +8 -5
- package/dist/components/chat/chat-context-picker.d.ts +8 -1
- package/dist/components/chat/chat-context-picker.d.ts.map +1 -1
- package/dist/components/chat/chat-context-picker.js +32 -9
- package/dist/components/chat/chat-header-rename-field.d.ts +18 -0
- package/dist/components/chat/chat-header-rename-field.d.ts.map +1 -0
- package/dist/components/chat/chat-header-rename-field.js +49 -0
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-input.js +5 -0
- package/dist/components/chat/composer-sheet.d.ts +44 -0
- package/dist/components/chat/composer-sheet.d.ts.map +1 -0
- package/dist/components/chat/composer-sheet.js +140 -0
- package/dist/components/chat/embeddable-chat.d.ts +114 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +328 -215
- package/dist/components/chat/index.cjs +118 -103
- package/dist/components/chat/index.d.ts +6 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +9 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts +18 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-day-groups.js +45 -0
- package/dist/components/chat/mingo-chat-header.d.ts +34 -6
- package/dist/components/chat/mingo-chat-header.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-header.js +44 -7
- package/dist/components/chat/mingo-chat-history-section.d.ts +30 -0
- package/dist/components/chat/mingo-chat-history-section.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-history-section.js +500 -0
- package/dist/components/chat/mingo-chat-history.d.ts +5 -2
- package/dist/components/chat/mingo-chat-history.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-history.js +26 -30
- package/dist/components/chat/mingo-chat-list-shared.d.ts +136 -0
- package/dist/components/chat/mingo-chat-list-shared.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-list-shared.js +76 -0
- package/dist/components/chat/mingo-chat-rail.d.ts +19 -51
- package/dist/components/chat/mingo-chat-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-rail.js +23 -45
- package/dist/components/chat/mingo-edge-light.d.ts +13 -0
- package/dist/components/chat/mingo-edge-light.d.ts.map +1 -0
- package/dist/components/chat/mingo-edge-light.js +17 -0
- package/dist/components/chat/mingo-history-rail.d.ts +5 -4
- package/dist/components/chat/mingo-history-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-history-rail.js +5 -10
- package/dist/components/chat/mingo-quick-action-wall.d.ts +27 -0
- package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -0
- package/dist/components/chat/mingo-quick-action-wall.js +41 -0
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/mingo-welcome.js +6 -20
- package/dist/components/chat/model-display.d.ts.map +1 -1
- package/dist/components/chat/model-display.js +38 -9
- package/dist/components/chat/tool-execution-display.d.ts.map +1 -1
- package/dist/components/chat/tool-execution-display.js +15 -1
- package/dist/components/chat/types/component.types.d.ts +13 -1
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-day-label.d.ts +8 -0
- package/dist/components/chat/utils/chat-day-label.d.ts.map +1 -0
- package/dist/components/chat/utils/chat-day-label.js +21 -0
- package/dist/components/contact/index.cjs +109 -107
- package/dist/components/docs/index.cjs +112 -110
- package/dist/components/embeds/index.cjs +109 -107
- package/dist/components/faq/index.cjs +110 -108
- package/dist/components/features/board/board-column.d.ts +3 -1
- package/dist/components/features/board/board-column.d.ts.map +1 -1
- package/dist/components/features/board/board-column.js +6 -2
- package/dist/components/features/board/board.d.ts +6 -0
- package/dist/components/features/board/board.d.ts.map +1 -1
- package/dist/components/features/board/board.js +14 -3
- package/dist/components/features/board/touch-board.d.ts +1 -1
- package/dist/components/features/board/touch-board.d.ts.map +1 -1
- package/dist/components/features/board/touch-board.js +3 -1
- package/dist/components/features/index.cjs +108 -106
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts +7 -1
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/approval-request-notification-tile.js +1 -1
- package/dist/components/features/notifications/notification-drawer.d.ts +6 -1
- package/dist/components/features/notifications/notification-drawer.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-drawer.js +3 -2
- package/dist/components/features/notifications/notification-tile.d.ts +4 -1
- package/dist/components/features/notifications/notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-tile.js +9 -7
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts +18 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts.map +1 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.js +31 -7
- package/dist/components/help-center-pages/index.cjs +217 -215
- package/dist/components/icons-v2-generated/icon-loaders.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/icon-loaders.js +1 -0
- package/dist/components/icons-v2-generated/icon-names.js +1 -1
- package/dist/components/icons-v2-generated/index.cjs +90 -86
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.js +21 -24
- package/dist/components/icons-v2-generated/logos/index.d.ts +1 -0
- package/dist/components/icons-v2-generated/logos/index.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/logos/index.js +2 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts +9 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts.map +1 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.js +36 -0
- package/dist/components/index.cjs +215 -182
- package/dist/components/meeting-scheduler/index.cjs +182 -180
- package/dist/components/navigation/account-popover.d.ts +62 -0
- package/dist/components/navigation/account-popover.d.ts.map +1 -0
- package/dist/components/navigation/account-popover.js +138 -0
- package/dist/components/navigation/app-header.d.ts +36 -2
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-header.js +28 -24
- package/dist/components/navigation/app-layout-context.d.ts +17 -0
- package/dist/components/navigation/app-layout-context.d.ts.map +1 -1
- package/dist/components/navigation/app-layout-context.js +9 -1
- package/dist/components/navigation/app-layout.d.ts +93 -1
- package/dist/components/navigation/app-layout.d.ts.map +1 -1
- package/dist/components/navigation/app-layout.js +149 -30
- package/dist/components/navigation/header-button.d.ts +11 -1
- package/dist/components/navigation/header-button.d.ts.map +1 -1
- package/dist/components/navigation/header-button.js +16 -5
- package/dist/components/navigation/header-mingo-button.d.ts.map +1 -1
- package/dist/components/navigation/header-mingo-button.js +6 -5
- package/dist/components/navigation/index.cjs +120 -109
- package/dist/components/navigation/index.d.ts +10 -1
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +8 -0
- package/dist/components/navigation/mingo-ai-button.d.ts.map +1 -1
- package/dist/components/navigation/mingo-ai-button.js +2 -1
- package/dist/components/navigation/mobile-burger-menu.d.ts.map +1 -1
- package/dist/components/navigation/mobile-burger-menu.js +155 -39
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts +57 -0
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-grouped.js +365 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts +37 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-match.js +85 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts +7 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-slot.js +11 -0
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts +7 -1
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar-toggle.js +52 -23
- package/dist/components/navigation/navigation-sidebar.d.ts +13 -1
- package/dist/components/navigation/navigation-sidebar.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar.js +188 -52
- package/dist/components/navigation/notifications-bell-button.d.ts +28 -0
- package/dist/components/navigation/notifications-bell-button.d.ts.map +1 -0
- package/dist/components/navigation/notifications-bell-button.js +44 -0
- package/dist/components/navigation/ticket-alerts-button.d.ts +7 -1
- package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
- package/dist/components/navigation/ticket-alerts-button.js +3 -2
- package/dist/components/onboarding-guides/index.cjs +111 -109
- package/dist/components/product-demo/index.cjs +119 -117
- package/dist/components/related-content/index.cjs +13 -13
- package/dist/components/tickets/index.cjs +115 -113
- package/dist/components/ui/actions-menu.d.ts +6 -1
- package/dist/components/ui/actions-menu.d.ts.map +1 -1
- package/dist/components/ui/actions-menu.js +6 -2
- package/dist/components/ui/fade-preview.d.ts +8 -0
- package/dist/components/ui/fade-preview.d.ts.map +1 -1
- package/dist/components/ui/fade-preview.js +7 -5
- package/dist/components/ui/index.cjs +136 -111
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/mobile-action-bar.d.ts +14 -0
- package/dist/components/ui/mobile-action-bar.d.ts.map +1 -0
- package/dist/components/ui/mobile-action-bar.js +68 -0
- package/dist/components/ui/no-data/no-data-styles.d.ts +1 -1
- package/dist/components/ui/no-data/no-data-styles.d.ts.map +1 -1
- package/dist/components/ui/no-data/no-data-styles.js +1 -1
- package/dist/components/ui/page-actions.d.ts.map +1 -1
- package/dist/components/ui/page-actions.js +24 -8
- package/dist/components/ui/panel-resize-handle.d.ts +6 -2
- package/dist/components/ui/panel-resize-handle.d.ts.map +1 -1
- package/dist/components/ui/panel-resize-handle.js +6 -3
- package/dist/components/ui/square-avatar.d.ts.map +1 -1
- package/dist/components/ui/square-avatar.js +5 -2
- package/dist/{devices-DW5NDXMD.cjs → devices-SJORCARH.cjs} +109 -107
- package/dist/dots-loader-icon-5JXWD6FB.cjs +7 -0
- package/dist/{embeddable-chat-NBJMXEXB.cjs → embeddable-chat-7Z4CEZJL.cjs} +513 -398
- package/dist/hooks/index.cjs +15 -16
- package/dist/hooks/ui/use-content-breakpoint.d.ts +4 -2
- package/dist/hooks/ui/use-content-breakpoint.d.ts.map +1 -1
- package/dist/{icon-loaders-OLGJZGRP.cjs → icon-loaders-SUPEKMBJ.cjs} +2 -1
- package/dist/index.cjs +154 -121
- package/dist/{knowledge-EYJG2TNW.cjs → knowledge-QXILUVEM.cjs} +109 -107
- package/dist/{logs-2LV7DTSL.cjs → logs-E3KQQQD6.cjs} +118 -115
- package/dist/mingo-logo-icon-WGPBSDTF.cjs +7 -0
- package/dist/{policies-HSDYIQBX.cjs → policies-IOYQY6TF.cjs} +112 -110
- package/dist/{remote-session-BQMTIQTU.cjs → remote-session-QGFG5WAL.cjs} +99 -97
- package/dist/{scripts-UI6V7ANQ.cjs → scripts-E5TWWUNP.cjs} +115 -113
- package/dist/{software-update-WMLY7VHH.cjs → software-update-QZGYG4TD.cjs} +112 -110
- package/dist/{tickets-board-TRXOX77R.cjs → tickets-board-KCH6ITUV.cjs} +95 -94
- package/dist/types/navigation.d.ts +131 -0
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/utils/index.cjs +65 -25
- package/package.json +1 -1
- package/src/components/chat/approval-batch-message.tsx +3 -2
- package/src/components/chat/chat-archive-page.tsx +16 -0
- package/src/components/chat/chat-composer.tsx +131 -61
- package/src/components/chat/chat-context-memory-bar.tsx +27 -17
- package/src/components/chat/chat-context-picker.tsx +45 -11
- package/src/components/chat/chat-header-rename-field.tsx +68 -0
- package/src/components/chat/chat-input.tsx +9 -1
- package/src/components/chat/composer-sheet.tsx +196 -0
- package/src/components/chat/embeddable-chat.tsx +636 -319
- package/src/components/chat/index.ts +6 -0
- package/src/components/chat/mingo-chat-day-groups.ts +62 -0
- package/src/components/chat/mingo-chat-header.tsx +99 -23
- package/src/components/chat/mingo-chat-history-section.tsx +670 -0
- package/src/components/chat/mingo-chat-history.tsx +31 -45
- package/src/components/chat/mingo-chat-list-shared.tsx +244 -0
- package/src/components/chat/mingo-chat-rail.tsx +45 -97
- package/src/components/chat/mingo-edge-light.tsx +25 -0
- package/src/components/chat/mingo-history-rail.tsx +7 -17
- package/src/components/chat/mingo-quick-action-wall.tsx +64 -0
- package/src/components/chat/mingo-welcome.tsx +5 -19
- package/src/components/chat/model-display.tsx +66 -14
- package/src/components/chat/tool-execution-display.tsx +9 -1
- package/src/components/chat/types/component.types.ts +13 -1
- package/src/components/chat/utils/chat-day-label.ts +24 -0
- package/src/components/features/board/board-column.tsx +8 -0
- package/src/components/features/board/board.tsx +16 -2
- package/src/components/features/board/touch-board.tsx +2 -0
- package/src/components/features/notifications/approval-request-notification-tile.tsx +8 -2
- package/src/components/features/notifications/notification-drawer.tsx +7 -1
- package/src/components/features/notifications/notification-tile.tsx +17 -9
- package/src/components/features/time-tracker/time-tracker-header-button.tsx +53 -6
- package/src/components/icons-v2/icon-colors.json +4 -0
- package/src/components/icons-v2-generated/icon-loaders.ts +1 -0
- package/src/components/icons-v2-generated/icon-names.ts +1 -1
- package/src/components/icons-v2-generated/loaders/dots-loader-icon.tsx +18 -27
- package/src/components/icons-v2-generated/logos/index.ts +1 -0
- package/src/components/icons-v2-generated/logos/mingo-logo-icon.tsx +35 -0
- package/src/components/navigation/account-popover.tsx +198 -0
- package/src/components/navigation/app-header.tsx +74 -33
- package/src/components/navigation/app-layout-context.ts +22 -0
- package/src/components/navigation/app-layout.tsx +290 -24
- package/src/components/navigation/header-button.tsx +27 -5
- package/src/components/navigation/header-mingo-button.tsx +6 -5
- package/src/components/navigation/index.ts +19 -0
- package/src/components/navigation/mingo-ai-button.tsx +2 -3
- package/src/components/navigation/mobile-burger-menu.tsx +219 -53
- package/src/components/navigation/navigation-sidebar-grouped.tsx +554 -0
- package/src/components/navigation/navigation-sidebar-match.ts +152 -0
- package/src/components/navigation/navigation-sidebar-slot.ts +12 -0
- package/src/components/navigation/navigation-sidebar-toggle.tsx +39 -6
- package/src/components/navigation/navigation-sidebar.tsx +278 -61
- package/src/components/navigation/notifications-bell-button.tsx +70 -0
- package/src/components/navigation/ticket-alerts-button.tsx +9 -2
- package/src/components/ui/actions-menu.tsx +19 -3
- package/src/components/ui/fade-preview.tsx +13 -6
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/mobile-action-bar.ts +87 -0
- package/src/components/ui/no-data/no-data-styles.ts +5 -2
- package/src/components/ui/page-actions.tsx +38 -11
- package/src/components/ui/panel-resize-handle.tsx +14 -5
- package/src/components/ui/square-avatar.tsx +5 -2
- package/src/hooks/ui/use-content-breakpoint.ts +4 -2
- package/src/styles/ods-interaction-states.css +68 -0
- package/src/types/navigation.ts +140 -0
- package/dist/chunk-C7GIHB3V.cjs +0 -59
- package/dist/dots-loader-icon-RBLX46X7.cjs +0 -7
- package/dist/{chunk-ZOZR3QI2.cjs → chunk-46547WQW.cjs} +0 -0
- package/dist/{video-file-player-IAMWBKEQ.cjs → video-file-player-IHO66P2Q.cjs} +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useState, useMemo
|
|
3
|
+
import { useState, useMemo } from 'react';
|
|
4
4
|
import { cn } from '../../utils/cn';
|
|
5
5
|
import { Ellipsis01Icon, SearchXmarkIcon } from '../icons-v2-generated';
|
|
6
6
|
import { LoadingRegion } from '../loading/loading-region';
|
|
@@ -13,6 +13,8 @@ import { SquareAvatar } from '../ui/square-avatar';
|
|
|
13
13
|
import { chatDialogMenuItems } from './chat-dialog-menu-items';
|
|
14
14
|
import { ChatListEmptyState } from './chat-list-empty-state';
|
|
15
15
|
import { SKELETON_TITLE_WIDTHS } from './chat-nav-sidebar';
|
|
16
|
+
import { dialogTimestamp } from './mingo-chat-day-groups';
|
|
17
|
+
import { useLoadMoreSentinel } from './mingo-chat-list-shared';
|
|
16
18
|
import type { DialogItem } from './types/component.types';
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -64,8 +66,11 @@ export interface MingoChatHistoryProps {
|
|
|
64
66
|
hasMore?: boolean;
|
|
65
67
|
/** True while the next page is loading. */
|
|
66
68
|
isLoadingMore?: boolean;
|
|
67
|
-
/** Fetch the next page — fired when the bottom sentinel scrolls into view. */
|
|
69
|
+
/** Fetch the next page — fired when the bottom sentinel scrolls into view, or on "Show more" (`loadMore`). */
|
|
68
70
|
onLoadMore?: () => void;
|
|
71
|
+
/** How the next page loads: as the list's end scrolls into view (`'scroll'`, the default), or on a
|
|
72
|
+
* "Show more" under it (`'button'`, a page at a time; it spins while the page loads). */
|
|
73
|
+
loadMore?: 'scroll' | 'button';
|
|
69
74
|
/** The first page is still loading: the list draws its own loading state (one page of rows). Inside a
|
|
70
75
|
* `LoadingScope` it does so whatever this says. */
|
|
71
76
|
loading?: boolean;
|
|
@@ -85,12 +90,6 @@ interface DialogGroup {
|
|
|
85
90
|
// Date grouping — Today / Yesterday / Older
|
|
86
91
|
// =============================================================================
|
|
87
92
|
|
|
88
|
-
function dialogTime(d: DialogItem): number | null {
|
|
89
|
-
if (!d.timestamp) return null;
|
|
90
|
-
const t = typeof d.timestamp === 'string' ? Date.parse(d.timestamp) : d.timestamp.getTime();
|
|
91
|
-
return Number.isNaN(t) ? null : t;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
93
|
function groupDialogs(dialogs: ReadonlyArray<DialogItem>): DialogGroup[] {
|
|
95
94
|
const now = new Date();
|
|
96
95
|
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
@@ -100,7 +99,7 @@ function groupDialogs(dialogs: ReadonlyArray<DialogItem>): DialogGroup[] {
|
|
|
100
99
|
const yesterday: DialogItem[] = [];
|
|
101
100
|
const older: DialogItem[] = [];
|
|
102
101
|
for (const d of dialogs) {
|
|
103
|
-
const t =
|
|
102
|
+
const t = dialogTimestamp(d);
|
|
104
103
|
if (t !== null && t >= startOfToday) today.push(d);
|
|
105
104
|
else if (t !== null && t >= startOfYesterday) yesterday.push(d);
|
|
106
105
|
else older.push(d); // includes timestamp-less dialogs
|
|
@@ -363,6 +362,7 @@ export function MingoChatHistory({
|
|
|
363
362
|
hasMore = false,
|
|
364
363
|
isLoadingMore = false,
|
|
365
364
|
onLoadMore,
|
|
365
|
+
loadMore = 'scroll',
|
|
366
366
|
loading = false,
|
|
367
367
|
pageSize = CHAT_HISTORY_PAGE_SIZE,
|
|
368
368
|
className,
|
|
@@ -377,42 +377,15 @@ export function MingoChatHistory({
|
|
|
377
377
|
const { scrollRef, fadeTop, fadeBottom, update: updateFade } = useScrollFade<HTMLDivElement>();
|
|
378
378
|
|
|
379
379
|
// Infinite scroll — load the next page when the sentinel enters the
|
|
380
|
-
// scroll viewport.
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
useEffect(() => {
|
|
389
|
-
onLoadMoreRef.current = onLoadMore;
|
|
390
|
-
isLoadingMoreRef.current = isLoadingMore;
|
|
380
|
+
// scroll viewport. Not with "Show more": the list then grows on a click only.
|
|
381
|
+
const onScroll = loadMore === 'scroll';
|
|
382
|
+
const sentinelRef = useLoadMoreSentinel({
|
|
383
|
+
hasMore: hasMore && onScroll,
|
|
384
|
+
isLoadingMore,
|
|
385
|
+
onLoadMore,
|
|
386
|
+
itemCount: dialogs.length,
|
|
387
|
+
rootRef: scrollRef,
|
|
391
388
|
});
|
|
392
|
-
const dialogCount = dialogs.length;
|
|
393
|
-
useEffect(() => {
|
|
394
|
-
const root = scrollRef.current;
|
|
395
|
-
const sentinel = sentinelRef.current;
|
|
396
|
-
if (!root || !sentinel || !hasMore || typeof IntersectionObserver === 'undefined') return undefined;
|
|
397
|
-
const io = new IntersectionObserver(
|
|
398
|
-
([entry]) => {
|
|
399
|
-
if (entry.isIntersecting && !isLoadingMoreRef.current) {
|
|
400
|
-
onLoadMoreRef.current?.();
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
{ root, rootMargin: '120px', threshold: 0.1 },
|
|
404
|
-
);
|
|
405
|
-
io.observe(sentinel);
|
|
406
|
-
return () => io.disconnect();
|
|
407
|
-
// `dialogCount`/`isLoadingMore` deps re-arm the observer after every page
|
|
408
|
-
// lands: `observe()` re-reports the CURRENT intersection, so a sentinel
|
|
409
|
-
// that stays in view (short host-filtered list — e.g. the "My Chats"
|
|
410
|
-
// scope keeps a handful of rows out of a 20-row page) keeps chaining
|
|
411
|
-
// loads until the viewport fills or `hasMore` flips. A continuously
|
|
412
|
-
// visible sentinel never re-crosses the threshold, so the previous
|
|
413
|
-
// [hasMore]-only observer fired exactly once per mount and the list
|
|
414
|
-
// grew by a single page per drawer open.
|
|
415
|
-
}, [hasMore, isLoadingMore, dialogCount, scrollRef]);
|
|
416
389
|
|
|
417
390
|
if (isLoading) return <MingoChatHistorySkeleton rows={pageSize} className={className} />;
|
|
418
391
|
|
|
@@ -456,7 +429,20 @@ export function MingoChatHistory({
|
|
|
456
429
|
</div>
|
|
457
430
|
))
|
|
458
431
|
)}
|
|
459
|
-
{hasMore ? <div ref={sentinelRef} className="h-px shrink-0" /> : null}
|
|
432
|
+
{hasMore && onScroll ? <div ref={sentinelRef} className="h-px shrink-0" /> : null}
|
|
433
|
+
{hasMore && !onScroll && onLoadMore ? (
|
|
434
|
+
<Button
|
|
435
|
+
variant="link"
|
|
436
|
+
size="compact"
|
|
437
|
+
type="button"
|
|
438
|
+
data-tone="neutral"
|
|
439
|
+
loading={isLoadingMore}
|
|
440
|
+
onClick={onLoadMore}
|
|
441
|
+
className="self-start px-[var(--spacing-system-xs)]"
|
|
442
|
+
>
|
|
443
|
+
Show more
|
|
444
|
+
</Button>
|
|
445
|
+
) : null}
|
|
460
446
|
</div>
|
|
461
447
|
|
|
462
448
|
{/* Scroll-fade — only while content is hidden in that direction. */}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type ReactNode, type RefObject, useEffect, useRef } from 'react';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { AlertCircleIcon, MessageIndicatorIcon, Refresh01RightIcon, ShieldCheckIcon } from '../icons-v2-generated';
|
|
6
|
+
import type { ActionsMenuItem } from '../ui/actions-menu';
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
import type { DialogItem } from './types/component.types';
|
|
9
|
+
|
|
10
|
+
/** Ownership scope of a Mingo chat list: the current user's chats only, or
|
|
11
|
+
* every admin's chats in the tenant. */
|
|
12
|
+
export type MingoHistoryScope = 'my' | 'all';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What a chat is doing, shown at the end of its row:
|
|
16
|
+
* - `working`: Mingo is answering in it
|
|
17
|
+
* - `unread`: a reply the user has not seen
|
|
18
|
+
* - `approval`: Mingo waits for an approval there
|
|
19
|
+
*/
|
|
20
|
+
export type MingoDialogStatus = 'working' | 'unread' | 'approval';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `DotsLoaderIcon` drawn as HTML boxes (`ods-dots-loader` in the ODS styles): same box,
|
|
24
|
+
* dots and motion. A chat row shows it for as long as a reply streams, on every page,
|
|
25
|
+
* and WebKit animates an SVG child on the main thread every frame — one row's icon kept
|
|
26
|
+
* ~12% of a core busy; HTML boxes ~3% (2026-10-21).
|
|
27
|
+
*/
|
|
28
|
+
function WorkingDots({ className }: { className?: string }) {
|
|
29
|
+
return (
|
|
30
|
+
<span className={cn('ods-dots-loader', className)}>
|
|
31
|
+
<span />
|
|
32
|
+
<span />
|
|
33
|
+
<span />
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One glyph per status, for every Mingo chat list (the v2 rail, the sidebar section). */
|
|
39
|
+
export const MINGO_DIALOG_STATUS_GLYPHS: Record<MingoDialogStatus, { icon: ReactNode; label: string }> = {
|
|
40
|
+
working: { icon: <WorkingDots className="text-ods-text-secondary" />, label: 'Mingo is working' },
|
|
41
|
+
unread: { icon: <MessageIndicatorIcon className="text-ods-accent" />, label: 'New reply' },
|
|
42
|
+
approval: { icon: <ShieldCheckIcon className="text-ods-accent" />, label: 'Waiting for approval' },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The list both Mingo chat lists render — the v2 panel's rail and the main
|
|
47
|
+
* sidebar's chat-history section (`MingoChatRail` `variant`). The host owns the
|
|
48
|
+
* data, the scope, the search term and the paging; the list only shows them.
|
|
49
|
+
*/
|
|
50
|
+
export interface MingoChatListProps {
|
|
51
|
+
/** Dialogs to list, newest first. */
|
|
52
|
+
dialogs: ReadonlyArray<DialogItem>;
|
|
53
|
+
activeDialogId?: string;
|
|
54
|
+
onSelectDialog?: (id: string) => void;
|
|
55
|
+
/** A chat being started and not saved yet: a selected row at the top
|
|
56
|
+
* (e.g. "New Chat"), so the list says what the chat beside it is. */
|
|
57
|
+
draftTitle?: string;
|
|
58
|
+
/** Open the archive. The rail lists it as an action; the section puts
|
|
59
|
+
* "Chat archive" in its ⋯ menu. */
|
|
60
|
+
onOpenArchive?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* "What to ask Mingo?": the suggestions a chat starts from. The rail draws it as an
|
|
63
|
+
* action under the logo, the section as an item of its ⋯ menu.
|
|
64
|
+
*/
|
|
65
|
+
onWhatToAsk?: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* The host's own actions at the end of the section's ⋯ menu, after "Chat archive" and
|
|
68
|
+
* "What to ask Mingo?" (e.g. "Reset Onboarding"). The section only: the rail has no ⋯ of its own.
|
|
69
|
+
*/
|
|
70
|
+
moreMenuItems?: ActionsMenuItem[];
|
|
71
|
+
/** A row's status glyph. Unread replies are shown without it. */
|
|
72
|
+
statusOf?: (dialog: DialogItem) => MingoDialogStatus | undefined;
|
|
73
|
+
/** Row ⋯ menu actions — each item appears only when its handler is set. */
|
|
74
|
+
onRequestRename?: (dialog: DialogItem) => void;
|
|
75
|
+
onRequestArchive?: (dialog: DialogItem) => void;
|
|
76
|
+
onRequestCopyLink?: (dialog: DialogItem) => void;
|
|
77
|
+
onRequestCompact?: (dialog: DialogItem) => void;
|
|
78
|
+
/** My Chats / All Chats; both or neither. The rail offers it in its ⋯
|
|
79
|
+
* menu, the section as a `TabSelector`. */
|
|
80
|
+
scope?: MingoHistoryScope;
|
|
81
|
+
onScopeChange?: (scope: MingoHistoryScope) => void;
|
|
82
|
+
/** Server-side search: `searchQuery` is the host's term, `onSearchChange`
|
|
83
|
+
* receives the debounced input. Without a handler there is no search. */
|
|
84
|
+
searchQuery?: string;
|
|
85
|
+
onSearchChange?: (query: string) => void;
|
|
86
|
+
/** Whether the search is open. Controlled with `onSearchOpenChange` (e.g. a
|
|
87
|
+
* host that opens it on ⌘K); without it the list keeps its own state, open
|
|
88
|
+
* from the start while `searchQuery` holds a term (the rail). The rail's is a
|
|
89
|
+
* field in its header; the section's is a modal — `MingoChatSearchModal`,
|
|
90
|
+
* which a host controlling this renders once itself. The section's Search
|
|
91
|
+
* tooltip names ⌘K / Ctrl K: binding that key is the host's (it may have to
|
|
92
|
+
* open a collapsed sidebar first), the list listens for none. */
|
|
93
|
+
searchOpen?: boolean;
|
|
94
|
+
onSearchOpenChange?: (open: boolean) => void;
|
|
95
|
+
hasMore?: boolean;
|
|
96
|
+
isLoadingMore?: boolean;
|
|
97
|
+
onLoadMore?: () => void;
|
|
98
|
+
/**
|
|
99
|
+
* How the section's list loads its next page: as its end scrolls into view
|
|
100
|
+
* (`'scroll'`, the default), or on a "Show more" under it (`'button'`). The
|
|
101
|
+
* search results and the rail always scroll.
|
|
102
|
+
*/
|
|
103
|
+
loadMore?: 'scroll' | 'button';
|
|
104
|
+
/** The first page is still loading: the list draws one page of loading rows. */
|
|
105
|
+
isLoadingHistory?: boolean;
|
|
106
|
+
/** The host's page size: how many rows the loading state draws. Default `CHAT_HISTORY_PAGE_SIZE`. */
|
|
107
|
+
pageSize?: number;
|
|
108
|
+
/** The list failed to load with nothing cached. */
|
|
109
|
+
loadError?: boolean;
|
|
110
|
+
onRetry?: () => void;
|
|
111
|
+
/** Section only: the chat belongs to someone other than the viewer, so its
|
|
112
|
+
* row shows the owner's (`dialog.owner`) initials. The row cannot tell on
|
|
113
|
+
* its own: hosts set `owner` on the viewer's chats too. Wins over
|
|
114
|
+
* `currentUserId`. */
|
|
115
|
+
ownedByOther?: (dialog: DialogItem) => boolean;
|
|
116
|
+
/** Section only: the viewer's user id. Without `ownedByOther`, a chat whose
|
|
117
|
+
* `owner.id` is set and differs from it is someone else's; a chat with no
|
|
118
|
+
* `owner.id` is taken as the viewer's. */
|
|
119
|
+
currentUserId?: string | null;
|
|
120
|
+
className?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether a row is someone else's chat: the host's answer when it gives one
|
|
125
|
+
* (`ownedByOther`), else `owner.id` against the viewer's id. Unknown = the
|
|
126
|
+
* viewer's own, so no row shows a stranger's initials on a guess.
|
|
127
|
+
*/
|
|
128
|
+
export function dialogOwnedByOther(
|
|
129
|
+
dialog: DialogItem,
|
|
130
|
+
ownedByOther: ((dialog: DialogItem) => boolean) | undefined,
|
|
131
|
+
currentUserId: string | null | undefined,
|
|
132
|
+
): boolean {
|
|
133
|
+
if (ownedByOther) return ownedByOther(dialog);
|
|
134
|
+
const ownerId = dialog.owner?.id;
|
|
135
|
+
return !!currentUserId && !!ownerId && ownerId !== currentUserId;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** The host's status for the row, else an unread reply when the row counts one. */
|
|
139
|
+
export function mingoDialogStatusOf(
|
|
140
|
+
dialog: DialogItem,
|
|
141
|
+
statusOf: ((dialog: DialogItem) => MingoDialogStatus | undefined) | undefined,
|
|
142
|
+
): MingoDialogStatus | undefined {
|
|
143
|
+
return statusOf?.(dialog) ?? ((dialog.unreadMessagesCount ?? 0) > 0 ? 'unread' : undefined);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* "Couldn't load your chats" + Try again: what a Mingo chat list shows when its
|
|
148
|
+
* first page failed with nothing cached. One block for every list, so the
|
|
149
|
+
* wording cannot drift between them.
|
|
150
|
+
*/
|
|
151
|
+
export function ChatListLoadError({ onRetry, className }: { onRetry?: () => void; className?: string }) {
|
|
152
|
+
return (
|
|
153
|
+
<div className={cn('flex flex-col items-center gap-[var(--spacing-system-m)] text-center', className)}>
|
|
154
|
+
<AlertCircleIcon className="size-8 shrink-0 text-ods-text-secondary" />
|
|
155
|
+
<div className="flex flex-col gap-[var(--spacing-system-xxs)]">
|
|
156
|
+
<p className="text-ods-text-primary text-h4">Couldn’t load your chats</p>
|
|
157
|
+
<p className="text-ods-text-secondary text-h6">Something went wrong reaching the server. Try again.</p>
|
|
158
|
+
</div>
|
|
159
|
+
{onRetry && (
|
|
160
|
+
<Button variant="outline" size="small" leftIcon={<Refresh01RightIcon />} onClick={onRetry}>
|
|
161
|
+
Try again
|
|
162
|
+
</Button>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface LoadMoreSentinelOptions {
|
|
169
|
+
/** Whether more rows remain (cursor pagination). */
|
|
170
|
+
hasMore: boolean;
|
|
171
|
+
/** True while the next page is loading: no second request meanwhile. */
|
|
172
|
+
isLoadingMore: boolean;
|
|
173
|
+
/** Fetch the next page. */
|
|
174
|
+
onLoadMore?: () => void;
|
|
175
|
+
/** Rows rendered so far: a landed page re-arms the observer. */
|
|
176
|
+
itemCount: number;
|
|
177
|
+
/**
|
|
178
|
+
* The scrolling element the sentinel is clipped by. Omitted: the viewport —
|
|
179
|
+
* which still clips by every scroll box between it and the sentinel, so a
|
|
180
|
+
* list works whichever ancestor scrolls it (the sidebar's history section:
|
|
181
|
+
* the sidebar body).
|
|
182
|
+
*/
|
|
183
|
+
rootRef?: RefObject<HTMLElement | null>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* How far ahead of the end of the list the next page starts loading: about a
|
|
188
|
+
* screen of rows, so a reader scrolling at a normal pace never reaches the end
|
|
189
|
+
* and never sees the placeholder. Below only — a list off to the side (the
|
|
190
|
+
* closed phone drawer, translated out of view) must not count as near.
|
|
191
|
+
*/
|
|
192
|
+
const LOAD_AHEAD = '0px 0px 600px 0px';
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Infinite scroll for a chat list: put the returned ref on a 1px sentinel after
|
|
196
|
+
* the last row (rendered only while `hasMore`), and `onLoadMore` fires when it
|
|
197
|
+
* comes into view.
|
|
198
|
+
*/
|
|
199
|
+
export function useLoadMoreSentinel({
|
|
200
|
+
hasMore,
|
|
201
|
+
isLoadingMore,
|
|
202
|
+
onLoadMore,
|
|
203
|
+
itemCount,
|
|
204
|
+
rootRef,
|
|
205
|
+
}: LoadMoreSentinelOptions) {
|
|
206
|
+
const sentinelRef = useRef<HTMLDivElement>(null);
|
|
207
|
+
// Refreshed in an unconditional effect, declared before the observer effect
|
|
208
|
+
// so it wins the same flush. Not in the render body: the only reader is the
|
|
209
|
+
// IntersectionObserver callback, which cannot fire before a commit, and a
|
|
210
|
+
// discarded render attempt must not install a loading flag that never was.
|
|
211
|
+
const onLoadMoreRef = useRef(onLoadMore);
|
|
212
|
+
const isLoadingMoreRef = useRef(isLoadingMore);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
onLoadMoreRef.current = onLoadMore;
|
|
215
|
+
isLoadingMoreRef.current = isLoadingMore;
|
|
216
|
+
});
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
const sentinel = sentinelRef.current;
|
|
219
|
+
const root = rootRef ? rootRef.current : null;
|
|
220
|
+
if (!sentinel || (rootRef && !root) || !hasMore || typeof IntersectionObserver === 'undefined') return undefined;
|
|
221
|
+
// `rootMargin` grows the root only. `scrollMargin` grows every scroll box
|
|
222
|
+
// between the sentinel and the root as well, so the page also loads ahead
|
|
223
|
+
// inside a nested list; an engine without it ignores the key and loads
|
|
224
|
+
// once the sentinel shows.
|
|
225
|
+
const options: IntersectionObserverInit & { scrollMargin?: string } = {
|
|
226
|
+
root,
|
|
227
|
+
rootMargin: LOAD_AHEAD,
|
|
228
|
+
scrollMargin: LOAD_AHEAD,
|
|
229
|
+
threshold: 0.1,
|
|
230
|
+
};
|
|
231
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
232
|
+
if (entry?.isIntersecting && !isLoadingMoreRef.current) onLoadMoreRef.current?.();
|
|
233
|
+
}, options);
|
|
234
|
+
observer.observe(sentinel);
|
|
235
|
+
return () => observer.disconnect();
|
|
236
|
+
// `itemCount`/`isLoadingMore` re-arm the observer after every page lands:
|
|
237
|
+
// `observe()` re-reports the CURRENT intersection, so a sentinel that stays
|
|
238
|
+
// in view (a short page, e.g. the "My Chats" scope) keeps chaining loads
|
|
239
|
+
// until the list fills its box or `hasMore` flips. A sentinel that never
|
|
240
|
+
// leaves the view never re-crosses the threshold, so an observer armed once
|
|
241
|
+
// would load a single page per mount.
|
|
242
|
+
}, [hasMore, isLoadingMore, itemCount, rootRef]);
|
|
243
|
+
return sentinelRef;
|
|
244
|
+
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
4
|
+
import { type ReactNode, useState } from 'react';
|
|
4
5
|
import { cn } from '../../utils/cn';
|
|
5
6
|
import { AgentMark } from '../agent-mark';
|
|
6
7
|
import {
|
|
7
|
-
AlertCircleIcon,
|
|
8
8
|
Arrow02LeftIcon,
|
|
9
9
|
ChatPlusIcon,
|
|
10
10
|
ChatQuestionIcon,
|
|
11
11
|
ChatsIcon,
|
|
12
12
|
ClockHistoryIcon,
|
|
13
|
-
DotsLoaderIcon,
|
|
14
13
|
Ellipsis01Icon,
|
|
15
|
-
MessageIndicatorIcon,
|
|
16
|
-
Refresh01RightIcon,
|
|
17
14
|
SearchIcon,
|
|
18
|
-
ShieldCheckIcon,
|
|
19
15
|
UserIcon,
|
|
20
16
|
UsersIcon,
|
|
21
17
|
} from '../icons-v2-generated';
|
|
@@ -27,66 +23,43 @@ import { ChatHeaderSearchField } from './chat-header-search-field';
|
|
|
27
23
|
import { ChatListEmptyState } from './chat-list-empty-state';
|
|
28
24
|
import { ChatListItem, ChatListItemLoadingPage, ChatNavSidebar, type ChatNavSidebarItem } from './chat-nav-sidebar';
|
|
29
25
|
import { CHAT_HISTORY_PAGE_SIZE } from './mingo-chat-history';
|
|
30
|
-
import
|
|
26
|
+
import { MingoChatHistorySection } from './mingo-chat-history-section';
|
|
27
|
+
import {
|
|
28
|
+
ChatListLoadError,
|
|
29
|
+
MINGO_DIALOG_STATUS_GLYPHS,
|
|
30
|
+
type MingoChatListProps,
|
|
31
|
+
type MingoDialogStatus,
|
|
32
|
+
mingoDialogStatusOf,
|
|
33
|
+
useLoadMoreSentinel,
|
|
34
|
+
} from './mingo-chat-list-shared';
|
|
31
35
|
import type { DialogItem } from './types/component.types';
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** A chat being started and not saved yet: a selected row at the top
|
|
47
|
-
* (e.g. "New Chat"), so the list says what the chat beside it is. */
|
|
48
|
-
draftTitle?: string;
|
|
37
|
+
export interface MingoChatRailProps extends MingoChatListProps {
|
|
38
|
+
/**
|
|
39
|
+
* `'rail'` (default): the v2 chat panel's own column — the Mingo mark, the
|
|
40
|
+
* actions below (start a chat, the archive, "What to ask Mingo?") and the
|
|
41
|
+
* list, at a fixed 296 px.
|
|
42
|
+
* `'section'`: the chat history block of a host's main navigation sidebar
|
|
43
|
+
* (`MingoChatHistorySection`) — caption, Search, ⋯ (Chat archive, What to ask Mingo?), the scope,
|
|
44
|
+
* the chats grouped by day. No outer chrome or width of its own; it fills the
|
|
45
|
+
* height it is given and scrolls inside. The rail-only props below are
|
|
46
|
+
* ignored there.
|
|
47
|
+
*/
|
|
48
|
+
variant?: 'rail' | 'section';
|
|
49
|
+
/** Rail only. */
|
|
49
50
|
onNewChat?: () => void;
|
|
50
|
-
/**
|
|
51
|
-
onOpenArchive?: () => void;
|
|
51
|
+
/** Rail only: the archive is the view on screen. */
|
|
52
52
|
archiveActive?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
onWhatToAsk?: () => void;
|
|
55
|
-
/** A row's status glyph. Unread replies are shown without it. */
|
|
56
|
-
statusOf?: (dialog: DialogItem) => MingoDialogStatus | undefined;
|
|
57
|
-
onRequestRename?: (dialog: DialogItem) => void;
|
|
58
|
-
onRequestArchive?: (dialog: DialogItem) => void;
|
|
59
|
-
onRequestCopyLink?: (dialog: DialogItem) => void;
|
|
60
|
-
onRequestCompact?: (dialog: DialogItem) => void;
|
|
61
|
-
/** "Show My Chats" / "Show All Chats" in the list's ⋯ menu; both or neither. */
|
|
62
|
-
scope?: MingoHistoryScope;
|
|
63
|
-
onScopeChange?: (scope: MingoHistoryScope) => void;
|
|
64
|
-
/** Server-side search. With a handler the ⋯ menu offers "Search for Chat". */
|
|
65
|
-
searchQuery?: string;
|
|
66
|
-
onSearchChange?: (query: string) => void;
|
|
67
|
-
hasMore?: boolean;
|
|
68
|
-
isLoadingMore?: boolean;
|
|
69
|
-
onLoadMore?: () => void;
|
|
70
|
-
/** The first page is still loading: the list draws one page of loading rows. */
|
|
71
|
-
isLoadingHistory?: boolean;
|
|
72
|
-
/** The host's page size: how many rows the loading state draws. Default `CHAT_HISTORY_PAGE_SIZE`. */
|
|
73
|
-
pageSize?: number;
|
|
74
|
-
/** The list failed to load with nothing cached. */
|
|
75
|
-
loadError?: boolean;
|
|
76
|
-
onRetry?: () => void;
|
|
77
|
-
/** The |← control beside the logo: widen the panel to the list and the chat. */
|
|
53
|
+
/** Rail only — the |← control beside the logo: widen the panel to the list and the chat. */
|
|
78
54
|
onExpand?: () => void;
|
|
79
|
-
className?: string;
|
|
80
55
|
}
|
|
81
56
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function statusFor(dialog: DialogItem, statusOf: MingoChatRailProps['statusOf']): MingoDialogStatus | undefined {
|
|
89
|
-
return statusOf?.(dialog) ?? ((dialog.unreadMessagesCount ?? 0) > 0 ? 'unread' : undefined);
|
|
57
|
+
/**
|
|
58
|
+
* The Mingo chat list. The default rail is the v2 panel's column; the section
|
|
59
|
+
* is the same list placed in the main sidebar (see `variant`).
|
|
60
|
+
*/
|
|
61
|
+
export function MingoChatRail({ variant = 'rail', ...props }: MingoChatRailProps) {
|
|
62
|
+
return variant === 'section' ? <MingoChatHistorySection {...props} /> : <MingoChatRailPanel {...props} />;
|
|
90
63
|
}
|
|
91
64
|
|
|
92
65
|
/**
|
|
@@ -96,7 +69,7 @@ function statusFor(dialog: DialogItem, statusOf: MingoChatRailProps['statusOf'])
|
|
|
96
69
|
* status at the end. Row actions (rename, archive, ...) sit behind a ⋯ that
|
|
97
70
|
* replaces the status on hover.
|
|
98
71
|
*/
|
|
99
|
-
|
|
72
|
+
function MingoChatRailPanel({
|
|
100
73
|
dialogs,
|
|
101
74
|
activeDialogId,
|
|
102
75
|
onSelectDialog,
|
|
@@ -114,6 +87,8 @@ export function MingoChatRail({
|
|
|
114
87
|
onScopeChange,
|
|
115
88
|
searchQuery,
|
|
116
89
|
onSearchChange,
|
|
90
|
+
searchOpen: searchOpenProp,
|
|
91
|
+
onSearchOpenChange,
|
|
117
92
|
hasMore = false,
|
|
118
93
|
isLoadingMore = false,
|
|
119
94
|
onLoadMore,
|
|
@@ -123,10 +98,14 @@ export function MingoChatRail({
|
|
|
123
98
|
onRetry,
|
|
124
99
|
onExpand,
|
|
125
100
|
className,
|
|
126
|
-
}: MingoChatRailProps) {
|
|
101
|
+
}: Omit<MingoChatRailProps, 'variant'>) {
|
|
127
102
|
// ONE switch: the first page loading (or the page's loading state) draws one page of the rows' own skeleton.
|
|
128
103
|
const loading = useLoadingScope() || isLoadingHistory;
|
|
129
|
-
const [searchOpen, setSearchOpen] =
|
|
104
|
+
const [searchOpen, setSearchOpen] = useControllableState({
|
|
105
|
+
prop: searchOpenProp,
|
|
106
|
+
defaultProp: !!searchQuery?.trim(),
|
|
107
|
+
onChange: onSearchOpenChange,
|
|
108
|
+
});
|
|
130
109
|
const hasSearch = !!searchQuery?.trim();
|
|
131
110
|
|
|
132
111
|
const items: ChatNavSidebarItem[] = [];
|
|
@@ -176,43 +155,12 @@ export function MingoChatRail({
|
|
|
176
155
|
|
|
177
156
|
// Infinite scroll: the next page when the sentinel at the list's end shows.
|
|
178
157
|
// The observer clips against the scrolling list, so the viewport root works.
|
|
179
|
-
const sentinelRef =
|
|
180
|
-
const onLoadMoreRef = useRef(onLoadMore);
|
|
181
|
-
const isLoadingMoreRef = useRef(isLoadingMore);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
onLoadMoreRef.current = onLoadMore;
|
|
184
|
-
isLoadingMoreRef.current = isLoadingMore;
|
|
185
|
-
});
|
|
186
|
-
const dialogCount = dialogs.length;
|
|
187
|
-
useEffect(() => {
|
|
188
|
-
const sentinel = sentinelRef.current;
|
|
189
|
-
if (!sentinel || !hasMore || typeof IntersectionObserver === 'undefined') return undefined;
|
|
190
|
-
const observer = new IntersectionObserver(
|
|
191
|
-
([entry]) => {
|
|
192
|
-
if (entry?.isIntersecting && !isLoadingMoreRef.current) onLoadMoreRef.current?.();
|
|
193
|
-
},
|
|
194
|
-
{ rootMargin: '120px', threshold: 0.1 },
|
|
195
|
-
);
|
|
196
|
-
observer.observe(sentinel);
|
|
197
|
-
return () => observer.disconnect();
|
|
198
|
-
// Re-armed per page: a sentinel still in view after a short page keeps loading.
|
|
199
|
-
}, [hasMore, dialogCount, isLoadingMore]);
|
|
158
|
+
const sentinelRef = useLoadMoreSentinel({ hasMore, isLoadingMore, onLoadMore, itemCount: dialogs.length });
|
|
200
159
|
|
|
201
160
|
let list: ReactNode;
|
|
202
161
|
if (loadError) {
|
|
203
162
|
list = (
|
|
204
|
-
<
|
|
205
|
-
<AlertCircleIcon className="size-8 shrink-0 text-ods-text-secondary" />
|
|
206
|
-
<div className="flex flex-col gap-[var(--spacing-system-xxs)]">
|
|
207
|
-
<p className="text-ods-text-primary text-h4">Couldn’t load your chats</p>
|
|
208
|
-
<p className="text-ods-text-secondary text-h6">Something went wrong reaching the server. Try again.</p>
|
|
209
|
-
</div>
|
|
210
|
-
{onRetry && (
|
|
211
|
-
<Button variant="outline" size="small" leftIcon={<Refresh01RightIcon />} onClick={onRetry}>
|
|
212
|
-
Try again
|
|
213
|
-
</Button>
|
|
214
|
-
)}
|
|
215
|
-
</div>
|
|
163
|
+
<ChatListLoadError onRetry={onRetry} className="px-[var(--spacing-system-xs)] py-[var(--spacing-system-l)]" />
|
|
216
164
|
);
|
|
217
165
|
} else if (loading) {
|
|
218
166
|
list = <ChatListItemLoadingPage count={pageSize} />;
|
|
@@ -238,7 +186,7 @@ export function MingoChatRail({
|
|
|
238
186
|
data-loading-item
|
|
239
187
|
dialog={dialog}
|
|
240
188
|
active={dialog.id === activeDialogId}
|
|
241
|
-
status={
|
|
189
|
+
status={mingoDialogStatusOf(dialog, statusOf)}
|
|
242
190
|
onSelect={onSelectDialog}
|
|
243
191
|
menuItems={chatDialogMenuItems({
|
|
244
192
|
onCopyLink: onRequestCopyLink && (() => onRequestCopyLink(dialog)),
|
|
@@ -326,7 +274,7 @@ interface MingoChatRailRowProps {
|
|
|
326
274
|
function MingoChatRailRow({ dialog, active, status, onSelect, menuItems, ...props }: MingoChatRailRowProps) {
|
|
327
275
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
328
276
|
const hasMenu = menuItems.length > 0;
|
|
329
|
-
const glyph = status ?
|
|
277
|
+
const glyph = status ? MINGO_DIALOG_STATUS_GLYPHS[status] : undefined;
|
|
330
278
|
const title = dialog.title || 'Untitled Chat';
|
|
331
279
|
|
|
332
280
|
return (
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn } from '../../utils/cn';
|
|
2
|
+
|
|
3
|
+
export interface MingoEdgeLightProps {
|
|
4
|
+
/** The host's corner radius (e.g. `rounded-md`), so the ring follows its outline. */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Mingo's AI edge light (`.mingo-edge-frame` / `.mingo-edge` in
|
|
10
|
+
* `styles/chat-animations.css`): an accent arc travelling around the host's
|
|
11
|
+
* outline, clipped to a 1px ring by a CSS mask, so the host's own background
|
|
12
|
+
* shows through. Static under reduced motion. Absolutely positioned over a
|
|
13
|
+
* `relative` host, on its border box; it takes no pointer events.
|
|
14
|
+
*/
|
|
15
|
+
export function MingoEdgeLight({ className }: MingoEdgeLightProps) {
|
|
16
|
+
return (
|
|
17
|
+
<span
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
data-testid="mingo-edge-light"
|
|
20
|
+
className={cn('mingo-edge-frame pointer-events-none absolute inset-0', className)}
|
|
21
|
+
>
|
|
22
|
+
<span className="mingo-edge" />
|
|
23
|
+
</span>
|
|
24
|
+
);
|
|
25
|
+
}
|