@datarecce/ui 0.1.29 → 0.1.31
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/{RecceCheckContext-fAKHgsGz.js → RecceCheckContext-DPpu9nG5.js} +2 -2
- package/dist/{RecceCheckContext-fAKHgsGz.js.map → RecceCheckContext-DPpu9nG5.js.map} +1 -1
- package/dist/{RecceCheckContext-PT4-g1bW.mjs → RecceCheckContext-bXdfQLGG.mjs} +2 -2
- package/dist/{RecceCheckContext-PT4-g1bW.mjs.map → RecceCheckContext-bXdfQLGG.mjs.map} +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +4 -3
- package/dist/api.mjs +4 -3
- package/dist/{components-B9F5oJbK.js → components-B-YxuuPz.js} +66 -65
- package/dist/{components-B9F5oJbK.js.map → components-B-YxuuPz.js.map} +1 -1
- package/dist/{components-D2DRqJsz.css → components-BeAjVBV3.css} +1 -1
- package/dist/{components-D2DRqJsz.css.map → components-BeAjVBV3.css.map} +1 -1
- package/dist/{components-gDC1ucjo.mjs → components-DCOI1YlQ.mjs} +8 -7
- package/dist/{components-gDC1ucjo.mjs.map → components-DCOI1YlQ.mjs.map} +1 -1
- package/dist/{components-dVXbmdqd.css → components-iUxcqtUB.css} +1 -1
- package/dist/{components-dVXbmdqd.css.map → components-iUxcqtUB.css.map} +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +6 -5
- package/dist/components.mjs +6 -5
- package/dist/{hooks-C2jUJ9EN.js → hooks-B9hsc1oD.js} +3 -3
- package/dist/{hooks-C2jUJ9EN.js.map → hooks-B9hsc1oD.js.map} +1 -1
- package/dist/{hooks-4hRUjy9Q.mjs → hooks-DjBNmTdh.mjs} +3 -3
- package/dist/{hooks-4hRUjy9Q.mjs.map → hooks-DjBNmTdh.mjs.map} +1 -1
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +5 -4
- package/dist/hooks.mjs +5 -4
- package/dist/{html2canvas-pro.esm-BR5xeFe-.mjs → html2canvas-pro.esm-BInzOtWO.mjs} +1 -1
- package/dist/{html2canvas-pro.esm-BR5xeFe-.mjs.map → html2canvas-pro.esm-BInzOtWO.mjs.map} +1 -1
- package/dist/{html2canvas-pro.esm-CVOsBdk0.js → html2canvas-pro.esm-WJxOmKlq.js} +1 -1
- package/dist/{html2canvas-pro.esm-CVOsBdk0.js.map → html2canvas-pro.esm-WJxOmKlq.js.map} +1 -1
- package/dist/{index-Bv5R8iLo.d.mts → index-B9lSPJTi.d.ts} +192 -12
- package/dist/index-B9lSPJTi.d.ts.map +1 -0
- package/dist/{index-CUtFlKOo.d.ts → index-IIXVIoOL.d.mts} +262 -78
- package/dist/index-IIXVIoOL.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/dist/mui-theme-B2wm_cvZ.js +732 -0
- package/dist/mui-theme-B2wm_cvZ.js.map +1 -0
- package/dist/mui-theme-CUhybmBq.mjs +696 -0
- package/dist/mui-theme-CUhybmBq.mjs.map +1 -0
- package/dist/{state-CELzQ0tM.mjs → state-B9yzhuKs.mjs} +5 -694
- package/dist/state-B9yzhuKs.mjs.map +1 -0
- package/dist/{state-eEsMhIy4.css → state-DOUPNifc.css} +1 -1
- package/dist/{state-eEsMhIy4.css.map → state-DOUPNifc.css.map} +1 -1
- package/dist/{state-CemiRRon.js → state-lPCQsWy5.js} +24 -737
- package/dist/state-lPCQsWy5.js.map +1 -0
- package/dist/styles.css +4 -0
- package/dist/theme.d.mts +3 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +9 -0
- package/dist/theme.mjs +4 -0
- package/dist/{tooltipMessage-CrXjOmVM.mjs → tooltipMessage-B--I3p1V.mjs} +1 -1
- package/dist/{tooltipMessage-CrXjOmVM.mjs.map → tooltipMessage-B--I3p1V.mjs.map} +1 -1
- package/dist/{tooltipMessage-Dbi1kkfi.js → tooltipMessage-DosF13kZ.js} +1 -1
- package/dist/{tooltipMessage-Dbi1kkfi.js.map → tooltipMessage-DosF13kZ.js.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -2
- package/dist/types.mjs +2 -2
- package/dist/{urls-D7PrPolY.mjs → urls-B1Ymdoz-.mjs} +1 -1
- package/dist/{urls-D7PrPolY.mjs.map → urls-B1Ymdoz-.mjs.map} +1 -1
- package/dist/{urls-SazAekCZ.js → urls-C4eAc82S.js} +1 -1
- package/dist/{urls-SazAekCZ.js.map → urls-C4eAc82S.js.map} +1 -1
- package/dist/{version-bWg7XwOu.js → version-Dh8sZhvs.js} +2 -2
- package/dist/{version-bWg7XwOu.js.map → version-Dh8sZhvs.js.map} +1 -1
- package/dist/{version-paZ9esBk.mjs → version-OnOKzBeQ.mjs} +2 -2
- package/dist/{version-paZ9esBk.mjs.map → version-OnOKzBeQ.mjs.map} +1 -1
- package/package.json +9 -2
- package/recce-source/.editorconfig +26 -0
- package/recce-source/.flake8 +37 -0
- package/recce-source/.github/ISSUE_TEMPLATE/bug_report.yml +67 -0
- package/recce-source/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/recce-source/.github/ISSUE_TEMPLATE/feature_request.yml +42 -0
- package/recce-source/.github/PULL_REQUEST_TEMPLATE.md +21 -0
- package/recce-source/.github/copilot-instructions.md +331 -0
- package/recce-source/.github/instructions/backend-instructions.md +541 -0
- package/recce-source/.github/instructions/frontend-instructions.md +317 -0
- package/recce-source/.github/workflows/build-statics.yaml +72 -0
- package/recce-source/.github/workflows/bump.yaml +48 -0
- package/recce-source/.github/workflows/integration-tests-cloud.yaml +92 -0
- package/recce-source/.github/workflows/integration-tests-sqlmesh.yaml +33 -0
- package/recce-source/.github/workflows/integration-tests.yaml +52 -0
- package/recce-source/.github/workflows/nightly.yaml +246 -0
- package/recce-source/.github/workflows/release.yaml +196 -0
- package/recce-source/.github/workflows/tests-js.yaml +58 -0
- package/recce-source/.github/workflows/tests-python.yaml +128 -0
- package/recce-source/.pre-commit-config.yaml +26 -0
- package/recce-source/CLAUDE.md +483 -0
- package/recce-source/CODE_OF_CONDUCT.md +128 -0
- package/recce-source/CONTRIBUTING.md +107 -0
- package/recce-source/LICENSE +201 -0
- package/recce-source/Makefile +126 -0
- package/recce-source/README.md +182 -0
- package/recce-source/RECCE_CLOUD.md +81 -0
- package/recce-source/SECURITY.md +25 -0
- package/recce-source/docs/PACKAGING.md +340 -0
- package/recce-source/docs/README.md +1 -0
- package/recce-source/integration_tests/dbt/dbt_project.yml +26 -0
- package/recce-source/integration_tests/dbt/models/customers.sql +69 -0
- package/recce-source/integration_tests/dbt/models/docs.md +14 -0
- package/recce-source/integration_tests/dbt/models/orders.sql +56 -0
- package/recce-source/integration_tests/dbt/models/schema.yml +82 -0
- package/recce-source/integration_tests/dbt/models/staging/schema.yml +31 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_customers.sql +22 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_orders.sql +23 -0
- package/recce-source/integration_tests/dbt/models/staging/stg_payments.sql +25 -0
- package/recce-source/integration_tests/dbt/packages.yml +7 -0
- package/recce-source/integration_tests/dbt/profiles.yml +8 -0
- package/recce-source/integration_tests/dbt/seeds/raw_customers.csv +101 -0
- package/recce-source/integration_tests/dbt/seeds/raw_orders.csv +100 -0
- package/recce-source/integration_tests/dbt/seeds/raw_payments.csv +114 -0
- package/recce-source/integration_tests/dbt/seeds/raw_statuses.csv +5 -0
- package/recce-source/integration_tests/dbt/smoke_test.sh +72 -0
- package/recce-source/integration_tests/dbt/smoke_test_cloud.sh +71 -0
- package/recce-source/integration_tests/sqlmesh/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/audits/assert_item_price_above_zero.sql +9 -0
- package/recce-source/integration_tests/sqlmesh/audits/items.sql +7 -0
- package/recce-source/integration_tests/sqlmesh/audits/order_items.sql +7 -0
- package/recce-source/integration_tests/sqlmesh/config.py +171 -0
- package/recce-source/integration_tests/sqlmesh/helper.py +20 -0
- package/recce-source/integration_tests/sqlmesh/hooks/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/macros/__init__.py +0 -0
- package/recce-source/integration_tests/sqlmesh/macros/macros.py +8 -0
- package/recce-source/integration_tests/sqlmesh/macros/macros.sql +8 -0
- package/recce-source/integration_tests/sqlmesh/macros/utils.py +11 -0
- package/recce-source/integration_tests/sqlmesh/metrics/metrics.sql +25 -0
- package/recce-source/integration_tests/sqlmesh/models/customer_revenue_by_day.sql +41 -0
- package/recce-source/integration_tests/sqlmesh/models/customer_revenue_lifetime.sql +60 -0
- package/recce-source/integration_tests/sqlmesh/models/customers.sql +32 -0
- package/recce-source/integration_tests/sqlmesh/models/items.py +95 -0
- package/recce-source/integration_tests/sqlmesh/models/marketing.sql +15 -0
- package/recce-source/integration_tests/sqlmesh/models/order_items.py +95 -0
- package/recce-source/integration_tests/sqlmesh/models/orders.py +70 -0
- package/recce-source/integration_tests/sqlmesh/models/raw_marketing.py +62 -0
- package/recce-source/integration_tests/sqlmesh/models/top_waiters.sql +23 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_as_customer_by_day.sql +29 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_names.sql +10 -0
- package/recce-source/integration_tests/sqlmesh/models/waiter_revenue_by_day.sql +29 -0
- package/recce-source/integration_tests/sqlmesh/models/waiters.py +62 -0
- package/recce-source/integration_tests/sqlmesh/prep_env.sh +16 -0
- package/recce-source/integration_tests/sqlmesh/schema.yaml +5 -0
- package/recce-source/integration_tests/sqlmesh/seeds/waiter_names.csv +11 -0
- package/recce-source/integration_tests/sqlmesh/test_server.sh +29 -0
- package/recce-source/integration_tests/sqlmesh/tests/test_customer_revenue_by_day.yaml +63 -0
- package/recce-source/integration_tests/sqlmesh/tests/test_order_items.yaml +72 -0
- package/recce-source/js/.editorconfig +27 -0
- package/recce-source/js/.env.development +5 -0
- package/recce-source/js/.husky/pre-commit +29 -0
- package/recce-source/js/.nvmrc +1 -0
- package/recce-source/js/README.md +39 -0
- package/recce-source/js/app/(mainComponents)/DisplayModeToggle.tsx +65 -0
- package/recce-source/js/app/(mainComponents)/NavBar.tsx +228 -0
- package/recce-source/js/app/(mainComponents)/RecceVersionBadge.tsx +107 -0
- package/recce-source/js/app/(mainComponents)/TopBar.tsx +252 -0
- package/recce-source/js/app/@lineage/default.tsx +20 -0
- package/recce-source/js/app/@lineage/page.tsx +14 -0
- package/recce-source/js/app/MainLayout.tsx +170 -0
- package/recce-source/js/app/Providers.tsx +49 -0
- package/recce-source/js/app/checks/page.tsx +296 -0
- package/recce-source/js/app/error.tsx +93 -0
- package/recce-source/js/app/favicon.ico +0 -0
- package/recce-source/js/app/global-error.tsx +115 -0
- package/recce-source/js/app/global.css +82 -0
- package/recce-source/js/app/layout.tsx +48 -0
- package/recce-source/js/app/lineage/page.tsx +15 -0
- package/recce-source/js/app/page.tsx +12 -0
- package/recce-source/js/app/query/page.tsx +8 -0
- package/recce-source/js/biome.json +313 -0
- package/recce-source/js/jest.config.js +34 -0
- package/recce-source/js/jest.globals.d.ts +32 -0
- package/recce-source/js/jest.setup.js +91 -0
- package/recce-source/js/next.config.js +16 -0
- package/recce-source/js/package-lock.json +13843 -0
- package/recce-source/js/package.json +123 -0
- package/recce-source/js/pnpm-lock.yaml +9235 -0
- package/recce-source/js/pnpm-workspace.yaml +6 -0
- package/recce-source/js/postcss.config.js +5 -0
- package/recce-source/js/public/auth_callback.html +68 -0
- package/recce-source/js/public/imgs/feedback/thumbs-down.png +0 -0
- package/recce-source/js/public/imgs/feedback/thumbs-up.png +0 -0
- package/recce-source/js/public/imgs/reload-image.svg +4 -0
- package/recce-source/js/public/logo/recce-logo-white.png +0 -0
- package/recce-source/js/src/components/AuthModal/AuthModal.tsx +202 -0
- package/recce-source/js/src/components/app/AvatarDropdown.tsx +159 -0
- package/recce-source/js/src/components/app/EnvInfo.tsx +357 -0
- package/recce-source/js/src/components/app/Filename.tsx +388 -0
- package/recce-source/js/src/components/app/SetupConnectionPopover.tsx +91 -0
- package/recce-source/js/src/components/app/StateExporter.tsx +57 -0
- package/recce-source/js/src/components/app/StateImporter.tsx +198 -0
- package/recce-source/js/src/components/app/StateSharing.tsx +145 -0
- package/recce-source/js/src/components/app/StateSynchronizer.tsx +205 -0
- package/recce-source/js/src/components/charts/HistogramChart.tsx +291 -0
- package/recce-source/js/src/components/charts/SquareIcon.tsx +51 -0
- package/recce-source/js/src/components/charts/TopKSummaryList.tsx +457 -0
- package/recce-source/js/src/components/charts/chartTheme.ts +74 -0
- package/recce-source/js/src/components/check/CheckBreadcrumb.tsx +97 -0
- package/recce-source/js/src/components/check/CheckDescription.tsx +134 -0
- package/recce-source/js/src/components/check/CheckDetail.tsx +797 -0
- package/recce-source/js/src/components/check/CheckEmptyState.tsx +84 -0
- package/recce-source/js/src/components/check/CheckList.tsx +320 -0
- package/recce-source/js/src/components/check/LineageDiffView.tsx +32 -0
- package/recce-source/js/src/components/check/PresetCheckTemplateView.tsx +48 -0
- package/recce-source/js/src/components/check/SchemaDiffView.tsx +290 -0
- package/recce-source/js/src/components/check/check.ts +25 -0
- package/recce-source/js/src/components/check/timeline/CheckTimeline.tsx +163 -0
- package/recce-source/js/src/components/check/timeline/CommentInput.tsx +84 -0
- package/recce-source/js/src/components/check/timeline/TimelineEvent.tsx +468 -0
- package/recce-source/js/src/components/check/timeline/index.ts +12 -0
- package/recce-source/js/src/components/check/utils.ts +12 -0
- package/recce-source/js/src/components/data-grid/ScreenshotDataGrid.tsx +333 -0
- package/recce-source/js/src/components/data-grid/agGridStyles.css +55 -0
- package/recce-source/js/src/components/data-grid/agGridTheme.ts +43 -0
- package/recce-source/js/src/components/editor/CodeEditor.tsx +107 -0
- package/recce-source/js/src/components/editor/DiffEditor.tsx +162 -0
- package/recce-source/js/src/components/editor/index.ts +12 -0
- package/recce-source/js/src/components/errorboundary/ErrorBoundary.tsx +87 -0
- package/recce-source/js/src/components/histogram/HistogramDiffForm.tsx +147 -0
- package/recce-source/js/src/components/histogram/HistogramDiffResultView.tsx +63 -0
- package/recce-source/js/src/components/icons/index.tsx +142 -0
- package/recce-source/js/src/components/lineage/ActionControl.tsx +63 -0
- package/recce-source/js/src/components/lineage/ActionTag.tsx +141 -0
- package/recce-source/js/src/components/lineage/ChangeStatusLegend.tsx +46 -0
- package/recce-source/js/src/components/lineage/ColumnLevelLineageControl.tsx +327 -0
- package/recce-source/js/src/components/lineage/ColumnLevelLineageLegend.tsx +57 -0
- package/recce-source/js/src/components/lineage/GraphColumnNode.tsx +199 -0
- package/recce-source/js/src/components/lineage/GraphEdge.tsx +59 -0
- package/recce-source/js/src/components/lineage/GraphNode.tsx +555 -0
- package/recce-source/js/src/components/lineage/LineagePage.tsx +10 -0
- package/recce-source/js/src/components/lineage/LineageView.tsx +1384 -0
- package/recce-source/js/src/components/lineage/LineageViewContext.tsx +86 -0
- package/recce-source/js/src/components/lineage/LineageViewContextMenu.tsx +637 -0
- package/recce-source/js/src/components/lineage/LineageViewNotification.tsx +64 -0
- package/recce-source/js/src/components/lineage/LineageViewTopBar.tsx +596 -0
- package/recce-source/js/src/components/lineage/NodeSqlView.tsx +136 -0
- package/recce-source/js/src/components/lineage/NodeTag.tsx +278 -0
- package/recce-source/js/src/components/lineage/NodeView.tsx +642 -0
- package/recce-source/js/src/components/lineage/SandboxView.tsx +436 -0
- package/recce-source/js/src/components/lineage/ServerDisconnectedModalContent.tsx +105 -0
- package/recce-source/js/src/components/lineage/SetupConnectionBanner.tsx +52 -0
- package/recce-source/js/src/components/lineage/SingleEnvironmentQueryView.tsx +152 -0
- package/recce-source/js/src/components/lineage/graph.test.ts +31 -0
- package/recce-source/js/src/components/lineage/graph.ts +58 -0
- package/recce-source/js/src/components/lineage/lineage.test.ts +169 -0
- package/recce-source/js/src/components/lineage/lineage.ts +521 -0
- package/recce-source/js/src/components/lineage/styles.css +42 -0
- package/recce-source/js/src/components/lineage/styles.tsx +165 -0
- package/recce-source/js/src/components/lineage/useMultiNodesAction.ts +352 -0
- package/recce-source/js/src/components/lineage/useValueDiffAlertDialog.tsx +108 -0
- package/recce-source/js/src/components/onboarding-guide/Notification.tsx +62 -0
- package/recce-source/js/src/components/profile/ProfileDiffForm.tsx +134 -0
- package/recce-source/js/src/components/profile/ProfileDiffResultView.tsx +245 -0
- package/recce-source/js/src/components/query/ChangedOnlyCheckbox.tsx +29 -0
- package/recce-source/js/src/components/query/DiffText.tsx +120 -0
- package/recce-source/js/src/components/query/QueryDiffResultView.tsx +470 -0
- package/recce-source/js/src/components/query/QueryForm.tsx +80 -0
- package/recce-source/js/src/components/query/QueryPage.tsx +282 -0
- package/recce-source/js/src/components/query/QueryResultView.tsx +180 -0
- package/recce-source/js/src/components/query/SetupConnectionGuide.tsx +57 -0
- package/recce-source/js/src/components/query/SqlEditor.tsx +245 -0
- package/recce-source/js/src/components/query/ToggleSwitch.tsx +84 -0
- package/recce-source/js/src/components/query/styles.css +21 -0
- package/recce-source/js/src/components/routing/DirectUrlAccess.test.tsx +428 -0
- package/recce-source/js/src/components/routing/LineageStatePreservation.test.tsx +311 -0
- package/recce-source/js/src/components/routing/Navigation.test.tsx +256 -0
- package/recce-source/js/src/components/rowcount/RowCountDiffResultView.tsx +109 -0
- package/recce-source/js/src/components/rowcount/delta.ts +11 -0
- package/recce-source/js/src/components/run/RunList.tsx +303 -0
- package/recce-source/js/src/components/run/RunModal.tsx +191 -0
- package/recce-source/js/src/components/run/RunPage.tsx +26 -0
- package/recce-source/js/src/components/run/RunResultPane.tsx +454 -0
- package/recce-source/js/src/components/run/RunStatusAndDate.tsx +106 -0
- package/recce-source/js/src/components/run/RunToolbar.tsx +70 -0
- package/recce-source/js/src/components/run/RunView.tsx +196 -0
- package/recce-source/js/src/components/run/registry.ts +214 -0
- package/recce-source/js/src/components/run/types.ts +14 -0
- package/recce-source/js/src/components/schema/ColumnNameCell.test.tsx +169 -0
- package/recce-source/js/src/components/schema/ColumnNameCell.tsx +198 -0
- package/recce-source/js/src/components/schema/SchemaView.tsx +337 -0
- package/recce-source/js/src/components/schema/schemaDiff.ts +32 -0
- package/recce-source/js/src/components/schema/style.css +134 -0
- package/recce-source/js/src/components/screenshot/ScreenshotBox.tsx +39 -0
- package/recce-source/js/src/components/shared/HistoryToggle.tsx +35 -0
- package/recce-source/js/src/components/split/Split.tsx +40 -0
- package/recce-source/js/src/components/split/styles.css +24 -0
- package/recce-source/js/src/components/summary/ChangeSummary.tsx +264 -0
- package/recce-source/js/src/components/summary/SchemaSummary.tsx +123 -0
- package/recce-source/js/src/components/summary/SummaryView.tsx +29 -0
- package/recce-source/js/src/components/timeout/IdleTimeoutBadge.tsx +48 -0
- package/recce-source/js/src/components/top-k/TopKDiffForm.tsx +58 -0
- package/recce-source/js/src/components/top-k/TopKDiffResultView.tsx +73 -0
- package/recce-source/js/src/components/ui/dataGrid/DataFrameColumnGroupHeader.tsx +228 -0
- package/recce-source/js/src/components/ui/dataGrid/DataFrameColumnHeader.tsx +113 -0
- package/recce-source/js/src/components/ui/dataGrid/defaultRenderCell.tsx +72 -0
- package/recce-source/js/src/components/ui/dataGrid/index.ts +23 -0
- package/recce-source/js/src/components/ui/dataGrid/inlineRenderCell.test.tsx +607 -0
- package/recce-source/js/src/components/ui/dataGrid/inlineRenderCell.tsx +211 -0
- package/recce-source/js/src/components/ui/dataGrid/schemaCells.test.tsx +452 -0
- package/recce-source/js/src/components/ui/dataGrid/schemaCells.tsx +142 -0
- package/recce-source/js/src/components/ui/dataGrid/valueDiffCells.test.tsx +178 -0
- package/recce-source/js/src/components/ui/dataGrid/valueDiffCells.tsx +275 -0
- package/recce-source/js/src/components/ui/markdown/ExternalLinkConfirmDialog.tsx +134 -0
- package/recce-source/js/src/components/ui/markdown/MarkdownContent.tsx +364 -0
- package/recce-source/js/src/components/ui/mui/index.ts +13 -0
- package/recce-source/js/src/components/ui/mui-provider.tsx +67 -0
- package/recce-source/js/src/components/ui/mui-theme.ts +1039 -0
- package/recce-source/js/src/components/ui/mui-utils.ts +113 -0
- package/recce-source/js/src/components/ui/toaster.tsx +288 -0
- package/recce-source/js/src/components/valuediff/ValueDiffDetailResultView.tsx +217 -0
- package/recce-source/js/src/components/valuediff/ValueDiffForm.tsx +246 -0
- package/recce-source/js/src/components/valuediff/ValueDiffResultView.tsx +82 -0
- package/recce-source/js/src/components/valuediff/shared.ts +33 -0
- package/recce-source/js/src/constants/tooltipMessage.ts +3 -0
- package/recce-source/js/src/constants/urls.ts +1 -0
- package/recce-source/js/src/lib/UrlHash.ts +12 -0
- package/recce-source/js/src/lib/api/adhocQuery.ts +70 -0
- package/recce-source/js/src/lib/api/axiosClient.ts +9 -0
- package/recce-source/js/src/lib/api/cacheKeys.ts +13 -0
- package/recce-source/js/src/lib/api/checkEvents.ts +252 -0
- package/recce-source/js/src/lib/api/checks.ts +129 -0
- package/recce-source/js/src/lib/api/cll.ts +53 -0
- package/recce-source/js/src/lib/api/connectToCloud.ts +13 -0
- package/recce-source/js/src/lib/api/flag.ts +37 -0
- package/recce-source/js/src/lib/api/info.ts +198 -0
- package/recce-source/js/src/lib/api/instanceInfo.ts +25 -0
- package/recce-source/js/src/lib/api/keepAlive.ts +108 -0
- package/recce-source/js/src/lib/api/lineagecheck.ts +35 -0
- package/recce-source/js/src/lib/api/localStorageKeys.ts +7 -0
- package/recce-source/js/src/lib/api/models.ts +59 -0
- package/recce-source/js/src/lib/api/profile.ts +65 -0
- package/recce-source/js/src/lib/api/rowcount.ts +19 -0
- package/recce-source/js/src/lib/api/runs.ts +174 -0
- package/recce-source/js/src/lib/api/schemacheck.ts +31 -0
- package/recce-source/js/src/lib/api/select.ts +25 -0
- package/recce-source/js/src/lib/api/sessionStorageKeys.ts +8 -0
- package/recce-source/js/src/lib/api/state.ts +117 -0
- package/recce-source/js/src/lib/api/track.ts +281 -0
- package/recce-source/js/src/lib/api/types.ts +284 -0
- package/recce-source/js/src/lib/api/user.ts +42 -0
- package/recce-source/js/src/lib/api/valuediff.ts +46 -0
- package/recce-source/js/src/lib/api/version.ts +40 -0
- package/recce-source/js/src/lib/const.ts +9 -0
- package/recce-source/js/src/lib/dataGrid/crossFunctionConsistency.test.ts +626 -0
- package/recce-source/js/src/lib/dataGrid/dataGridFactory.test.ts +2140 -0
- package/recce-source/js/src/lib/dataGrid/dataGridFactory.ts +397 -0
- package/recce-source/js/src/lib/dataGrid/generators/rowCountUtils.test.ts +132 -0
- package/recce-source/js/src/lib/dataGrid/generators/rowCountUtils.ts +126 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataDiffGrid.test.ts +1627 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataDiffGrid.ts +140 -0
- package/recce-source/js/src/lib/dataGrid/generators/toDataGrid.ts +67 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDataGrid.test.ts +142 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDataGrid.ts +71 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDiffDataGrid.test.ts +258 -0
- package/recce-source/js/src/lib/dataGrid/generators/toRowCountDiffDataGrid.ts +153 -0
- package/recce-source/js/src/lib/dataGrid/generators/toSchemaDataGrid.test.ts +951 -0
- package/recce-source/js/src/lib/dataGrid/generators/toSchemaDataGrid.ts +221 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDataGrid.test.ts +395 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDataGrid.ts +184 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDiffGrid.test.ts +884 -0
- package/recce-source/js/src/lib/dataGrid/generators/toValueDiffGrid.ts +113 -0
- package/recce-source/js/src/lib/dataGrid/index.ts +51 -0
- package/recce-source/js/src/lib/dataGrid/propertyBased.test.ts +858 -0
- package/recce-source/js/src/lib/dataGrid/shared/columnBuilders.test.ts +482 -0
- package/recce-source/js/src/lib/dataGrid/shared/columnBuilders.ts +345 -0
- package/recce-source/js/src/lib/dataGrid/shared/dataTypeEdgeCases.test.ts +698 -0
- package/recce-source/js/src/lib/dataGrid/shared/diffColumnBuilder.test.tsx +820 -0
- package/recce-source/js/src/lib/dataGrid/shared/diffColumnBuilder.tsx +277 -0
- package/recce-source/js/src/lib/dataGrid/shared/gridUtils.test.ts +785 -0
- package/recce-source/js/src/lib/dataGrid/shared/gridUtils.ts +370 -0
- package/recce-source/js/src/lib/dataGrid/shared/index.ts +81 -0
- package/recce-source/js/src/lib/dataGrid/shared/rowBuilders.test.ts +909 -0
- package/recce-source/js/src/lib/dataGrid/shared/rowBuilders.ts +325 -0
- package/recce-source/js/src/lib/dataGrid/shared/simpleColumnBuilder.tsx +240 -0
- package/recce-source/js/src/lib/dataGrid/shared/toDiffColumn.test.tsx +719 -0
- package/recce-source/js/src/lib/dataGrid/shared/toDiffColumn.tsx +231 -0
- package/recce-source/js/src/lib/dataGrid/shared/validation.test.ts +559 -0
- package/recce-source/js/src/lib/dataGrid/shared/validation.ts +367 -0
- package/recce-source/js/src/lib/dataGrid/warehouseNamingConventions.test.ts +1117 -0
- package/recce-source/js/src/lib/formatSelect.ts +50 -0
- package/recce-source/js/src/lib/hooks/ApiConfigContext.tsx +181 -0
- package/recce-source/js/src/lib/hooks/IdleTimeoutContext.tsx +177 -0
- package/recce-source/js/src/lib/hooks/LineageGraphContext.tsx +512 -0
- package/recce-source/js/src/lib/hooks/RecceActionContext.tsx +269 -0
- package/recce-source/js/src/lib/hooks/RecceCheckContext.tsx +33 -0
- package/recce-source/js/src/lib/hooks/RecceContextProvider.tsx +54 -0
- package/recce-source/js/src/lib/hooks/RecceInstanceContext.tsx +129 -0
- package/recce-source/js/src/lib/hooks/RecceQueryContext.tsx +98 -0
- package/recce-source/js/src/lib/hooks/RecceShareStateContext.tsx +59 -0
- package/recce-source/js/src/lib/hooks/ScreenShot.tsx +399 -0
- package/recce-source/js/src/lib/hooks/useAppRouter.test.ts +211 -0
- package/recce-source/js/src/lib/hooks/useAppRouter.ts +200 -0
- package/recce-source/js/src/lib/hooks/useCheckEvents.ts +99 -0
- package/recce-source/js/src/lib/hooks/useCheckToast.tsx +14 -0
- package/recce-source/js/src/lib/hooks/useClipBoardToast.tsx +27 -0
- package/recce-source/js/src/lib/hooks/useCountdownToast.tsx +102 -0
- package/recce-source/js/src/lib/hooks/useFeedbackCollectionToast.tsx +130 -0
- package/recce-source/js/src/lib/hooks/useGuideToast.tsx +45 -0
- package/recce-source/js/src/lib/hooks/useIdleDetection.tsx +185 -0
- package/recce-source/js/src/lib/hooks/useModelColumns.tsx +113 -0
- package/recce-source/js/src/lib/hooks/useRecceInstanceInfo.tsx +13 -0
- package/recce-source/js/src/lib/hooks/useRecceServerFlag.tsx +13 -0
- package/recce-source/js/src/lib/hooks/useRun.tsx +89 -0
- package/recce-source/js/src/lib/hooks/useThemeColors.ts +115 -0
- package/recce-source/js/src/lib/mergeKeys.test.ts +89 -0
- package/recce-source/js/src/lib/mergeKeys.ts +86 -0
- package/recce-source/js/src/lib/result/ResultErrorFallback.tsx +9 -0
- package/recce-source/js/src/lib/utils/formatTime.ts +84 -0
- package/recce-source/js/src/lib/utils/urls.ts +16 -0
- package/recce-source/js/src/utils/DropdownValuesInput.tsx +297 -0
- package/recce-source/js/src/utils/formatters.tsx +237 -0
- package/recce-source/js/src/utils/transforms.ts +81 -0
- package/recce-source/js/tsconfig.json +47 -0
- package/recce-source/macros/README.md +8 -0
- package/recce-source/macros/recce_athena.sql +73 -0
- package/recce-source/pyproject.toml +109 -0
- package/recce-source/recce/VERSION +1 -0
- package/recce-source/recce/__init__.py +84 -0
- package/recce-source/recce/adapter/__init__.py +0 -0
- package/recce-source/recce/adapter/base.py +109 -0
- package/recce-source/recce/adapter/dbt_adapter/__init__.py +1699 -0
- package/recce-source/recce/adapter/dbt_adapter/dbt_version.py +42 -0
- package/recce-source/recce/adapter/sqlmesh_adapter.py +141 -0
- package/recce-source/recce/apis/__init__.py +0 -0
- package/recce-source/recce/apis/check_api.py +203 -0
- package/recce-source/recce/apis/check_events_api.py +353 -0
- package/recce-source/recce/apis/check_func.py +130 -0
- package/recce-source/recce/apis/run_api.py +130 -0
- package/recce-source/recce/apis/run_func.py +258 -0
- package/recce-source/recce/artifact.py +266 -0
- package/recce-source/recce/cli.py +1846 -0
- package/recce-source/recce/config.py +127 -0
- package/recce-source/recce/connect_to_cloud.py +138 -0
- package/recce-source/recce/core.py +334 -0
- package/recce-source/recce/diff.py +26 -0
- package/recce-source/recce/event/CONFIG +1 -0
- package/recce-source/recce/event/SENTRY_DNS +1 -0
- package/recce-source/recce/event/__init__.py +304 -0
- package/recce-source/recce/event/collector.py +184 -0
- package/recce-source/recce/event/track.py +158 -0
- package/recce-source/recce/exceptions.py +21 -0
- package/recce-source/recce/git.py +77 -0
- package/recce-source/recce/github.py +222 -0
- package/recce-source/recce/mcp_server.py +861 -0
- package/recce-source/recce/models/__init__.py +6 -0
- package/recce-source/recce/models/check.py +473 -0
- package/recce-source/recce/models/run.py +46 -0
- package/recce-source/recce/models/types.py +218 -0
- package/recce-source/recce/pull_request.py +124 -0
- package/recce-source/recce/run.py +390 -0
- package/recce-source/recce/server.py +877 -0
- package/recce-source/recce/state/__init__.py +31 -0
- package/recce-source/recce/state/cloud.py +644 -0
- package/recce-source/recce/state/const.py +26 -0
- package/recce-source/recce/state/local.py +56 -0
- package/recce-source/recce/state/state.py +119 -0
- package/recce-source/recce/state/state_loader.py +174 -0
- package/recce-source/recce/summary.py +575 -0
- package/recce-source/recce/tasks/__init__.py +23 -0
- package/recce-source/recce/tasks/core.py +134 -0
- package/recce-source/recce/tasks/dataframe.py +170 -0
- package/recce-source/recce/tasks/histogram.py +433 -0
- package/recce-source/recce/tasks/lineage.py +19 -0
- package/recce-source/recce/tasks/profile.py +298 -0
- package/recce-source/recce/tasks/query.py +450 -0
- package/recce-source/recce/tasks/rowcount.py +277 -0
- package/recce-source/recce/tasks/schema.py +65 -0
- package/recce-source/recce/tasks/top_k.py +172 -0
- package/recce-source/recce/tasks/utils.py +147 -0
- package/recce-source/recce/tasks/valuediff.py +497 -0
- package/recce-source/recce/util/__init__.py +4 -0
- package/recce-source/recce/util/api_token.py +80 -0
- package/recce-source/recce/util/breaking.py +330 -0
- package/recce-source/recce/util/cache.py +25 -0
- package/recce-source/recce/util/cll.py +355 -0
- package/recce-source/recce/util/cloud/__init__.py +15 -0
- package/recce-source/recce/util/cloud/base.py +115 -0
- package/recce-source/recce/util/cloud/check_events.py +190 -0
- package/recce-source/recce/util/cloud/checks.py +242 -0
- package/recce-source/recce/util/io.py +120 -0
- package/recce-source/recce/util/lineage.py +83 -0
- package/recce-source/recce/util/logger.py +25 -0
- package/recce-source/recce/util/onboarding_state.py +45 -0
- package/recce-source/recce/util/perf_tracking.py +85 -0
- package/recce-source/recce/util/pydantic_model.py +22 -0
- package/recce-source/recce/util/recce_cloud.py +454 -0
- package/recce-source/recce/util/singleton.py +18 -0
- package/recce-source/recce/util/startup_perf.py +121 -0
- package/recce-source/recce/yaml/__init__.py +58 -0
- package/recce-source/recce_cloud/README.md +780 -0
- package/recce-source/recce_cloud/VERSION +1 -0
- package/recce-source/recce_cloud/__init__.py +24 -0
- package/recce-source/recce_cloud/api/__init__.py +17 -0
- package/recce-source/recce_cloud/api/base.py +132 -0
- package/recce-source/recce_cloud/api/client.py +186 -0
- package/recce-source/recce_cloud/api/exceptions.py +26 -0
- package/recce-source/recce_cloud/api/factory.py +63 -0
- package/recce-source/recce_cloud/api/github.py +106 -0
- package/recce-source/recce_cloud/api/gitlab.py +111 -0
- package/recce-source/recce_cloud/artifact.py +57 -0
- package/recce-source/recce_cloud/ci_providers/__init__.py +9 -0
- package/recce-source/recce_cloud/ci_providers/base.py +82 -0
- package/recce-source/recce_cloud/ci_providers/detector.py +147 -0
- package/recce-source/recce_cloud/ci_providers/github_actions.py +136 -0
- package/recce-source/recce_cloud/ci_providers/gitlab_ci.py +130 -0
- package/recce-source/recce_cloud/cli.py +434 -0
- package/recce-source/recce_cloud/download.py +230 -0
- package/recce-source/recce_cloud/hatch_build.py +20 -0
- package/recce-source/recce_cloud/pyproject.toml +49 -0
- package/recce-source/recce_cloud/upload.py +214 -0
- package/recce-source/test.py +0 -0
- package/recce-source/tests/__init__.py +0 -0
- package/recce-source/tests/adapter/__init__.py +0 -0
- package/recce-source/tests/adapter/dbt_adapter/__init__.py +0 -0
- package/recce-source/tests/adapter/dbt_adapter/conftest.py +17 -0
- package/recce-source/tests/adapter/dbt_adapter/dbt_test_helper.py +298 -0
- package/recce-source/tests/adapter/dbt_adapter/test_dbt_adapter.py +25 -0
- package/recce-source/tests/adapter/dbt_adapter/test_dbt_cll.py +717 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/dbt_project.yml +4 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/manifest.json +1 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/package-lock.yml +8 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/packages.yml +7 -0
- package/recce-source/tests/adapter/dbt_adapter/test_proj/profiles.yml +6 -0
- package/recce-source/tests/adapter/dbt_adapter/test_selector.py +205 -0
- package/recce-source/tests/apis/__init__.py +0 -0
- package/recce-source/tests/apis/row_count_diff.json +59 -0
- package/recce-source/tests/apis/test_check_events_api.py +615 -0
- package/recce-source/tests/apis/test_run_func.py +433 -0
- package/recce-source/tests/catalog.json +527 -0
- package/recce-source/tests/data/manifest/base/catalog.json +1 -0
- package/recce-source/tests/data/manifest/base/manifest.json +1 -0
- package/recce-source/tests/data/manifest/pr2/catalog.json +1 -0
- package/recce-source/tests/data/manifest/pr2/manifest.json +1 -0
- package/recce-source/tests/manifest.json +10655 -0
- package/recce-source/tests/models/__init__.py +0 -0
- package/recce-source/tests/models/test_check.py +731 -0
- package/recce-source/tests/models/test_run_models.py +295 -0
- package/recce-source/tests/recce_cloud/__init__.py +0 -0
- package/recce-source/tests/recce_cloud/test_ci_providers.py +351 -0
- package/recce-source/tests/recce_cloud/test_cli.py +735 -0
- package/recce-source/tests/recce_cloud/test_client.py +379 -0
- package/recce-source/tests/recce_cloud/test_platform_clients.py +483 -0
- package/recce-source/tests/recce_state.json +1 -0
- package/recce-source/tests/state/test_cloud.py +719 -0
- package/recce-source/tests/state/test_local.py +164 -0
- package/recce-source/tests/state/test_state_loader.py +211 -0
- package/recce-source/tests/tasks/__init__.py +0 -0
- package/recce-source/tests/tasks/conftest.py +4 -0
- package/recce-source/tests/tasks/test_histogram.py +129 -0
- package/recce-source/tests/tasks/test_lineage.py +55 -0
- package/recce-source/tests/tasks/test_preset_checks.py +64 -0
- package/recce-source/tests/tasks/test_profile.py +397 -0
- package/recce-source/tests/tasks/test_query.py +528 -0
- package/recce-source/tests/tasks/test_row_count.py +133 -0
- package/recce-source/tests/tasks/test_schema.py +122 -0
- package/recce-source/tests/tasks/test_top_k.py +77 -0
- package/recce-source/tests/tasks/test_utils.py +439 -0
- package/recce-source/tests/tasks/test_valuediff.py +361 -0
- package/recce-source/tests/test_cli.py +236 -0
- package/recce-source/tests/test_cli_mcp_optional.py +45 -0
- package/recce-source/tests/test_cloud_listing_cli.py +324 -0
- package/recce-source/tests/test_config.py +43 -0
- package/recce-source/tests/test_connect_to_cloud.py +82 -0
- package/recce-source/tests/test_core.py +174 -0
- package/recce-source/tests/test_dbt.py +36 -0
- package/recce-source/tests/test_mcp_server.py +505 -0
- package/recce-source/tests/test_pull_request.py +130 -0
- package/recce-source/tests/test_server.py +202 -0
- package/recce-source/tests/test_server_lifespan.py +138 -0
- package/recce-source/tests/test_summary.py +73 -0
- package/recce-source/tests/util/__init__.py +0 -0
- package/recce-source/tests/util/cloud/__init__.py +0 -0
- package/recce-source/tests/util/cloud/test_check_events.py +255 -0
- package/recce-source/tests/util/cloud/test_checks.py +204 -0
- package/recce-source/tests/util/test_api_token.py +119 -0
- package/recce-source/tests/util/test_breaking.py +1427 -0
- package/recce-source/tests/util/test_cll.py +706 -0
- package/recce-source/tests/util/test_lineage.py +122 -0
- package/recce-source/tests/util/test_onboarding_state.py +84 -0
- package/recce-source/tests/util/test_recce_cloud.py +231 -0
- package/recce-source/tox.ini +40 -0
- package/recce-source/uv.lock +3928 -0
- package/src/api/index.ts +32 -0
- package/src/components/index.ts +154 -0
- package/src/global.d.ts +14 -0
- package/src/hooks/index.ts +56 -0
- package/src/index.ts +17 -0
- package/src/lib/hooks/RouteConfigContext.ts +139 -0
- package/src/lib/hooks/useAppRouter.ts +240 -0
- package/src/mui-augmentation.d.ts +139 -0
- package/src/theme/index.ts +13 -0
- package/src/theme.ts +23 -0
- package/src/types/index.ts +23 -0
- package/dist/index-Bv5R8iLo.d.mts.map +0 -1
- package/dist/index-CUtFlKOo.d.ts.map +0 -1
- package/dist/state-CELzQ0tM.mjs.map +0 -1
- package/dist/state-CemiRRon.js.map +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAppRouter - Navigation utilities for Next.js App Router
|
|
3
|
+
*
|
|
4
|
+
* Provides a similar API to Wouter's useLocation for easier migration.
|
|
5
|
+
* This hook combines Next.js's useRouter, usePathname, useParams,
|
|
6
|
+
* and useSearchParams into a unified interface.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: useSearchParams() triggers Suspense boundaries in Next.js.
|
|
9
|
+
* To avoid full-page loading states, useAppLocation() only returns the
|
|
10
|
+
* pathname by default. Use useAppLocationWithSearch() if you need
|
|
11
|
+
* search params included in the location string.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use client";
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
useParams,
|
|
18
|
+
usePathname,
|
|
19
|
+
useRouter,
|
|
20
|
+
useSearchParams,
|
|
21
|
+
} from "next/navigation";
|
|
22
|
+
import { useCallback, useMemo } from "react";
|
|
23
|
+
|
|
24
|
+
interface NavigateOptions {
|
|
25
|
+
replace?: boolean;
|
|
26
|
+
scroll?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Hook that provides Wouter-compatible location API using Next.js App Router
|
|
31
|
+
*
|
|
32
|
+
* NOTE: This returns only the pathname (not search params) to avoid
|
|
33
|
+
* triggering Suspense boundaries on every navigation.
|
|
34
|
+
*
|
|
35
|
+
* @returns [pathname, setLocation] tuple similar to Wouter's useLocation
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* const [location, setLocation] = useAppLocation();
|
|
39
|
+
* setLocation("/checks?id=123"); // Navigate to new path with query
|
|
40
|
+
* setLocation("/checks", { replace: true }); // Replace current history entry
|
|
41
|
+
*/
|
|
42
|
+
export function useAppLocation(): [
|
|
43
|
+
string,
|
|
44
|
+
(to: string, options?: NavigateOptions) => void,
|
|
45
|
+
] {
|
|
46
|
+
const router = useRouter();
|
|
47
|
+
const pathname = usePathname();
|
|
48
|
+
|
|
49
|
+
// Navigation function compatible with Wouter's setLocation
|
|
50
|
+
const setLocation = useCallback(
|
|
51
|
+
(to: string, options?: NavigateOptions) => {
|
|
52
|
+
if (options?.replace) {
|
|
53
|
+
router.replace(to, { scroll: options?.scroll ?? true });
|
|
54
|
+
} else {
|
|
55
|
+
router.push(to, { scroll: options?.scroll ?? true });
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
[router],
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return [pathname, setLocation];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Hook that includes search params in the location string.
|
|
66
|
+
*
|
|
67
|
+
* WARNING: This hook uses useSearchParams() which triggers Suspense.
|
|
68
|
+
* Only use this in components that are wrapped in a <Suspense> boundary,
|
|
69
|
+
* or in leaf components where suspension is acceptable.
|
|
70
|
+
*
|
|
71
|
+
* @returns [fullLocation, setLocation] tuple with search params included
|
|
72
|
+
*/
|
|
73
|
+
export function useAppLocationWithSearch(): [
|
|
74
|
+
string,
|
|
75
|
+
(to: string, options?: NavigateOptions) => void,
|
|
76
|
+
] {
|
|
77
|
+
const router = useRouter();
|
|
78
|
+
const pathname = usePathname();
|
|
79
|
+
const searchParams = useSearchParams();
|
|
80
|
+
|
|
81
|
+
// Construct full location string including search params
|
|
82
|
+
const location = useMemo(() => {
|
|
83
|
+
const search = searchParams?.toString();
|
|
84
|
+
return search ? `${pathname}?${search}` : pathname;
|
|
85
|
+
}, [pathname, searchParams]);
|
|
86
|
+
|
|
87
|
+
// Navigation function compatible with Wouter's setLocation
|
|
88
|
+
const setLocation = useCallback(
|
|
89
|
+
(to: string, options?: NavigateOptions) => {
|
|
90
|
+
if (options?.replace) {
|
|
91
|
+
router.replace(to, { scroll: options?.scroll ?? true });
|
|
92
|
+
} else {
|
|
93
|
+
router.push(to, { scroll: options?.scroll ?? true });
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
[router],
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return [location, setLocation];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Hook to check if current path matches a pattern
|
|
104
|
+
* Similar to Wouter's useRoute
|
|
105
|
+
*
|
|
106
|
+
* @param pattern - The route pattern to match (e.g., "/checks/:checkId")
|
|
107
|
+
* @returns [isMatch, params] tuple
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* const [isMatch, params] = useAppRoute("/checks/:checkId");
|
|
111
|
+
* if (isMatch) {
|
|
112
|
+
* console.log(params.checkId); // "abc-123"
|
|
113
|
+
* }
|
|
114
|
+
*/
|
|
115
|
+
export function useAppRoute(
|
|
116
|
+
pattern: string,
|
|
117
|
+
): [boolean, Record<string, string>] {
|
|
118
|
+
const pathname = usePathname();
|
|
119
|
+
const params = useParams();
|
|
120
|
+
|
|
121
|
+
const isMatch = useMemo(() => {
|
|
122
|
+
// Convert Next.js dynamic route pattern to regex
|
|
123
|
+
// /checks/[checkId] -> /checks/:checkId -> /checks/([^/]+)
|
|
124
|
+
const regexPattern = pattern
|
|
125
|
+
.replace(/:\w+/g, "([^/]+)") // :param -> capture group
|
|
126
|
+
.replace(/\*/g, ".*"); // * -> wildcard
|
|
127
|
+
|
|
128
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
129
|
+
return regex.test(pathname);
|
|
130
|
+
}, [pattern, pathname]);
|
|
131
|
+
|
|
132
|
+
// Convert Next.js params to plain object
|
|
133
|
+
const paramsObj = useMemo(() => {
|
|
134
|
+
if (!params) return {};
|
|
135
|
+
return Object.fromEntries(
|
|
136
|
+
Object.entries(params).map(([key, value]) => [
|
|
137
|
+
key,
|
|
138
|
+
Array.isArray(value) ? value.join("/") : value,
|
|
139
|
+
]),
|
|
140
|
+
);
|
|
141
|
+
}, [params]);
|
|
142
|
+
|
|
143
|
+
return [isMatch, paramsObj as Record<string, string>];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Imperative navigation function for use outside React components
|
|
148
|
+
* Use sparingly - prefer useAppLocation hook in components
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* // In an event handler or utility function
|
|
152
|
+
* import { navigateTo } from "@/lib/hooks/useAppRouter";
|
|
153
|
+
* navigateTo("/checks?id=123");
|
|
154
|
+
*/
|
|
155
|
+
export function navigateTo(path: string, replace = false): void {
|
|
156
|
+
if (typeof window !== "undefined") {
|
|
157
|
+
if (replace) {
|
|
158
|
+
window.history.replaceState(null, "", path);
|
|
159
|
+
} else {
|
|
160
|
+
window.history.pushState(null, "", path);
|
|
161
|
+
}
|
|
162
|
+
// Trigger Next.js to recognize the navigation
|
|
163
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Hook for programmatic navigation with more options
|
|
169
|
+
* Provides direct access to Next.js router methods
|
|
170
|
+
*
|
|
171
|
+
* NOTE: Does not include searchParams to avoid Suspense.
|
|
172
|
+
* Use useSearchParams() directly in components that need it.
|
|
173
|
+
*/
|
|
174
|
+
export function useAppNavigation() {
|
|
175
|
+
const router = useRouter();
|
|
176
|
+
const pathname = usePathname();
|
|
177
|
+
const params = useParams();
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
/** Current pathname */
|
|
181
|
+
pathname,
|
|
182
|
+
/** Current route params */
|
|
183
|
+
params: params as Record<string, string>,
|
|
184
|
+
/** Navigate to a new path */
|
|
185
|
+
push: router.push,
|
|
186
|
+
/** Replace current history entry */
|
|
187
|
+
replace: router.replace,
|
|
188
|
+
/** Go back in history */
|
|
189
|
+
back: router.back,
|
|
190
|
+
/** Go forward in history */
|
|
191
|
+
forward: router.forward,
|
|
192
|
+
/** Refresh the current route */
|
|
193
|
+
refresh: router.refresh,
|
|
194
|
+
/** Prefetch a route for faster navigation */
|
|
195
|
+
prefetch: router.prefetch,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Re-export Next.js hooks for convenience
|
|
200
|
+
export { useRouter, usePathname, useParams, useSearchParams };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook for managing check events (timeline/conversation).
|
|
3
|
+
*
|
|
4
|
+
* Provides data fetching with polling for real-time updates,
|
|
5
|
+
* and mutation functions for CRUD operations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import { cacheKeys } from "@/lib/api/cacheKeys";
|
|
10
|
+
import {
|
|
11
|
+
CheckEvent,
|
|
12
|
+
createComment,
|
|
13
|
+
deleteComment,
|
|
14
|
+
listCheckEvents,
|
|
15
|
+
updateComment,
|
|
16
|
+
} from "@/lib/api/checkEvents";
|
|
17
|
+
import { useApiConfig } from "./ApiConfigContext";
|
|
18
|
+
|
|
19
|
+
const POLLING_INTERVAL = 10000; // 10 seconds
|
|
20
|
+
|
|
21
|
+
interface UseCheckEventsOptions {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function useCheckEvents(
|
|
26
|
+
checkId: string,
|
|
27
|
+
options: UseCheckEventsOptions = {},
|
|
28
|
+
) {
|
|
29
|
+
const { enabled = true } = options;
|
|
30
|
+
const queryClient = useQueryClient();
|
|
31
|
+
const { apiClient } = useApiConfig();
|
|
32
|
+
|
|
33
|
+
// Fetch events with polling
|
|
34
|
+
const {
|
|
35
|
+
data: events,
|
|
36
|
+
isLoading,
|
|
37
|
+
error,
|
|
38
|
+
refetch,
|
|
39
|
+
} = useQuery({
|
|
40
|
+
queryKey: cacheKeys.checkEvents(checkId),
|
|
41
|
+
queryFn: () => listCheckEvents(checkId, apiClient),
|
|
42
|
+
enabled,
|
|
43
|
+
refetchInterval: POLLING_INTERVAL,
|
|
44
|
+
refetchIntervalInBackground: false,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Create comment mutation
|
|
48
|
+
const createCommentMutation = useMutation({
|
|
49
|
+
mutationFn: (content: string) => createComment(checkId, content, apiClient),
|
|
50
|
+
onSuccess: async () => {
|
|
51
|
+
await queryClient.invalidateQueries({
|
|
52
|
+
queryKey: cacheKeys.checkEvents(checkId),
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Update comment mutation
|
|
58
|
+
const updateCommentMutation = useMutation({
|
|
59
|
+
mutationFn: ({ eventId, content }: { eventId: string; content: string }) =>
|
|
60
|
+
updateComment(checkId, eventId, content, apiClient),
|
|
61
|
+
onSuccess: async () => {
|
|
62
|
+
await queryClient.invalidateQueries({
|
|
63
|
+
queryKey: cacheKeys.checkEvents(checkId),
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Delete comment mutation
|
|
69
|
+
const deleteCommentMutation = useMutation({
|
|
70
|
+
mutationFn: (eventId: string) => deleteComment(checkId, eventId, apiClient),
|
|
71
|
+
onSuccess: async () => {
|
|
72
|
+
await queryClient.invalidateQueries({
|
|
73
|
+
queryKey: cacheKeys.checkEvents(checkId),
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
events: events ?? [],
|
|
80
|
+
isLoading,
|
|
81
|
+
error,
|
|
82
|
+
refetch,
|
|
83
|
+
|
|
84
|
+
// Mutations
|
|
85
|
+
createComment: createCommentMutation.mutate,
|
|
86
|
+
isCreatingComment: createCommentMutation.isPending,
|
|
87
|
+
createCommentError: createCommentMutation.error,
|
|
88
|
+
|
|
89
|
+
// Use mutateAsync for updateComment to allow awaiting in UI
|
|
90
|
+
updateComment: updateCommentMutation.mutateAsync,
|
|
91
|
+
isUpdatingComment: updateCommentMutation.isPending,
|
|
92
|
+
updateCommentError: updateCommentMutation.error,
|
|
93
|
+
|
|
94
|
+
// Use mutateAsync for deleteComment to allow awaiting in UI
|
|
95
|
+
deleteComment: deleteCommentMutation.mutateAsync,
|
|
96
|
+
isDeletingComment: deleteCommentMutation.isPending,
|
|
97
|
+
deleteCommentError: deleteCommentMutation.error,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { toaster } from "@/components/ui/toaster";
|
|
2
|
+
|
|
3
|
+
export function useCheckToast() {
|
|
4
|
+
function markedAsApprovedToast() {
|
|
5
|
+
toaster.create({
|
|
6
|
+
title: "Marked as approved",
|
|
7
|
+
type: "success",
|
|
8
|
+
duration: 2000,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
markedAsApprovedToast,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { toaster } from "@/components/ui/toaster";
|
|
2
|
+
|
|
3
|
+
export function useClipBoardToast() {
|
|
4
|
+
function successToast(message: string) {
|
|
5
|
+
toaster.create({
|
|
6
|
+
description: message,
|
|
7
|
+
type: "info",
|
|
8
|
+
duration: 5000,
|
|
9
|
+
closable: true,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function failToast(title: string, error: unknown) {
|
|
14
|
+
toaster.create({
|
|
15
|
+
title: title,
|
|
16
|
+
description: String(error),
|
|
17
|
+
type: "error",
|
|
18
|
+
duration: 5000,
|
|
19
|
+
closable: true,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
successToast,
|
|
25
|
+
failToast,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useTimeout } from "usehooks-ts";
|
|
3
|
+
import { toaster } from "@/components/ui/toaster";
|
|
4
|
+
|
|
5
|
+
const COUNTDOWN_CONFIG = {
|
|
6
|
+
TOAST_ID: "lifetime-countdown",
|
|
7
|
+
WARNING_THRESHOLD: 60, // seconds before expiry to show warning
|
|
8
|
+
UPDATE_INTERVAL: 1000, // milliseconds
|
|
9
|
+
MESSAGE: (seconds: number) =>
|
|
10
|
+
`The server will be closed in ${seconds} seconds.`,
|
|
11
|
+
STYLE: {
|
|
12
|
+
fontFamily: "monospace",
|
|
13
|
+
},
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook to manage countdown toast notifications for server lifetime
|
|
18
|
+
* @param lifetimeExpiredAt - Date when the server will expire
|
|
19
|
+
*/
|
|
20
|
+
export function useCountdownToast(lifetimeExpiredAt: Date | undefined) {
|
|
21
|
+
const countdownToast = toaster;
|
|
22
|
+
const [countdownToastId, setCountdownToastId] = useState<string | null>(null);
|
|
23
|
+
const countdownIntervalRef = useRef<NodeJS.Timeout>(undefined);
|
|
24
|
+
|
|
25
|
+
const calculateRemainingSeconds = useCallback(() => {
|
|
26
|
+
if (!lifetimeExpiredAt) return 0;
|
|
27
|
+
|
|
28
|
+
const now = new Date();
|
|
29
|
+
const remaining = Math.floor(
|
|
30
|
+
(lifetimeExpiredAt.getTime() - now.getTime()) / 1000,
|
|
31
|
+
);
|
|
32
|
+
return Math.max(0, remaining); // Ensure we don't return negative values
|
|
33
|
+
}, [lifetimeExpiredAt]);
|
|
34
|
+
|
|
35
|
+
const cleanupToast = useCallback(() => {
|
|
36
|
+
if (countdownToastId != null) {
|
|
37
|
+
countdownToast.remove(countdownToastId);
|
|
38
|
+
setCountdownToastId(null);
|
|
39
|
+
}
|
|
40
|
+
}, [countdownToast, countdownToastId]);
|
|
41
|
+
|
|
42
|
+
const updateToast = useCallback(() => {
|
|
43
|
+
if (countdownToastId == null) return;
|
|
44
|
+
|
|
45
|
+
const remainingSeconds = calculateRemainingSeconds();
|
|
46
|
+
if (remainingSeconds <= 0) {
|
|
47
|
+
cleanupToast();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
countdownToast.update(countdownToastId, {
|
|
52
|
+
description: COUNTDOWN_CONFIG.MESSAGE(remainingSeconds),
|
|
53
|
+
});
|
|
54
|
+
}, [
|
|
55
|
+
countdownToastId,
|
|
56
|
+
calculateRemainingSeconds,
|
|
57
|
+
countdownToast,
|
|
58
|
+
cleanupToast,
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
const showToast = useCallback(() => {
|
|
62
|
+
if (!lifetimeExpiredAt) return;
|
|
63
|
+
|
|
64
|
+
// Cleanup any existing toast before showing new one
|
|
65
|
+
cleanupToast();
|
|
66
|
+
|
|
67
|
+
const remainingSeconds = calculateRemainingSeconds();
|
|
68
|
+
if (remainingSeconds <= 0) return;
|
|
69
|
+
|
|
70
|
+
setCountdownToastId(
|
|
71
|
+
countdownToast.create({
|
|
72
|
+
id: COUNTDOWN_CONFIG.TOAST_ID,
|
|
73
|
+
description: COUNTDOWN_CONFIG.MESSAGE(remainingSeconds),
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
countdownIntervalRef.current = setInterval(
|
|
78
|
+
updateToast,
|
|
79
|
+
COUNTDOWN_CONFIG.UPDATE_INTERVAL,
|
|
80
|
+
);
|
|
81
|
+
}, [
|
|
82
|
+
lifetimeExpiredAt,
|
|
83
|
+
countdownToast,
|
|
84
|
+
calculateRemainingSeconds,
|
|
85
|
+
updateToast,
|
|
86
|
+
cleanupToast,
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
// Calculate delay for showing toast
|
|
90
|
+
const remainingSeconds = calculateRemainingSeconds();
|
|
91
|
+
const delay = lifetimeExpiredAt
|
|
92
|
+
? Math.max(0, remainingSeconds - COUNTDOWN_CONFIG.WARNING_THRESHOLD) * 1000
|
|
93
|
+
: null;
|
|
94
|
+
|
|
95
|
+
// Use useTimeout hook to schedule toast display
|
|
96
|
+
useTimeout(showToast, delay);
|
|
97
|
+
|
|
98
|
+
// Cleanup effect
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
return cleanupToast;
|
|
101
|
+
}, [cleanupToast]);
|
|
102
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import Link from "@mui/material/Link";
|
|
4
|
+
import Stack from "@mui/material/Stack";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { LuExternalLink } from "react-icons/lu";
|
|
7
|
+
import { toaster } from "@/components/ui/toaster";
|
|
8
|
+
|
|
9
|
+
function ReactionFeedback({
|
|
10
|
+
description,
|
|
11
|
+
onLike,
|
|
12
|
+
onDislike,
|
|
13
|
+
onClickLink,
|
|
14
|
+
externalLink,
|
|
15
|
+
externalLinkText,
|
|
16
|
+
}: {
|
|
17
|
+
description: string;
|
|
18
|
+
onLike: () => void;
|
|
19
|
+
onDislike: () => void;
|
|
20
|
+
onClickLink: () => void;
|
|
21
|
+
externalLink?: string;
|
|
22
|
+
externalLinkText?: string;
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<Box
|
|
26
|
+
sx={{
|
|
27
|
+
display: "flex",
|
|
28
|
+
gap: 4,
|
|
29
|
+
justifyContent: "center",
|
|
30
|
+
alignContent: "center",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{description}
|
|
35
|
+
<IconButton
|
|
36
|
+
aria-label="thumbs up"
|
|
37
|
+
onClick={onLike}
|
|
38
|
+
sx={{ width: "32px", height: "32px" }}
|
|
39
|
+
>
|
|
40
|
+
<Box component="img" src="/imgs/feedback/thumbs-up.png" alt="like" />
|
|
41
|
+
</IconButton>
|
|
42
|
+
<IconButton
|
|
43
|
+
aria-label="thumbs down"
|
|
44
|
+
onClick={onDislike}
|
|
45
|
+
sx={{ width: "32px", height: "32px" }}
|
|
46
|
+
>
|
|
47
|
+
<Box
|
|
48
|
+
component="img"
|
|
49
|
+
src="/imgs/feedback/thumbs-down.png"
|
|
50
|
+
alt="dislike"
|
|
51
|
+
/>
|
|
52
|
+
</IconButton>
|
|
53
|
+
{externalLink && externalLinkText && (
|
|
54
|
+
<Link
|
|
55
|
+
href={externalLink}
|
|
56
|
+
target="_blank"
|
|
57
|
+
onClick={onClickLink}
|
|
58
|
+
sx={{ textDecoration: "underline" }}
|
|
59
|
+
>
|
|
60
|
+
{externalLinkText} <LuExternalLink />
|
|
61
|
+
</Link>
|
|
62
|
+
)}
|
|
63
|
+
</Box>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function useFeedbackCollectionToast(options: {
|
|
68
|
+
feedbackId: string;
|
|
69
|
+
description: string;
|
|
70
|
+
onFeedbackSubmit: (feedback: string) => void;
|
|
71
|
+
externalLink?: string;
|
|
72
|
+
externalLinkText?: string;
|
|
73
|
+
}) {
|
|
74
|
+
const {
|
|
75
|
+
feedbackId,
|
|
76
|
+
description,
|
|
77
|
+
onFeedbackSubmit,
|
|
78
|
+
externalLink,
|
|
79
|
+
externalLinkText,
|
|
80
|
+
} = options;
|
|
81
|
+
const [toastId, setToastId] = useState<string | undefined>(undefined);
|
|
82
|
+
|
|
83
|
+
function feedBackCollectionToast(skipBypassFeedback = false) {
|
|
84
|
+
const isSkipFeedback = localStorage.getItem(feedbackId);
|
|
85
|
+
if (toastId != null) {
|
|
86
|
+
// Don't show the toast again if it's already active
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (isSkipFeedback === "true" && !skipBypassFeedback) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setToastId(
|
|
94
|
+
toaster.create({
|
|
95
|
+
id: feedbackId,
|
|
96
|
+
duration: undefined,
|
|
97
|
+
type: "success",
|
|
98
|
+
description: (
|
|
99
|
+
<Stack direction="row">
|
|
100
|
+
<ReactionFeedback
|
|
101
|
+
description={description}
|
|
102
|
+
onLike={() => {
|
|
103
|
+
onFeedbackSubmit("like");
|
|
104
|
+
toaster.dismiss(feedbackId);
|
|
105
|
+
localStorage.setItem(feedbackId, "true");
|
|
106
|
+
}}
|
|
107
|
+
onDislike={() => {
|
|
108
|
+
onFeedbackSubmit("dislike");
|
|
109
|
+
toaster.dismiss(feedbackId);
|
|
110
|
+
localStorage.setItem(feedbackId, "true");
|
|
111
|
+
}}
|
|
112
|
+
externalLink={externalLink}
|
|
113
|
+
externalLinkText={externalLinkText}
|
|
114
|
+
onClickLink={() => {
|
|
115
|
+
onFeedbackSubmit("link");
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
</Stack>
|
|
119
|
+
),
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
feedbackToast: feedBackCollectionToast,
|
|
126
|
+
closeToast: () => {
|
|
127
|
+
if (toastId) toaster.dismiss(toastId);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { toaster } from "@/components/ui/toaster";
|
|
3
|
+
|
|
4
|
+
export function useGuideToast(options: {
|
|
5
|
+
guideId: string;
|
|
6
|
+
description: string;
|
|
7
|
+
externalLink?: string;
|
|
8
|
+
externalLinkText?: string;
|
|
9
|
+
onExternalLinkClick?: () => void;
|
|
10
|
+
}) {
|
|
11
|
+
const [toastId, setToastId] = useState<string | undefined>(undefined);
|
|
12
|
+
const { guideId, description, externalLinkText, onExternalLinkClick } =
|
|
13
|
+
options;
|
|
14
|
+
|
|
15
|
+
function guideToast() {
|
|
16
|
+
if (toastId != null) {
|
|
17
|
+
// Don't show the toast again if it's already active
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setToastId(
|
|
22
|
+
toaster.create({
|
|
23
|
+
id: guideId,
|
|
24
|
+
duration: 3000,
|
|
25
|
+
type: "success",
|
|
26
|
+
description: description,
|
|
27
|
+
action: {
|
|
28
|
+
label: externalLinkText ?? "link",
|
|
29
|
+
onClick: () => {
|
|
30
|
+
if (onExternalLinkClick) {
|
|
31
|
+
onExternalLinkClick();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
guideToast: guideToast,
|
|
41
|
+
closeGuideToast: () => {
|
|
42
|
+
if (toastId) toaster.dismiss(toastId);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|