realtimex-crm 0.1.2
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/LICENSE.md +21 -0
- package/README.md +104 -0
- package/dist/assets/DealList-DqDrFeDV.js +59 -0
- package/dist/assets/DealList-DqDrFeDV.js.map +1 -0
- package/dist/assets/index-BiQoGq1P.css +1 -0
- package/dist/assets/index-CDIy4x-0.js +152 -0
- package/dist/assets/index-CDIy4x-0.js.map +1 -0
- package/dist/auth-callback.html +140 -0
- package/dist/favicon.ico +0 -0
- package/dist/img/adding-users.png +0 -0
- package/dist/img/empty.svg +42 -0
- package/dist/index.html +1 -0
- package/dist/logo192.png +0 -0
- package/dist/logo512.png +0 -0
- package/dist/logos/0.png +0 -0
- package/dist/logos/1.png +0 -0
- package/dist/logos/10.png +0 -0
- package/dist/logos/11.png +0 -0
- package/dist/logos/12.png +0 -0
- package/dist/logos/13.png +0 -0
- package/dist/logos/14.png +0 -0
- package/dist/logos/15.png +0 -0
- package/dist/logos/16.png +0 -0
- package/dist/logos/17.png +0 -0
- package/dist/logos/18.png +0 -0
- package/dist/logos/19.png +0 -0
- package/dist/logos/2.png +0 -0
- package/dist/logos/20.png +0 -0
- package/dist/logos/21.png +0 -0
- package/dist/logos/22.png +0 -0
- package/dist/logos/23.png +0 -0
- package/dist/logos/24.png +0 -0
- package/dist/logos/25.png +0 -0
- package/dist/logos/26.png +0 -0
- package/dist/logos/27.png +0 -0
- package/dist/logos/28.png +0 -0
- package/dist/logos/29.png +0 -0
- package/dist/logos/3.png +0 -0
- package/dist/logos/30.png +0 -0
- package/dist/logos/31.png +0 -0
- package/dist/logos/32.png +0 -0
- package/dist/logos/33.png +0 -0
- package/dist/logos/34.png +0 -0
- package/dist/logos/35.png +0 -0
- package/dist/logos/36.png +0 -0
- package/dist/logos/37.png +0 -0
- package/dist/logos/38.png +0 -0
- package/dist/logos/39.png +0 -0
- package/dist/logos/4.png +0 -0
- package/dist/logos/40.png +0 -0
- package/dist/logos/41.png +0 -0
- package/dist/logos/42.png +0 -0
- package/dist/logos/43.png +0 -0
- package/dist/logos/44.png +0 -0
- package/dist/logos/45.png +0 -0
- package/dist/logos/46.png +0 -0
- package/dist/logos/47.png +0 -0
- package/dist/logos/48.png +0 -0
- package/dist/logos/49.png +0 -0
- package/dist/logos/5.png +0 -0
- package/dist/logos/50.png +0 -0
- package/dist/logos/51.png +0 -0
- package/dist/logos/52.png +0 -0
- package/dist/logos/53.png +0 -0
- package/dist/logos/54.png +0 -0
- package/dist/logos/55.png +0 -0
- package/dist/logos/6.png +0 -0
- package/dist/logos/7.png +0 -0
- package/dist/logos/8.png +0 -0
- package/dist/logos/9.png +0 -0
- package/dist/logos/Readme.md +1 -0
- package/dist/logos/logo_atomic_crm.svg +14 -0
- package/dist/logos/logo_atomic_crm_dark.svg +14 -0
- package/dist/logos/logo_atomic_crm_light.svg +14 -0
- package/dist/manifest.json +25 -0
- package/dist/robots.txt +3 -0
- package/dist/stats.html +4949 -0
- package/package.json +152 -0
- package/public/auth-callback.html +140 -0
- package/public/favicon.ico +0 -0
- package/public/img/adding-users.png +0 -0
- package/public/img/empty.svg +42 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/logos/0.png +0 -0
- package/public/logos/1.png +0 -0
- package/public/logos/10.png +0 -0
- package/public/logos/11.png +0 -0
- package/public/logos/12.png +0 -0
- package/public/logos/13.png +0 -0
- package/public/logos/14.png +0 -0
- package/public/logos/15.png +0 -0
- package/public/logos/16.png +0 -0
- package/public/logos/17.png +0 -0
- package/public/logos/18.png +0 -0
- package/public/logos/19.png +0 -0
- package/public/logos/2.png +0 -0
- package/public/logos/20.png +0 -0
- package/public/logos/21.png +0 -0
- package/public/logos/22.png +0 -0
- package/public/logos/23.png +0 -0
- package/public/logos/24.png +0 -0
- package/public/logos/25.png +0 -0
- package/public/logos/26.png +0 -0
- package/public/logos/27.png +0 -0
- package/public/logos/28.png +0 -0
- package/public/logos/29.png +0 -0
- package/public/logos/3.png +0 -0
- package/public/logos/30.png +0 -0
- package/public/logos/31.png +0 -0
- package/public/logos/32.png +0 -0
- package/public/logos/33.png +0 -0
- package/public/logos/34.png +0 -0
- package/public/logos/35.png +0 -0
- package/public/logos/36.png +0 -0
- package/public/logos/37.png +0 -0
- package/public/logos/38.png +0 -0
- package/public/logos/39.png +0 -0
- package/public/logos/4.png +0 -0
- package/public/logos/40.png +0 -0
- package/public/logos/41.png +0 -0
- package/public/logos/42.png +0 -0
- package/public/logos/43.png +0 -0
- package/public/logos/44.png +0 -0
- package/public/logos/45.png +0 -0
- package/public/logos/46.png +0 -0
- package/public/logos/47.png +0 -0
- package/public/logos/48.png +0 -0
- package/public/logos/49.png +0 -0
- package/public/logos/5.png +0 -0
- package/public/logos/50.png +0 -0
- package/public/logos/51.png +0 -0
- package/public/logos/52.png +0 -0
- package/public/logos/53.png +0 -0
- package/public/logos/54.png +0 -0
- package/public/logos/55.png +0 -0
- package/public/logos/6.png +0 -0
- package/public/logos/7.png +0 -0
- package/public/logos/8.png +0 -0
- package/public/logos/9.png +0 -0
- package/public/logos/Readme.md +1 -0
- package/public/logos/logo_atomic_crm.svg +14 -0
- package/public/logos/logo_atomic_crm_dark.svg +14 -0
- package/public/logos/logo_atomic_crm_light.svg +14 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.css +42 -0
- package/src/App.tsx +58 -0
- package/src/assets/react.svg +1 -0
- package/src/components/admin/Readme.md +40 -0
- package/src/components/admin/admin.tsx +132 -0
- package/src/components/admin/app-sidebar.tsx +166 -0
- package/src/components/admin/array-field.tsx +59 -0
- package/src/components/admin/array-input.tsx +201 -0
- package/src/components/admin/authentication.tsx +86 -0
- package/src/components/admin/autocomplete-array-input.tsx +254 -0
- package/src/components/admin/autocomplete-input.tsx +296 -0
- package/src/components/admin/badge-field.tsx +65 -0
- package/src/components/admin/boolean-input.tsx +116 -0
- package/src/components/admin/breadcrumb.tsx +135 -0
- package/src/components/admin/bulk-actions-toolbar.tsx +83 -0
- package/src/components/admin/bulk-delete-button.tsx +70 -0
- package/src/components/admin/bulk-export-button.tsx +76 -0
- package/src/components/admin/cancel-button.tsx +46 -0
- package/src/components/admin/columns-button.tsx +345 -0
- package/src/components/admin/confirm.tsx +166 -0
- package/src/components/admin/count.tsx +94 -0
- package/src/components/admin/create-button.tsx +58 -0
- package/src/components/admin/create.tsx +132 -0
- package/src/components/admin/data-table.tsx +520 -0
- package/src/components/admin/date-field.tsx +136 -0
- package/src/components/admin/date-input.tsx +317 -0
- package/src/components/admin/date-time-input.tsx +331 -0
- package/src/components/admin/delete-button.tsx +113 -0
- package/src/components/admin/edit-button.tsx +64 -0
- package/src/components/admin/edit-guesser.tsx +157 -0
- package/src/components/admin/edit.tsx +152 -0
- package/src/components/admin/email-field.tsx +74 -0
- package/src/components/admin/error.tsx +111 -0
- package/src/components/admin/export-button.tsx +126 -0
- package/src/components/admin/field-toggle.tsx +164 -0
- package/src/components/admin/file-field.tsx +123 -0
- package/src/components/admin/file-input.tsx +361 -0
- package/src/components/admin/filter-form.tsx +510 -0
- package/src/components/admin/form.tsx +312 -0
- package/src/components/admin/icon-button-with-tooltip.tsx +85 -0
- package/src/components/admin/index.ts +73 -0
- package/src/components/admin/input-helper-text.tsx +29 -0
- package/src/components/admin/layout.tsx +69 -0
- package/src/components/admin/list-guesser.tsx +239 -0
- package/src/components/admin/list-pagination.tsx +247 -0
- package/src/components/admin/list.tsx +178 -0
- package/src/components/admin/loading.tsx +40 -0
- package/src/components/admin/locales-menu-button.tsx +60 -0
- package/src/components/admin/login-page.tsx +104 -0
- package/src/components/admin/notification.tsx +114 -0
- package/src/components/admin/number-field.tsx +84 -0
- package/src/components/admin/number-input.tsx +124 -0
- package/src/components/admin/radio-button-group-input.tsx +184 -0
- package/src/components/admin/ready.tsx +55 -0
- package/src/components/admin/record-field.tsx +132 -0
- package/src/components/admin/reference-array-field.tsx +152 -0
- package/src/components/admin/reference-array-input.tsx +68 -0
- package/src/components/admin/reference-field.tsx +153 -0
- package/src/components/admin/reference-input.tsx +46 -0
- package/src/components/admin/reference-many-count.tsx +92 -0
- package/src/components/admin/reference-many-field.tsx +132 -0
- package/src/components/admin/refresh-button.tsx +31 -0
- package/src/components/admin/saved-queries.tsx +174 -0
- package/src/components/admin/search-input.tsx +57 -0
- package/src/components/admin/select-field.tsx +111 -0
- package/src/components/admin/select-input.tsx +323 -0
- package/src/components/admin/show-button.tsx +57 -0
- package/src/components/admin/show-guesser.tsx +215 -0
- package/src/components/admin/show.tsx +184 -0
- package/src/components/admin/simple-form-iterator.tsx +582 -0
- package/src/components/admin/simple-form.tsx +95 -0
- package/src/components/admin/simple-show-layout.tsx +8 -0
- package/src/components/admin/single-field-list.tsx +67 -0
- package/src/components/admin/sort-button.tsx +152 -0
- package/src/components/admin/spinner.tsx +46 -0
- package/src/components/admin/text-field.tsx +60 -0
- package/src/components/admin/text-input.tsx +77 -0
- package/src/components/admin/theme-mode-toggle.tsx +48 -0
- package/src/components/admin/theme-provider.tsx +74 -0
- package/src/components/admin/toggle-filter-button.tsx +77 -0
- package/src/components/admin/url-field.tsx +83 -0
- package/src/components/admin/user-menu.tsx +84 -0
- package/src/components/atomic-crm/activity/ActivityLog.tsx +54 -0
- package/src/components/atomic-crm/activity/ActivityLogCompanyCreated.tsx +50 -0
- package/src/components/atomic-crm/activity/ActivityLogContactCreated.tsx +42 -0
- package/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx +71 -0
- package/src/components/atomic-crm/activity/ActivityLogContext.tsx +11 -0
- package/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx +41 -0
- package/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx +84 -0
- package/src/components/atomic-crm/activity/ActivityLogIterator.tsx +80 -0
- package/src/components/atomic-crm/activity/ActivityLogNote.tsx +36 -0
- package/src/components/atomic-crm/companies/AutocompleteCompanyInput.tsx +43 -0
- package/src/components/atomic-crm/companies/CompanyAside.tsx +207 -0
- package/src/components/atomic-crm/companies/CompanyAvatar.tsx +29 -0
- package/src/components/atomic-crm/companies/CompanyCard.tsx +88 -0
- package/src/components/atomic-crm/companies/CompanyCreate.tsx +41 -0
- package/src/components/atomic-crm/companies/CompanyEdit.tsx +33 -0
- package/src/components/atomic-crm/companies/CompanyEmpty.tsx +26 -0
- package/src/components/atomic-crm/companies/CompanyInputs.tsx +160 -0
- package/src/components/atomic-crm/companies/CompanyList.tsx +54 -0
- package/src/components/atomic-crm/companies/CompanyListFilter.tsx +55 -0
- package/src/components/atomic-crm/companies/CompanyShow.tsx +241 -0
- package/src/components/atomic-crm/companies/GridList.tsx +46 -0
- package/src/components/atomic-crm/companies/index.ts +11 -0
- package/src/components/atomic-crm/companies/sizes.ts +7 -0
- package/src/components/atomic-crm/consts.ts +5 -0
- package/src/components/atomic-crm/contacts/Avatar.tsx +40 -0
- package/src/components/atomic-crm/contacts/ContactAside.tsx +187 -0
- package/src/components/atomic-crm/contacts/ContactCreate.tsx +34 -0
- package/src/components/atomic-crm/contacts/ContactEdit.tsx +32 -0
- package/src/components/atomic-crm/contacts/ContactEmpty.tsx +28 -0
- package/src/components/atomic-crm/contacts/ContactImportButton.tsx +213 -0
- package/src/components/atomic-crm/contacts/ContactInputs.tsx +209 -0
- package/src/components/atomic-crm/contacts/ContactList.tsx +116 -0
- package/src/components/atomic-crm/contacts/ContactListContent.tsx +107 -0
- package/src/components/atomic-crm/contacts/ContactListFilter.tsx +126 -0
- package/src/components/atomic-crm/contacts/ContactMergeButton.tsx +263 -0
- package/src/components/atomic-crm/contacts/ContactShow.tsx +76 -0
- package/src/components/atomic-crm/contacts/ExportVCardButton.tsx +79 -0
- package/src/components/atomic-crm/contacts/TagsList.tsx +33 -0
- package/src/components/atomic-crm/contacts/TagsListEdit.tsx +155 -0
- package/src/components/atomic-crm/contacts/contacts_export.csv +3 -0
- package/src/components/atomic-crm/contacts/exportToVCard.ts +104 -0
- package/src/components/atomic-crm/contacts/index.tsx +14 -0
- package/src/components/atomic-crm/contacts/useContactImport.tsx +206 -0
- package/src/components/atomic-crm/dashboard/Dashboard.tsx +66 -0
- package/src/components/atomic-crm/dashboard/DashboardActivityLog.tsx +22 -0
- package/src/components/atomic-crm/dashboard/DashboardStepper.tsx +72 -0
- package/src/components/atomic-crm/dashboard/DealsChart.tsx +202 -0
- package/src/components/atomic-crm/dashboard/DealsPipeline.tsx +90 -0
- package/src/components/atomic-crm/dashboard/HotContacts.tsx +92 -0
- package/src/components/atomic-crm/dashboard/LatestNotes.tsx +116 -0
- package/src/components/atomic-crm/dashboard/TasksList.tsx +69 -0
- package/src/components/atomic-crm/dashboard/TasksListEmpty.tsx +22 -0
- package/src/components/atomic-crm/dashboard/TasksListFilter.tsx +72 -0
- package/src/components/atomic-crm/dashboard/Welcome.tsx +41 -0
- package/src/components/atomic-crm/deals/ContactList.tsx +31 -0
- package/src/components/atomic-crm/deals/DealArchivedList.tsx +105 -0
- package/src/components/atomic-crm/deals/DealCard.tsx +78 -0
- package/src/components/atomic-crm/deals/DealColumn.tsx +52 -0
- package/src/components/atomic-crm/deals/DealCreate.tsx +95 -0
- package/src/components/atomic-crm/deals/DealEdit.tsx +81 -0
- package/src/components/atomic-crm/deals/DealEmpty.tsx +63 -0
- package/src/components/atomic-crm/deals/DealInputs.tsx +103 -0
- package/src/components/atomic-crm/deals/DealList.tsx +95 -0
- package/src/components/atomic-crm/deals/DealListContent.tsx +245 -0
- package/src/components/atomic-crm/deals/DealShow.tsx +260 -0
- package/src/components/atomic-crm/deals/OnlyMineInput.tsx +30 -0
- package/src/components/atomic-crm/deals/deal.ts +5 -0
- package/src/components/atomic-crm/deals/dealUtils.ts +26 -0
- package/src/components/atomic-crm/deals/index.ts +6 -0
- package/src/components/atomic-crm/deals/stages.ts +28 -0
- package/src/components/atomic-crm/filters/FilterCategory.tsx +20 -0
- package/src/components/atomic-crm/layout/FormToolbar.tsx +12 -0
- package/src/components/atomic-crm/layout/Header.tsx +134 -0
- package/src/components/atomic-crm/layout/Layout.tsx +21 -0
- package/src/components/atomic-crm/layout/TopToolbar.tsx +24 -0
- package/src/components/atomic-crm/login/LoginSkeleton.tsx +18 -0
- package/src/components/atomic-crm/login/SignupPage.tsx +150 -0
- package/src/components/atomic-crm/login/StartPage.tsx +27 -0
- package/src/components/atomic-crm/misc/AsideSection.tsx +21 -0
- package/src/components/atomic-crm/misc/ContactOption.tsx +26 -0
- package/src/components/atomic-crm/misc/ImageEditorField.tsx +206 -0
- package/src/components/atomic-crm/misc/RelativeDate.tsx +5 -0
- package/src/components/atomic-crm/misc/Status.tsx +28 -0
- package/src/components/atomic-crm/misc/fetchWithTimeout.ts +19 -0
- package/src/components/atomic-crm/misc/isLinkedInUrl.ts +15 -0
- package/src/components/atomic-crm/misc/unsupportedDomains.const.ts +105 -0
- package/src/components/atomic-crm/misc/useAppBarHeight.ts +9 -0
- package/src/components/atomic-crm/misc/usePapaParse.tsx +144 -0
- package/src/components/atomic-crm/notes/Note.tsx +187 -0
- package/src/components/atomic-crm/notes/NoteAttachments.tsx +56 -0
- package/src/components/atomic-crm/notes/NoteCreate.tsx +112 -0
- package/src/components/atomic-crm/notes/NoteInputs.tsx +92 -0
- package/src/components/atomic-crm/notes/NotesIterator.tsx +37 -0
- package/src/components/atomic-crm/notes/StatusSelector.tsx +39 -0
- package/src/components/atomic-crm/notes/index.ts +3 -0
- package/src/components/atomic-crm/notes/utils.ts +13 -0
- package/src/components/atomic-crm/providers/commons/activity.ts +174 -0
- package/src/components/atomic-crm/providers/commons/canAccess.ts +26 -0
- package/src/components/atomic-crm/providers/commons/getCompanyAvatar.spec.ts +20 -0
- package/src/components/atomic-crm/providers/commons/getCompanyAvatar.ts +21 -0
- package/src/components/atomic-crm/providers/commons/getContactAvatar.spec.ts +80 -0
- package/src/components/atomic-crm/providers/commons/getContactAvatar.ts +70 -0
- package/src/components/atomic-crm/providers/commons/mergeContacts.ts +185 -0
- package/src/components/atomic-crm/providers/fakerest/authProvider.ts +74 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/companies.ts +53 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/contactNotes.ts +25 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/contacts.ts +103 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/dealNotes.ts +19 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/deals.ts +53 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/finalize.ts +10 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/index.ts +25 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/sales.ts +37 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/tags.ts +14 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/tasks.ts +55 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/types.ts +21 -0
- package/src/components/atomic-crm/providers/fakerest/dataGenerator/utils.ts +28 -0
- package/src/components/atomic-crm/providers/fakerest/dataProvider.ts +518 -0
- package/src/components/atomic-crm/providers/fakerest/index.ts +2 -0
- package/src/components/atomic-crm/providers/fakerest/internal/listParser.ts +48 -0
- package/src/components/atomic-crm/providers/fakerest/internal/supabaseAdapter.spec.ts +721 -0
- package/src/components/atomic-crm/providers/fakerest/internal/supabaseAdapter.ts +49 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformContainsFilter.spec.ts +35 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformContainsFilter.ts +17 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformFilter.ts +57 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformInFilter.spec.ts +32 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformInFilter.ts +17 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformOrFilter.spec.ts +23 -0
- package/src/components/atomic-crm/providers/fakerest/internal/transformOrFilter.ts +17 -0
- package/src/components/atomic-crm/providers/supabase/authProvider.ts +121 -0
- package/src/components/atomic-crm/providers/supabase/dataProvider.ts +407 -0
- package/src/components/atomic-crm/providers/supabase/index.ts +2 -0
- package/src/components/atomic-crm/providers/supabase/supabase.ts +34 -0
- package/src/components/atomic-crm/providers/types.ts +1 -0
- package/src/components/atomic-crm/root/CRM.tsx +167 -0
- package/src/components/atomic-crm/root/ConfigurationContext.tsx +80 -0
- package/src/components/atomic-crm/root/defaultConfiguration.ts +64 -0
- package/src/components/atomic-crm/root/i18nProvider.tsx +25 -0
- package/src/components/atomic-crm/sales/SaleName.tsx +13 -0
- package/src/components/atomic-crm/sales/SalesCreate.tsx +51 -0
- package/src/components/atomic-crm/sales/SalesEdit.tsx +82 -0
- package/src/components/atomic-crm/sales/SalesInputs.tsx +31 -0
- package/src/components/atomic-crm/sales/SalesList.tsx +62 -0
- package/src/components/atomic-crm/sales/index.ts +12 -0
- package/src/components/atomic-crm/settings/DatabaseSettings.tsx +169 -0
- package/src/components/atomic-crm/settings/SettingsPage.tsx +259 -0
- package/src/components/atomic-crm/setup/SupabaseSetupWizard.tsx +215 -0
- package/src/components/atomic-crm/simple-list/ListNoResults.tsx +53 -0
- package/src/components/atomic-crm/simple-list/ListPlaceholder.tsx +9 -0
- package/src/components/atomic-crm/simple-list/SimpleList.tsx +245 -0
- package/src/components/atomic-crm/simple-list/SimpleListItem.tsx +138 -0
- package/src/components/atomic-crm/simple-list/SimpleListLoading.tsx +60 -0
- package/src/components/atomic-crm/tags/RoundButton.tsx +10 -0
- package/src/components/atomic-crm/tags/TagChip.tsx +45 -0
- package/src/components/atomic-crm/tags/TagCreateModal.tsx +39 -0
- package/src/components/atomic-crm/tags/TagDialog.tsx +118 -0
- package/src/components/atomic-crm/tags/TagEditModal.tsx +42 -0
- package/src/components/atomic-crm/tags/colors.ts +12 -0
- package/src/components/atomic-crm/tasks/AddTask.tsx +191 -0
- package/src/components/atomic-crm/tasks/Task.tsx +184 -0
- package/src/components/atomic-crm/tasks/TaskEdit.tsx +96 -0
- package/src/components/atomic-crm/tasks/TasksIterator.tsx +30 -0
- package/src/components/atomic-crm/types.ts +226 -0
- package/src/components/supabase/forgot-password-page.tsx +86 -0
- package/src/components/supabase/layout.tsx +27 -0
- package/src/components/supabase/set-password-page.tsx +119 -0
- package/src/components/ui/README.md +34 -0
- package/src/components/ui/accordion.tsx +64 -0
- package/src/components/ui/alert.tsx +66 -0
- package/src/components/ui/avatar.tsx +99 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/command.tsx +175 -0
- package/src/components/ui/dialog.tsx +133 -0
- package/src/components/ui/drawer.tsx +133 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/pagination.tsx +127 -0
- package/src/components/ui/popover.tsx +46 -0
- package/src/components/ui/progress.tsx +29 -0
- package/src/components/ui/radio-group.tsx +43 -0
- package/src/components/ui/select.tsx +183 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/sheet.tsx +137 -0
- package/src/components/ui/sidebar.tsx +724 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +38 -0
- package/src/components/ui/spinner.tsx +51 -0
- package/src/components/ui/switch.tsx +29 -0
- package/src/components/ui/table.tsx +114 -0
- package/src/components/ui/tabs.tsx +64 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/hooks/saved-queries.tsx +67 -0
- package/src/hooks/simple-form-iterator-context.tsx +70 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/hooks/useBulkExport.tsx +61 -0
- package/src/hooks/useSupportCreateSuggestion.tsx +188 -0
- package/src/hooks/user-menu-context.tsx +24 -0
- package/src/index.css +170 -0
- package/src/lib/field.type.ts +22 -0
- package/src/lib/genericMemo.ts +18 -0
- package/src/lib/i18nProvider.ts +9 -0
- package/src/lib/sanitizeInputRestProps.ts +46 -0
- package/src/lib/supabase-config.ts +123 -0
- package/src/lib/utils.ts +6 -0
- package/src/main.tsx +10 -0
- package/src/setupTests.js +5 -0
- package/src/vite-env.d.ts +1 -0
- package/supabase/config.toml +157 -0
- package/supabase/functions/.env.development +7 -0
- package/supabase/functions/_shared/db.ts +187 -0
- package/supabase/functions/_shared/supabaseAdmin.ts +13 -0
- package/supabase/functions/_shared/utils.ts +13 -0
- package/supabase/functions/mergeContacts/index.ts +215 -0
- package/supabase/functions/postmark/addNoteToContact.ts +129 -0
- package/supabase/functions/postmark/extractMailContactData.ts +41 -0
- package/supabase/functions/postmark/getExpectedAuthorization.ts +4 -0
- package/supabase/functions/postmark/getNoteContent.ts +6 -0
- package/supabase/functions/postmark/index.ts +210 -0
- package/supabase/functions/updatePassword/index.ts +50 -0
- package/supabase/functions/users/index.ts +206 -0
- package/supabase/migrations/20240730075029_init_db.sql +600 -0
- package/supabase/migrations/20240730075425_init_triggers.sql +57 -0
- package/supabase/migrations/20240806124555_task_sales_id.sql +1 -0
- package/supabase/migrations/20240807082449_remove-aquisition.sql +20 -0
- package/supabase/migrations/20240808141826_init_state_configure.sql +9 -0
- package/supabase/migrations/20240813084010_tags_policy.sql +18 -0
- package/supabase/migrations/20241104153231_sales_policies.sql +7 -0
- package/supabase/migrations/20250109152531_email_jsonb.sql +43 -0
- package/supabase/migrations/20250113132531_phone_jsonb.sql +67 -0
- package/supabase/migrations/20251204172855_merge_contacts_function.sql +153 -0
- package/supabase/migrations/20251204201317_drop_merge_contacts_function.sql +2 -0
- package/supabase/seed.sql +0 -0
- package/supabase/templates/invite.html +70 -0
- package/supabase/templates/recovery.html +75 -0
package/src/App.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.logo {
|
|
9
|
+
height: 6em;
|
|
10
|
+
padding: 1.5em;
|
|
11
|
+
will-change: filter;
|
|
12
|
+
transition: filter 300ms;
|
|
13
|
+
}
|
|
14
|
+
.logo:hover {
|
|
15
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
16
|
+
}
|
|
17
|
+
.logo.react:hover {
|
|
18
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@keyframes logo-spin {
|
|
22
|
+
from {
|
|
23
|
+
transform: rotate(0deg);
|
|
24
|
+
}
|
|
25
|
+
to {
|
|
26
|
+
transform: rotate(360deg);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
31
|
+
a:nth-of-type(2) .logo {
|
|
32
|
+
animation: logo-spin infinite 20s linear;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.card {
|
|
37
|
+
padding: 2em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.read-the-docs {
|
|
41
|
+
color: #888;
|
|
42
|
+
}
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { CRM } from "@/components/atomic-crm/root/CRM";
|
|
3
|
+
import { SupabaseSetupWizard } from "@/components/atomic-crm/setup/SupabaseSetupWizard";
|
|
4
|
+
import { isSupabaseConfigured } from "@/lib/supabase-config";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Application entry point
|
|
8
|
+
*
|
|
9
|
+
* Customize Atomic CRM by passing props to the CRM component:
|
|
10
|
+
* - contactGender
|
|
11
|
+
* - companySectors
|
|
12
|
+
* - darkTheme
|
|
13
|
+
* - dealCategories
|
|
14
|
+
* - dealPipelineStatuses
|
|
15
|
+
* - dealStages
|
|
16
|
+
* - lightTheme
|
|
17
|
+
* - logo
|
|
18
|
+
* - noteStatuses
|
|
19
|
+
* - taskTypes
|
|
20
|
+
* - title
|
|
21
|
+
* ... as well as all the props accepted by shadcn-admin-kit's <Admin> component.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const App = () => (
|
|
25
|
+
* <CRM
|
|
26
|
+
* logo="./img/logo.png"
|
|
27
|
+
* title="Acme CRM"
|
|
28
|
+
* />
|
|
29
|
+
* );
|
|
30
|
+
*/
|
|
31
|
+
const App = () => {
|
|
32
|
+
const [needsSetup, setNeedsSetup] = useState<boolean>(() => {
|
|
33
|
+
// Check immediately on mount
|
|
34
|
+
const configured = isSupabaseConfigured();
|
|
35
|
+
console.log("[App] Supabase configured:", configured);
|
|
36
|
+
return !configured;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// If Supabase is not configured, only show the setup wizard
|
|
40
|
+
if (needsSetup) {
|
|
41
|
+
return (
|
|
42
|
+
<div className="min-h-screen flex items-center justify-center bg-background">
|
|
43
|
+
<SupabaseSetupWizard
|
|
44
|
+
open={true}
|
|
45
|
+
onComplete={() => {
|
|
46
|
+
setNeedsSetup(false);
|
|
47
|
+
// Will reload anyway, but update state for clarity
|
|
48
|
+
}}
|
|
49
|
+
canClose={false}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return <CRM />;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Admin Components
|
|
2
|
+
|
|
3
|
+
The components in this directory come from [Shadcn Admin Kit](https://marmelab.com/shadcn-admin-kit/). They are application building blocks providing solution to usual single-page apps needs, including:
|
|
4
|
+
|
|
5
|
+
- data fetching,
|
|
6
|
+
- lists and data tables,
|
|
7
|
+
- forms & validation,
|
|
8
|
+
- authentication,
|
|
9
|
+
- search & filtering,
|
|
10
|
+
- i18n,
|
|
11
|
+
- theming,
|
|
12
|
+
- loading and error management.
|
|
13
|
+
- rapid CRUD generation,
|
|
14
|
+
- ralationship management,
|
|
15
|
+
- roles & permissions,
|
|
16
|
+
- optimistic UI,
|
|
17
|
+
- undo functionality,
|
|
18
|
+
- bulk actions,
|
|
19
|
+
- user preferences,
|
|
20
|
+
- notifications,
|
|
21
|
+
- and more.
|
|
22
|
+
|
|
23
|
+
These components are built on top of [TanStack Query](https://tanstack.com/query/latest), [React Hook Form](https://react-hook-form.com/), [React Router](https://reactrouter.com/), [ra-core](https://marmelab.com/ra-core/), [Radix UI](https://www.radix-ui.com/) and [Shadcn UI](https://ui.shadcn.com/).
|
|
24
|
+
|
|
25
|
+
## Documentation
|
|
26
|
+
|
|
27
|
+
You can find the documentation for these components on the [Shadcn Admin Kit website](https://marmelab.com/shadcn-admin-kit/docs).
|
|
28
|
+
|
|
29
|
+
## Customization
|
|
30
|
+
|
|
31
|
+
In Atomic CRM, these components are sometimes slightly modified to fit the look and feel of the application. You can customize them further by editing the source files in this directory.
|
|
32
|
+
|
|
33
|
+
## Updates
|
|
34
|
+
|
|
35
|
+
Shadcn Admin Kit components are actively maintained and updated. To update the components in Atomic CRM, type the following command:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
npx shadcn@latest add -o https://marmelab.com/shadcn-admin-kit/r/admin.json
|
|
39
|
+
```
|
|
40
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CoreAdminUI,
|
|
3
|
+
type CoreAdminUIProps,
|
|
4
|
+
CoreAdminContext,
|
|
5
|
+
type CoreAdminContextProps,
|
|
6
|
+
type CoreAdminProps,
|
|
7
|
+
localStorageStore,
|
|
8
|
+
} from "ra-core";
|
|
9
|
+
import { i18nProvider as defaultI18nProvider } from "@/lib/i18nProvider";
|
|
10
|
+
import { Layout } from "@/components/admin/layout";
|
|
11
|
+
import { LoginPage } from "@/components/admin/login-page";
|
|
12
|
+
import { Ready } from "@/components/admin/ready";
|
|
13
|
+
import { ThemeProvider } from "@/components/admin/theme-provider";
|
|
14
|
+
import { AuthCallback } from "@/components/admin/authentication";
|
|
15
|
+
|
|
16
|
+
const defaultStore = localStorageStore();
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Context provider for the Admin component.
|
|
20
|
+
*
|
|
21
|
+
* Wraps CoreAdminContext to provide core admin functionality including data provider,
|
|
22
|
+
* auth provider, i18n provider, and store access to child components.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
const AdminContext = (props: CoreAdminContextProps) => (
|
|
27
|
+
<CoreAdminContext {...props} />
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* UI component for the Admin application.
|
|
32
|
+
*
|
|
33
|
+
* Wraps CoreAdminUI with theme provider and handles telemetry reporting.
|
|
34
|
+
* Provides the main layout, login page, ready page, and authentication callback.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
const AdminUI = (props: CoreAdminUIProps) => (
|
|
39
|
+
<ThemeProvider>
|
|
40
|
+
<CoreAdminUI
|
|
41
|
+
layout={Layout}
|
|
42
|
+
loginPage={LoginPage}
|
|
43
|
+
ready={Ready}
|
|
44
|
+
authCallbackPage={AuthCallback}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
</ThemeProvider>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Root component of a shadcn-admin-kit application.
|
|
52
|
+
*
|
|
53
|
+
* Creates context providers to allow its children to access the app configuration.
|
|
54
|
+
* Renders the main routes and layout, and delegates content area rendering to Resource children.
|
|
55
|
+
* Combines AdminContext and AdminUI to provide a complete admin interface.
|
|
56
|
+
*
|
|
57
|
+
* @see {@link https://marmelab.com/shadcn-admin-kit/docs/admin/ Admin documentation}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Basic usage with dataProvider and Resources
|
|
61
|
+
* import { Admin } from "@/components/admin";
|
|
62
|
+
* import { Resource } from 'ra-core';
|
|
63
|
+
* import simpleRestProvider from 'ra-data-simple-rest';
|
|
64
|
+
*
|
|
65
|
+
* const App = () => (
|
|
66
|
+
* <Admin dataProvider={simpleRestProvider('http://path.to.my.api')}>
|
|
67
|
+
* <Resource name="posts" list={PostList} />
|
|
68
|
+
* </Admin>
|
|
69
|
+
* );
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* // With authentication and i18n
|
|
73
|
+
* <Admin
|
|
74
|
+
* dataProvider={dataProvider}
|
|
75
|
+
* authProvider={authProvider}
|
|
76
|
+
* i18nProvider={i18nProvider}
|
|
77
|
+
* >
|
|
78
|
+
* <Resource name="posts" list={PostList} edit={PostEdit} />
|
|
79
|
+
* </Admin>
|
|
80
|
+
*/
|
|
81
|
+
export const Admin = (props: CoreAdminProps) => {
|
|
82
|
+
const {
|
|
83
|
+
accessDenied,
|
|
84
|
+
authCallbackPage = AuthCallback,
|
|
85
|
+
authenticationError,
|
|
86
|
+
authProvider,
|
|
87
|
+
basename,
|
|
88
|
+
catchAll,
|
|
89
|
+
children,
|
|
90
|
+
dashboard,
|
|
91
|
+
dataProvider,
|
|
92
|
+
disableTelemetry,
|
|
93
|
+
error,
|
|
94
|
+
i18nProvider = defaultI18nProvider,
|
|
95
|
+
layout = Layout,
|
|
96
|
+
loading,
|
|
97
|
+
loginPage = LoginPage,
|
|
98
|
+
queryClient,
|
|
99
|
+
ready = Ready,
|
|
100
|
+
requireAuth,
|
|
101
|
+
store = defaultStore,
|
|
102
|
+
title = "Shadcn Admin",
|
|
103
|
+
} = props;
|
|
104
|
+
return (
|
|
105
|
+
<AdminContext
|
|
106
|
+
authProvider={authProvider}
|
|
107
|
+
basename={basename}
|
|
108
|
+
dataProvider={dataProvider}
|
|
109
|
+
i18nProvider={i18nProvider}
|
|
110
|
+
queryClient={queryClient}
|
|
111
|
+
store={store}
|
|
112
|
+
>
|
|
113
|
+
<AdminUI
|
|
114
|
+
accessDenied={accessDenied}
|
|
115
|
+
authCallbackPage={authCallbackPage}
|
|
116
|
+
authenticationError={authenticationError}
|
|
117
|
+
catchAll={catchAll}
|
|
118
|
+
dashboard={dashboard}
|
|
119
|
+
disableTelemetry={disableTelemetry}
|
|
120
|
+
error={error}
|
|
121
|
+
layout={layout}
|
|
122
|
+
loading={loading}
|
|
123
|
+
loginPage={loginPage}
|
|
124
|
+
ready={ready}
|
|
125
|
+
requireAuth={requireAuth}
|
|
126
|
+
title={title}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
</AdminUI>
|
|
130
|
+
</AdminContext>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import {
|
|
3
|
+
useCanAccess,
|
|
4
|
+
useCreatePath,
|
|
5
|
+
useGetResourceLabel,
|
|
6
|
+
useHasDashboard,
|
|
7
|
+
useResourceDefinitions,
|
|
8
|
+
useTranslate,
|
|
9
|
+
} from "ra-core";
|
|
10
|
+
import { Link, useMatch } from "react-router";
|
|
11
|
+
import {
|
|
12
|
+
Sidebar,
|
|
13
|
+
SidebarContent,
|
|
14
|
+
SidebarFooter,
|
|
15
|
+
SidebarGroup,
|
|
16
|
+
SidebarGroupContent,
|
|
17
|
+
SidebarHeader,
|
|
18
|
+
SidebarMenu,
|
|
19
|
+
SidebarMenuButton,
|
|
20
|
+
SidebarMenuItem,
|
|
21
|
+
useSidebar,
|
|
22
|
+
} from "@/components/ui/sidebar";
|
|
23
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
24
|
+
import { House, List, Shell } from "lucide-react";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Navigation sidebar displaying menu items, allowing users to navigate between different sections of the application.
|
|
28
|
+
*
|
|
29
|
+
* The sidebar can collapse to an icon-only view and renders as a collapsible drawer on mobile devices.
|
|
30
|
+
* It automatically includes links to the dashboard (if defined) and all list views defined in Resource components.
|
|
31
|
+
*
|
|
32
|
+
* Included in the default Layout component
|
|
33
|
+
*
|
|
34
|
+
* @see {@link https://marmelab.com/shadcn-admin-kit/docs/appsidebar AppSidebar documentation}
|
|
35
|
+
* @see {@link https://ui.shadcn.com/docs/components/sidebar shadcn/ui Sidebar component}
|
|
36
|
+
* @see layout.tsx
|
|
37
|
+
*/
|
|
38
|
+
export function AppSidebar() {
|
|
39
|
+
const hasDashboard = useHasDashboard();
|
|
40
|
+
const resources = useResourceDefinitions();
|
|
41
|
+
const { openMobile, setOpenMobile } = useSidebar();
|
|
42
|
+
const handleClick = () => {
|
|
43
|
+
if (openMobile) {
|
|
44
|
+
setOpenMobile(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return (
|
|
48
|
+
<Sidebar variant="floating" collapsible="icon">
|
|
49
|
+
<SidebarHeader>
|
|
50
|
+
<SidebarMenu>
|
|
51
|
+
<SidebarMenuItem>
|
|
52
|
+
<SidebarMenuButton
|
|
53
|
+
asChild
|
|
54
|
+
className="data-[slot=sidebar-menu-button]:!p-1.5"
|
|
55
|
+
>
|
|
56
|
+
<Link to="/">
|
|
57
|
+
<Shell className="!size-5" />
|
|
58
|
+
<span className="text-base font-semibold">Acme Inc.</span>
|
|
59
|
+
</Link>
|
|
60
|
+
</SidebarMenuButton>
|
|
61
|
+
</SidebarMenuItem>
|
|
62
|
+
</SidebarMenu>
|
|
63
|
+
</SidebarHeader>
|
|
64
|
+
<SidebarContent>
|
|
65
|
+
<SidebarGroup>
|
|
66
|
+
<SidebarGroupContent>
|
|
67
|
+
<SidebarMenu>
|
|
68
|
+
{hasDashboard ? (
|
|
69
|
+
<DashboardMenuItem onClick={handleClick} />
|
|
70
|
+
) : null}
|
|
71
|
+
{Object.keys(resources)
|
|
72
|
+
.filter((name) => resources[name].hasList)
|
|
73
|
+
.map((name) => (
|
|
74
|
+
<ResourceMenuItem
|
|
75
|
+
key={name}
|
|
76
|
+
name={name}
|
|
77
|
+
onClick={handleClick}
|
|
78
|
+
/>
|
|
79
|
+
))}
|
|
80
|
+
</SidebarMenu>
|
|
81
|
+
</SidebarGroupContent>
|
|
82
|
+
</SidebarGroup>
|
|
83
|
+
</SidebarContent>
|
|
84
|
+
<SidebarFooter />
|
|
85
|
+
</Sidebar>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Menu item for the dashboard link in the sidebar.
|
|
91
|
+
*
|
|
92
|
+
* This component renders a sidebar menu item that links to the dashboard page.
|
|
93
|
+
* It displays as active when the user is on the dashboard route.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* <DashboardMenuItem onClick={handleClick} />
|
|
97
|
+
*/
|
|
98
|
+
export const DashboardMenuItem = ({ onClick }: { onClick?: () => void }) => {
|
|
99
|
+
const translate = useTranslate();
|
|
100
|
+
const label = translate("ra.page.dashboard", {
|
|
101
|
+
_: "Dashboard",
|
|
102
|
+
});
|
|
103
|
+
const match = useMatch({ path: "/", end: true });
|
|
104
|
+
return (
|
|
105
|
+
<SidebarMenuItem>
|
|
106
|
+
<SidebarMenuButton asChild isActive={!!match}>
|
|
107
|
+
<Link to="/" onClick={onClick}>
|
|
108
|
+
<House />
|
|
109
|
+
{label}
|
|
110
|
+
</Link>
|
|
111
|
+
</SidebarMenuButton>
|
|
112
|
+
</SidebarMenuItem>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Menu item for a resource link in the sidebar.
|
|
118
|
+
*
|
|
119
|
+
* This component renders a sidebar menu item that links to a resource's list view.
|
|
120
|
+
* It checks permissions using canAccess and displays as active when the user is viewing that resource.
|
|
121
|
+
* The component icon and label are derived from the resource definition.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* <ResourceMenuItem key={name} name="posts" onClick={handleClick} />
|
|
125
|
+
*/
|
|
126
|
+
export const ResourceMenuItem = ({
|
|
127
|
+
name,
|
|
128
|
+
onClick,
|
|
129
|
+
}: {
|
|
130
|
+
name: string;
|
|
131
|
+
onClick?: () => void;
|
|
132
|
+
}) => {
|
|
133
|
+
const { canAccess, isPending } = useCanAccess({
|
|
134
|
+
resource: name,
|
|
135
|
+
action: "list",
|
|
136
|
+
});
|
|
137
|
+
const resources = useResourceDefinitions();
|
|
138
|
+
const getResourceLabel = useGetResourceLabel();
|
|
139
|
+
const createPath = useCreatePath();
|
|
140
|
+
const to = createPath({
|
|
141
|
+
resource: name,
|
|
142
|
+
type: "list",
|
|
143
|
+
});
|
|
144
|
+
const match = useMatch({ path: to, end: false });
|
|
145
|
+
|
|
146
|
+
if (isPending) {
|
|
147
|
+
return <Skeleton className="h-8 w-full" />;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!resources || !resources[name] || !canAccess) return null;
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<SidebarMenuItem>
|
|
154
|
+
<SidebarMenuButton asChild isActive={!!match}>
|
|
155
|
+
<Link to={to} state={{ _scrollToTop: true }} onClick={onClick}>
|
|
156
|
+
{resources[name].icon ? (
|
|
157
|
+
createElement(resources[name].icon)
|
|
158
|
+
) : (
|
|
159
|
+
<List />
|
|
160
|
+
)}
|
|
161
|
+
{getResourceLabel(name, 2)}
|
|
162
|
+
</Link>
|
|
163
|
+
</SidebarMenuButton>
|
|
164
|
+
</SidebarMenuItem>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { RaRecord, UseListOptions, UseFieldValueOptions } from "ra-core";
|
|
3
|
+
import { ListContextProvider, useList, useFieldValue } from "ra-core";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads an array field value, puts it in a ListContext and renders its children.
|
|
7
|
+
*
|
|
8
|
+
* This field enables the use of list rendering components like SingleFieldList or
|
|
9
|
+
* DataTable to display array data.
|
|
10
|
+
* To be used with RecordField or DataTable.Col components, or anywhere a RecordContext is available.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://marmelab.com/shadcn-admin-kit/docs/arrayfield/ ArrayField documentation}
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import {
|
|
16
|
+
* Show,
|
|
17
|
+
* ArrayField,
|
|
18
|
+
* RecordField,
|
|
19
|
+
* SingleFieldList,
|
|
20
|
+
* BadgeField,
|
|
21
|
+
* } from '@/components/admin';
|
|
22
|
+
*
|
|
23
|
+
* const PostShow = () => (
|
|
24
|
+
* <Show>
|
|
25
|
+
* <div className="flex flex-col gap-4">
|
|
26
|
+
* <RecordField source="title" />
|
|
27
|
+
* <RecordField source="content" />
|
|
28
|
+
* <RecordField source="tags">
|
|
29
|
+
* <ArrayField source="tags">
|
|
30
|
+
* <SingleFieldList>
|
|
31
|
+
* <BadgeField source="name" />
|
|
32
|
+
* </SingleFieldList>
|
|
33
|
+
* </ArrayField>
|
|
34
|
+
* </RecordField>
|
|
35
|
+
* </div>
|
|
36
|
+
* </Show>
|
|
37
|
+
* );
|
|
38
|
+
*/
|
|
39
|
+
export const ArrayField = <RecordType extends RaRecord = RaRecord>(
|
|
40
|
+
props: ArrayFieldProps<RecordType>,
|
|
41
|
+
) => {
|
|
42
|
+
const { children, resource, perPage, sort, filter } = props;
|
|
43
|
+
const data = useFieldValue(props) || emptyArray;
|
|
44
|
+
const listContext = useList({ data, resource, perPage, sort, filter });
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ListContextProvider value={listContext}>{children}</ListContextProvider>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
export type ArrayFieldProps<
|
|
51
|
+
RecordType extends RaRecord = RaRecord,
|
|
52
|
+
ErrorType = Error,
|
|
53
|
+
> = UseListOptions<RecordType, ErrorType> &
|
|
54
|
+
UseFieldValueOptions<RecordType> & {
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
const emptyArray: any[] = [];
|