bmdl-sdk 1.5.9 → 2.0.1
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/.prettierrc +37 -0
- package/bin/dev.js +10 -8
- package/bin/init.js +2 -1
- package/bmdl-sdk-2.0.1.tgz +0 -0
- package/global.d.ts +9 -0
- package/next.config.ts +35 -0
- package/package.json +35 -8
- package/postcss.config.mjs +5 -0
- package/public/favicon.ico +0 -0
- package/public/images/bg/404.bg.dark.png +0 -0
- package/public/images/bg/404.bg.png +0 -0
- package/public/images/bg/maintenance.bg.dark.png +0 -0
- package/public/images/bg/maintenance.bg.png +0 -0
- package/public/images/bg/not-authorized.bg.dark.png +0 -0
- package/public/images/bg/not-authorized.bg.png +0 -0
- package/public/images/bg/redirect.bg.dark.png +0 -0
- package/public/images/bg/redirect.bg.png +0 -0
- package/public/images/cover/email-verify.cover.dark.png +0 -0
- package/public/images/cover/email-verify.cover.png +0 -0
- package/public/images/cover/login.cover.dark.png +0 -0
- package/public/images/cover/login.cover.png +0 -0
- package/public/images/cover/password-forgot.cover.dark.png +0 -0
- package/public/images/cover/password-forgot.cover.png +0 -0
- package/public/images/cover/password-reset.cover.dark.png +0 -0
- package/public/images/cover/password-reset.cover.png +0 -0
- package/public/images/cover/register.cover.dark.png +0 -0
- package/public/images/cover/register.cover.png +0 -0
- package/public/images/cover/two-factor-verify.cover.dark.png +0 -0
- package/public/images/cover/two-factor-verify.cover.png +0 -0
- package/public/images/lang/en.png +0 -0
- package/public/images/lang/ru.png +0 -0
- package/public/locales/en/datasets.json +92 -0
- package/public/locales/en/errors.json +402 -0
- package/public/locales/en/general.json +139 -0
- package/public/locales/ru/datasets.json +92 -0
- package/public/locales/ru/errors.json +406 -0
- package/public/locales/ru/general.json +139 -0
- package/src/app/datasets/page.tsx +25 -0
- package/src/app/layout.tsx +45 -0
- package/src/app/not-found.tsx +34 -0
- package/src/app/page.tsx +24 -0
- package/src/components/atoms/Actions/Actions.styles.ts +31 -0
- package/src/components/atoms/Actions/Actions.tsx +45 -0
- package/src/components/atoms/Actions/index.ts +1 -0
- package/src/components/atoms/Avatar/Avatar.styles.ts +95 -0
- package/src/components/atoms/Avatar/Avatar.tsx +46 -0
- package/src/components/atoms/Avatar/index.ts +1 -0
- package/src/components/atoms/Badge/Badge.styles.ts +93 -0
- package/src/components/atoms/Badge/Badge.tsx +31 -0
- package/src/components/atoms/Badge/index.ts +1 -0
- package/src/components/atoms/Button/Button.styles.ts +189 -0
- package/src/components/atoms/Button/Button.tsx +29 -0
- package/src/components/atoms/Button/index.ts +1 -0
- package/src/components/atoms/Calendar/Calendar.styles.ts +227 -0
- package/src/components/atoms/Calendar/Calendar.tsx +96 -0
- package/src/components/atoms/Calendar/index.ts +1 -0
- package/src/components/atoms/Checkbox/Checkbox.styles.ts +37 -0
- package/src/components/atoms/Checkbox/Checkbox.tsx +26 -0
- package/src/components/atoms/Checkbox/index.ts +1 -0
- package/src/components/atoms/Date/Date.styles.ts +6 -0
- package/src/components/atoms/Date/Date.tsx +27 -0
- package/src/components/atoms/Date/index.ts +1 -0
- package/src/components/atoms/DatePicker/DatePicker.styles.ts +53 -0
- package/src/components/atoms/DatePicker/DatePicker.tsx +114 -0
- package/src/components/atoms/DatePicker/DatePicker.utils.tsx +49 -0
- package/src/components/atoms/DatePicker/index.ts +1 -0
- package/src/components/atoms/Dialog/Dialog.styles.ts +71 -0
- package/src/components/atoms/Dialog/Dialog.tsx +55 -0
- package/src/components/atoms/Dialog/index.ts +1 -0
- package/src/components/atoms/Dropdown/Divider/Divider.styles.ts +8 -0
- package/src/components/atoms/Dropdown/Divider/Divider.tsx +14 -0
- package/src/components/atoms/Dropdown/Divider/index.ts +1 -0
- package/src/components/atoms/Dropdown/Dropdown.styles.ts +31 -0
- package/src/components/atoms/Dropdown/Dropdown.tsx +48 -0
- package/src/components/atoms/Dropdown/Item/Item.styles.ts +12 -0
- package/src/components/atoms/Dropdown/Item/Item.tsx +18 -0
- package/src/components/atoms/Dropdown/Item/index.ts +1 -0
- package/src/components/atoms/Dropdown/index.ts +1 -0
- package/src/components/atoms/Form/Form.styles.ts +23 -0
- package/src/components/atoms/Form/Form.tsx +21 -0
- package/src/components/atoms/Form/Item/Item.styles.ts +23 -0
- package/src/components/atoms/Form/Item/Item.tsx +11 -0
- package/src/components/atoms/Form/Item/index.ts +1 -0
- package/src/components/atoms/Form/Label/Label.tsx +11 -0
- package/src/components/atoms/Form/Label/index.ts +1 -0
- package/src/components/atoms/Form/Message/Message.tsx +29 -0
- package/src/components/atoms/Form/Message/index.ts +1 -0
- package/src/components/atoms/Form/index.ts +1 -0
- package/src/components/atoms/Input/Email/Email.tsx +11 -0
- package/src/components/atoms/Input/Email/index.ts +1 -0
- package/src/components/atoms/Input/Input.styles.ts +77 -0
- package/src/components/atoms/Input/Input.tsx +29 -0
- package/src/components/atoms/Input/Number/Number.tsx +12 -0
- package/src/components/atoms/Input/Number/index.ts +1 -0
- package/src/components/atoms/Input/OTP/OTP.styles.ts +30 -0
- package/src/components/atoms/Input/OTP/OTP.tsx +23 -0
- package/src/components/atoms/Input/OTP/index.ts +1 -0
- package/src/components/atoms/Input/Password/Password.tsx +11 -0
- package/src/components/atoms/Input/Password/index.ts +1 -0
- package/src/components/atoms/Input/Search/Search.tsx +12 -0
- package/src/components/atoms/Input/Search/index.ts +1 -0
- package/src/components/atoms/Input/index.ts +1 -0
- package/src/components/atoms/Label/Label.styles.ts +29 -0
- package/src/components/atoms/Label/Label.tsx +18 -0
- package/src/components/atoms/Label/index.ts +1 -0
- package/src/components/atoms/Logo/Logo.styles.ts +16 -0
- package/src/components/atoms/Logo/Logo.tsx +20 -0
- package/src/components/atoms/Logo/index.ts +1 -0
- package/src/components/atoms/Pagination/Pagination.styles.ts +77 -0
- package/src/components/atoms/Pagination/Pagination.tsx +131 -0
- package/src/components/atoms/Pagination/index.ts +1 -0
- package/src/components/atoms/Popover/Popover.styles.ts +28 -0
- package/src/components/atoms/Popover/Popover.tsx +46 -0
- package/src/components/atoms/Popover/index.ts +1 -0
- package/src/components/atoms/Radio/Item/Item.styles.ts +35 -0
- package/src/components/atoms/Radio/Item/Item.tsx +18 -0
- package/src/components/atoms/Radio/Item/index.ts +1 -0
- package/src/components/atoms/Radio/Radio.styles.ts +25 -0
- package/src/components/atoms/Radio/Radio.tsx +21 -0
- package/src/components/atoms/Radio/index.ts +1 -0
- package/src/components/atoms/RangeNumber/RangeNumber.tsx +33 -0
- package/src/components/atoms/RangeNumber/index.ts +1 -0
- package/src/components/atoms/Select/Item/Item.styles.ts +22 -0
- package/src/components/atoms/Select/Item/Item.tsx +17 -0
- package/src/components/atoms/Select/Item/index.ts +1 -0
- package/src/components/atoms/Select/Select.styles.ts +149 -0
- package/src/components/atoms/Select/Select.tsx +68 -0
- package/src/components/atoms/Select/index.ts +1 -0
- package/src/components/atoms/Separator/Separator.styles.ts +13 -0
- package/src/components/atoms/Separator/Separator.tsx +20 -0
- package/src/components/atoms/Separator/index.ts +1 -0
- package/src/components/atoms/Sheet/Sheet.styles.ts +100 -0
- package/src/components/atoms/Sheet/Sheet.tsx +53 -0
- package/src/components/atoms/Sheet/index.ts +1 -0
- package/src/components/atoms/Skeleton/Skeleton.styles.ts +30 -0
- package/src/components/atoms/Skeleton/Skeleton.tsx +11 -0
- package/src/components/atoms/Skeleton/index.ts +1 -0
- package/src/components/atoms/Spin/Spin.styles.ts +17 -0
- package/src/components/atoms/Spin/Spin.tsx +19 -0
- package/src/components/atoms/Spin/index.ts +1 -0
- package/src/components/atoms/Switch/Switch.styles.ts +34 -0
- package/src/components/atoms/Switch/Switch.tsx +20 -0
- package/src/components/atoms/Switch/index.ts +1 -0
- package/src/components/atoms/Table/FilterContent/FilterContent.styles.ts +33 -0
- package/src/components/atoms/Table/FilterContent/FilterContent.tsx +300 -0
- package/src/components/atoms/Table/FilterContent/index.ts +1 -0
- package/src/components/atoms/Table/FilterIcon/FilterIcon.tsx +16 -0
- package/src/components/atoms/Table/FilterIcon/index.ts +1 -0
- package/src/components/atoms/Table/SortIcon/SortIcon.tsx +32 -0
- package/src/components/atoms/Table/SortIcon/index.ts +1 -0
- package/src/components/atoms/Table/Table.styles.ts +178 -0
- package/src/components/atoms/Table/Table.tsx +484 -0
- package/src/components/atoms/Table/Table.utils.tsx +19 -0
- package/src/components/atoms/Table/index.ts +1 -0
- package/src/components/atoms/Tabs/Tabs.tsx +15 -0
- package/src/components/atoms/Tabs/index.ts +1 -0
- package/src/components/atoms/Textarea/Textarea.styles.ts +64 -0
- package/src/components/atoms/Textarea/Textarea.tsx +15 -0
- package/src/components/atoms/Textarea/index.ts +1 -0
- package/src/components/atoms/Toast/Toast.styles.ts +35 -0
- package/src/components/atoms/Toast/Toast.tsx +85 -0
- package/src/components/atoms/Toast/Toast.utils.tsx +43 -0
- package/src/components/atoms/Toast/index.ts +1 -0
- package/src/components/atoms/Tooltip/Tooltip.styles.ts +33 -0
- package/src/components/atoms/Tooltip/Tooltip.tsx +32 -0
- package/src/components/atoms/Tooltip/index.ts +1 -0
- package/src/components/atoms/Typography/Display/Display.styles.ts +26 -0
- package/src/components/atoms/Typography/Display/Display.tsx +11 -0
- package/src/components/atoms/Typography/Display/index.ts +1 -0
- package/src/components/atoms/Typography/Link/Link.styles.ts +32 -0
- package/src/components/atoms/Typography/Link/Link.tsx +25 -0
- package/src/components/atoms/Typography/Link/index.ts +1 -0
- package/src/components/atoms/Typography/Paragraph/Paragraph.styles.ts +32 -0
- package/src/components/atoms/Typography/Paragraph/Paragraph.tsx +11 -0
- package/src/components/atoms/Typography/Paragraph/index.ts +1 -0
- package/src/components/atoms/Typography/Text/Text.styles.ts +39 -0
- package/src/components/atoms/Typography/Text/Text.tsx +25 -0
- package/src/components/atoms/Typography/Text/index.ts +1 -0
- package/src/components/atoms/Typography/Title/Title.styles.ts +28 -0
- package/src/components/atoms/Typography/Title/Title.tsx +15 -0
- package/src/components/atoms/Typography/Title/index.ts +1 -0
- package/src/components/atoms/Typography/Typography.tsx +21 -0
- package/src/components/atoms/Typography/index.ts +1 -0
- package/src/components/atoms/icons/AvanpostIcon.tsx +31 -0
- package/src/components/atoms/icons/CheckIcon.tsx +22 -0
- package/src/components/atoms/icons/EmptyIcon.tsx +56 -0
- package/src/components/atoms/icons/LogoIcon.tsx +141 -0
- package/src/components/atoms/icons/NumberTypeIcon.tsx +25 -0
- package/src/components/atoms/icons/SidebarCloseIcon.tsx +75 -0
- package/src/components/atoms/icons/index.ts +6 -0
- package/src/components/atoms/index.ts +31 -0
- package/src/components/molecules/DataTable/CreationModal/CreationModal.tsx +31 -0
- package/src/components/molecules/DataTable/CreationModal/index.ts +1 -0
- package/src/components/molecules/DataTable/DataTable.styles.ts +23 -0
- package/src/components/molecules/DataTable/DataTable.tsx +167 -0
- package/src/components/molecules/DataTable/Name/Name.tsx +20 -0
- package/src/components/molecules/DataTable/Name/index.ts +1 -0
- package/src/components/molecules/DataTable/Skeleton/Skeleton.tsx +27 -0
- package/src/components/molecules/DataTable/Skeleton/index.ts +6 -0
- package/src/components/molecules/DataTable/index.ts +8 -0
- package/src/components/molecules/Header/Button/Button.styles.ts +24 -0
- package/src/components/molecules/Header/Button/Button.tsx +20 -0
- package/src/components/molecules/Header/Button/index.ts +1 -0
- package/src/components/molecules/Header/Header.styles.ts +16 -0
- package/src/components/molecules/Header/Header.tsx +20 -0
- package/src/components/molecules/Header/Navigate/Navigate.tsx +40 -0
- package/src/components/molecules/Header/Navigate/index.ts +1 -0
- package/src/components/molecules/Header/SelectLang/SelectLang.tsx +47 -0
- package/src/components/molecules/Header/SelectLang/index.ts +2 -0
- package/src/components/molecules/Header/SelectTheme/SelectTheme.tsx +43 -0
- package/src/components/molecules/Header/SelectTheme/index.ts +1 -0
- package/src/components/molecules/Header/index.ts +2 -0
- package/src/components/molecules/ProjectIcon/ProjectIcon.styles.ts +23 -0
- package/src/components/molecules/ProjectIcon/ProjectIcon.tsx +37 -0
- package/src/components/molecules/ProjectIcon/index.ts +1 -0
- package/src/components/molecules/Sidebar/Item/Item.styles.ts +52 -0
- package/src/components/molecules/Sidebar/Item/Item.tsx +30 -0
- package/src/components/molecules/Sidebar/Item/index.ts +1 -0
- package/src/components/molecules/Sidebar/Sidebar.styles.ts +97 -0
- package/src/components/molecules/Sidebar/Sidebar.tsx +122 -0
- package/src/components/molecules/Sidebar/Sidebar.utils.tsx +36 -0
- package/src/components/molecules/Sidebar/Trigger/Trigger.tsx +23 -0
- package/src/components/molecules/Sidebar/Trigger/index.ts +1 -0
- package/src/components/molecules/Sidebar/index.ts +1 -0
- package/src/components/molecules/Widget/Content/Content.tsx +80 -0
- package/src/components/molecules/Widget/Content/index.ts +1 -0
- package/src/components/molecules/Widget/Toolbox/Toolbox.tsx +0 -0
- package/src/components/molecules/Widget/Toolbox/index.ts +0 -0
- package/src/components/molecules/Widget/Widget.tsx +26 -0
- package/src/components/molecules/Widget/Widget.utils.tsx +31 -0
- package/src/components/molecules/Widget/index.ts +2 -0
- package/src/components/molecules/index.ts +6 -0
- package/src/components/organisms/ComponentWidget/ComponentWidget.tsx +9 -0
- package/src/components/organisms/ComponentWidget/index.ts +2 -0
- package/src/components/organisms/DatasetsTable/Creation/Creation.tsx +105 -0
- package/src/components/organisms/DatasetsTable/Creation/Navigate/Navigate.tsx +59 -0
- package/src/components/organisms/DatasetsTable/Creation/Navigate/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/Step.styles.ts +12 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/Step.tsx +43 -0
- package/src/components/organisms/DatasetsTable/Creation/Step/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/Step1.styles.ts +41 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/Step1.tsx +67 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step1/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/SelectSource/SelectSource.tsx +252 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/SelectSource/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/Step2.tsx +11 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/UploadFile/UploadFile.tsx +112 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/UploadFile/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step2/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step3/Step3.tsx +145 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step3/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step4/Step4.tsx +120 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/Step4/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Creation/Steps/index.ts +4 -0
- package/src/components/organisms/DatasetsTable/Creation/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/DatasetsTable.tsx +81 -0
- package/src/components/organisms/DatasetsTable/DatasetsTable.utils.tsx +125 -0
- package/src/components/organisms/DatasetsTable/Source/Source.styles.ts +7 -0
- package/src/components/organisms/DatasetsTable/Source/Source.tsx +39 -0
- package/src/components/organisms/DatasetsTable/Source/Source.utils.tsx +45 -0
- package/src/components/organisms/DatasetsTable/Source/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Status/Status.styles.ts +25 -0
- package/src/components/organisms/DatasetsTable/Status/Status.tsx +29 -0
- package/src/components/organisms/DatasetsTable/Status/Status.utils.tsx +29 -0
- package/src/components/organisms/DatasetsTable/Status/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/Type/Type.styles.ts +7 -0
- package/src/components/organisms/DatasetsTable/Type/Type.tsx +32 -0
- package/src/components/organisms/DatasetsTable/Type/Type.utils.tsx +14 -0
- package/src/components/organisms/DatasetsTable/Type/index.ts +1 -0
- package/src/components/organisms/DatasetsTable/index.ts +1 -0
- package/src/components/organisms/index.ts +3 -0
- package/src/components/templates/DefaultLayout/DefaultLayout.styles.ts +26 -0
- package/src/components/templates/DefaultLayout/DefaultLayout.tsx +41 -0
- package/src/components/templates/DefaultLayout/index.ts +1 -0
- package/src/components/templates/PageLayout/PageLayout.styles.ts +25 -0
- package/src/components/templates/PageLayout/PageLayout.tsx +28 -0
- package/src/components/templates/PageLayout/index.ts +1 -0
- package/src/components/templates/index.ts +3 -0
- package/src/config/i18n.config.ts +46 -0
- package/src/constants/index.ts +10 -0
- package/src/contexts/CreateComponentContext/CreateComponentContext.tsx +17 -0
- package/src/contexts/CreateComponentContext/index.ts +4 -0
- package/src/contexts/CreateDatasetContext/CreateDatasetContext.tsx +25 -0
- package/src/contexts/CreateDatasetContext/index.ts +4 -0
- package/src/contexts/ProjectContext/ProjectContext.tsx +32 -0
- package/src/contexts/ProjectContext/index.ts +1 -0
- package/src/contexts/SidebarContext/SidebarContext.tsx +10 -0
- package/src/contexts/SidebarContext/index.ts +1 -0
- package/src/contexts/index.ts +10 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useCreateComponent.ts +15 -0
- package/src/hooks/useCreateDataset.ts +15 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useDebounced.ts +31 -0
- package/src/hooks/useIsMobile.ts +27 -0
- package/src/hooks/useSidebar.ts +15 -0
- package/src/hooks/useStickyHeader.ts +35 -0
- package/src/hooks/useWindowSize.ts +27 -0
- package/src/providers/CreateComponentProvider/CreateComponentProvider.tsx +53 -0
- package/src/providers/CreateComponentProvider/index.ts +1 -0
- package/src/providers/CreateDatasetProvider/CreateDatasetProvider.tsx +73 -0
- package/src/providers/CreateDatasetProvider/index.ts +1 -0
- package/src/providers/LangProvider/LangProvider.tsx +15 -0
- package/src/providers/LangProvider/index.ts +1 -0
- package/src/providers/ProjectProvider/ProjectProvider.tsx +110 -0
- package/src/providers/ProjectProvider/index.ts +1 -0
- package/src/providers/SidebarProvider/SidebarProvider.tsx +51 -0
- package/src/providers/SidebarProvider/index.ts +1 -0
- package/src/providers/ThemeProvider/ThemeProvider.tsx +20 -0
- package/src/providers/ThemeProvider/index.ts +1 -0
- package/src/providers/index.ts +6 -0
- package/src/store/index.ts +2 -0
- package/src/store/sidebar/sidebar.store.ts +17 -0
- package/src/store/sidebar/sidebar.type.ts +4 -0
- package/src/styles/globals.css +202 -0
- package/src/types/component.type.ts +13 -0
- package/src/types/dataset.type.ts +25 -0
- package/src/types/file.type.ts +13 -0
- package/src/types/general.type.ts +86 -0
- package/src/types/index.ts +9 -0
- package/src/types/layer.type.ts +7 -0
- package/src/types/project.type.ts +15 -0
- package/src/types/user.type.ts +6 -0
- package/src/types/widget.type.ts +12 -0
- package/src/utils/bm.util.ts +150 -0
- package/src/utils/bytes.util.ts +110 -0
- package/src/utils/date.util.ts +49 -0
- package/src/utils/dynamicMessage.util.ts +9 -0
- package/src/utils/getInitials.util.ts +10 -0
- package/src/utils/hideEmail.util.ts +14 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/pagination.util.ts +144 -0
- package/src/utils/twJoin.util.ts +49 -0
- package/src/utils/twMerge.util.ts +6 -0
- package/src/utils/upload.util.ts +26 -0
- package/src/utils/url.util.ts +29 -0
- package/tsconfig.json +40 -6
- package/bmdl-sdk-1.5.9.tgz +0 -0
- package/index.html +0 -12
- package/src/App.tsx +0 -187
- package/src/main.tsx +0 -15
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
import { useTranslations } from 'next-intl'
|
|
3
|
+
import Link from 'next/link'
|
|
4
|
+
import { TbDatabase, TbPuzzle } from 'react-icons/tb'
|
|
5
|
+
|
|
6
|
+
type NavigateProps = {
|
|
7
|
+
className?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function Navigate({className}: NavigateProps) {
|
|
11
|
+
const t = useTranslations()
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<nav className={clsx(className, 'py-3')}>
|
|
15
|
+
<ul className='flex gap-x-1'>
|
|
16
|
+
<li>
|
|
17
|
+
<Link
|
|
18
|
+
href='/'
|
|
19
|
+
className='oveflow-hidden bg-primary/20 text-primary flex h-9.5 items-center justify-center rounded-md px-3 py-2 text-base font-semibold [&_svg]:mr-2 [&_svg]:size-5.5 [&_svg]:shrink-0 [&_svg]:grow-0 [&_svg]:transition-[margin-inline-end]'
|
|
20
|
+
>
|
|
21
|
+
<TbPuzzle />
|
|
22
|
+
<span>{t('categories.components')}</span>
|
|
23
|
+
</Link>
|
|
24
|
+
</li>
|
|
25
|
+
<li>
|
|
26
|
+
<Link
|
|
27
|
+
href='/datasets'
|
|
28
|
+
className='oveflow-hidden dark:text-dark-gray-300 dark:hover:bg-dark-gray-800/50 flex h-9.5 items-center justify-center rounded-md px-3 py-2 text-base font-semibold text-gray-800 hover:bg-gray-100 [&_svg]:mr-2 [&_svg]:size-5.5 [&_svg]:shrink-0 [&_svg]:grow-0 [&_svg]:transition-[margin-inline-end]'
|
|
29
|
+
>
|
|
30
|
+
<TbDatabase />
|
|
31
|
+
<span>{t('categories.datasets')}</span>
|
|
32
|
+
</Link>
|
|
33
|
+
</li>
|
|
34
|
+
</ul>
|
|
35
|
+
</nav>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Navigate }
|
|
40
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Navigate } from './Navigate'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import Image from 'next/image'
|
|
4
|
+
import enSrc from '../../../../../public/images/lang/en.png'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { Select } from '@/components/atoms'
|
|
8
|
+
|
|
9
|
+
import { useLocale } from 'next-intl'
|
|
10
|
+
import { HeaderButton } from '../Button'
|
|
11
|
+
|
|
12
|
+
export function SelectLang() {
|
|
13
|
+
const language = useLocale();
|
|
14
|
+
|
|
15
|
+
const onValueChange = async (value: string) => {
|
|
16
|
+
// setCurrentLanguage(value)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Select
|
|
21
|
+
trigger={
|
|
22
|
+
<HeaderButton>
|
|
23
|
+
<Select.Value />
|
|
24
|
+
</HeaderButton>
|
|
25
|
+
}
|
|
26
|
+
align='end'
|
|
27
|
+
sideOffset={9}
|
|
28
|
+
value={language}
|
|
29
|
+
onValueChange={onValueChange}
|
|
30
|
+
>
|
|
31
|
+
<Select.Item value='ru'>
|
|
32
|
+
<Image
|
|
33
|
+
src={enSrc}
|
|
34
|
+
alt="Русский"
|
|
35
|
+
/>
|
|
36
|
+
<span>Русский</span>
|
|
37
|
+
</Select.Item>
|
|
38
|
+
<Select.Item value='en'>
|
|
39
|
+
<Image
|
|
40
|
+
src={enSrc}
|
|
41
|
+
alt="English"
|
|
42
|
+
/>
|
|
43
|
+
<span>English</span>
|
|
44
|
+
</Select.Item>
|
|
45
|
+
</Select>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl'
|
|
4
|
+
import { useTheme } from 'next-themes'
|
|
5
|
+
|
|
6
|
+
import { TbMoonStars, TbSun, TbSunMoon } from 'react-icons/tb'
|
|
7
|
+
|
|
8
|
+
import { Select } from '@/components/atoms'
|
|
9
|
+
|
|
10
|
+
import { HeaderButton } from '../Button'
|
|
11
|
+
|
|
12
|
+
export function SelectTheme() {
|
|
13
|
+
const t = useTranslations('')
|
|
14
|
+
const { setTheme, theme = 'system' } = useTheme()
|
|
15
|
+
|
|
16
|
+
const onValueChange = (value: string) => {
|
|
17
|
+
setTheme(value)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Select
|
|
22
|
+
trigger={
|
|
23
|
+
<HeaderButton>
|
|
24
|
+
<Select.Value />
|
|
25
|
+
</HeaderButton>
|
|
26
|
+
}
|
|
27
|
+
align='end'
|
|
28
|
+
sideOffset={9}
|
|
29
|
+
value={theme}
|
|
30
|
+
onValueChange={onValueChange}
|
|
31
|
+
>
|
|
32
|
+
<Select.Item value='light'>
|
|
33
|
+
<TbSun size={24} /> <span>{t('light')}</span>
|
|
34
|
+
</Select.Item>
|
|
35
|
+
<Select.Item value='dark'>
|
|
36
|
+
<TbMoonStars size={24} /> <span>{t('dark')}</span>
|
|
37
|
+
</Select.Item>
|
|
38
|
+
<Select.Item value='system'>
|
|
39
|
+
<TbSunMoon size={20} /> <span>{t('system')}</span>
|
|
40
|
+
</Select.Item>
|
|
41
|
+
</Select>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectTheme } from './SelectTheme'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VariantProps, cva } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { twJoin } from '@/utils'
|
|
4
|
+
|
|
5
|
+
export const rootStyles = cva(
|
|
6
|
+
twJoin({
|
|
7
|
+
display: 'flex items-center justify-center overflow-hidden',
|
|
8
|
+
visual: 'rounded-full'
|
|
9
|
+
}),
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
sm: 'size-8 min-w-8 [&_svg]:size-5',
|
|
14
|
+
md: 'size-9.5 min-w-9.5 [&_svg]:size-6'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: 'md'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
export type RootStylesProps = VariantProps<typeof rootStyles>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
|
|
3
|
+
// import Image from 'next/image'
|
|
4
|
+
|
|
5
|
+
import { TbPresentationAnalytics } from 'react-icons/tb'
|
|
6
|
+
|
|
7
|
+
import { rootStyles, RootStylesProps } from './ProjectIcon.styles'
|
|
8
|
+
|
|
9
|
+
type ProjectIconProps = RootStylesProps & {
|
|
10
|
+
icon: {
|
|
11
|
+
name: string
|
|
12
|
+
color: string
|
|
13
|
+
}
|
|
14
|
+
className?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function ProjectIcon({ icon, size, className }: ProjectIconProps) {
|
|
18
|
+
const iconStyle: any = { '--icon-color': icon.color }
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
style={iconStyle}
|
|
23
|
+
className={clsx(
|
|
24
|
+
rootStyles({ size, className }),
|
|
25
|
+
'bg-(--icon-color)/16 text-(--icon-color)'
|
|
26
|
+
)}
|
|
27
|
+
>
|
|
28
|
+
{/* {icon.path ? (
|
|
29
|
+
<Image src={icon.path} alt={icon.name} />
|
|
30
|
+
) : ( */}
|
|
31
|
+
<TbPresentationAnalytics />
|
|
32
|
+
{/* )} */}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ProjectIcon }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProjectIcon } from './ProjectIcon'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { VariantProps, cva } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { twJoin } from '@/utils'
|
|
4
|
+
|
|
5
|
+
export const rootStyles = twJoin({
|
|
6
|
+
display: 'mt-1 first:mt-0'
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
// /////////////////////////
|
|
10
|
+
|
|
11
|
+
export const linkStyles = cva(
|
|
12
|
+
twJoin({
|
|
13
|
+
display: 'flex items-center h-9.5 px-3 py-2 oveflow-hidden',
|
|
14
|
+
text: 'text-base text-gray-800',
|
|
15
|
+
visual: 'rounded-md outline-none',
|
|
16
|
+
animation: 'transition-(color,bg) duration-300',
|
|
17
|
+
hover: 'hover:bg-gray-100',
|
|
18
|
+
attrs: [
|
|
19
|
+
'group-data-[state="collapsed"]:[&_svg]:mr-0',
|
|
20
|
+
'group-data-[state="collapsed"]:[&_span]:hidden',
|
|
21
|
+
'group-data-[state="collapsed"]:[&_span]:opacity-0',
|
|
22
|
+
//
|
|
23
|
+
'group-data-[state="collapsed"]:justify-center'
|
|
24
|
+
],
|
|
25
|
+
childs: [
|
|
26
|
+
'[&_svg]:size-5.5',
|
|
27
|
+
'[&_svg]:mr-2',
|
|
28
|
+
'[&_svg]:transition-[margin-inline-end]',
|
|
29
|
+
'[&_svg]:grow-0',
|
|
30
|
+
'[&_svg]:shrink-0'
|
|
31
|
+
],
|
|
32
|
+
//
|
|
33
|
+
dark: {
|
|
34
|
+
text: 'dark:text-dark-gray-200',
|
|
35
|
+
hover: {
|
|
36
|
+
visual: 'dark:hover:bg-dark-gray-800/50'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
{
|
|
41
|
+
variants: {
|
|
42
|
+
active: {
|
|
43
|
+
true: 'bg-linear-(--gradient-primary) shadow-primary-sm text-white'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
active: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export type LinkStylesProps = VariantProps<typeof linkStyles>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Link, { type LinkProps } from 'next/link'
|
|
2
|
+
import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
import { Tooltip } from '@/components/atoms'
|
|
5
|
+
|
|
6
|
+
import { type LinkStylesProps, linkStyles, rootStyles } from './Item.styles'
|
|
7
|
+
|
|
8
|
+
import { useSidebar } from '@/hooks/useSidebar'
|
|
9
|
+
|
|
10
|
+
type ItemProps = ComponentProps<'a'> &
|
|
11
|
+
LinkProps &
|
|
12
|
+
LinkStylesProps & {
|
|
13
|
+
tooltip: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function Item({ active, tooltip, children, ...props }: ItemProps) {
|
|
17
|
+
const { isMobile, isOpen } = useSidebar()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<li className={rootStyles}>
|
|
21
|
+
<Tooltip title={tooltip} side='right' hidden={isOpen || isMobile}>
|
|
22
|
+
<Link className={linkStyles({ active })} {...props}>
|
|
23
|
+
{children}
|
|
24
|
+
</Link>
|
|
25
|
+
</Tooltip>
|
|
26
|
+
</li>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Item }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Item } from './Item'
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { twJoin } from '@/utils'
|
|
4
|
+
|
|
5
|
+
export const rootStyles = cva(
|
|
6
|
+
twJoin({
|
|
7
|
+
display: 'w-18 overflow-hidden',
|
|
8
|
+
animation: 'ease-linear duration-200',
|
|
9
|
+
attrs: 'group-data-[state=expanded]:w-60'
|
|
10
|
+
}),
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
content: {
|
|
14
|
+
true: twJoin({
|
|
15
|
+
position: 'fixed inset-y-0 left-0 z-50',
|
|
16
|
+
display: 'h-svh',
|
|
17
|
+
visual: 'bg-white shadow-sm',
|
|
18
|
+
animation: 'transition-[left,width]',
|
|
19
|
+
//
|
|
20
|
+
dark: 'dark:shadow-dark-sm dark:bg-dark-gray-900'
|
|
21
|
+
}),
|
|
22
|
+
false: 'relative transition-[width]'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
content: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
// /////////////////////////
|
|
32
|
+
|
|
33
|
+
export const wrapperStyles = twJoin({
|
|
34
|
+
display: 'flex h-full w-full flex-col'
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const headerStyles = twJoin({
|
|
38
|
+
display: 'flex items-center pt-5 pb-1 px-3.5',
|
|
39
|
+
text: 'text-2xl text-gray-900',
|
|
40
|
+
childs: {
|
|
41
|
+
display: [
|
|
42
|
+
'[&_button]:flex [&_button]:items-center [&_button]:px-3 [&_button]:py-1 [&_button]:ml-auto'
|
|
43
|
+
],
|
|
44
|
+
hover: {
|
|
45
|
+
mouse: 'hover:[&_button]:cursor-pointer'
|
|
46
|
+
},
|
|
47
|
+
attrs: [
|
|
48
|
+
'group-data-[state="expanded"]:pl-4.5',
|
|
49
|
+
'group-data-[state="expanded"]:pr-0',
|
|
50
|
+
//
|
|
51
|
+
'group-data-[state="collapsed"]:pb-2',
|
|
52
|
+
'group-data-[state="collapsed"]:[&_>_a]:hidden',
|
|
53
|
+
'group-data-[state="collapsed"]:[&_>_button]:ml-0',
|
|
54
|
+
'group-data-[state="collapsed"]:justify-center'
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
//
|
|
58
|
+
dark: {
|
|
59
|
+
text: 'dark:text-dark-gray-300'
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
// /////////////////////////
|
|
64
|
+
|
|
65
|
+
export const contentStyles = twJoin({
|
|
66
|
+
display: 'px-3'
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// /////////////////////////
|
|
70
|
+
|
|
71
|
+
export const groupHeadStyles = twJoin({
|
|
72
|
+
display: 'flex items-center h-11.5 p-3',
|
|
73
|
+
childs: {
|
|
74
|
+
display: '[&_svg]:size-5.5',
|
|
75
|
+
text: 'text-gray uppercase',
|
|
76
|
+
attrs: [
|
|
77
|
+
'group-data-[state="collapsed"]:[&_[role="separator"]]:hidden',
|
|
78
|
+
'group-data-[state="collapsed"]:[&_span]:hidden',
|
|
79
|
+
'group-data-[state="collapsed"]:justify-center',
|
|
80
|
+
//
|
|
81
|
+
'group-data-[state="expanded"]:[&_svg]:hidden'
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
//
|
|
85
|
+
dark: 'dark:text-dark-gray-600'
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// /////////////////////////
|
|
89
|
+
|
|
90
|
+
export const footerStyles = twJoin({
|
|
91
|
+
display: 'flex items-center justify-center py-2 px-3.5 mt-auto',
|
|
92
|
+
text: 'text-center text-nowrap',
|
|
93
|
+
visual: 'border-t border-divider',
|
|
94
|
+
childs: 'group-data-[state="collapsed"]:[&_span_span]:hidden',
|
|
95
|
+
//
|
|
96
|
+
dark: 'dark:border-dark-divider'
|
|
97
|
+
})
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl'
|
|
4
|
+
import { usePathname } from 'next/navigation'
|
|
5
|
+
import { Fragment } from 'react'
|
|
6
|
+
|
|
7
|
+
import { TbSeparator } from 'react-icons/tb'
|
|
8
|
+
|
|
9
|
+
import { Logo, Separator, Sheet, Typography } from '@/components/atoms'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
contentStyles,
|
|
13
|
+
footerStyles,
|
|
14
|
+
groupHeadStyles,
|
|
15
|
+
headerStyles,
|
|
16
|
+
rootStyles,
|
|
17
|
+
wrapperStyles
|
|
18
|
+
} from './Sidebar.styles'
|
|
19
|
+
|
|
20
|
+
import { Item } from './Item'
|
|
21
|
+
import { getSidebarGroups } from './Sidebar.utils'
|
|
22
|
+
import { Trigger } from './Trigger'
|
|
23
|
+
import { useSidebar } from '@/hooks'
|
|
24
|
+
|
|
25
|
+
const { Text } = Typography
|
|
26
|
+
|
|
27
|
+
function SidebarRoot({
|
|
28
|
+
className,
|
|
29
|
+
children,
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<'div'>) {
|
|
32
|
+
const { isMobile, isOpen, setIsOpen } = useSidebar()
|
|
33
|
+
|
|
34
|
+
if (isMobile) {
|
|
35
|
+
return (
|
|
36
|
+
<Sheet
|
|
37
|
+
open={isOpen}
|
|
38
|
+
onOpenChange={setIsOpen}
|
|
39
|
+
className='w-60 p-0'
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<div className={wrapperStyles}>{children}</div>
|
|
43
|
+
</Sheet>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className='group peer'
|
|
50
|
+
data-state={isOpen ? 'expanded' : 'collapsed'}
|
|
51
|
+
>
|
|
52
|
+
<div className={rootStyles()} />
|
|
53
|
+
<div className={rootStyles({ content: true })} {...props}>
|
|
54
|
+
<div className={wrapperStyles}>{children}</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function Sidebar() {
|
|
61
|
+
const t = useTranslations('')
|
|
62
|
+
//
|
|
63
|
+
const pathname = usePathname()
|
|
64
|
+
//
|
|
65
|
+
const groups = getSidebarGroups()
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<SidebarRoot>
|
|
69
|
+
<div className={headerStyles}>
|
|
70
|
+
<Logo />
|
|
71
|
+
<Trigger />
|
|
72
|
+
</div>
|
|
73
|
+
<div className={contentStyles}>
|
|
74
|
+
{groups.map(group => {
|
|
75
|
+
return (
|
|
76
|
+
<Fragment key={group.key}>
|
|
77
|
+
<div className={groupHeadStyles}>
|
|
78
|
+
<TbSeparator />
|
|
79
|
+
{group.title ? (
|
|
80
|
+
<Text size={'xs'} muted>
|
|
81
|
+
{group.title}
|
|
82
|
+
</Text>
|
|
83
|
+
) : (
|
|
84
|
+
<Separator className='w-full' />
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
<ul>
|
|
88
|
+
{group.items.map(item => {
|
|
89
|
+
const isActive =
|
|
90
|
+
pathname.startsWith(item.url) ||
|
|
91
|
+
pathname === item.url
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Item
|
|
95
|
+
key={item.title}
|
|
96
|
+
href={item.url}
|
|
97
|
+
tooltip={item.title}
|
|
98
|
+
active={isActive}
|
|
99
|
+
>
|
|
100
|
+
<item.icon />
|
|
101
|
+
<span>{item.title}</span>
|
|
102
|
+
</Item>
|
|
103
|
+
)
|
|
104
|
+
})}
|
|
105
|
+
</ul>
|
|
106
|
+
</Fragment>
|
|
107
|
+
)
|
|
108
|
+
})}
|
|
109
|
+
</div>
|
|
110
|
+
<div className={footerStyles}>
|
|
111
|
+
<Text size={'xs'}>
|
|
112
|
+
<span>{t('version')}</span>{' '}
|
|
113
|
+
{process.env.NEXT_PUBLIC_APP_VERSION}
|
|
114
|
+
</Text>
|
|
115
|
+
</div>
|
|
116
|
+
</SidebarRoot>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Sidebar.Trigger = Trigger
|
|
121
|
+
|
|
122
|
+
export { Sidebar }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useTranslations } from 'next-intl'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
TbChartHistogram,
|
|
5
|
+
TbDatabase,
|
|
6
|
+
TbPalette
|
|
7
|
+
} from 'react-icons/tb'
|
|
8
|
+
|
|
9
|
+
export const getSidebarGroups = () => {
|
|
10
|
+
const tg = useTranslations('')
|
|
11
|
+
const t = useTranslations('categories')
|
|
12
|
+
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
key: 'general',
|
|
16
|
+
title: '',
|
|
17
|
+
items: [
|
|
18
|
+
{
|
|
19
|
+
title: t('datasets'),
|
|
20
|
+
url: '/datasets',
|
|
21
|
+
icon: TbDatabase
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: t('widgets'),
|
|
25
|
+
url: '/widgets',
|
|
26
|
+
icon: TbChartHistogram
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: t('themes'),
|
|
30
|
+
url: '/themes',
|
|
31
|
+
icon: TbPalette
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react'
|
|
2
|
+
|
|
3
|
+
import { TbBaselineDensityMedium } from 'react-icons/tb'
|
|
4
|
+
|
|
5
|
+
import { SidebarCloseIcon } from '@/components/atoms/icons'
|
|
6
|
+
|
|
7
|
+
import { Button } from '@/components/atoms'
|
|
8
|
+
|
|
9
|
+
import { useSidebar } from '@/hooks/useSidebar'
|
|
10
|
+
|
|
11
|
+
type TriggerProps = ComponentProps<typeof Button>
|
|
12
|
+
|
|
13
|
+
function Trigger({ className, onClick, ...props }: TriggerProps) {
|
|
14
|
+
const { isOpen, toggleSidebar } = useSidebar()
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<button data-type='sidebar-trigger' onClick={toggleSidebar} {...props}>
|
|
18
|
+
{isOpen ? <SidebarCloseIcon /> : <TbBaselineDensityMedium />}
|
|
19
|
+
</button>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Trigger }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Trigger } from './Trigger'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Sidebar } from './Sidebar'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useTranslations } from 'next-intl'
|
|
4
|
+
import React, { Suspense, useEffect, useState } from 'react'
|
|
5
|
+
|
|
6
|
+
import { TbInfoHexagon, TbPuzzle, TbPuzzleOff } from 'react-icons/tb'
|
|
7
|
+
|
|
8
|
+
import { WidgetEmpty } from '../Widget.utils'
|
|
9
|
+
|
|
10
|
+
import { _ } from '@/utils'
|
|
11
|
+
|
|
12
|
+
interface ContentProps {
|
|
13
|
+
componentId?: number
|
|
14
|
+
dataOptions: any
|
|
15
|
+
viewOptions: any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function Content({
|
|
19
|
+
componentId,
|
|
20
|
+
dataOptions,
|
|
21
|
+
viewOptions
|
|
22
|
+
}: ContentProps) {
|
|
23
|
+
const t = useTranslations('components')
|
|
24
|
+
//
|
|
25
|
+
const [WidgetComponent, setWidgetComponent] =
|
|
26
|
+
useState<React.ComponentType<any>>()
|
|
27
|
+
//
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const loadWidget = async () => {
|
|
30
|
+
try {
|
|
31
|
+
const component = await import(
|
|
32
|
+
/* webpackIgnore: true */
|
|
33
|
+
`${process.env.NEXT_PUBLIC_SERVER_URL}/components/${componentId}/index.js`
|
|
34
|
+
)
|
|
35
|
+
setWidgetComponent(() => component.default(React))
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return (
|
|
38
|
+
<WidgetEmpty
|
|
39
|
+
icon={<TbInfoHexagon className='text-danger!' />}
|
|
40
|
+
text={'error'}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loadWidget()
|
|
47
|
+
}, [componentId])
|
|
48
|
+
//
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
console.log('dataOptions', dataOptions)
|
|
51
|
+
console.log('viewOptions', viewOptions)
|
|
52
|
+
}, [dataOptions, viewOptions])
|
|
53
|
+
//
|
|
54
|
+
if (_.isUndefined(componentId)) {
|
|
55
|
+
return <WidgetEmpty icon={<TbPuzzleOff />} text={t('empty')} />
|
|
56
|
+
}
|
|
57
|
+
//
|
|
58
|
+
//////////
|
|
59
|
+
//
|
|
60
|
+
const WidgetFallback = (
|
|
61
|
+
<WidgetEmpty
|
|
62
|
+
icon={<TbPuzzle />}
|
|
63
|
+
text={t('loading')}
|
|
64
|
+
className='animate-bounce'
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
//
|
|
68
|
+
if (_.isUndefined(WidgetComponent)) {
|
|
69
|
+
return WidgetFallback
|
|
70
|
+
}
|
|
71
|
+
//
|
|
72
|
+
return (
|
|
73
|
+
<Suspense fallback={WidgetFallback}>
|
|
74
|
+
<WidgetComponent
|
|
75
|
+
dataSettings={dataOptions}
|
|
76
|
+
viewSettings={viewOptions}
|
|
77
|
+
/>
|
|
78
|
+
</Suspense>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Content } from './Content'
|
|
File without changes
|
|
File without changes
|