@ebubekirylmaz/link-test 1.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/.babelrc +3 -0
- package/.browserslistrc +1 -0
- package/.env +2 -0
- package/.eslintignore +3 -0
- package/.eslintrc.json +58 -0
- package/.gitattributes +1 -0
- package/.github/workflows/publish.yml +66 -0
- package/.prettierignore +1 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +15 -0
- package/.storybook/preview.js +17 -0
- package/.storybook/vitest.setup.js +6 -0
- package/README.md +1 -0
- package/cypress.config.js +11 -0
- package/index.js +1 -0
- package/package.json +111 -0
- package/project/.eslintrc.cjs +22 -0
- package/project/config.js +18 -0
- package/project/config.menu.js +39 -0
- package/project/config.template.js +31 -0
- package/project/cypress/e2e/layouts.cy.js +170 -0
- package/project/cypress/e2e/login.cy.js +35 -0
- package/project/cypress/e2e/selectbar.cy.js +80 -0
- package/project/cypress/fixtures/CONFIG/MENU_CONFIG.js +39 -0
- package/project/cypress/fixtures/EMPEROR/EMPERORS_GET.json +51 -0
- package/project/cypress/fixtures/EMPEROR/EMPERORS_POST.json +9 -0
- package/project/cypress/fixtures/OAUTH/GITHUB/user.json +46 -0
- package/project/cypress/fixtures/example.json +5 -0
- package/project/cypress/support/commands.js +104 -0
- package/project/cypress/support/e2e.js +1 -0
- package/project/cypress.config.js +10 -0
- package/project/index.html +12 -0
- package/project/media/ProjectIcons/3d.png +0 -0
- package/project/media/ProjectIcons/box.png +0 -0
- package/project/media/ProjectIcons/cafe.png +0 -0
- package/project/media/ProjectIcons/cargo.png +0 -0
- package/project/media/ProjectIcons/cloud.png +0 -0
- package/project/media/ProjectIcons/code.png +0 -0
- package/project/media/ProjectIcons/company.png +0 -0
- package/project/media/ProjectIcons/conversation.png +0 -0
- package/project/media/ProjectIcons/distributed.png +0 -0
- package/project/media/ProjectIcons/fingerprint.png +0 -0
- package/project/media/ProjectIcons/forest.png +0 -0
- package/project/media/ProjectIcons/headphones.png +0 -0
- package/project/media/ProjectIcons/office.png +0 -0
- package/project/media/ProjectIcons/path.png +0 -0
- package/project/media/ProjectIcons/printer.png +0 -0
- package/project/media/ProjectIcons/project.png +0 -0
- package/project/media/ProjectIcons/resume.png +0 -0
- package/project/media/ProjectIcons/rocket.png +0 -0
- package/project/media/ProjectIcons/rtruck.png +0 -0
- package/project/media/ProjectIcons/sign.png +0 -0
- package/project/media/ProjectIcons/site.png +0 -0
- package/project/media/ProjectIcons/truck.png +0 -0
- package/project/media/logo.png +0 -0
- package/project/package-lock.json +22434 -0
- package/project/package.json +42 -0
- package/project/public/assets/background/overlay_2.jpg +0 -0
- package/project/public/assets/illustrations/illustration_dashboard.png +0 -0
- package/project/public/media/largeLogo.png +0 -0
- package/project/public/media/logo.png +0 -0
- package/project/public/vite.svg +1 -0
- package/project/routes.jsx +47 -0
- package/project/server/mock.json +110 -0
- package/project/server/oauthMock.js +27 -0
- package/project/server/package-lock.json +1505 -0
- package/project/server/package.json +20 -0
- package/project/server/server.js +127 -0
- package/project/src/Container.jsx +7 -0
- package/project/src/components/ActionButton.jsx +18 -0
- package/project/src/hooks/useEmperor.jsx +21 -0
- package/project/src/http/index.js +39 -0
- package/project/src/main.jsx +10 -0
- package/project/src/pages/Battles.jsx +16 -0
- package/project/src/pages/Emperor.jsx +50 -0
- package/project/src/pages/index.jsx +33 -0
- package/project/src/theme.js +151 -0
- package/project/src/widgets/ActionButton.jsx +68 -0
- package/project/src/widgets/AddNewEmperor.jsx +120 -0
- package/project/src/widgets/ProjectContainer.jsx +27 -0
- package/project/vite.config.js +6 -0
- package/project/vite.config.js.timestamp-1709564450418-45fdd27900806.mjs +341 -0
- package/public/assets/background/overlay_2.jpg +0 -0
- package/public/assets/illustrations/illustration_dashboard.png +0 -0
- package/public/vite.svg +1 -0
- package/src/ContextProvider/ContextProvider.jsx +19 -0
- package/src/GlobalSnackMessage/GlobalSnackMessage.jsx +45 -0
- package/src/GlobalSnackMessage/index.js +1 -0
- package/src/GlobalSnackMessage/styles.js +3 -0
- package/src/Platform.jsx +76 -0
- package/src/RouteManager/RouteManager.jsx +56 -0
- package/src/RouteManager/index.js +1 -0
- package/src/assets/illustrations/avatar-shape.jsx +31 -0
- package/src/assets/illustrations/background-shape.jsx +37 -0
- package/src/assets/illustrations/booking-illustration.jsx +335 -0
- package/src/assets/illustrations/check-in-illustration.jsx +96 -0
- package/src/assets/illustrations/check-out-illustration.jsx +69 -0
- package/src/assets/illustrations/coming-soon-illustration.jsx +125 -0
- package/src/assets/illustrations/forbidden-illustration.jsx +95 -0
- package/src/assets/illustrations/index.js +2 -0
- package/src/assets/illustrations/maintenance-illustration.jsx +228 -0
- package/src/assets/illustrations/motivation-illustration.jsx +74 -0
- package/src/assets/illustrations/order-complete-illustration.jsx +126 -0
- package/src/assets/illustrations/page-not-found-illustration.jsx +81 -0
- package/src/assets/illustrations/seo-illustration.jsx +244 -0
- package/src/assets/illustrations/sever-error-illustration.jsx +152 -0
- package/src/assets/illustrations/upgrade-storage-illustration.jsx +161 -0
- package/src/assets/illustrations/upload-illustration.jsx +622 -0
- package/src/components/Iconify/Iconify.jsx +18 -0
- package/src/components/Iconify/index.js +1 -0
- package/src/components/MiniTopBar/MiniTopBar.jsx +25 -0
- package/src/components/MiniTopBar/index.js +1 -0
- package/src/components/MiniTopBar/styles.js +6 -0
- package/src/components/NucleoidLoginForm/NucleoidLoginForm.jsx +69 -0
- package/src/components/NucleoidLoginForm/index.js +1 -0
- package/src/components/NucleoidLoginForm/styles.js +3 -0
- package/src/components/Sidebar/Sidebar.jsx +76 -0
- package/src/components/Sidebar/index.js +1 -0
- package/src/components/Sidebar/styles.js +25 -0
- package/src/components/SocialLoginButtons/SocialLoginButtons.jsx +55 -0
- package/src/components/SocialLoginButtons/index.js +1 -0
- package/src/components/SocialLoginButtons/styles.js +3 -0
- package/src/components/TopNavBar/TopNavBar.jsx +186 -0
- package/src/components/TopNavBar/index.js +1 -0
- package/src/components/TopNavBar/styles.js +7 -0
- package/src/components/animate/index.js +4 -0
- package/src/components/animate/motion-container.jsx +38 -0
- package/src/components/animate/motion-lazy.jsx +11 -0
- package/src/components/animate/motion-viewport.jsx +30 -0
- package/src/components/animate/variants/actions.js +4 -0
- package/src/components/animate/variants/background.js +97 -0
- package/src/components/animate/variants/bounce.js +107 -0
- package/src/components/animate/variants/container.js +20 -0
- package/src/components/animate/variants/fade.js +127 -0
- package/src/components/animate/variants/flip.js +54 -0
- package/src/components/animate/variants/index.js +12 -0
- package/src/components/animate/variants/path.js +12 -0
- package/src/components/animate/variants/rotate.js +33 -0
- package/src/components/animate/variants/scale.js +54 -0
- package/src/components/animate/variants/slide.js +65 -0
- package/src/components/animate/variants/transition.js +20 -0
- package/src/components/animate/variants/zoom.js +130 -0
- package/src/components/chart/chart.js +69 -0
- package/src/components/chart/index.js +5 -0
- package/src/components/chart/use-chart.js +215 -0
- package/src/components/custom-popover/custom-popover.jsx +46 -0
- package/src/components/custom-popover/index.js +3 -0
- package/src/components/custom-popover/styles.js +84 -0
- package/src/components/custom-popover/use-popover.js +22 -0
- package/src/components/custom-popover/utils.js +100 -0
- package/src/components/file-thumbnail/download-button.jsx +39 -0
- package/src/components/file-thumbnail/file-thumbnail.jsx +72 -0
- package/src/components/file-thumbnail/index.js +5 -0
- package/src/components/file-thumbnail/utils.js +148 -0
- package/src/components/image/image.jsx +119 -0
- package/src/components/image/index.js +1 -0
- package/src/components/image/utils.js +15 -0
- package/src/components/label/index.js +1 -0
- package/src/components/label/label.jsx +51 -0
- package/src/components/label/styles.js +78 -0
- package/src/components/loading-screen/index.js +2 -0
- package/src/components/loading-screen/loading-screen.jsx +23 -0
- package/src/components/loading-screen/splash-screen.jsx +95 -0
- package/src/components/logo/index.js +1 -0
- package/src/components/logo/logo.jsx +61 -0
- package/src/components/logo/styles.js +17 -0
- package/src/components/nav-section/horizontal/index.js +1 -0
- package/src/components/nav-section/horizontal/nav-item.jsx +224 -0
- package/src/components/nav-section/horizontal/nav-list.jsx +113 -0
- package/src/components/nav-section/horizontal/nav-section-horizontal.jsx +41 -0
- package/src/components/nav-section/index.js +3 -0
- package/src/components/nav-section/mini/index.js +1 -0
- package/src/components/nav-section/mini/nav-item.jsx +242 -0
- package/src/components/nav-section/mini/nav-list.jsx +107 -0
- package/src/components/nav-section/mini/nav-section-mini.jsx +35 -0
- package/src/components/nav-section/vertical/index.js +1 -0
- package/src/components/nav-section/vertical/nav-item.jsx +294 -0
- package/src/components/nav-section/vertical/nav-list.jsx +66 -0
- package/src/components/nav-section/vertical/nav-section-vertical.jsx +74 -0
- package/src/components/scrollbar/index.js +1 -0
- package/src/components/scrollbar/scrollbar.jsx +39 -0
- package/src/components/scrollbar/styles.js +27 -0
- package/src/components/search-not-found/index.js +1 -0
- package/src/components/search-not-found/search-not-found.jsx +29 -0
- package/src/components/settings/context/index.js +2 -0
- package/src/components/settings/context/settings-context.js +14 -0
- package/src/components/settings/context/settings-provider.jsx +46 -0
- package/src/components/settings/drawer/base-option.jsx +52 -0
- package/src/components/settings/drawer/fullscreen-option.jsx +58 -0
- package/src/components/settings/drawer/index.js +1 -0
- package/src/components/settings/drawer/layout-options.jsx +144 -0
- package/src/components/settings/drawer/presets-options.jsx +53 -0
- package/src/components/settings/drawer/settings-drawer.jsx +189 -0
- package/src/components/settings/drawer/stretch-options.jsx +67 -0
- package/src/components/settings/index.js +3 -0
- package/src/components/svg-color/index.js +1 -0
- package/src/components/svg-color/svg-color.jsx +23 -0
- package/src/config/config.js +48 -0
- package/src/config/schemas.js +148 -0
- package/src/context/reducer.js +52 -0
- package/src/global.css +2 -0
- package/src/hooks/index.js +2 -0
- package/src/hooks/use-boolean.js +27 -0
- package/src/hooks/use-event-listener.js +34 -0
- package/src/hooks/use-local-storage.js +89 -0
- package/src/hooks/use-off-set-top.js +37 -0
- package/src/hooks/use-responsive.js +47 -0
- package/src/hooks/use-scroll-to-top.js +14 -0
- package/src/hooks/use-user.js +58 -0
- package/src/hooks/useApi.js +25 -0
- package/src/hooks/useItemsState.js +23 -0
- package/src/hooks/useProjects.js +24 -0
- package/src/hooks/useSettings.jsx +51 -0
- package/src/http/index.js +155 -0
- package/src/http/oauth.js +27 -0
- package/src/http/user.js +110 -0
- package/src/layouts/AppLayout.jsx +113 -0
- package/src/layouts/CompactLayout/CompactLayout.jsx +32 -0
- package/src/layouts/CompactLayout/index.js +1 -0
- package/src/layouts/DashboardLayout/DashboardLayout.jsx +87 -0
- package/src/layouts/DashboardLayout/config-navigation.jsx +0 -0
- package/src/layouts/DashboardLayout/header.jsx +104 -0
- package/src/layouts/DashboardLayout/index.js +2 -0
- package/src/layouts/DashboardLayout/main.jsx +64 -0
- package/src/layouts/DashboardLayout/nav-horizontal.jsx +62 -0
- package/src/layouts/DashboardLayout/nav-mini.jsx +99 -0
- package/src/layouts/DashboardLayout/nav-vertical.jsx +201 -0
- package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +101 -0
- package/src/layouts/FullScreenLayout/index.js +1 -0
- package/src/layouts/FullScreenLayout/nav-horizontal.jsx +50 -0
- package/src/layouts/FullScreenLayout/nav-vertical.jsx +136 -0
- package/src/layouts/MainLayout/MainLayout.jsx +21 -0
- package/src/layouts/MainLayout/footer.jsx +153 -0
- package/src/layouts/MainLayout/header.jsx +81 -0
- package/src/layouts/MainLayout/index.js +1 -0
- package/src/layouts/MainLayout/nav/desktop/index.jsx +20 -0
- package/src/layouts/MainLayout/nav/desktop/nav-item.jsx +186 -0
- package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +145 -0
- package/src/layouts/MainLayout/nav/mobile/index.jsx +60 -0
- package/src/layouts/MainLayout/nav/mobile/nav-item.jsx +90 -0
- package/src/layouts/MainLayout/nav/mobile/nav-list.jsx +72 -0
- package/src/layouts/Page.jsx +16 -0
- package/src/layouts/SimpleLayout/SimpleLayout.jsx +8 -0
- package/src/layouts/SimpleLayout/index.js +1 -0
- package/src/layouts/TwoSideLayout/TwoSideLayout.jsx +31 -0
- package/src/layouts/TwoSideLayout/index.js +1 -0
- package/src/layouts/auth/classic.jsx +95 -0
- package/src/layouts/auth/modern-compact.jsx +51 -0
- package/src/layouts/auth/modern.jsx +94 -0
- package/src/layouts/common/ProjectBar/index.jsx +325 -0
- package/src/layouts/common/ProjectBar/result-item.jsx +90 -0
- package/src/layouts/common/ProjectBar/utils.js +86 -0
- package/src/layouts/common/account-popover.jsx +116 -0
- package/src/layouts/common/header-shadow.jsx +26 -0
- package/src/layouts/common/header-sim.jsx +52 -0
- package/src/layouts/common/header-simple.jsx +76 -0
- package/src/layouts/common/nav-toggle-button.jsx +57 -0
- package/src/layouts/common/notifications-popover/index.jsx +177 -0
- package/src/layouts/common/notifications-popover/notification-item.jsx +252 -0
- package/src/layouts/common/settings-button.jsx +48 -0
- package/src/layouts/config-layout.js +12 -0
- package/src/layouts/index.js +7 -0
- package/src/lib/AddItemWizard/AddItemWizard.jsx +211 -0
- package/src/lib/AddItemWizard/index.js +1 -0
- package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +88 -0
- package/src/lib/CustomBreadcrumbs/index.js +1 -0
- package/src/lib/CustomBreadcrumbs/link-item.jsx +58 -0
- package/src/lib/CustomPopover/CustomPopover.jsx +46 -0
- package/src/lib/CustomPopover/index.js +3 -0
- package/src/lib/CustomPopover/styles.js +82 -0
- package/src/lib/CustomPopover/usePopover.js +20 -0
- package/src/lib/CustomPopover/utils.js +100 -0
- package/src/lib/Flow/connectors/DynamicConnector.jsx +247 -0
- package/src/lib/Flow/core/Flow.jsx +79 -0
- package/src/lib/Flow/core/FlowNode.jsx +68 -0
- package/src/lib/Flow/core/FlowViewport.jsx +259 -0
- package/src/lib/Flow/graph/FloatingGraph.jsx +44 -0
- package/src/lib/Flow/hooks/useGraphOperations.js +362 -0
- package/src/lib/Flow/hooks/useNodeStyle.js +56 -0
- package/src/lib/Flow/index.js +1 -0
- package/src/lib/Flow/layouts/ActionNode.jsx +78 -0
- package/src/lib/Flow/layouts/AnimatedNode.jsx +22 -0
- package/src/lib/Flow/layouts/CardLayout.jsx +397 -0
- package/src/lib/Flow/layouts/InfoNode.jsx +255 -0
- package/src/lib/Flow/layouts/LoadingNode.jsx +37 -0
- package/src/lib/Flow/nodes/DefaultCard.jsx +107 -0
- package/src/lib/Flow/nodes/DraggableNode.jsx +162 -0
- package/src/lib/Flow/nodes/FlowNodeView.jsx +214 -0
- package/src/lib/Flow/selection/SelectionContext.jsx +259 -0
- package/src/lib/Flow/selection/SelectionOverlay.jsx +31 -0
- package/src/lib/Flow/styles.js +154 -0
- package/src/lib/Flow/utils/flowUtils.js +268 -0
- package/src/lib/FormProvider/FormProvider.jsx +16 -0
- package/src/lib/FormProvider/index.js +1 -0
- package/src/lib/IconSelector/IconSelector.jsx +89 -0
- package/src/lib/Iconify/Iconify.jsx +17 -0
- package/src/lib/Iconify/index.js +1 -0
- package/src/lib/Image/Image.jsx +116 -0
- package/src/lib/Image/index.js +1 -0
- package/src/lib/Image/utils.js +15 -0
- package/src/lib/ItemSummary/ItemSummary.jsx +77 -0
- package/src/lib/ItemSummary/ItemsSummary.jsx +163 -0
- package/src/lib/Label/Label.jsx +51 -0
- package/src/lib/Label/index.js +1 -0
- package/src/lib/Label/styles.js +76 -0
- package/src/lib/ProjectWizard.jsx +137 -0
- package/src/lib/RHFTextfield/RHFTextfield.jsx +39 -0
- package/src/lib/RHFTextfield/index.js +1 -0
- package/src/lib/Scrollbar/Scrollbar.jsx +39 -0
- package/src/lib/Scrollbar/index.js +1 -0
- package/src/lib/Scrollbar/styles.js +27 -0
- package/src/lib/SearchNotFound/SearchNotFound.jsx +29 -0
- package/src/lib/SearchNotFound/index.js +1 -0
- package/src/lib/SparkleInput/SparkleInput.jsx +51 -0
- package/src/lib/StepComponent/StepComponent.jsx +98 -0
- package/src/lib/SvgColor/SvgColor.jsx +28 -0
- package/src/lib/SvgColor/index.js +1 -0
- package/src/lib/TableHeadCustom/TableHeadCustom.jsx +87 -0
- package/src/lib/TableHeadCustom/index.js +1 -0
- package/src/lib/TableSelectedAction/TableSelectedAction.jsx +72 -0
- package/src/lib/TableSelectedAction/index.js +1 -0
- package/src/lib/index.js +36 -0
- package/src/lib/lib/Icons.js +40 -0
- package/src/lib/lib/context.json +272 -0
- package/src/lib/useChart/useChart.js +179 -0
- package/src/lib/useTable/useTable.js +121 -0
- package/src/pages/404.jsx +17 -0
- package/src/pages/Callback.jsx +126 -0
- package/src/pages/ConfigError.jsx +49 -0
- package/src/pages/LoginPage.jsx +43 -0
- package/src/routes/components/index.js +1 -0
- package/src/routes/components/router-link.jsx +11 -0
- package/src/routes/hooks/index.js +4 -0
- package/src/routes/hooks/use-active-link.js +15 -0
- package/src/routes/hooks/use-pathname.js +10 -0
- package/src/routes/hooks/use-router.js +21 -0
- package/src/stories/FlowChart.stories.jsx +333 -0
- package/src/stories/Iconify.stories.jsx +183 -0
- package/src/stories/Label.stories.jsx +447 -0
- package/src/stories/Navbar.stories.jsx +588 -0
- package/src/theme/css.js +152 -0
- package/src/theme/custom-shadows.js +47 -0
- package/src/theme/index.jsx +100 -0
- package/src/theme/options/contrast.js +34 -0
- package/src/theme/options/presets.js +89 -0
- package/src/theme/options/right-to-left.jsx +26 -0
- package/src/theme/overrides/components/accordion.js +43 -0
- package/src/theme/overrides/components/alert.js +69 -0
- package/src/theme/overrides/components/appbar.js +13 -0
- package/src/theme/overrides/components/autocomplete.js +44 -0
- package/src/theme/overrides/components/avatar.js +111 -0
- package/src/theme/overrides/components/backdrop.js +18 -0
- package/src/theme/overrides/components/badge.js +90 -0
- package/src/theme/overrides/components/breadcrumbs.js +21 -0
- package/src/theme/overrides/components/button-group.js +90 -0
- package/src/theme/overrides/components/button.js +145 -0
- package/src/theme/overrides/components/card.js +30 -0
- package/src/theme/overrides/components/checkbox.js +13 -0
- package/src/theme/overrides/components/chip.js +129 -0
- package/src/theme/overrides/components/css-baseline.js +48 -0
- package/src/theme/overrides/components/data-grid.js +94 -0
- package/src/theme/overrides/components/date-picker.jsx +94 -0
- package/src/theme/overrides/components/dialog.js +49 -0
- package/src/theme/overrides/components/drawer.js +39 -0
- package/src/theme/overrides/components/fab.js +165 -0
- package/src/theme/overrides/components/list.js +33 -0
- package/src/theme/overrides/components/loading-button.js +30 -0
- package/src/theme/overrides/components/menu.js +15 -0
- package/src/theme/overrides/components/pagination.js +81 -0
- package/src/theme/overrides/components/paper.js +18 -0
- package/src/theme/overrides/components/popover.js +20 -0
- package/src/theme/overrides/components/progress.js +40 -0
- package/src/theme/overrides/components/radio.js +22 -0
- package/src/theme/overrides/components/rating.js +40 -0
- package/src/theme/overrides/components/select.js +26 -0
- package/src/theme/overrides/components/skeleton.js +16 -0
- package/src/theme/overrides/components/slider.js +30 -0
- package/src/theme/overrides/components/stepper.js +13 -0
- package/src/theme/overrides/components/svg-icon.js +15 -0
- package/src/theme/overrides/components/switch.js +66 -0
- package/src/theme/overrides/components/table.js +79 -0
- package/src/theme/overrides/components/tabs.js +39 -0
- package/src/theme/overrides/components/textfield.js +146 -0
- package/src/theme/overrides/components/timeline.js +20 -0
- package/src/theme/overrides/components/toggle-button.js +70 -0
- package/src/theme/overrides/components/tooltip.js +18 -0
- package/src/theme/overrides/components/tree-view.js +16 -0
- package/src/theme/overrides/components/typography.js +16 -0
- package/src/theme/overrides/default-props.jsx +238 -0
- package/src/theme/overrides/index.js +100 -0
- package/src/theme/palette.js +144 -0
- package/src/theme/shadows.js +41 -0
- package/src/theme/typography.js +107 -0
- package/src/utils/flatten-array.js +16 -0
- package/src/utils/format-number.js +37 -0
- package/src/utils/format-time.js +27 -0
- package/src/utils/storage-available.js +24 -0
- package/src/widgets/Login/CognitoLogin.jsx +43 -0
- package/src/widgets/Login/Login.jsx +58 -0
- package/src/widgets/Login/cognitoAuth.jsx +26 -0
- package/src/widgets/LoginForm/LoginForm.jsx +87 -0
- package/src/widgets/LoginForm/LoginFormStyles.js +43 -0
- package/src/widgets/LoginForm/index.js +1 -0
- package/src/widgets/SettingsDialog.jsx +308 -0
- package/src/widgets/error/index.js +1 -0
- package/src/widgets/error/not-found-view.jsx +42 -0
- package/vite/vite.js +77 -0
- package/vite.config.js +7 -0
- package/vitest.config.js +32 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "json server for example project",
|
|
5
|
+
"main": "server.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"start": "node server.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"cors": "^2.8.5",
|
|
14
|
+
"joi": "^17.13.3",
|
|
15
|
+
"jsonwebtoken": "^9.0.2"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"json-server": "^0.17.4"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
const jsonServer = require("json-server");
|
|
2
|
+
const cors = require("cors");
|
|
3
|
+
|
|
4
|
+
const jwt = require("jsonwebtoken");
|
|
5
|
+
const axios = require("axios");
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
mockPermission,
|
|
9
|
+
config,
|
|
10
|
+
JWT_SECRET,
|
|
11
|
+
OAUTH_CLIENT_SECRET,
|
|
12
|
+
} = require("./oauthMock");
|
|
13
|
+
|
|
14
|
+
const server = jsonServer.create();
|
|
15
|
+
const router = jsonServer.router("mock.json");
|
|
16
|
+
const middlewares = jsonServer.defaults();
|
|
17
|
+
|
|
18
|
+
server.use(jsonServer.bodyParser);
|
|
19
|
+
server.use(middlewares);
|
|
20
|
+
server.use(cors());
|
|
21
|
+
|
|
22
|
+
server.post("/oauth", async (req, res) => {
|
|
23
|
+
let { appId, projectId, code, refreshToken, redirectUri } = req.body;
|
|
24
|
+
if (!code && !refreshToken) {
|
|
25
|
+
return res.status(400).send("Missing OAuth Code and Refresh Token");
|
|
26
|
+
}
|
|
27
|
+
if (code && redirectUri) {
|
|
28
|
+
const params = new URLSearchParams();
|
|
29
|
+
params.append("client_id", config.project.oauth.clientId);
|
|
30
|
+
params.append("client_secret", OAUTH_CLIENT_SECRET);
|
|
31
|
+
params.append("code", code);
|
|
32
|
+
params.append("redirect_uri", redirectUri);
|
|
33
|
+
params.append("grant_type", "authorization_code");
|
|
34
|
+
|
|
35
|
+
const { data } = await axios.post(
|
|
36
|
+
config.project.oauth.tokenUrl,
|
|
37
|
+
params.toString(),
|
|
38
|
+
{
|
|
39
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
console.log(data);
|
|
44
|
+
|
|
45
|
+
const urlParams = new URLSearchParams(data);
|
|
46
|
+
|
|
47
|
+
if (urlParams.get("error")) {
|
|
48
|
+
throw new Error(urlParams.get("error_description"));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
refreshToken = urlParams.get("access_token");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { userId, role, organizationId } = mockPermission;
|
|
55
|
+
|
|
56
|
+
let accessToken;
|
|
57
|
+
|
|
58
|
+
if (projectId) {
|
|
59
|
+
accessToken = jwt.sign(
|
|
60
|
+
{
|
|
61
|
+
sub: userId,
|
|
62
|
+
iss: "nuc",
|
|
63
|
+
aud: projectId,
|
|
64
|
+
oid: organizationId,
|
|
65
|
+
aid: appId,
|
|
66
|
+
rls: role,
|
|
67
|
+
},
|
|
68
|
+
JWT_SECRET,
|
|
69
|
+
{ expiresIn: "12h" }
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
accessToken = jwt.sign(
|
|
73
|
+
{ sub: userId, iss: "nuc", aid: appId },
|
|
74
|
+
JWT_SECRET,
|
|
75
|
+
{
|
|
76
|
+
expiresIn: "12h",
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
res.status(200).json({ accessToken, refreshToken });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
server.get("/emperors", (req, res) => {
|
|
85
|
+
res.jsonp(router.db.get("emperors").value());
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
server.patch("/projects/:id/settings", async (req, res) => {
|
|
89
|
+
const projectId = req.params.id;
|
|
90
|
+
const newSettings = req.body.settings;
|
|
91
|
+
|
|
92
|
+
const existingSettings = router.db
|
|
93
|
+
.get("settings")
|
|
94
|
+
.find({ projectId })
|
|
95
|
+
.value();
|
|
96
|
+
|
|
97
|
+
let updatedSettings;
|
|
98
|
+
|
|
99
|
+
if (existingSettings) {
|
|
100
|
+
updatedSettings = router.db
|
|
101
|
+
.get("settings")
|
|
102
|
+
.find({ projectId })
|
|
103
|
+
.assign({
|
|
104
|
+
projectId,
|
|
105
|
+
settings: {
|
|
106
|
+
...existingSettings.settings,
|
|
107
|
+
...newSettings,
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
.write();
|
|
111
|
+
} else {
|
|
112
|
+
updatedSettings = router.db
|
|
113
|
+
.get("settings")
|
|
114
|
+
.push({
|
|
115
|
+
projectId,
|
|
116
|
+
settings: { ...newSettings },
|
|
117
|
+
})
|
|
118
|
+
.write();
|
|
119
|
+
}
|
|
120
|
+
res.jsonp(updatedSettings);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
server.use(router);
|
|
124
|
+
|
|
125
|
+
server.listen(3000, () => {
|
|
126
|
+
console.log("JSON Server is running");
|
|
127
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import BoltIcon from "@mui/icons-material/Bolt";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
const EnergyButton = () => (
|
|
5
|
+
<IconButton
|
|
6
|
+
sx={{
|
|
7
|
+
width: "3rem",
|
|
8
|
+
height: "3rem",
|
|
9
|
+
borderStyle: "solid",
|
|
10
|
+
borderWidth: "1px",
|
|
11
|
+
borderColor: (theme) => theme.palette.primary,
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<BoltIcon sx={{ width: "100%", height: "100%" }} color="primary" />
|
|
15
|
+
</IconButton>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export default EnergyButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import config from "../../config";
|
|
5
|
+
|
|
6
|
+
const useEmperor = (id) => {
|
|
7
|
+
const [emperor, setEmperor] = useState([]);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
getEmperorById(id);
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
const getEmperorById = async (id) => {
|
|
14
|
+
const response = await axios.get(`${config.api}/emperors/${id}`);
|
|
15
|
+
setEmperor(response.data);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return { emperor };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default useEmperor;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import config from "../../config";
|
|
3
|
+
import { storage } from "@nucleoidjs/webstorage";
|
|
4
|
+
|
|
5
|
+
const instance = axios.create({
|
|
6
|
+
baseURL: config.api,
|
|
7
|
+
headers: {
|
|
8
|
+
common: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
instance.interceptors.request.use((request) => {
|
|
15
|
+
const accessToken = storage.get(config.name, "accessToken");
|
|
16
|
+
if (!accessToken) {
|
|
17
|
+
window.location.href =
|
|
18
|
+
config.base === "/" ? "/login" : `${config.base}/login`;
|
|
19
|
+
}
|
|
20
|
+
request.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
21
|
+
request.headers["companyId"] = "1";
|
|
22
|
+
return request;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
instance.interceptors.response.use((response) => {
|
|
26
|
+
const accessToken = storage.get(config.name, "accessToken");
|
|
27
|
+
if (!accessToken) {
|
|
28
|
+
window.location.href = "/login";
|
|
29
|
+
}
|
|
30
|
+
response.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
31
|
+
response.headers["companyId"] = "1";
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
instance.interceptors.response.use((response) => {
|
|
36
|
+
return response;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default instance;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Platform } from "@nucleoidai/platform";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import ReactDOM from "react-dom/client";
|
|
4
|
+
import routes from "../routes";
|
|
5
|
+
|
|
6
|
+
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
7
|
+
<React.StrictMode>
|
|
8
|
+
<Platform routes={routes} />
|
|
9
|
+
</React.StrictMode>
|
|
10
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import Stack from "@mui/material/Stack";
|
|
3
|
+
|
|
4
|
+
export default function Battles() {
|
|
5
|
+
return (
|
|
6
|
+
<Stack
|
|
7
|
+
spacing={1}
|
|
8
|
+
alignItems="center"
|
|
9
|
+
sx={{
|
|
10
|
+
border: "solid 0.5rem gray",
|
|
11
|
+
width: "100%",
|
|
12
|
+
height: "100vh",
|
|
13
|
+
}}
|
|
14
|
+
></Stack>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Box, Stack, Typography } from "@mui/material";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { alpha } from "@mui/material";
|
|
5
|
+
import useEmperor from "../hooks/useEmperor";
|
|
6
|
+
import { useStorage } from "@nucleoidjs/webstorage";
|
|
7
|
+
|
|
8
|
+
const Emperor = () => {
|
|
9
|
+
const [itemId] = useStorage("projectId", null);
|
|
10
|
+
|
|
11
|
+
const { emperor } = useEmperor(itemId);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<Box
|
|
16
|
+
sx={{
|
|
17
|
+
mt: 5,
|
|
18
|
+
mb: 5,
|
|
19
|
+
width: 1,
|
|
20
|
+
height: "100%",
|
|
21
|
+
borderRadius: 2,
|
|
22
|
+
bgcolor: (theme) => alpha(theme.palette.grey[500], 0.04),
|
|
23
|
+
border: (theme) => `dashed 1px ${theme.palette.divider}`,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<Stack
|
|
27
|
+
direction={"column"}
|
|
28
|
+
alignItems={"center"}
|
|
29
|
+
justifyContent={"center"}
|
|
30
|
+
p={5}
|
|
31
|
+
>
|
|
32
|
+
<Box
|
|
33
|
+
component={"img"}
|
|
34
|
+
src={emperor.portrait}
|
|
35
|
+
sx={{ width: "10rem", borderWidth: 2, borderRadius: "2rem" }}
|
|
36
|
+
/>
|
|
37
|
+
<Typography variant="h2">{emperor.name}</Typography>
|
|
38
|
+
<Typography variant="subtitle1">Reign: {emperor.reign}</Typography>
|
|
39
|
+
<Typography variant="subtitle2">Born: {emperor.born}</Typography>
|
|
40
|
+
<Stack width={"70rem"} m={2}>
|
|
41
|
+
<Typography variant="body1">{emperor.description}</Typography>
|
|
42
|
+
</Stack>
|
|
43
|
+
</Stack>
|
|
44
|
+
</Box>
|
|
45
|
+
Emperor
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default Emperor;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Container, Typography } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import { useStorage } from "@nucleoidjs/webstorage";
|
|
6
|
+
|
|
7
|
+
const Index = () => {
|
|
8
|
+
const navigate = useNavigate();
|
|
9
|
+
const [itemId] = useStorage("projectId", null);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (itemId) {
|
|
13
|
+
navigate("/emperor");
|
|
14
|
+
}
|
|
15
|
+
}, [itemId]);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Container
|
|
19
|
+
sx={{
|
|
20
|
+
height: "100dvh",
|
|
21
|
+
width: "100dvh",
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
flexDirection: "column",
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<Typography variant="h3">Select An Emperor</Typography>
|
|
29
|
+
</Container>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default Index;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { createTheme } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
let theme = createTheme({
|
|
4
|
+
palette: {
|
|
5
|
+
type: "light",
|
|
6
|
+
primary: {
|
|
7
|
+
main: "#060F12",
|
|
8
|
+
},
|
|
9
|
+
secondary: {
|
|
10
|
+
main: "#C7C7C7",
|
|
11
|
+
},
|
|
12
|
+
background: {
|
|
13
|
+
default: "#F7F7F7",
|
|
14
|
+
paper: "#EDEDED",
|
|
15
|
+
},
|
|
16
|
+
text: {
|
|
17
|
+
secondary: "#45CCB4",
|
|
18
|
+
},
|
|
19
|
+
custom: {
|
|
20
|
+
popUpBg: "#C0C0C0",
|
|
21
|
+
sidebarBG: "#1C2028",
|
|
22
|
+
error: "#CC0000",
|
|
23
|
+
loading: "#D4AF37",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
MuiButton: {
|
|
29
|
+
variant: "contained",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
theme = {
|
|
35
|
+
...theme,
|
|
36
|
+
components: {
|
|
37
|
+
MuiCssBaseline: {
|
|
38
|
+
styleOverrides: {
|
|
39
|
+
body: {
|
|
40
|
+
"&::-webkit-scrollbar, & *::-webkit-scrollbar": {
|
|
41
|
+
backgroundColor: "#fff",
|
|
42
|
+
width: 6,
|
|
43
|
+
height: 6,
|
|
44
|
+
},
|
|
45
|
+
"&::-webkit-scrollbar-thumb, & *::-webkit-scrollbar-thumb": {
|
|
46
|
+
borderRadius: 10,
|
|
47
|
+
backgroundColor: "#959595",
|
|
48
|
+
minHeight: 24,
|
|
49
|
+
border: "3px",
|
|
50
|
+
},
|
|
51
|
+
"&::-webkit-scrollbar-thumb:focus, & *::-webkit-scrollbar-thumb:focus":
|
|
52
|
+
{
|
|
53
|
+
backgroundColor: "#c9c9c9",
|
|
54
|
+
},
|
|
55
|
+
"&::-webkit-scrollbar-thumb:active, & *::-webkit-scrollbar-thumb:active":
|
|
56
|
+
{
|
|
57
|
+
backgroundColor: "#c9c9c9",
|
|
58
|
+
},
|
|
59
|
+
"&::-webkit-scrollbar-thumb:hover, & *::-webkit-scrollbar-thumb:hover":
|
|
60
|
+
{
|
|
61
|
+
backgroundColor: "#c9c9c9",
|
|
62
|
+
},
|
|
63
|
+
"&::-webkit-scrollbar-corner, & *::-webkit-scrollbar-corner": {
|
|
64
|
+
backgroundColor: "#2b2b2b",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
MuiDataGrid: {
|
|
70
|
+
styleOverrides: {
|
|
71
|
+
root: {
|
|
72
|
+
"& .MuiDataGrid-columnHeader:focus-within, & .MuiDataGrid-cell:focus-within":
|
|
73
|
+
{
|
|
74
|
+
outline: "none",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
MuiDrawer: {
|
|
80
|
+
styleOverrides: {
|
|
81
|
+
paper: {
|
|
82
|
+
backgroundColor: "#323a40",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
MuiCard: {
|
|
87
|
+
styleOverrides: {
|
|
88
|
+
root: {
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "column",
|
|
91
|
+
justifyContent: "space-between",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
MuiCardActions: {
|
|
96
|
+
styleOverrides: {
|
|
97
|
+
root: {
|
|
98
|
+
justifyContent: "center",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
MuiBackdrop: {
|
|
103
|
+
styleOverrides: {
|
|
104
|
+
root: {
|
|
105
|
+
backgroundColor: "rgba(0,0,0,0.1)",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
MuiTextField: {
|
|
110
|
+
defaultProps: {
|
|
111
|
+
variant: "standard",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
MuiSelect: {
|
|
115
|
+
defaultProps: {
|
|
116
|
+
variant: "standard",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
MuiButton: {
|
|
120
|
+
styleOverrides: {
|
|
121
|
+
root: {
|
|
122
|
+
color: "black",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
MuiLinearProgress: {
|
|
127
|
+
styleOverrides: {
|
|
128
|
+
root: {
|
|
129
|
+
background: "#c9c9c9",
|
|
130
|
+
color: "#959595",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
theme = {
|
|
138
|
+
...theme,
|
|
139
|
+
custom: {
|
|
140
|
+
schema: {
|
|
141
|
+
width: 75,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
theme = {
|
|
147
|
+
...theme,
|
|
148
|
+
spacing: (factor) => 8 * factor, // Bootstrap strategy
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default theme;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Alert, Avatar, Box, Snackbar } from "@mui/material";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { Label } from "@nucleoidai/platform/minimal/components";
|
|
5
|
+
|
|
6
|
+
export default function ActionButton() {
|
|
7
|
+
const [open, setOpen] = useState(false);
|
|
8
|
+
|
|
9
|
+
const handleClick = () => {
|
|
10
|
+
setOpen(true);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const handleClose = (event, reason) => {
|
|
14
|
+
if (reason === "clickaway") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setOpen(false);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<Box sx={{ position: "relative" }} onClick={handleClick}>
|
|
24
|
+
<Avatar
|
|
25
|
+
src={"https://cdn-icons-png.flaticon.com/512/12482/12482702.png"}
|
|
26
|
+
sx={{
|
|
27
|
+
display: "flex",
|
|
28
|
+
alignSelf: "center",
|
|
29
|
+
mx: "auto",
|
|
30
|
+
width: { xs: 24, md: 45 },
|
|
31
|
+
height: { xs: 24, md: 45 },
|
|
32
|
+
border: `solid 2px ${(theme) => theme.palette.common.white}`,
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
<Label
|
|
36
|
+
color="primary"
|
|
37
|
+
variant="filled"
|
|
38
|
+
sx={{
|
|
39
|
+
m: 1,
|
|
40
|
+
top: -18,
|
|
41
|
+
px: 0.5,
|
|
42
|
+
left: 30,
|
|
43
|
+
height: 20,
|
|
44
|
+
position: "absolute",
|
|
45
|
+
borderBottomLeftRadius: 2,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
Talk to Emperor
|
|
49
|
+
</Label>
|
|
50
|
+
</Box>
|
|
51
|
+
<Snackbar
|
|
52
|
+
open={open}
|
|
53
|
+
autoHideDuration={5000}
|
|
54
|
+
onClose={handleClose}
|
|
55
|
+
anchorOrigin={{ vertical: "bottom", horizontal: "center" }}
|
|
56
|
+
>
|
|
57
|
+
<Alert
|
|
58
|
+
onClose={handleClose}
|
|
59
|
+
severity="error"
|
|
60
|
+
variant="filled"
|
|
61
|
+
sx={{ width: "100%" }}
|
|
62
|
+
>
|
|
63
|
+
Emperor is busy right now
|
|
64
|
+
</Alert>
|
|
65
|
+
</Snackbar>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogActions,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogContentText,
|
|
7
|
+
DialogTitle,
|
|
8
|
+
TextField,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
import React, { useState } from "react";
|
|
11
|
+
import { publish, useEvent } from "@nucleoidai/react-event";
|
|
12
|
+
|
|
13
|
+
import useEmperor from "../hooks/useEmperor";
|
|
14
|
+
|
|
15
|
+
function AddNewEmperor() {
|
|
16
|
+
const [platformDialog] = useEvent("PLATFORM_DIALOG", { open: false });
|
|
17
|
+
const { addEmperor } = useEmperor();
|
|
18
|
+
const [emperor, setEmperor] = useState({
|
|
19
|
+
id: "",
|
|
20
|
+
name: "",
|
|
21
|
+
born: "",
|
|
22
|
+
icon: "",
|
|
23
|
+
reign: "",
|
|
24
|
+
portrait: "",
|
|
25
|
+
description: "",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const handleClose = () => {
|
|
29
|
+
publish("PLATFORM_DIALOG", { open: false });
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleChange = (e) => {
|
|
33
|
+
setEmperor({ ...emperor, [e.target.name]: e.target.value });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleSubmit = (e) => {
|
|
37
|
+
emperor.id = 4;
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
addEmperor(emperor);
|
|
40
|
+
handleClose();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div>
|
|
45
|
+
<Dialog
|
|
46
|
+
open={platformDialog.open}
|
|
47
|
+
onClose={handleClose}
|
|
48
|
+
aria-labelledby="form-dialog-title"
|
|
49
|
+
>
|
|
50
|
+
<DialogTitle id="form-dialog-title">Add New Emperor</DialogTitle>
|
|
51
|
+
<DialogContent>
|
|
52
|
+
<DialogContentText>
|
|
53
|
+
Please fill out the details of the new emperor.
|
|
54
|
+
</DialogContentText>
|
|
55
|
+
<form onSubmit={handleSubmit}>
|
|
56
|
+
<TextField
|
|
57
|
+
autoFocus
|
|
58
|
+
margin="dense"
|
|
59
|
+
name="name"
|
|
60
|
+
label="Name"
|
|
61
|
+
type="text"
|
|
62
|
+
fullWidth
|
|
63
|
+
onChange={handleChange}
|
|
64
|
+
/>
|
|
65
|
+
<TextField
|
|
66
|
+
margin="dense"
|
|
67
|
+
name="born"
|
|
68
|
+
label="Born"
|
|
69
|
+
type="text"
|
|
70
|
+
fullWidth
|
|
71
|
+
onChange={handleChange}
|
|
72
|
+
/>
|
|
73
|
+
<TextField
|
|
74
|
+
margin="dense"
|
|
75
|
+
name="icon"
|
|
76
|
+
label="Icon"
|
|
77
|
+
type="text"
|
|
78
|
+
fullWidth
|
|
79
|
+
onChange={handleChange}
|
|
80
|
+
/>
|
|
81
|
+
<TextField
|
|
82
|
+
margin="dense"
|
|
83
|
+
name="reign"
|
|
84
|
+
label="Reign"
|
|
85
|
+
type="text"
|
|
86
|
+
fullWidth
|
|
87
|
+
onChange={handleChange}
|
|
88
|
+
/>
|
|
89
|
+
<TextField
|
|
90
|
+
margin="dense"
|
|
91
|
+
name="portrait"
|
|
92
|
+
label="Portrait URL"
|
|
93
|
+
type="text"
|
|
94
|
+
fullWidth
|
|
95
|
+
onChange={handleChange}
|
|
96
|
+
/>
|
|
97
|
+
<TextField
|
|
98
|
+
margin="dense"
|
|
99
|
+
name="description"
|
|
100
|
+
label="Description"
|
|
101
|
+
type="text"
|
|
102
|
+
fullWidth
|
|
103
|
+
onChange={handleChange}
|
|
104
|
+
/>
|
|
105
|
+
<DialogActions>
|
|
106
|
+
<Button onClick={handleClose} color="primary">
|
|
107
|
+
Cancel
|
|
108
|
+
</Button>
|
|
109
|
+
<Button type="submit" color="primary">
|
|
110
|
+
Add
|
|
111
|
+
</Button>
|
|
112
|
+
</DialogActions>
|
|
113
|
+
</form>
|
|
114
|
+
</DialogContent>
|
|
115
|
+
</Dialog>
|
|
116
|
+
</div>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default AddNewEmperor;
|