bmdl-sdk 1.5.9 → 2.0.0
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 +5 -4
- package/bin/init.js +2 -1
- package/bmdl-sdk-2.0.0.tgz +0 -0
- package/global.d.ts +9 -0
- package/next.config.ts +27 -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 +107 -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/templates/App.tsx +1 -1
- package/templates/config.ts +1 -1
- package/templates/dataOptions.ts +1 -1
- package/templates/viewOptions.ts +1 -1
- 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,81 @@
|
|
|
1
|
+
// 'use client'
|
|
2
|
+
|
|
3
|
+
// import { useEffect, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
// import { LOADIND_TABLE_PAGINATION, LOADING_TABLE_DATA } from '@/constants'
|
|
6
|
+
|
|
7
|
+
// import { DataTable } from '@/components/molecules'
|
|
8
|
+
|
|
9
|
+
// import { IDataQuery } from '@/types'
|
|
10
|
+
|
|
11
|
+
// import { DatasetCreation } from './Creation'
|
|
12
|
+
// import {
|
|
13
|
+
// getDatasetsTableColumns,
|
|
14
|
+
// getDatasetsTableData
|
|
15
|
+
// } from './DatasetsTable.utils'
|
|
16
|
+
// import { getParams } from '@/utils'
|
|
17
|
+
|
|
18
|
+
// export function DatasetsTable() {
|
|
19
|
+
// const columns = getDatasetsTableColumns()
|
|
20
|
+
// //
|
|
21
|
+
// // const [defaultData, setDefaultData] = useState<GetDataInput>({
|
|
22
|
+
// // sort: [{ column: 'createdAt', order: 'desc' }]
|
|
23
|
+
// // })
|
|
24
|
+
// // //
|
|
25
|
+
// // const [getDatasets, { data, loading, called, refetch }] =
|
|
26
|
+
// // useGetDatasetsLazyQuery()
|
|
27
|
+
// // //
|
|
28
|
+
// // useEffect(() => {
|
|
29
|
+
// // const { q, sort, filter, page, limit }: IDataQuery = getParams()
|
|
30
|
+
// // //
|
|
31
|
+
// // const newState = {
|
|
32
|
+
// // ...defaultData,
|
|
33
|
+
// // ...(q && { q }),
|
|
34
|
+
// // ...(sort && { sort: JSON.parse(sort) }),
|
|
35
|
+
// // ...(filter && { filter: JSON.parse(filter) }),
|
|
36
|
+
// // ...(page && { page: +page }),
|
|
37
|
+
// // ...(limit && { limit: +limit })
|
|
38
|
+
// // }
|
|
39
|
+
// // //
|
|
40
|
+
// // setDefaultData(newState)
|
|
41
|
+
// // //
|
|
42
|
+
// // getDatasets({
|
|
43
|
+
// // variables: { data: newState }
|
|
44
|
+
// // })
|
|
45
|
+
// // }, [])
|
|
46
|
+
// // //
|
|
47
|
+
// // const getData = (data: Record<string, any>) => {
|
|
48
|
+
// // const newState = {
|
|
49
|
+
// // ...defaultData,
|
|
50
|
+
// // ...data
|
|
51
|
+
// // }
|
|
52
|
+
// // //
|
|
53
|
+
// // setDefaultData(newState)
|
|
54
|
+
// // //
|
|
55
|
+
// // refetch({
|
|
56
|
+
// // data: newState
|
|
57
|
+
// // })
|
|
58
|
+
// // }
|
|
59
|
+
// //
|
|
60
|
+
// return (
|
|
61
|
+
// <>DataTable
|
|
62
|
+
// {/* <DataTable
|
|
63
|
+
// creation={<DatasetCreation />}
|
|
64
|
+
// columns={columns}
|
|
65
|
+
// dataSource={getDatasetsTableData(
|
|
66
|
+
// data?.getDatasets.data || LOADING_TABLE_DATA,
|
|
67
|
+
// !called || loading
|
|
68
|
+
// )}
|
|
69
|
+
// pagination={
|
|
70
|
+
// data?.getDatasets.pagination || LOADIND_TABLE_PAGINATION
|
|
71
|
+
// }
|
|
72
|
+
// getData={getData}
|
|
73
|
+
// filterQuery={{
|
|
74
|
+
// querykey: 'getDatasetFilter',
|
|
75
|
+
// queryFn: useGetDatasetFilterQuery
|
|
76
|
+
// }}
|
|
77
|
+
// listName='datasets'
|
|
78
|
+
// /> */}
|
|
79
|
+
// </>
|
|
80
|
+
// )
|
|
81
|
+
// }
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// import { useTranslations } from 'next-intl'
|
|
2
|
+
|
|
3
|
+
// import { DatasetModel } from '@/graphql'
|
|
4
|
+
|
|
5
|
+
// import { Date, Skeleton, Typography } from '@/components/atoms'
|
|
6
|
+
|
|
7
|
+
// import { ProfileCard } from '@/components/molecules'
|
|
8
|
+
// import {
|
|
9
|
+
// Name,
|
|
10
|
+
// SkeletonConnects,
|
|
11
|
+
// SkeletonDate,
|
|
12
|
+
// SkeletonIcon,
|
|
13
|
+
// SkeletonProfile
|
|
14
|
+
// } from '@/components/molecules/DataTable'
|
|
15
|
+
|
|
16
|
+
// import { DatasetsTableDataItem } from '@/types'
|
|
17
|
+
|
|
18
|
+
// import { Source } from './Source'
|
|
19
|
+
// import { Status } from './Status'
|
|
20
|
+
// import { Type } from './Type'
|
|
21
|
+
|
|
22
|
+
// const { Text } = Typography
|
|
23
|
+
// //
|
|
24
|
+
// export function getDatasetsTableData(
|
|
25
|
+
// dataSource: DatasetModel[],
|
|
26
|
+
// isLoading: boolean
|
|
27
|
+
// ): DatasetsTableDataItem[] {
|
|
28
|
+
// if (isLoading) {
|
|
29
|
+
// return dataSource.map(dataItem => ({
|
|
30
|
+
// ...dataItem,
|
|
31
|
+
// type: <SkeletonIcon />,
|
|
32
|
+
// name: <Skeleton className='h-5 w-80' />,
|
|
33
|
+
// items: <Skeleton className='h-5 w-16' />,
|
|
34
|
+
// connects: <SkeletonConnects />,
|
|
35
|
+
// source: <SkeletonIcon />,
|
|
36
|
+
// author: <SkeletonProfile />,
|
|
37
|
+
// createdAt: <SkeletonDate />,
|
|
38
|
+
// editedAt: <SkeletonDate />,
|
|
39
|
+
// updatedAt: <SkeletonDate />,
|
|
40
|
+
// status: <Skeleton circle className='size-7.5' />
|
|
41
|
+
// }))
|
|
42
|
+
// }
|
|
43
|
+
// //
|
|
44
|
+
// return dataSource.map(dataItem => ({
|
|
45
|
+
// id: dataItem.id,
|
|
46
|
+
// type: <Type type={dataItem.type} />,
|
|
47
|
+
// name: <Name name={dataItem.name} href={`/datasets/${dataItem.id}`} />,
|
|
48
|
+
// items: <Text>{dataItem.total?.toLocaleString()}</Text>,
|
|
49
|
+
// connects: <Text>{dataItem._count?.widgets?.toLocaleString()}</Text>,
|
|
50
|
+
// source: <Source source={dataItem.source || dataItem.file!} />,
|
|
51
|
+
// author: <ProfileCard user={dataItem.author} size={'sm'} />,
|
|
52
|
+
// createdAt: <Date date={dataItem.createdAt} />,
|
|
53
|
+
// editedAt: <Date date={dataItem.editedAt} />,
|
|
54
|
+
// updatedAt: <Date date={dataItem.updatedAt} />,
|
|
55
|
+
// status: <Status status={dataItem.status} />
|
|
56
|
+
// }))
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// ////////////
|
|
60
|
+
|
|
61
|
+
// export function getDatasetsTableColumns() {
|
|
62
|
+
// const t = useTranslations('datasets.columns')
|
|
63
|
+
// //
|
|
64
|
+
// return [
|
|
65
|
+
// {
|
|
66
|
+
// key: 'type',
|
|
67
|
+
// title: t('type'),
|
|
68
|
+
// sort: 'string',
|
|
69
|
+
// width: 120
|
|
70
|
+
// },
|
|
71
|
+
// {
|
|
72
|
+
// key: 'name',
|
|
73
|
+
// title: t('name'),
|
|
74
|
+
// sort: 'string',
|
|
75
|
+
// width: 300
|
|
76
|
+
// },
|
|
77
|
+
// {
|
|
78
|
+
// key: 'items',
|
|
79
|
+
// title: t('items'),
|
|
80
|
+
// sort: 'number',
|
|
81
|
+
// width: 120
|
|
82
|
+
// },
|
|
83
|
+
// {
|
|
84
|
+
// key: 'connects',
|
|
85
|
+
// title: t('connects'),
|
|
86
|
+
// sort: 'number',
|
|
87
|
+
// width: 120
|
|
88
|
+
// },
|
|
89
|
+
// {
|
|
90
|
+
// key: 'source',
|
|
91
|
+
// title: t('source'),
|
|
92
|
+
// sort: 'string',
|
|
93
|
+
// width: 140
|
|
94
|
+
// },
|
|
95
|
+
// {
|
|
96
|
+
// key: 'author',
|
|
97
|
+
// title: t('author'),
|
|
98
|
+
// sort: 'string',
|
|
99
|
+
// width: 250
|
|
100
|
+
// },
|
|
101
|
+
// {
|
|
102
|
+
// key: 'createdAt',
|
|
103
|
+
// title: t('created'),
|
|
104
|
+
// sort: 'date',
|
|
105
|
+
// width: 170
|
|
106
|
+
// },
|
|
107
|
+
// {
|
|
108
|
+
// key: 'editedAt',
|
|
109
|
+
// title: t('edited'),
|
|
110
|
+
// sort: 'date',
|
|
111
|
+
// width: 170
|
|
112
|
+
// },
|
|
113
|
+
// {
|
|
114
|
+
// key: 'updatedAt',
|
|
115
|
+
// title: t('updated'),
|
|
116
|
+
// sort: 'date',
|
|
117
|
+
// width: 17
|
|
118
|
+
// },
|
|
119
|
+
// {
|
|
120
|
+
// key: 'status',
|
|
121
|
+
// title: t('status'),
|
|
122
|
+
// sort: 'string'
|
|
123
|
+
// }
|
|
124
|
+
// ]
|
|
125
|
+
// }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useTranslations } from 'next-intl'
|
|
2
|
+
import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
import { FileModel, SourceModel } from '@/graphql'
|
|
5
|
+
|
|
6
|
+
import { Tooltip, Typography } from '@/components/atoms'
|
|
7
|
+
|
|
8
|
+
import { rootStyles } from './Source.styles'
|
|
9
|
+
|
|
10
|
+
import { getSourceIcon, getSourceType } from './Source.utils'
|
|
11
|
+
|
|
12
|
+
const { Text } = Typography
|
|
13
|
+
|
|
14
|
+
type SourceProps = ComponentProps<'span'> & {
|
|
15
|
+
source?: SourceModel | FileModel
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function Source({ source }: SourceProps) {
|
|
19
|
+
const t = useTranslations('datasets.source')
|
|
20
|
+
//
|
|
21
|
+
const sourceType = getSourceType(source!)
|
|
22
|
+
//
|
|
23
|
+
const Icon = getSourceIcon(sourceType)
|
|
24
|
+
//
|
|
25
|
+
return (
|
|
26
|
+
<Tooltip
|
|
27
|
+
title={t(sourceType, {
|
|
28
|
+
name: (source as FileModel).originalName || source!.name
|
|
29
|
+
})}
|
|
30
|
+
side='left'
|
|
31
|
+
>
|
|
32
|
+
<Text className={rootStyles}>
|
|
33
|
+
<Icon />
|
|
34
|
+
</Text>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Source }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FileModel, SourceModel } from '@/graphql'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
TbApi,
|
|
5
|
+
TbDatabase,
|
|
6
|
+
TbFileTypeCsv,
|
|
7
|
+
TbFileTypeXls,
|
|
8
|
+
TbFileTypeXml,
|
|
9
|
+
TbJson
|
|
10
|
+
} from 'react-icons/tb'
|
|
11
|
+
|
|
12
|
+
import { DatasetType } from '@/types'
|
|
13
|
+
|
|
14
|
+
export const getSourceType = (source: SourceModel | FileModel): DatasetType => {
|
|
15
|
+
console.log('source', source);
|
|
16
|
+
|
|
17
|
+
if ('ext' in source!) {
|
|
18
|
+
return source.ext.toLowerCase() as DatasetType
|
|
19
|
+
}
|
|
20
|
+
//
|
|
21
|
+
if (source.type === 'POLYMATICA') {
|
|
22
|
+
return 'api'
|
|
23
|
+
}
|
|
24
|
+
//
|
|
25
|
+
return 'db'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const getSourceIcon = (type: DatasetType) => {
|
|
29
|
+
switch (type) {
|
|
30
|
+
case 'api':
|
|
31
|
+
return TbApi
|
|
32
|
+
case 'txt':
|
|
33
|
+
case 'csv':
|
|
34
|
+
return TbFileTypeCsv
|
|
35
|
+
case 'xml':
|
|
36
|
+
return TbFileTypeXml
|
|
37
|
+
case 'xls':
|
|
38
|
+
case 'xlsx':
|
|
39
|
+
return TbFileTypeXls
|
|
40
|
+
case 'json':
|
|
41
|
+
return TbJson
|
|
42
|
+
default:
|
|
43
|
+
return TbDatabase
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Source } from './Source'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cva, VariantProps } from 'class-variance-authority'
|
|
2
|
+
|
|
3
|
+
import { twJoin } from '@/utils'
|
|
4
|
+
|
|
5
|
+
export const rootStyles = cva(
|
|
6
|
+
twJoin({
|
|
7
|
+
display: 'flex size-7.5 items-center justify-center',
|
|
8
|
+
visual: 'rounded-full',
|
|
9
|
+
childs: '[&_svg]:size-5.5'
|
|
10
|
+
}),
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
status: {
|
|
14
|
+
pending: 'text-info bg-info/15',
|
|
15
|
+
success: 'text-success bg-success/15',
|
|
16
|
+
error: 'text-danger bg-danger/15'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
status: 'pending'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
export type RootStylesProps = VariantProps<typeof rootStyles>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// import { useTranslations } from 'next-intl'
|
|
2
|
+
// import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
// import { Tooltip } from '@/components/atoms'
|
|
5
|
+
|
|
6
|
+
// import { rootStyles } from './Status.styles'
|
|
7
|
+
|
|
8
|
+
// import { getSourceIcon, toNormilizeCase } from './Status.utils'
|
|
9
|
+
|
|
10
|
+
// type StatusProps = ComponentProps<'span'> & {
|
|
11
|
+
// status?: any
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
// function Status({ status }: StatusProps) {
|
|
15
|
+
// const t = useTranslations('status')
|
|
16
|
+
// //
|
|
17
|
+
// const Icon = getSourceIcon(status!)
|
|
18
|
+
// //
|
|
19
|
+
// return (
|
|
20
|
+
// <Tooltip title={t(toNormilizeCase(status!))} side='left'>
|
|
21
|
+
// <span className={rootStyles({ status: toNormilizeCase(status!) })}>
|
|
22
|
+
// <Icon />
|
|
23
|
+
// </span>
|
|
24
|
+
// </Tooltip>
|
|
25
|
+
// )
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
// export { Status }
|
|
29
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// import { TbAlertCircle, TbCircleArrowDown, TbCircleCheck } from 'react-icons/tb'
|
|
2
|
+
|
|
3
|
+
// export const getSourceIcon = (status: DatasetStatus) => {
|
|
4
|
+
// switch (status) {
|
|
5
|
+
// case DatasetStatus.Success:
|
|
6
|
+
// return TbCircleCheck
|
|
7
|
+
// case DatasetStatus.Error:
|
|
8
|
+
// return TbAlertCircle
|
|
9
|
+
// default:
|
|
10
|
+
// return TbCircleArrowDown
|
|
11
|
+
// }
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
// ////////////
|
|
15
|
+
|
|
16
|
+
// export const toNormilizeCase = (
|
|
17
|
+
// status: DatasetStatus
|
|
18
|
+
// ): 'pending' | 'success' | 'error' => {
|
|
19
|
+
// switch (status) {
|
|
20
|
+
// case DatasetStatus.Pending:
|
|
21
|
+
// return 'pending'
|
|
22
|
+
// case DatasetStatus.Success:
|
|
23
|
+
// return 'success'
|
|
24
|
+
// case DatasetStatus.Error:
|
|
25
|
+
// return 'error'
|
|
26
|
+
// default:
|
|
27
|
+
// return 'pending'
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export { Status } from './Status'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// import { useTranslations } from 'next-intl'
|
|
2
|
+
// import { type ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
// import { TbTable, TbTableAlias } from 'react-icons/tb'
|
|
5
|
+
|
|
6
|
+
// import { Tooltip, Typography } from '@/components/atoms'
|
|
7
|
+
|
|
8
|
+
// import { rootStyles } from './Type.styles'
|
|
9
|
+
|
|
10
|
+
// import { toNormilizeCase } from './Type.utils'
|
|
11
|
+
|
|
12
|
+
// const { Text } = Typography
|
|
13
|
+
|
|
14
|
+
// type TypeProps = ComponentProps<'span'> & {
|
|
15
|
+
// type: DatasetType
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
// function Type({ type }: TypeProps) {
|
|
19
|
+
// const t = useTranslations('datasets.type')
|
|
20
|
+
// //
|
|
21
|
+
// const Icon = type === DatasetType.Local ? TbTable : TbTableAlias
|
|
22
|
+
// //
|
|
23
|
+
// return (
|
|
24
|
+
// <Tooltip title={t(toNormilizeCase(type))} side='right'>
|
|
25
|
+
// <Text className={rootStyles}>
|
|
26
|
+
// <Icon />
|
|
27
|
+
// </Text>
|
|
28
|
+
// </Tooltip>
|
|
29
|
+
// )
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
// export { Type }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// import { DatasetType } from '@/graphql'
|
|
2
|
+
|
|
3
|
+
// ////////////
|
|
4
|
+
|
|
5
|
+
// export const toNormilizeCase = (type: DatasetType): 'local' | 'joined' => {
|
|
6
|
+
// switch (type) {
|
|
7
|
+
// case DatasetType.Local:
|
|
8
|
+
// return 'local'
|
|
9
|
+
// case DatasetType.Joined:
|
|
10
|
+
// return 'joined'
|
|
11
|
+
// default:
|
|
12
|
+
// return 'local'
|
|
13
|
+
// }
|
|
14
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export { Type } from './Type'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export { DatasetsTable } from './DatasetsTable'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { twJoin } from '@/utils'
|
|
2
|
+
|
|
3
|
+
export const sidebarWrapperStyles = twJoin({
|
|
4
|
+
tw: 'group/sidebar-wrapper',
|
|
5
|
+
display: 'flex min-h-svh w-full'
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export const pageWrapperStyles = twJoin({
|
|
9
|
+
position: 'relative',
|
|
10
|
+
display: 'flex min-h-screen w-full flex-col px-6.5 pt-4',
|
|
11
|
+
visual: 'bg-background',
|
|
12
|
+
//
|
|
13
|
+
dark: 'dark:bg-dark-background'
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const headerBackdropStyles = twJoin({
|
|
17
|
+
position: 'fixed top-0 left-0',
|
|
18
|
+
display: 'h-19.5 w-full',
|
|
19
|
+
visual: 'bg-background/70 backdrop-blur-xs',
|
|
20
|
+
dark: 'dark:bg-dark-background/80'
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const contentWrapperStyles = twJoin({
|
|
24
|
+
position: 'relative',
|
|
25
|
+
display: 'pt-6.5'
|
|
26
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Typography } from '@/components/atoms'
|
|
4
|
+
|
|
5
|
+
import { Header, Sidebar } from '@/components/molecules'
|
|
6
|
+
|
|
7
|
+
import { SidebarProvider } from '@/providers'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
contentWrapperStyles,
|
|
11
|
+
headerBackdropStyles,
|
|
12
|
+
pageWrapperStyles,
|
|
13
|
+
sidebarWrapperStyles
|
|
14
|
+
} from './DefaultLayout.styles'
|
|
15
|
+
|
|
16
|
+
const { Title } = Typography
|
|
17
|
+
|
|
18
|
+
type DefaultLayoutProps = {
|
|
19
|
+
title: string
|
|
20
|
+
children: ReactNode
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function DefaultLayout({ title, children }: DefaultLayoutProps) {
|
|
24
|
+
return (
|
|
25
|
+
<div className={sidebarWrapperStyles}>
|
|
26
|
+
<SidebarProvider>
|
|
27
|
+
<Sidebar />
|
|
28
|
+
<div className={pageWrapperStyles}>
|
|
29
|
+
<Header />
|
|
30
|
+
<div className={contentWrapperStyles}>
|
|
31
|
+
<div className={headerBackdropStyles}></div>
|
|
32
|
+
<Title level={4} className='mb-6.5'>
|
|
33
|
+
{title}
|
|
34
|
+
</Title>
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</SidebarProvider>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DefaultLayout } from './DefaultLayout'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { twJoin } from '@/utils'
|
|
2
|
+
|
|
3
|
+
export const rootStyles = twJoin({
|
|
4
|
+
display: 'mx-auto w-330 p-8'
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
// /////////////////////////
|
|
8
|
+
|
|
9
|
+
export const bgStyles = twJoin({
|
|
10
|
+
display: 'h-[calc(100vh-64px)] w-full',
|
|
11
|
+
visual: ' rounded-2xl bg-cover bg-center'
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
// /////////////////////////
|
|
15
|
+
|
|
16
|
+
export const gridStyles = twJoin({
|
|
17
|
+
display: 'grid grid-cols-24 items-center'
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// /////////////////////////
|
|
21
|
+
|
|
22
|
+
export const contentStyles = twJoin({
|
|
23
|
+
display: 'm-auto flex h-[35vh] flex-col items-center justify-center',
|
|
24
|
+
text: 'text-center'
|
|
25
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
2
|
+
import { type ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
bgStyles,
|
|
6
|
+
contentStyles,
|
|
7
|
+
gridStyles,
|
|
8
|
+
rootStyles
|
|
9
|
+
} from './PageLayout.styles'
|
|
10
|
+
|
|
11
|
+
type PageLayoutProps = {
|
|
12
|
+
className?: string
|
|
13
|
+
children: ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function PageLayout({ className, children }: PageLayoutProps) {
|
|
17
|
+
return (
|
|
18
|
+
<div className={rootStyles}>
|
|
19
|
+
<div className={clsx(bgStyles, className)}>
|
|
20
|
+
<div className={gridStyles}>
|
|
21
|
+
<div className='col-span-16 col-start-5'>
|
|
22
|
+
<div className={contentStyles}>{children}</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageLayout } from './PageLayout'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getRequestConfig } from 'next-intl/server'
|
|
2
|
+
import { cookies } from 'next/headers'
|
|
3
|
+
|
|
4
|
+
const COOKIE_NAME = 'language'
|
|
5
|
+
const languages = ['ru', 'en']
|
|
6
|
+
const defaultLanguage: Language = 'ru'
|
|
7
|
+
|
|
8
|
+
type Language = (typeof languages)[number]
|
|
9
|
+
|
|
10
|
+
////////////
|
|
11
|
+
|
|
12
|
+
export async function getCurrentLanguage() {
|
|
13
|
+
const cookiesStore = await cookies()
|
|
14
|
+
|
|
15
|
+
const language = cookiesStore.get(COOKIE_NAME)?.value ?? defaultLanguage
|
|
16
|
+
|
|
17
|
+
return language
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
////////////
|
|
21
|
+
|
|
22
|
+
export async function setCurrentLanguage(language: Language) {
|
|
23
|
+
const cookiesStore = await cookies()
|
|
24
|
+
|
|
25
|
+
return cookiesStore.set(COOKIE_NAME, language)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
////////////
|
|
29
|
+
|
|
30
|
+
export default getRequestConfig(async () => {
|
|
31
|
+
const language = await getCurrentLanguage()
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
locale: language,
|
|
35
|
+
messages: {
|
|
36
|
+
datasets: (
|
|
37
|
+
await import(`../../public/locales/${language}/datasets.json`)
|
|
38
|
+
).default,
|
|
39
|
+
errors: (
|
|
40
|
+
await import(`../../public/locales/${language}/errors.json`)
|
|
41
|
+
).default,
|
|
42
|
+
...(await import(`../../public/locales/${language}/general.json`))
|
|
43
|
+
.default
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, Dispatch, SetStateAction } from 'react'
|
|
2
|
+
|
|
3
|
+
import { IFileInfo } from '@/types'
|
|
4
|
+
|
|
5
|
+
export type CreateComponentContextProps = {
|
|
6
|
+
name: string
|
|
7
|
+
setName: Dispatch<SetStateAction<string>>
|
|
8
|
+
//
|
|
9
|
+
fileInfo: IFileInfo | null
|
|
10
|
+
setFileInfo: Dispatch<SetStateAction<IFileInfo | null>>
|
|
11
|
+
//
|
|
12
|
+
componentPath: string
|
|
13
|
+
setComponentPath: Dispatch<SetStateAction<string>>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CreateComponentContext =
|
|
17
|
+
createContext<CreateComponentContextProps | null>(null)
|