@fernir2/saas-kit-cli 0.1.4 → 0.1.5
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/package.json +211 -7
- package/cli/.gitlab-ci.yml +0 -14
- package/cli/.husky/commit-msg +0 -1
- package/cli/.husky/pre-commit +0 -1
- package/cli/README.md +0 -101
- package/cli/bin/index.ts +0 -358
- package/cli/drizzle.config.ts +0 -12
- package/cli/global-setup.ts +0 -25
- package/cli/npm-commands/gen-meta/index.ts +0 -3
- package/cli/npm-commands/gen-schema/index.ts +0 -5
- package/cli/npm-commands/migrate-db/index.ts +0 -5
- package/cli/npm-commands/migrate-db/migrate-db.ts +0 -15
- package/cli/npm-commands/seed-db/index.ts +0 -5
- package/cli/npm-commands/seed-db/seed-db.ts +0 -15
- package/cli/playwright.config.ts +0 -34
- package/cli/postcss.config.mjs +0 -9
- package/cli/server.ts +0 -41
- package/cli/src/app/api/v1/[resourceName]/[id]/route.ts/route.ts +0 -11
- package/cli/src/app/api/v1/[resourceName]/route.ts/route.ts +0 -14
- package/cli/src/app/api/v1/[resourceName]/upsert/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/log/route.ts/route.ts +0 -7
- package/cli/src/app/api/v1/otheruser/[id]/route.ts/route.ts +0 -14
- package/cli/src/app/api/v1/otheruser/route.ts/route.ts +0 -7
- package/cli/src/app/api/v1/password/forgotpassword/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/password/resetpassword/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/payment/method/route.ts/route.ts +0 -4
- package/cli/src/app/api/v1/payment/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/payment/verify-fail/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/payment/verify-success/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/preload/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/searchable-resources/route.ts/route.ts +0 -11
- package/cli/src/app/api/v1/searchresult/route.ts/route.ts +0 -35
- package/cli/src/app/api/v1/sign-in/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/sign-out/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/sign-up/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/subscription/cancel/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/subscription/create/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/subscription/update/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/uimeta/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/uimetas/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/userpermission/route.ts/route.ts +0 -3
- package/cli/src/app/api/v1/visible-workspace/route.ts/route.ts +0 -5
- package/cli/src/app/api/v1/workspace/change/route.ts/route.ts +0 -5
- package/cli/src/app/favicon.ico +0 -0
- package/cli/src/app/layout.tsx +0 -42
- package/cli/src/app/page.tsx +0 -9
- package/cli/tailwind.config.ts +0 -13
- package/packages/base-repo/tools/git/commit-msg-script.ts +0 -42
- package/packages/base-repo/tools/git/pre-commit-script.ts +0 -431
- package/packages/level2/client/components/error-fallback/FdErrorFallback.jsx +0 -14
- package/packages/level2/client/components/feed/FdFeed.funcs.jsx +0 -65
- package/packages/level2/client/components/feed/FdFeed.jsx +0 -34
- package/packages/level2/client/components/feed/FdFeedActions.jsx +0 -15
- package/packages/level2/client/components/feed/FdFeedComments.jsx +0 -6
- package/packages/level2/client/components/feed/FdFeedEntry.jsx +0 -36
- package/packages/level2/client/components/feed/FdFeedHeader.jsx +0 -23
- package/packages/level2/client/components/feed/FdFeedReactionsSummary.jsx +0 -16
- package/packages/level2/client/components/providers/FdProviders.jsx +0 -28
- package/packages/level2/client/components/subscription-plan/FdSubscriptionPlan.jsx +0 -163
- package/packages/level2/client/components/wizard/FdWizard.jsx +0 -45
- package/packages/level2/client/components/wizard/FdWizardStepper.jsx +0 -55
- package/packages/level2/client/pages/dashboard-page/DashbordPage.jsx +0 -46
- package/packages/level2/client/pages/dynamic-layout-page/DynamicLayoutPage.jsx +0 -22
- package/packages/level2/client/pages/edit-password-page/EditPasswordPage.jsx +0 -8
- package/packages/level2/client/pages/edit-user-by-id-page/EditUserByIdPage.jsx +0 -14
- package/packages/level2/client/pages/edit-user-page/EditUserPage.jsx +0 -6
- package/packages/level2/client/pages/feed-page/FeedPage.jsx +0 -8
- package/packages/level2/client/pages/file-upload-page/FileUploadPage.jsx +0 -7
- package/packages/level2/client/pages/forgot-password-page/ForgotPasswordPage.jsx +0 -8
- package/packages/level2/client/pages/leads-viw-page/LeadsViewPage.jsx +0 -6
- package/packages/level2/client/pages/microsoft-page/MicrosoftPage.jsx +0 -16
- package/packages/level2/client/pages/payment-plan-page/PaymentPlanPage.jsx +0 -18
- package/packages/level2/client/pages/preload-page/PreloadPage.jsx +0 -25
- package/packages/level2/client/pages/reset-password-page/ResetPasswordPage.jsx +0 -8
- package/packages/level2/client/pages/screenshot-page/TestScreenshotPage.jsx +0 -23
- package/packages/level2/client/pages/sign-in-page/SignInPage.jsx +0 -24
- package/packages/level2/client/pages/sign-up-page/SignUpPage.jsx +0 -9
- package/packages/level2/client/pages/status-board-page/StatusBoardPage.jsx +0 -6
- package/packages/level2/client/pages/test-layout/TestLayout.jsx +0 -11
- package/packages/level2/client/pages/test-page/TestPage.jsx +0 -12
- package/packages/level2/client/pages/user-list-page/UserListPage.jsx +0 -4
- package/packages/level2/client/pages/view-page/ViewPage.jsx +0 -21
- package/packages/level2/client/payments/change-payment-method-field/ChangePaymentMethodField.jsx +0 -48
- package/packages/level2/client/payments/checkout-form/CheckoutForm.jsx +0 -95
- package/packages/level2/client/payments/checkout-form/CheckoutFormSubmit.jsx +0 -11
- package/packages/level2/client/payments/checkout-form/checkout-form-fields.jsx +0 -68
- package/packages/level2/client/website-scan/FdWebsiteScanResult.funcs.jsx +0 -12
- package/packages/level2/client/website-scan/FdWebsiteScanResult.jsx +0 -33
- package/packages/level2/client/website-scan/website-scan-data.jsx +0 -28
- package/packages/level2/client/website-scan/website-scan-icons/FacebookIcon.jsx +0 -6
- package/packages/level2/client/website-scan/website-scan-icons/FacebookPixelIcon.jsx +0 -49
- package/packages/level2/client/website-scan/website-scan-icons/GoogleAnalyticsIcon.jsx +0 -7
- package/packages/level2/client/website-scan/website-scan-icons/InstagramIcon.jsx +0 -32
- package/packages/level2/client/website-scan/website-scan-icons/LinkedinIcon.jsx +0 -6
- package/packages/level2/client/website-scan/website-scan-icons/OtherPlatformIcon.jsx +0 -110
- package/packages/level2/client/website-scan/website-scan-icons/ShopifyIcon.jsx +0 -46
- package/packages/level2/client/website-scan/website-scan-icons/SquarespaceIcon.jsx +0 -57
- package/packages/level2/client/website-scan/website-scan-icons/TiktokIcon.jsx +0 -15
- package/packages/level2/client/website-scan/website-scan-icons/WixIcon.jsx +0 -62
- package/packages/level2/client/website-scan/website-scan-icons/WordpressIcon.jsx +0 -53
- package/packages/level2/client/website-scan/website-scan-icons/XIcon.jsx +0 -6
- package/packages/level2/fd-app-toolbox/edit-other-user/EditOtherUser.jsx +0 -7
- package/packages/level2/fd-app-toolbox/edit-password-form/EditPasswordForm.jsx +0 -68
- package/packages/level2/fd-app-toolbox/edit-user-form/EditUserForm.jsx +0 -122
- package/packages/level2/fd-app-toolbox/edit-user-sheet/EditUserSheet.jsx +0 -35
- package/packages/level2/fd-app-toolbox/forgot-password-form/ForgotPasswordForm.jsx +0 -87
- package/packages/level2/fd-app-toolbox/layout/client-layout/ClientLayout.jsx +0 -19
- package/packages/level2/fd-app-toolbox/layout/client-root/ClientRoot.jsx +0 -32
- package/packages/level2/fd-app-toolbox/layout/hamburger-menu/FdHamburgerMenu.jsx +0 -47
- package/packages/level2/fd-app-toolbox/layout/navbar/FdNarrowNavbar.jsx +0 -40
- package/packages/level2/fd-app-toolbox/layout/sidebar/FdSidebar.jsx +0 -48
- package/packages/level2/fd-app-toolbox/layout/sidebar/sidebar-dropdown-menu/FdDropdownMenuItemTitle.jsx +0 -12
- package/packages/level2/fd-app-toolbox/layout/sidebar/sidebar-dropdown-menu/FdSidebarDropdownMenu.jsx +0 -81
- package/packages/level2/fd-app-toolbox/layout/sidebar/sidebar-resources-provider.jsx +0 -30
- package/packages/level2/fd-app-toolbox/layout/toolbar/FdToolbar.jsx +0 -89
- package/packages/level2/fd-app-toolbox/layout/toolbar/FdTopNav.jsx +0 -42
- package/packages/level2/fd-app-toolbox/layout/toolbar/title-provider/ToolbarTitleProvider.jsx +0 -10
- package/packages/level2/fd-app-toolbox/login-form/LoginForm.jsx +0 -165
- package/packages/level2/fd-app-toolbox/menu/notifications-menu/FdNotificationMenu.jsx +0 -43
- package/packages/level2/fd-app-toolbox/menu/notifications-menu/notification-list/FdNotificationList.jsx +0 -53
- package/packages/level2/fd-app-toolbox/menu/top-menu/FdTopMenu.jsx +0 -28
- package/packages/level2/fd-app-toolbox/menu/top-menu/top-menu-group/FdTopMenuGroup.jsx +0 -35
- package/packages/level2/fd-app-toolbox/menu/top-menu/top-menu-item/FdTopMenuItem.jsx +0 -47
- package/packages/level2/fd-app-toolbox/menu/user-dropdown-menu/FdUserDropdownMenu.jsx +0 -122
- package/packages/level2/fd-app-toolbox/menu/user-dropdown-menu/user-dropdown-menu-item/FdUserDropdownMenuItem.jsx +0 -56
- package/packages/level2/fd-app-toolbox/menu/visible-workspace-picker/FdVisibleWorkspacePicker.jsx +0 -36
- package/packages/level2/fd-app-toolbox/menu/workspace-picker/FdWorkspacePicker.jsx +0 -47
- package/packages/level2/fd-app-toolbox/providers/ThemeProvider/ThemeProvider.jsx +0 -27
- package/packages/level2/fd-app-toolbox/providers/auth-provider/AuthProvider.jsx +0 -38
- package/packages/level2/fd-app-toolbox/providers/sidebar-provider/FdSidebarContext.jsx +0 -17
- package/packages/level2/fd-app-toolbox/register-form/RegisterForm.jsx +0 -119
- package/packages/level2/fd-app-toolbox/report/FdChart.jsx +0 -120
- package/packages/level2/fd-app-toolbox/report/ReportChart.jsx +0 -29
- package/packages/level2/fd-app-toolbox/reset-password-form/ResetPasswordForm.jsx +0 -81
- package/packages/level2/fd-app-toolbox/search/FdSearch.jsx +0 -56
- package/packages/level2/fd-app-toolbox/search/search-dialog/FdSearchDialog.jsx +0 -72
- package/packages/level2/fd-app-toolbox/search/search-dialog-provider.jsx +0 -16
- package/packages/level2/fd-app-toolbox/search/search-input/FdSearchInput.jsx +0 -49
- package/packages/level2/fd-app-toolbox/search/search-resource-results/FdSearchResourcesResults.jsx +0 -36
- package/packages/level2/fd-app-toolbox/search/search-result/FdSearchResult.jsx +0 -46
- package/packages/level2/fd-app-toolbox/search/search-searchable-resource-results/FdSearchSearchableResourceResult.jsx +0 -43
- package/packages/level2/fd-app-toolbox/search/search-searchable-resource-results/FdSearchSearchableResourceResults.jsx +0 -22
- package/packages/level2/fd-app-toolbox/server/layout/private-layout/PrivateLayout.jsx +0 -32
- package/packages/level2/fd-app-toolbox/status-board/FdStatusBoard.jsx +0 -49
- package/packages/level2/fd-app-toolbox/status-board/status-board-item/FdStatusBoardItem.jsx +0 -17
- package/packages/level2/fd-app-toolbox/status-board/status-board-status/FdStatusBoardStatus.jsx +0 -27
- package/packages/level2/fd-app-toolbox/user-list/UserList.jsx +0 -58
- package/packages/level2/fd-component-toolbox/animation/FdLabelAnimation.jsx +0 -55
- package/packages/level2/fd-component-toolbox/avatar/FdAvatar.jsx +0 -50
- package/packages/level2/fd-component-toolbox/back-button/FdBackButton.jsx +0 -21
- package/packages/level2/fd-component-toolbox/badge/FdBadge.jsx +0 -19
- package/packages/level2/fd-component-toolbox/badge-toggle-list/FdBadgeToggleList.jsx +0 -47
- package/packages/level2/fd-component-toolbox/button/FdButton.jsx +0 -64
- package/packages/level2/fd-component-toolbox/calendar/FdCalendar.jsx +0 -68
- package/packages/level2/fd-component-toolbox/card/FdCard.jsx +0 -56
- package/packages/level2/fd-component-toolbox/card/FdCardBigDigits.jsx +0 -25
- package/packages/level2/fd-component-toolbox/chart/FdChart.jsx +0 -269
- package/packages/level2/fd-component-toolbox/checkbox/FdCheckbox.jsx +0 -39
- package/packages/level2/fd-component-toolbox/command/FdCommand.jsx +0 -123
- package/packages/level2/fd-component-toolbox/datepicker/FdDatePicker.jsx +0 -155
- package/packages/level2/fd-component-toolbox/dialog/FdDialog.jsx +0 -106
- package/packages/level2/fd-component-toolbox/dialog/YesOrNoDialog.jsx +0 -57
- package/packages/level2/fd-component-toolbox/drag-and-drop/FdDragDropContext.jsx +0 -19
- package/packages/level2/fd-component-toolbox/drag-and-drop/FdDraggable.jsx +0 -27
- package/packages/level2/fd-component-toolbox/drag-and-drop/FdDroppable.jsx +0 -22
- package/packages/level2/fd-component-toolbox/dropdown-menu/FdDropdownMenu.jsx +0 -198
- package/packages/level2/fd-component-toolbox/dynamic-layout/FdDynamicComponent.jsx +0 -27
- package/packages/level2/fd-component-toolbox/dynamic-layout/FdDynamicLayoutDragAndDrop.jsx +0 -78
- package/packages/level2/fd-component-toolbox/fade-out-text/FdFadeOutText.jsx +0 -52
- package/packages/level2/fd-component-toolbox/form/FdForm.jsx +0 -146
- package/packages/level2/fd-component-toolbox/icon/FdIcon.jsx +0 -192
- package/packages/level2/fd-component-toolbox/icon/custom-icons/FdFilterIcon.jsx +0 -11
- package/packages/level2/fd-component-toolbox/image/FdImage.jsx +0 -15
- package/packages/level2/fd-component-toolbox/input/FdInput.jsx +0 -94
- package/packages/level2/fd-component-toolbox/label/FdLabel.jsx +0 -19
- package/packages/level2/fd-component-toolbox/link/FdLink.jsx +0 -23
- package/packages/level2/fd-component-toolbox/list/FdList.jsx +0 -20
- package/packages/level2/fd-component-toolbox/list/list-item/FdListItem.jsx +0 -46
- package/packages/level2/fd-component-toolbox/loading/FdLoadingIndicator.jsx +0 -7
- package/packages/level2/fd-component-toolbox/logos/FacebookLogo.jsx +0 -11
- package/packages/level2/fd-component-toolbox/logos/GoogleLogo.jsx +0 -12
- package/packages/level2/fd-component-toolbox/logos/MicrosoftLogo.jsx +0 -11
- package/packages/level2/fd-component-toolbox/markdown/FdMarkdown.jsx +0 -105
- package/packages/level2/fd-component-toolbox/markdown/markdown-parser.jsx +0 -72
- package/packages/level2/fd-component-toolbox/multiselect/FdMultiselect.jsx +0 -240
- package/packages/level2/fd-component-toolbox/navigation/FdNavigation.jsx +0 -43
- package/packages/level2/fd-component-toolbox/navigation/navigation-item/FdNavigationItem.jsx +0 -23
- package/packages/level2/fd-component-toolbox/radio-group/FdRadioGroup.jsx +0 -46
- package/packages/level2/fd-component-toolbox/rich-text/FdRichText.jsx +0 -58
- package/packages/level2/fd-component-toolbox/save-status/FdSaveStatus.jsx +0 -40
- package/packages/level2/fd-component-toolbox/select/FdSelect.jsx +0 -173
- package/packages/level2/fd-component-toolbox/separator/FdSeparator.jsx +0 -19
- package/packages/level2/fd-component-toolbox/sheet/FdSheet.jsx +0 -121
- package/packages/level2/fd-component-toolbox/slide-toggle/FdSlideToggle.jsx +0 -57
- package/packages/level2/fd-component-toolbox/spinner/Spinner.jsx +0 -36
- package/packages/level2/fd-component-toolbox/subheading/FdSubHeading.jsx +0 -12
- package/packages/level2/fd-component-toolbox/switch/FdSwitch.jsx +0 -55
- package/packages/level2/fd-component-toolbox/tabs/FdTabs.jsx +0 -53
- package/packages/level2/fd-component-toolbox/textarea/FdTextArea.jsx +0 -42
- package/packages/level2/fd-component-toolbox/toaster/FdToaster.jsx +0 -20
- package/packages/level2/fd-component-toolbox/tooltip/FdTooltip.jsx +0 -80
- package/packages/level2/meta/browsers/base-multi-browser/FdBaseMultiBrowser.jsx +0 -72
- package/packages/level2/meta/browsers/base-multi-browser/base-multi-browser-dialog/FdBaseMultiBrowserDialog.jsx +0 -159
- package/packages/level2/meta/browsers/browser/FdBrowser.jsx +0 -58
- package/packages/level2/meta/browsers/browser/browser-dialog/FdBrowserDialog.jsx +0 -89
- package/packages/level2/meta/browsers/many-to-many-browser/FdManyToManyBrowser.jsx +0 -33
- package/packages/level2/meta/browsers/multi-browser/FdMultiBrowser.jsx +0 -32
- package/packages/level2/meta/card-list/FdCardList.jsx +0 -40
- package/packages/level2/meta/card-list/card/FdCard.jsx +0 -44
- package/packages/level2/meta/card-list/card/action-block/FdCardActionBlock.jsx +0 -70
- package/packages/level2/meta/card-list/card/content-block/FdCardContentBlock.jsx +0 -64
- package/packages/level2/meta/card-list/card/image-block/FdCardImage.jsx +0 -10
- package/packages/level2/meta/client/framework/hooks.jsx +0 -39
- package/packages/level2/meta/comment/FdComment.jsx +0 -16
- package/packages/level2/meta/comment/FdCommentList.jsx +0 -32
- package/packages/level2/meta/components/edit-image/FdEditImage.jsx +0 -42
- package/packages/level2/meta/components/edit-image/FdEditImageActionMenu.jsx +0 -31
- package/packages/level2/meta/components/edit-image/FdEditImageDropdownMenu.jsx +0 -42
- package/packages/level2/meta/components/file-upload/FileUpload.jsx +0 -103
- package/packages/level2/meta/components/file-upload/PreviewMedia.jsx +0 -36
- package/packages/level2/meta/components/multi-list/FdMultiList.jsx +0 -65
- package/packages/level2/meta/components/multi-list/FdMultiListEditResource.jsx +0 -31
- package/packages/level2/meta/edit-resource/FdEditResource.jsx +0 -135
- package/packages/level2/meta/edit-resource/FdEditResourceFormBody.jsx +0 -8
- package/packages/level2/meta/edit-resource/FdEditResourceHeader.jsx +0 -43
- package/packages/level2/meta/edit-resource/FdEditResourceSheet.jsx +0 -70
- package/packages/level2/meta/edit-resource/SaveCompleteProvider.jsx +0 -16
- package/packages/level2/meta/edit-resource/edit-link/FdEditLink.jsx +0 -48
- package/packages/level2/meta/edit-resource/edit-link/FdEditLinkResource.jsx +0 -18
- package/packages/level2/meta/edit-resource/edit-resource-dialog/FdEditResourceDialog.jsx +0 -34
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourceBlobField.jsx +0 -15
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourceEnumField.jsx +0 -35
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourceFlagsEnumField.jsx +0 -23
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourceImageField.jsx +0 -7
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourcePropertyBlock.jsx +0 -38
- package/packages/level2/meta/edit-resource/edit-resource-property-block/FdEditResourceRichTextField.jsx +0 -16
- package/packages/level2/meta/edit-resource/edit-resource-property-block/edit-resource-fields.jsx +0 -53
- package/packages/level2/meta/edit-resource/edit-resource-property-field/FdEditResourcePropertyField.jsx +0 -105
- package/packages/level2/meta/filtering/filter/FdEnumFlagFilter.jsx +0 -40
- package/packages/level2/meta/filtering/filter/FdFilter.jsx +0 -123
- package/packages/level2/meta/filtering/filter/filters/BooleanFilter.jsx +0 -25
- package/packages/level2/meta/filtering/filter/filters/DateFilter.jsx +0 -10
- package/packages/level2/meta/filtering/filter/filters/EnumFilter.jsx +0 -44
- package/packages/level2/meta/filtering/filter/filters/GuidFilter.jsx +0 -28
- package/packages/level2/meta/filtering/filter/filters/IntegerFilter.jsx +0 -28
- package/packages/level2/meta/filtering/filter/filters/TextFilter.jsx +0 -11
- package/packages/level2/meta/filtering/resource-filter-list/FdResourceFilterList.jsx +0 -120
- package/packages/level2/meta/filtering/resource-filter-list/resource-list-dropdown-menu/ResourceListDropdownMenu.funcs.jsx +0 -4
- package/packages/level2/meta/filtering/resource-filter-list/resource-list-dropdown-menu/ResourceListDropdownMenu.jsx +0 -43
- package/packages/level2/meta/providers/global-provider/FdGlobalContext.jsx +0 -17
- package/packages/level2/meta/resource-list/ResourceList.jsx +0 -63
- package/packages/level2/meta/resource-list/resource-add-button.jsx +0 -11
- package/packages/level2/meta/resource-list/resource-list-card/FdResourceListCard.jsx +0 -7
- package/packages/level2/meta/resource-list/resource-list-filter/FdResourceListFilter.jsx +0 -11
- package/packages/level2/meta/resource-list/resource-table-list/FdResourceTableList.jsx +0 -14
- package/packages/level2/meta/table/FdTable.jsx +0 -147
- package/packages/level2/meta/table/body/FdTableBody.jsx +0 -9
- package/packages/level2/meta/table/body-cell/FdActionBodyCell.jsx +0 -145
- package/packages/level2/meta/table/body-cell/FdBlobBodyCell.jsx +0 -27
- package/packages/level2/meta/table/body-cell/FdBodyCell.jsx +0 -133
- package/packages/level2/meta/table/body-cell/FdBodyCellValue.jsx +0 -59
- package/packages/level2/meta/table/body-cell/FdBodyExpandCell.jsx +0 -6
- package/packages/level2/meta/table/body-cell/FdBodyExpandPropertyCell.jsx +0 -22
- package/packages/level2/meta/table/body-cell/FdCustomActionLink.jsx +0 -16
- package/packages/level2/meta/table/body-cell/FdMultiselectCellTemplate.jsx +0 -39
- package/packages/level2/meta/table/body-cell/FdViewCell.jsx +0 -12
- package/packages/level2/meta/table/body-row/FdTableBodyRow.jsx +0 -49
- package/packages/level2/meta/table/header/FdTableHeader.jsx +0 -54
- package/packages/level2/meta/table/header-cell/FdResizable.jsx +0 -18
- package/packages/level2/meta/table/header-cell/FdResizableEdgeHandle.jsx +0 -4
- package/packages/level2/meta/table/header-cell/FdTableHeaderActionCell.jsx +0 -49
- package/packages/level2/meta/table/header-cell/FdTableHeaderCell.jsx +0 -89
- package/packages/level2/meta/table/header-cell/FdTableHeaderCellActionButton.jsx +0 -23
- package/packages/level2/meta/table/pager/FdPager.jsx +0 -72
- package/packages/level2/meta/table/table-custom-action/TableCustomAction.jsx +0 -26
- package/packages/level2/meta/view/FdView.jsx +0 -31
- package/packages/level2/meta/view/FdViewSheet.jsx +0 -103
- package/packages/level2/meta/view/view-resource/FdViewResource.jsx +0 -108
- package/packages/level2/meta/view/view-resource/templates/ManyToOneTableHeaderCellTemplate.jsx +0 -13
- package/src/app/error.jsx +0 -5
- package/src/app/global-error.jsx +0 -5
- package/src/app/loading.jsx +0 -11
- package/src/hd/footer/HdFooter.jsx +0 -27
- package/src/hd/footer/hd-footer-item/HdFooterItem.jsx +0 -14
- package/src/lm/ai-scan/AiScanAction.jsx +0 -21
- package/src/lm/ai-scan/cell-templates/AiScanWebsiteResultCellTemplate.jsx +0 -31
- package/src/lm/components/LmCardReport.jsx +0 -12
- package/src/lm/configs/lm-list-configs.jsx +0 -72
- package/src/lm/google-place/action-dropdown/GooglePlaceActionDropdown.jsx +0 -42
- package/src/lm/google-place/actions/GooglePlaceSaveToGroupAction.jsx +0 -22
- package/src/lm/google-place/cell-templates/GooglePlaceBusinessInfoCellTemplate.jsx +0 -59
- package/src/lm/google-place/cell-templates/GooglePlaceEmailsCellTemplate.jsx +0 -34
- package/src/lm/google-place/cell-templates/GooglePlaceScanAction.jsx +0 -15
- package/src/lm/lead/action-dropdown/LeadActionDropdown.jsx +0 -39
- package/src/lm/lead/actions/move-to-group-action/LeadMoveToGroupAction.jsx +0 -28
- package/src/lm/lead/cell-templates/LeadBusinessInfoCellTemplate.jsx +0 -64
- package/src/lm/lead/cell-templates/LeadScanAction.jsx +0 -15
- package/src/lm/lead/lead-google-place/LeadGooglePlaceIndicator.jsx +0 -8
- package/src/lm/lead/lead-google-place/LeadGooglePlaceIndicators.jsx +0 -17
- package/src/lm/lead/lead-google-place/LeadGooglePlaceInfo.jsx +0 -15
- package/src/lm/lead/view/LeadsView.jsx +0 -8
- package/src/lm/pages/HomePage.jsx +0 -53
- package/types-output/tsconfig.tsbuildinfo +0 -1
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useCallback, useLayoutEffect, useState } from "react";
|
|
3
|
-
import { FdFrameworkImage } from "@fd-component-toolbox/client/framework";
|
|
4
|
-
import { routes } from "@fd-toolbox/routing/routes";
|
|
5
|
-
import { FdInput } from "@fd-component-toolbox/input/FdInput";
|
|
6
|
-
import { FdButton } from "@fd-component-toolbox/button/FdButton";
|
|
7
|
-
import { useForm } from "react-hook-form";
|
|
8
|
-
import { FdLabel } from "@fd-component-toolbox/label/FdLabel";
|
|
9
|
-
import { useFdRouter, useFdSearchParams } from "@meta/client/framework/hooks";
|
|
10
|
-
import { FdForm, FdFormControl, FdFormField, FdFormItem, FdFormMessage, } from "@fd-component-toolbox/form/FdForm";
|
|
11
|
-
import { loginDisplayProps } from "@meta/auth/login";
|
|
12
|
-
import { FdCard, FdCardContent, FdCardHeader, FdCardTitle } from "@fd-component-toolbox/card/FdCard";
|
|
13
|
-
import { codeParam } from "@fd-toolbox/constants/auth-constants";
|
|
14
|
-
import { FdIcon, iconNames } from "@fd-component-toolbox/icon/FdIcon";
|
|
15
|
-
import FdLink from "@fd-component-toolbox/link/FdLink";
|
|
16
|
-
import { userRoutes } from "@fd-toolbox/constants/user-routes";
|
|
17
|
-
import { useAsyncEffect } from "@fd-toolbox/hooks/use-async-effect";
|
|
18
|
-
import { getLoginButtonId, getOAuthProvider, handleOAuth, loadThemeLoginImage, onLoginSubmit, } from "@fd-app-toolbox/login-form/LoginForm.funcs";
|
|
19
|
-
import { useSetTitle } from "@meta/page/use-set-title";
|
|
20
|
-
import { elements } from "@fd-toolbox/constants/elements";
|
|
21
|
-
import { getLoginState } from "@fd-toolbox/auth/login-states";
|
|
22
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
23
|
-
import { useAuth } from "@fd-app-toolbox/providers/auth-provider/AuthProvider";
|
|
24
|
-
const pageTitle = "Sign In";
|
|
25
|
-
const OauthButtonLayoutStep = 3;
|
|
26
|
-
/**
|
|
27
|
-
* Sign-in form component with support for email/password and OAuth login.
|
|
28
|
-
*
|
|
29
|
-
* @param props - See {@link LoginFromProps}
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```typescript
|
|
33
|
-
* <LoginForm
|
|
34
|
-
* oAuthLoginConfigs={[
|
|
35
|
-
* getGoogleOAuthConfig(),
|
|
36
|
-
* getMicrosoftOAuthConfig(),
|
|
37
|
-
* getFacebookOAuthConfig(),
|
|
38
|
-
* ]}
|
|
39
|
-
* hideSignUpLink={true}
|
|
40
|
-
* />
|
|
41
|
-
*/
|
|
42
|
-
export function LoginForm({ oAuthLoginConfigs, hideSignUpLink }) {
|
|
43
|
-
const [hidePassword, setHidePassword] = useState(true);
|
|
44
|
-
const [isAuthInit, setIsAuthInit] = useState(false);
|
|
45
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
46
|
-
const [imgSrc, setImgSrc] = useState();
|
|
47
|
-
useSetTitle(pageTitle);
|
|
48
|
-
const context = useAuth();
|
|
49
|
-
const router = useFdRouter();
|
|
50
|
-
useLayoutEffect(() => {
|
|
51
|
-
loadThemeLoginImage(setImgSrc);
|
|
52
|
-
}, []);
|
|
53
|
-
const form = useForm({
|
|
54
|
-
defaultValues: {
|
|
55
|
-
email: "tim.w@example.com",
|
|
56
|
-
password: "Admin1!",
|
|
57
|
-
},
|
|
58
|
-
mode: "onChange",
|
|
59
|
-
});
|
|
60
|
-
const { handleSubmit, formState: { isValid }, control, } = form;
|
|
61
|
-
const searchParams = useFdSearchParams();
|
|
62
|
-
const getCodeParam = searchParams.get(codeParam);
|
|
63
|
-
const oAuthProvider = getOAuthProvider(searchParams, oAuthLoginConfigs);
|
|
64
|
-
const onSubmit = useCallback(async (data) => {
|
|
65
|
-
if (!isSubmitting)
|
|
66
|
-
await onLoginSubmit(data, setIsSubmitting, router, context.setLoginState);
|
|
67
|
-
}, [isSubmitting, router, context.setLoginState]);
|
|
68
|
-
useAsyncEffect(async () => {
|
|
69
|
-
if (!isAuthInit) {
|
|
70
|
-
setIsAuthInit(true);
|
|
71
|
-
setIsSubmitting(true);
|
|
72
|
-
if (getCodeParam && oAuthProvider && oAuthLoginConfigs) {
|
|
73
|
-
await handleOAuth(oAuthProvider, getCodeParam, oAuthLoginConfigs, router);
|
|
74
|
-
context.setLoginState?.(getLoginState());
|
|
75
|
-
}
|
|
76
|
-
setIsSubmitting(false);
|
|
77
|
-
}
|
|
78
|
-
}, [isAuthInit, getCodeParam, oAuthProvider, oAuthLoginConfigs, router]);
|
|
79
|
-
const togglePasswordVisibility = useCallback(() => {
|
|
80
|
-
setHidePassword((prev) => !prev);
|
|
81
|
-
}, []);
|
|
82
|
-
const customIconFunc = useCallback(() => hidePassword ? (<div onClick={togglePasswordVisibility}>
|
|
83
|
-
<FdIcon name={iconNames.visibility}/>
|
|
84
|
-
</div>) : (<div onClick={togglePasswordVisibility}>
|
|
85
|
-
<FdIcon name={iconNames.visibilityOff}/>
|
|
86
|
-
</div>), [hidePassword, togglePasswordVisibility]);
|
|
87
|
-
function isFullSizeOAuthButton(configs, index) {
|
|
88
|
-
return (!(index % OauthButtonLayoutStep) ||
|
|
89
|
-
(index % OauthButtonLayoutStep === 1 && index + 1 === configs.length));
|
|
90
|
-
}
|
|
91
|
-
return (<div className="relative h-screen w-full overflow-hidden">
|
|
92
|
-
{imgSrc && <FdFrameworkImage src={imgSrc} alt="Forest" fill className="object-cover" priority/>}
|
|
93
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
94
|
-
<FdCard className="mx-auto grid w-80 gap-6 rounded-lg p-6 shadow-lg">
|
|
95
|
-
<FdCardHeader className="grid gap-2 p-0 text-center">
|
|
96
|
-
<FdCardTitle className="text-3xl font-bold">Sign In</FdCardTitle>
|
|
97
|
-
</FdCardHeader>
|
|
98
|
-
<FdCardContent className="p-0">
|
|
99
|
-
{oAuthLoginConfigs && oAuthLoginConfigs.length > 0 && (<div className="grid grid-cols-2 gap-3">
|
|
100
|
-
{oAuthLoginConfigs.map((oauthConfig, index) => (<FdButton key={`${oauthConfig.buttonText}_${oauthConfig.iconName}`} className={cn("flex w-full items-center gap-1", isFullSizeOAuthButton(oAuthLoginConfigs, index) && "col-span-2")} id={getLoginButtonId(oauthConfig.oAuthProvider)} variant={"outline"} onClick={oauthConfig.onLogin} disabled={isSubmitting}>
|
|
101
|
-
<FdIcon name={oauthConfig.iconName}/>
|
|
102
|
-
{oauthConfig.buttonText}
|
|
103
|
-
</FdButton>))}
|
|
104
|
-
</div>)}
|
|
105
|
-
{oAuthLoginConfigs && oAuthLoginConfigs.length > 0 && (<div className="flex items-center gap-2 pt-3">
|
|
106
|
-
<hr className="w-full"/>
|
|
107
|
-
<span className="text-nowrap text-xs text-muted-foreground">
|
|
108
|
-
OR CONTINUE WITH
|
|
109
|
-
</span>
|
|
110
|
-
<hr className="w-full"/>
|
|
111
|
-
</div>)}
|
|
112
|
-
<FdForm {...form}>
|
|
113
|
-
<form onSubmit={handleSubmit(onSubmit)}>
|
|
114
|
-
<FdFormField control={control} name={userRoutes.email} render={({ field }) => (<FdFormItem>
|
|
115
|
-
<div className="w-full py-1">
|
|
116
|
-
<FdLabel>{loginDisplayProps.email}</FdLabel>
|
|
117
|
-
<FdFormControl>
|
|
118
|
-
<FdInput {...field} inputId="loginInput" placeholder={loginDisplayProps.email} showClearIcon={!isSubmitting} disabled={isSubmitting}/>
|
|
119
|
-
</FdFormControl>
|
|
120
|
-
<FdFormMessage />
|
|
121
|
-
</div>
|
|
122
|
-
</FdFormItem>)}/>
|
|
123
|
-
|
|
124
|
-
<FdFormField control={control} name={userRoutes.password} render={({ field }) => (<FdFormItem>
|
|
125
|
-
<div className="w-full py-1">
|
|
126
|
-
<div className="flex items-center justify-between">
|
|
127
|
-
<FdLabel>{loginDisplayProps.password}</FdLabel>
|
|
128
|
-
<FdLink id={elements.login.forgotPasswordButton} className="inline-block text-xs text-muted-foreground" href={routes.forgotPassword}>
|
|
129
|
-
Forgot password?
|
|
130
|
-
</FdLink>
|
|
131
|
-
</div>
|
|
132
|
-
|
|
133
|
-
<div>
|
|
134
|
-
<FdFormControl>
|
|
135
|
-
<FdInput {...field} value={field.value ?? ""} inputId="passwordInput" placeholder={loginDisplayProps.password} type={hidePassword ? "password" : "text"} showClearIcon={!isSubmitting} disabled={isSubmitting}>
|
|
136
|
-
<FdButton variant="icon" size="icon" type="button" tabIndex={-1} className="w-6" disabled={isSubmitting}>
|
|
137
|
-
{customIconFunc()}
|
|
138
|
-
</FdButton>
|
|
139
|
-
</FdInput>
|
|
140
|
-
</FdFormControl>
|
|
141
|
-
<FdFormMessage />
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</FdFormItem>)}/>
|
|
145
|
-
<div className="flex w-full justify-center gap-1 px-1 pt-2">
|
|
146
|
-
{!hideSignUpLink && (<>
|
|
147
|
-
<p className="text-sm">Don't have an account?</p>
|
|
148
|
-
<FdLink className="inline-block text-sm text-muted-foreground" href={routes.register}>
|
|
149
|
-
Sign Up
|
|
150
|
-
</FdLink>
|
|
151
|
-
</>)}
|
|
152
|
-
</div>
|
|
153
|
-
<FdButton className="mr-4 mt-4 flex w-full items-center justify-center" id={elements.login.loginButton} disabled={!isValid || isSubmitting} type="submit">
|
|
154
|
-
{isSubmitting ? (<>
|
|
155
|
-
<div className="mr-2 size-4 animate-spin rounded-full border-2 border-inherit border-r-transparent"/>
|
|
156
|
-
Signing in...
|
|
157
|
-
</>) : ("Sign In")}
|
|
158
|
-
</FdButton>
|
|
159
|
-
</form>
|
|
160
|
-
</FdForm>
|
|
161
|
-
</FdCardContent>
|
|
162
|
-
</FdCard>
|
|
163
|
-
</div>
|
|
164
|
-
</div>);
|
|
165
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { use, useCallback, useState } from "react";
|
|
2
|
-
import { FdIcon, iconNames, iconSizes } from "@fd-component-toolbox/icon/FdIcon";
|
|
3
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
4
|
-
import { FdSheet, FdSheetContent, FdSheetHeader, FdSheetTitle, FdSheetTrigger, FdSheetDescription, } from "@fd-component-toolbox/sheet/FdSheet";
|
|
5
|
-
import { FdNotificationList } from "@fd-app-toolbox/menu/notifications-menu/notification-list/FdNotificationList";
|
|
6
|
-
import { useAsyncEffect } from "@fd-toolbox/hooks/use-async-effect";
|
|
7
|
-
import { setNotificationState, initNotification, getNotificationMenuTriggerId, getNotificationMenuId, handleNotificationOpenChange, } from "@fd-app-toolbox/menu/notifications-menu/FdNotificationMenu.funcs";
|
|
8
|
-
import { FdButton } from "@fd-component-toolbox/button/FdButton";
|
|
9
|
-
import { useAuth } from "@fd-app-toolbox/providers/auth-provider/AuthProvider";
|
|
10
|
-
export function FdNotificationMenu({ parentContextName, notificationsPromise }) {
|
|
11
|
-
const notificationProps = use(notificationsPromise);
|
|
12
|
-
const { loginState } = useAuth();
|
|
13
|
-
const [notifications, setNotifications] = useState([]);
|
|
14
|
-
const [hasUnreadNotification, setHasUnreadNotification] = useState(false);
|
|
15
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
16
|
-
const notificationMenuId = getNotificationMenuId(parentContextName);
|
|
17
|
-
const onNotification = useCallback((notification) => {
|
|
18
|
-
setNotificationState(notification, setNotifications, setHasUnreadNotification);
|
|
19
|
-
}, []);
|
|
20
|
-
useAsyncEffect(async () => {
|
|
21
|
-
await initNotification(loginState.loggedIn, loginState.userId, setNotifications, setHasUnreadNotification, onNotification, notificationProps);
|
|
22
|
-
}, [loginState.loggedIn, isOpen]);
|
|
23
|
-
const onOpenChange = useCallback(async (open) => {
|
|
24
|
-
await handleNotificationOpenChange(open, setIsOpen, notifications, setNotifications, setHasUnreadNotification);
|
|
25
|
-
}, [notifications]);
|
|
26
|
-
return (<FdSheet onOpenChange={onOpenChange} open={isOpen}>
|
|
27
|
-
<FdSheetTrigger asChild>
|
|
28
|
-
<FdButton variant="icon" className="relative flex size-8 justify-center rounded-md p-1 hover:bg-fd-tertiary-700" tooltipText="Notifications" tooltipClassName="mt-2" id={getNotificationMenuTriggerId(notificationMenuId)}>
|
|
29
|
-
{hasUnreadNotification && (<FdIcon name={iconNames.dotFilled} size={iconSizes.large} className="absolute -right-1 -top-1" color="text-destructive"/>)}
|
|
30
|
-
<FdIcon name={iconNames.bell} className="w-full text-fd-tertiary-50" color="color-white"/>
|
|
31
|
-
</FdButton>
|
|
32
|
-
</FdSheetTrigger>
|
|
33
|
-
<FdSheetContent className={cn("flex h-full w-3/4 flex-col border-none bg-background p-0 pb-4 md:w-1/2 xl:w-3/12")}>
|
|
34
|
-
<FdSheetHeader className="flex min-h-16 flex-row items-center justify-between bg-gradient-accent px-8">
|
|
35
|
-
<FdSheetTitle className="text-xl font-bold text-fd-tertiary-50">
|
|
36
|
-
Notifications
|
|
37
|
-
</FdSheetTitle>
|
|
38
|
-
<FdSheetDescription></FdSheetDescription>
|
|
39
|
-
</FdSheetHeader>
|
|
40
|
-
<FdNotificationList parentContextName={notificationMenuId} notifications={notifications}/>
|
|
41
|
-
</FdSheetContent>
|
|
42
|
-
</FdSheet>);
|
|
43
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { FdIcon, iconNames } from "@fd-component-toolbox/icon/FdIcon";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { checkNotificationGroupDateLabel, getDateLabelForNotificationGroup, getNotificationListDescriptionId, getNotificationListItemId, getNotificationListMessageId, getNotificationMenuListId, } from "@fd-app-toolbox/menu/notifications-menu/notification-list/FdNotificationList.funcs";
|
|
4
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
5
|
-
import { formatUserFrendlyRelativeTime, parseToUtc } from "@fd-toolbox/dates/date-times";
|
|
6
|
-
/**
|
|
7
|
-
* Component that displays a list of notifications grouped by date with read/unread status
|
|
8
|
-
*
|
|
9
|
-
* @param FdNotificationListProps {@link FdNotificationListProps}
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
function MyComponent() {
|
|
14
|
-
const [notifications, setNotifications] = useState<Notification[]>([]);
|
|
15
|
-
|
|
16
|
-
return <FdNotificationList notifications={notifications} />;
|
|
17
|
-
}
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export function FdNotificationList({ parentContextName, notifications }) {
|
|
21
|
-
const notificationMenuListId = getNotificationMenuListId(parentContextName);
|
|
22
|
-
return (<div id={notificationMenuListId} className="h-full">
|
|
23
|
-
{notifications.length ? (notifications.map((notification, index) => (<div id={getNotificationListItemId(notificationMenuListId, notification.id)} key={notification.id}>
|
|
24
|
-
{checkNotificationGroupDateLabel(notifications, notification, index) && (<div className="w-full border-b bg-muted/100 p-2 px-4">
|
|
25
|
-
<span className="text-xs text-muted-foreground">
|
|
26
|
-
{getDateLabelForNotificationGroup(parseToUtc(notification.createdDate))}
|
|
27
|
-
</span>
|
|
28
|
-
</div>)}
|
|
29
|
-
<div className={cn("w-full border-b bg-background p-4 transition-all hover:bg-muted/50", notification.isRead && "opacity-70")}>
|
|
30
|
-
<div className="flex flex-row items-baseline justify-between">
|
|
31
|
-
<span id={getNotificationListMessageId(notificationMenuListId, notification.id)} className="font-semibold text-foreground">
|
|
32
|
-
{notification.message}
|
|
33
|
-
</span>
|
|
34
|
-
<span className={cn("ml-2 flex min-w-24 flex-row items-center justify-end gap-1 text-xs text-foreground", !notification.isRead && "font-bold")}>
|
|
35
|
-
{!notification.isRead && (<FdIcon name={iconNames.dotFilled} className="text-destructive"/>)}
|
|
36
|
-
{formatUserFrendlyRelativeTime(notification.createdDate)}
|
|
37
|
-
</span>
|
|
38
|
-
</div>
|
|
39
|
-
<p id={getNotificationListDescriptionId(notificationMenuListId, notification.id)} className="text-sm text-muted-foreground">
|
|
40
|
-
{notification.description}
|
|
41
|
-
</p>
|
|
42
|
-
</div>
|
|
43
|
-
</div>))) : (<div className="flex h-full items-center justify-center pb-4">
|
|
44
|
-
<div className="flex flex-col items-center px-16 text-center">
|
|
45
|
-
<FdIcon name={iconNames.globe} className="mb-8 size-32"/>
|
|
46
|
-
<h4 className="mb-4 text-xl font-bold">You don’t have any notifications</h4>
|
|
47
|
-
<p className="m-4 text-muted-foreground">
|
|
48
|
-
But as soon as something happens, you’ll find it right here.
|
|
49
|
-
</p>
|
|
50
|
-
</div>
|
|
51
|
-
</div>)}
|
|
52
|
-
</div>);
|
|
53
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useMemo } from "react";
|
|
3
|
-
import { FdTopMenuGroup } from "@fd-app-toolbox/menu/top-menu/top-menu-group/FdTopMenuGroup";
|
|
4
|
-
/**
|
|
5
|
-
* Navigation menu component that renders horizontal menu groups
|
|
6
|
-
*
|
|
7
|
-
* @param FdTopMenuProps {@link FdTopMenuProps}
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
<FdTopMenu groups={[
|
|
12
|
-
{
|
|
13
|
-
groupName: "Dashboard",
|
|
14
|
-
subgroupsOrMenuItems: [
|
|
15
|
-
{ text: "Overview", path: "/dashboard", type: 1 },
|
|
16
|
-
{ text: "Analytics", path: "/analytics", type: 1 },
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
]}
|
|
20
|
-
/>;
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function FdTopMenu({ groups }) {
|
|
24
|
-
const memoGroups = useMemo(() => groups.map((group) => <FdTopMenuGroup key={group.groupName} group={group}/>), [groups]);
|
|
25
|
-
return (<nav>
|
|
26
|
-
<ul className="flex w-52 flex-row justify-between gap-10">{memoGroups}</ul>
|
|
27
|
-
</nav>);
|
|
28
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useMemo } from "react";
|
|
3
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
4
|
-
import { FdTopMenuItem } from "@fd-app-toolbox/menu/top-menu/top-menu-item/FdTopMenuItem";
|
|
5
|
-
import { FdButton } from "@fd-component-toolbox/button/FdButton";
|
|
6
|
-
/**
|
|
7
|
-
* Component that renders a group of menu items within the top navigation menu
|
|
8
|
-
*
|
|
9
|
-
* @param FdTopMenuGroupProps {@link FdTopMenuGroupProps}
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
<FdTopMenuGroup group={{
|
|
14
|
-
groupName: "Settings",
|
|
15
|
-
buttonIcon: "gear",
|
|
16
|
-
subgroupsOrMenuItems: [
|
|
17
|
-
{ text: "Profile", path: "/profile", icon: "person", type: 1 },
|
|
18
|
-
{ text: "Preferences", path: "/preferences", icon: "mixerHorizontal", type: 1 },
|
|
19
|
-
],
|
|
20
|
-
}}
|
|
21
|
-
/>;
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export function FdTopMenuGroup({ group }) {
|
|
25
|
-
const [open, setOpen] = useState(false);
|
|
26
|
-
const memoSubgroupsOrMenuItems = useMemo(() => group?.subgroupsOrMenuItems?.map((subItem) => (<FdTopMenuItem key={`${subItem.text}_${subItem.type}`} item={subItem}/>)), [group.subgroupsOrMenuItems]);
|
|
27
|
-
return (<li className="relative p-2" onMouseEnter={() => setOpen(true)} onMouseLeave={() => setOpen(false)}>
|
|
28
|
-
<FdButton variant="ghost" className={"flex size-full flex-row items-start justify-center py-1 text-xs font-bold text-black"}>
|
|
29
|
-
{group.groupName}
|
|
30
|
-
</FdButton>
|
|
31
|
-
<div className={cn("absolute left-0 top-full w-52 divide-y rounded-md p-3 shadow", !open && "hidden")}>
|
|
32
|
-
<ul>{memoSubgroupsOrMenuItems}</ul>
|
|
33
|
-
</div>
|
|
34
|
-
</li>);
|
|
35
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useMemo, useCallback } from "react";
|
|
3
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
4
|
-
import { FdButton } from "@fd-component-toolbox/button/FdButton";
|
|
5
|
-
import { FdIcon } from "@fd-component-toolbox/icon/FdIcon";
|
|
6
|
-
import { useFdRouter } from "@meta/client/framework/hooks";
|
|
7
|
-
import { navigateToItem } from "@fd-app-toolbox/menu/top-menu/top-menu-item/FdTopMenuItem.funcs";
|
|
8
|
-
/**
|
|
9
|
-
* Menu item component that supports navigation and nested submenus with hover interaction
|
|
10
|
-
*
|
|
11
|
-
* @param FdTopMenuItemProps {@link FdTopMenuItemProps}
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
<FdTopMenuItem item={{
|
|
16
|
-
text: "Settings",
|
|
17
|
-
icon: "gear",
|
|
18
|
-
type: 0,
|
|
19
|
-
nextSubgroupsOrMenuItems: [{ text: "Profile", path: "/profile", type: 1 }],
|
|
20
|
-
}}
|
|
21
|
-
/>;
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export function FdTopMenuItem({ item }) {
|
|
25
|
-
const [open, setOpen] = useState(false);
|
|
26
|
-
const router = useFdRouter();
|
|
27
|
-
const navigateTo = useCallback(() => {
|
|
28
|
-
navigateToItem(item.type, router, item.path, item.routerLinkQueryParam);
|
|
29
|
-
}, [item.path, item.routerLinkQueryParam, item.type, router]);
|
|
30
|
-
const memoNextSubgroupsOrMenuItems = useMemo(() => item?.nextSubgroupsOrMenuItems?.map((subItem) => (<FdTopMenuItem key={`${subItem.text}_${subItem.type}`} item={subItem}/>)), [item.nextSubgroupsOrMenuItems]);
|
|
31
|
-
if (item.nextSubgroupsOrMenuItems && item.nextSubgroupsOrMenuItems.length > 0) {
|
|
32
|
-
return (<li className="relative" onMouseEnter={() => setOpen(true)} onMouseLeave={() => setOpen(false)}>
|
|
33
|
-
<FdButton className={"flex size-full flex-row items-center justify-between text-nowrap p-2 text-xs font-normal text-black"}>
|
|
34
|
-
{item.text}
|
|
35
|
-
<FdIcon name="chevronRight"/>
|
|
36
|
-
</FdButton>
|
|
37
|
-
<div className={cn("absolute left-full top-0 w-52 divide-y rounded-md p-3 shadow", !open && "hidden")}>
|
|
38
|
-
<ul>{memoNextSubgroupsOrMenuItems}</ul>
|
|
39
|
-
</div>
|
|
40
|
-
</li>);
|
|
41
|
-
}
|
|
42
|
-
return (<li>
|
|
43
|
-
<FdButton onClick={navigateTo} className={"flex size-full flex-row items-center justify-start text-nowrap p-2 text-xs font-normal text-black"}>
|
|
44
|
-
{item.text}
|
|
45
|
-
</FdButton>
|
|
46
|
-
</li>);
|
|
47
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
3
|
-
import { FdSelect, FdSelectContent, FdSelectGroup, FdSelectItem, FdSelectTrigger, } from "@fd-component-toolbox/select/FdSelect";
|
|
4
|
-
import { themes } from "@fd-app-toolbox/menu/themes";
|
|
5
|
-
import { FdUserDropdownMenuItem } from "@fd-app-toolbox/menu/user-dropdown-menu/user-dropdown-menu-item/FdUserDropdownMenuItem";
|
|
6
|
-
import { FdAvatar, FdAvatarFallback, FdAvatarImage } from "@fd-component-toolbox/avatar/FdAvatar";
|
|
7
|
-
import { FdFrameworkImage } from "@fd-component-toolbox/client/framework";
|
|
8
|
-
import { ChevronDown } from "lucide-react";
|
|
9
|
-
import { getLoginState } from "@fd-toolbox/auth/login-states";
|
|
10
|
-
import { useTheme } from "@fd-app-toolbox/providers/ThemeProvider/ThemeProvider";
|
|
11
|
-
import { useEffect, useState, useCallback, useMemo, Suspense } from "react";
|
|
12
|
-
import { imageNotFoundUrl } from "@fd-toolbox/constants/public-files";
|
|
13
|
-
import { FdSubHeading } from "@fd-component-toolbox/subheading/FdSubHeading";
|
|
14
|
-
import { FdIcon, iconNames } from "@fd-component-toolbox/icon/FdIcon";
|
|
15
|
-
import { isPackageMode } from "@fd-toolbox/lib/environments";
|
|
16
|
-
import { useSaveComplete } from "@meta/edit-resource/save-complete-context";
|
|
17
|
-
import { FdWorkspacePicker } from "@fd-app-toolbox/menu/workspace-picker/FdWorkspacePicker";
|
|
18
|
-
import { getUserDropDownMenuTriggerId } from "@fd-app-toolbox/menu/user-dropdown-menu/user-dropdown-menu-item/FdUserDropdownMenu.funcs";
|
|
19
|
-
import { elements } from "@fd-toolbox/constants/elements";
|
|
20
|
-
import { FdVisibleWorkspacePicker } from "@fd-app-toolbox/menu/visible-workspace-picker/FdVisibleWorkspacePicker";
|
|
21
|
-
/**
|
|
22
|
-
* User dropdown menu component with avatar, user info, theme switching, and custom menu items
|
|
23
|
-
*
|
|
24
|
-
* @param FdDropdownMenuProps {@link FdDropdownMenuProps}
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
<FdUserDropdownMenu items={[
|
|
29
|
-
{ label: "Setting", icon: "gear", path: "/setting", type: 1 },
|
|
30
|
-
{ label: "Logout", icon: "logOut", type: 0, onClick: ... }
|
|
31
|
-
]}
|
|
32
|
-
/>
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export function FdUserDropdownMenu({ id, items, parentContextName, userWorkspacesPromise, visibleWorkspacesPromise, }) {
|
|
36
|
-
const [open, setOpen] = useState(false);
|
|
37
|
-
const { theme, switchTheme } = useTheme();
|
|
38
|
-
const loginState = getLoginState();
|
|
39
|
-
const avatarImageUrl = useMemo(() => (loginState?.loggedIn ? loginState.imageUrl || imageNotFoundUrl : imageNotFoundUrl), [loginState?.loggedIn, loginState?.imageUrl]);
|
|
40
|
-
useSaveComplete();
|
|
41
|
-
const closeMenu = useCallback(() => setOpen(false), []);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
document.documentElement.style.colorScheme = theme;
|
|
44
|
-
}, [theme]);
|
|
45
|
-
const handleToggleTheme = useCallback((newTheme) => {
|
|
46
|
-
switchTheme(newTheme);
|
|
47
|
-
}, [switchTheme]);
|
|
48
|
-
const getThemeIcon = useCallback(() => {
|
|
49
|
-
switch (theme) {
|
|
50
|
-
case themes.light:
|
|
51
|
-
return iconNames.sun;
|
|
52
|
-
case themes.dark:
|
|
53
|
-
return iconNames.moon;
|
|
54
|
-
default:
|
|
55
|
-
return iconNames.desktop;
|
|
56
|
-
}
|
|
57
|
-
}, [theme]);
|
|
58
|
-
const setThemeLabel = useCallback(() => {
|
|
59
|
-
switch (theme) {
|
|
60
|
-
case themes.light:
|
|
61
|
-
return themes.lightMode;
|
|
62
|
-
case themes.dark:
|
|
63
|
-
return themes.darkMode;
|
|
64
|
-
default:
|
|
65
|
-
return themes.systemMode;
|
|
66
|
-
}
|
|
67
|
-
}, [theme]);
|
|
68
|
-
return (<DropdownMenu.Root open={open} onOpenChange={setOpen}>
|
|
69
|
-
<DropdownMenu.Trigger id={elements.userSettings.userDropdownButton}>
|
|
70
|
-
<div className="py-1.5 pl-2" id={id}>
|
|
71
|
-
<div className="flex flex-row items-center rounded-md px-2 py-1 hover:bg-fd-tertiary-700">
|
|
72
|
-
<FdAvatar className="mr-2.5 size-5">
|
|
73
|
-
<FdAvatarImage />
|
|
74
|
-
<FdAvatarFallback>
|
|
75
|
-
<FdFrameworkImage className="bg-background object-fill" src={avatarImageUrl} alt="logo" width={40} height={40}/>
|
|
76
|
-
</FdAvatarFallback>
|
|
77
|
-
</FdAvatar>
|
|
78
|
-
<FdSubHeading className="mr-2 whitespace-nowrap p-0 text-center text-sm text-fd-tertiary-50">
|
|
79
|
-
{loginState.loggedIn ? loginState.displayName : "Login"}
|
|
80
|
-
</FdSubHeading>
|
|
81
|
-
<ChevronDown className="size-5 justify-end text-fd-tertiary-50"/>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</DropdownMenu.Trigger>
|
|
85
|
-
<DropdownMenu.Portal>
|
|
86
|
-
<DropdownMenu.Content className="z-50 mr-4 min-w-32 rounded-md border bg-background shadow outline-none focus:ring-primary">
|
|
87
|
-
{!isPackageMode() && (<>
|
|
88
|
-
<div className="my-1 flex items-center pt-1 hover:bg-muted/50">
|
|
89
|
-
<FdSelect value={theme} onValueChange={handleToggleTheme}>
|
|
90
|
-
<FdSelectTrigger className="border-0 text-sm font-medium shadow-none">
|
|
91
|
-
<div className="mr-2 flex items-center gap-x-2">
|
|
92
|
-
<FdIcon name={getThemeIcon()} className="size-3"/>
|
|
93
|
-
<p>{setThemeLabel()}</p>
|
|
94
|
-
</div>
|
|
95
|
-
</FdSelectTrigger>
|
|
96
|
-
<FdSelectContent>
|
|
97
|
-
<FdSelectGroup>
|
|
98
|
-
<FdSelectItem value={themes.light}>
|
|
99
|
-
{themes.lightMode}
|
|
100
|
-
</FdSelectItem>
|
|
101
|
-
<FdSelectItem value={themes.dark}>{themes.darkMode}</FdSelectItem>
|
|
102
|
-
<FdSelectItem value={themes.system}>
|
|
103
|
-
{themes.systemMode}
|
|
104
|
-
</FdSelectItem>
|
|
105
|
-
</FdSelectGroup>
|
|
106
|
-
</FdSelectContent>
|
|
107
|
-
</FdSelect>
|
|
108
|
-
</div>
|
|
109
|
-
<div className="py-1">
|
|
110
|
-
<Suspense>
|
|
111
|
-
<FdWorkspacePicker parentContextName={getUserDropDownMenuTriggerId(parentContextName)} userWorkspacesPromise={userWorkspacesPromise}/>
|
|
112
|
-
</Suspense>
|
|
113
|
-
</div>
|
|
114
|
-
<Suspense>
|
|
115
|
-
<FdVisibleWorkspacePicker visibleWorkspacesPromise={visibleWorkspacesPromise}/>
|
|
116
|
-
</Suspense>
|
|
117
|
-
</>)}
|
|
118
|
-
{items.map((item) => (<FdUserDropdownMenuItem id={item.id} key={`${item.text}_${item.type}`} item={item} className={"z-50 m-1 rounded-md hover:bg-muted/50"} closeMenu={closeMenu}/>))}
|
|
119
|
-
</DropdownMenu.Content>
|
|
120
|
-
</DropdownMenu.Portal>
|
|
121
|
-
</DropdownMenu.Root>);
|
|
122
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useCallback } from "react";
|
|
3
|
-
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
4
|
-
import { isText, isRedirectUrl, getUserDropdownMenuItemId, onUserDropdownMenuItemClick, } from "@fd-app-toolbox/menu/user-dropdown-menu/user-dropdown-menu-item/FdUserDropdownMenuItem.funcs";
|
|
5
|
-
import { cn } from "@fd-toolbox/lib/utils";
|
|
6
|
-
import { FdIcon } from "@fd-component-toolbox/icon/FdIcon";
|
|
7
|
-
import FdLink from "@fd-component-toolbox/link/FdLink";
|
|
8
|
-
import { addQueryParamsToPath } from "@fd-toolbox/routing/paths";
|
|
9
|
-
/**
|
|
10
|
-
* Dropdown menu item component that supports nested submenus, links and callbacks
|
|
11
|
-
*
|
|
12
|
-
* @param FdUserDropdownMenuItemProps {@link FdUserDropdownMenuItemProps}
|
|
13
|
-
* Based on {@link https://ui.shadcn.com/docs/components/dropdown-menu Dropdown}
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
...
|
|
18
|
-
<DropdownMenu.Content>
|
|
19
|
-
<FdUserDropdownMenuItem
|
|
20
|
-
item={{ label: "Logout", icon: "logOut", onClick: ...}}
|
|
21
|
-
closeMenu={...}
|
|
22
|
-
/>
|
|
23
|
-
</DropdownMenu.Content>
|
|
24
|
-
...
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function FdUserDropdownMenuItem({ id, item, className, closeMenu }) {
|
|
28
|
-
const onItemClickCallback = useCallback(() => {
|
|
29
|
-
onUserDropdownMenuItemClick(closeMenu, item.callback);
|
|
30
|
-
}, [item, closeMenu]);
|
|
31
|
-
if (item.nextSubgroupsOrMenuItems && item.nextSubgroupsOrMenuItems.length > 0)
|
|
32
|
-
return (<DropdownMenu.Sub>
|
|
33
|
-
<DropdownMenu.SubTrigger className={cn("outline-none", className)} id={getUserDropdownMenuItemId(item.text)}>
|
|
34
|
-
<div className="inline-flex w-full items-center gap-x-2 px-3 py-2 text-sm font-medium hover:cursor-pointer">
|
|
35
|
-
{item.icon && <FdIcon name={item.icon} className="size-3"/>}
|
|
36
|
-
{item.text}
|
|
37
|
-
|
|
38
|
-
<FdIcon name="caretSort" className="ml-auto text-foreground opacity-50"/>
|
|
39
|
-
</div>
|
|
40
|
-
</DropdownMenu.SubTrigger>
|
|
41
|
-
<DropdownMenu.Portal>
|
|
42
|
-
<DropdownMenu.SubContent className="z-50 min-w-52 rounded-md bg-background shadow">
|
|
43
|
-
{item.nextSubgroupsOrMenuItems.map((subItem) => (<FdUserDropdownMenuItem key={`${subItem.text}_${subItem.type}`} item={subItem}/>))}
|
|
44
|
-
</DropdownMenu.SubContent>
|
|
45
|
-
</DropdownMenu.Portal>
|
|
46
|
-
</DropdownMenu.Sub>);
|
|
47
|
-
return (<DropdownMenu.Item className={cn("outline-none", className)}>
|
|
48
|
-
<div className="p-2 text-sm font-medium" onClick={onItemClickCallback} id={getUserDropdownMenuItemId(item.id)}>
|
|
49
|
-
{isRedirectUrl(item) && item.path && (<FdLink id={id} className="flex items-center gap-x-2" href={addQueryParamsToPath(item.path, item.routerLinkQueryParam)}>
|
|
50
|
-
{item.icon && <FdIcon name={item.icon} className="size-3"/>}
|
|
51
|
-
{item.text}
|
|
52
|
-
</FdLink>)}
|
|
53
|
-
{isText(item) && item.text}
|
|
54
|
-
</div>
|
|
55
|
-
</DropdownMenu.Item>);
|
|
56
|
-
}
|
package/packages/level2/fd-app-toolbox/menu/visible-workspace-picker/FdVisibleWorkspacePicker.jsx
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { use, useCallback, useState } from "react";
|
|
3
|
-
import { FdMultiselect, FdMultiselectContent, FdMultiselectInput, FdMultiselectItem, FdMultiselectList, FdMultiselectTrigger, } from "@fd-component-toolbox/multiselect/FdMultiselect";
|
|
4
|
-
import { initVisibleWorkspacePicker, onSelectedVisibleWorkspaceChange, } from "@fd-app-toolbox/menu/visible-workspace-picker/FdVisibleWorkspacePicker.funcs";
|
|
5
|
-
import { useAsyncEffect } from "@fd-toolbox/hooks/use-async-effect";
|
|
6
|
-
import { isTemporaryDisabled } from "@fd-toolbox/functions/condition-check-functions";
|
|
7
|
-
/**
|
|
8
|
-
* Component that allows user to select workspaces visible to them
|
|
9
|
-
*
|
|
10
|
-
* @param props - See {@link FdVisibleWorkspacePickerProps}
|
|
11
|
-
*/
|
|
12
|
-
export function FdVisibleWorkspacePicker({ visibleWorkspacesPromise }) {
|
|
13
|
-
const userVisibleWorkspaces = use(visibleWorkspacesPromise);
|
|
14
|
-
const [visibleWorkspaces, setVisibleWorkspaces] = useState([]);
|
|
15
|
-
const [workspaces, setWorkspaces] = useState();
|
|
16
|
-
useAsyncEffect(async () => {
|
|
17
|
-
await initVisibleWorkspacePicker(setVisibleWorkspaces, setWorkspaces, userVisibleWorkspaces);
|
|
18
|
-
}, []);
|
|
19
|
-
const onSelectedWorkspace = useCallback((value) => {
|
|
20
|
-
onSelectedVisibleWorkspaceChange(value, setVisibleWorkspaces);
|
|
21
|
-
}, []);
|
|
22
|
-
return workspaces && workspaces.size > 0 ? (<div>
|
|
23
|
-
<FdMultiselect values={visibleWorkspaces} onValuesChange={onSelectedWorkspace} disabled={false} displayValues={workspaces} variant="float" withSelectAll>
|
|
24
|
-
{!isTemporaryDisabled() && (<FdMultiselectTrigger className="border-0 pl-1 pr-3 text-sm font-medium shadow-none">
|
|
25
|
-
<FdMultiselectInput placeholder="Visible Workspaces" className="mt-0 cursor-pointer"/>
|
|
26
|
-
</FdMultiselectTrigger>)}
|
|
27
|
-
<FdMultiselectContent className="absolute min-w-60">
|
|
28
|
-
<FdMultiselectList className="top-9 z-50">
|
|
29
|
-
{Array.from(workspaces).map(([key, value]) => (<FdMultiselectItem className="min-h-6 whitespace-nowrap" key={key} value={key}>
|
|
30
|
-
{value}
|
|
31
|
-
</FdMultiselectItem>))}
|
|
32
|
-
</FdMultiselectList>
|
|
33
|
-
</FdMultiselectContent>
|
|
34
|
-
</FdMultiselect>
|
|
35
|
-
</div>) : null;
|
|
36
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState, useCallback, use } from "react";
|
|
3
|
-
import { getWorkspacePickerSelectItemId, getWorkspacePickerSelectTriggerId, initWorkspacePicker, onSelectedWorkspaceChange, } from "@fd-app-toolbox/menu/workspace-picker/FdWorkspacePicker.funcs";
|
|
4
|
-
import { FdSelect, FdSelectContent, FdSelectGroup, FdSelectItem, FdSelectTrigger, FdSelectValue, } from "@fd-component-toolbox/select/FdSelect";
|
|
5
|
-
import { useAsyncEffect } from "@fd-toolbox/hooks/use-async-effect";
|
|
6
|
-
import { FdIcon, iconNames } from "@fd-component-toolbox/icon/FdIcon";
|
|
7
|
-
/**
|
|
8
|
-
* A workspace selection dropdown component.
|
|
9
|
-
* This component displays the current workspace and allows users to switch between
|
|
10
|
-
* available child workspaces and the home workspace.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link FdWorkspacePickerProps} for component props
|
|
13
|
-
*/
|
|
14
|
-
export function FdWorkspacePicker({ parentContextName, userWorkspacesPromise }) {
|
|
15
|
-
const userWorkspaces = use(userWorkspacesPromise);
|
|
16
|
-
const [childWorkspaces, setChildWorkspaces] = useState([]);
|
|
17
|
-
const [homeWorkspace, setHomeWorkspace] = useState();
|
|
18
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
19
|
-
const [selectedWorkspace, setSelectedWorkspace] = useState("");
|
|
20
|
-
const onSelectedWorkspace = useCallback((value) => {
|
|
21
|
-
onSelectedWorkspaceChange(value, setSelectedWorkspace);
|
|
22
|
-
}, []);
|
|
23
|
-
useAsyncEffect(async () => {
|
|
24
|
-
await initWorkspacePicker(setChildWorkspaces, setHomeWorkspace, setSelectedWorkspace, userWorkspaces);
|
|
25
|
-
}, []);
|
|
26
|
-
if (childWorkspaces.length === 0) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return (<FdSelect value={selectedWorkspace} onValueChange={onSelectedWorkspace} open={isOpen} onOpenChange={setIsOpen}>
|
|
30
|
-
<FdSelectTrigger id={getWorkspacePickerSelectTriggerId(parentContextName)} className="border-0 text-sm font-medium shadow-none">
|
|
31
|
-
<div className="mr-2 flex items-center gap-x-2">
|
|
32
|
-
<FdIcon name={iconNames.desktop} className="size-3"/>
|
|
33
|
-
<FdSelectValue />
|
|
34
|
-
</div>
|
|
35
|
-
</FdSelectTrigger>
|
|
36
|
-
<FdSelectContent>
|
|
37
|
-
<FdSelectGroup>
|
|
38
|
-
{homeWorkspace && (<FdSelectItem value={homeWorkspace.id} id={getWorkspacePickerSelectItemId(parentContextName, homeWorkspace.id)}>
|
|
39
|
-
{homeWorkspace.name}
|
|
40
|
-
</FdSelectItem>)}
|
|
41
|
-
{childWorkspaces.map((workspace) => (<FdSelectItem value={workspace.id} key={workspace.id} id={getWorkspacePickerSelectItemId(parentContextName, workspace.id)}>
|
|
42
|
-
{workspace.name}
|
|
43
|
-
</FdSelectItem>))}
|
|
44
|
-
</FdSelectGroup>
|
|
45
|
-
</FdSelectContent>
|
|
46
|
-
</FdSelect>);
|
|
47
|
-
}
|