From 06dd0117029efaa85cd4f707ebe4d76c0573dffe Mon Sep 17 00:00:00 2001 From: melvinchia3636 Date: Tue, 9 Jun 2026 09:46:23 +0800 Subject: [PATCH] refactor(shared): remove reexport of react-router and nuqs --- apps/lifeforge--achievements | 1 + apps/lifeforge--utility-widgets | 1 + apps/lifeforge--wallet | 1 + apps/melvinchia3636--modrinth | 1 + bun.lock | 7 +- client/package.json | 1 - .../components/QRCodeDisplay.tsx | 4 +- client/src/core/auth/components/AuthForm.tsx | 3 +- .../components/SigninWithProviderButton.tsx | 3 +- .../dashboard/components/DashboardGrid.tsx | 5 +- .../dashboard/components/NotFoundWidget.tsx | 5 +- .../components/ComponentItem.tsx | 5 +- client/src/core/documentation/index.tsx | 2 +- .../moduleManager/pages/Modules/index.tsx | 2 +- .../components/BgImageSelector/index.tsx | 2 +- .../components/ResultShowcase.tsx | 2 +- .../modals/AdjustBgImageModal/index.tsx | 2 +- .../components/BgTempSelector/index.tsx | 2 +- .../components/BorderRadiusSelector/index.tsx | 2 +- .../components/BorderedSelector.tsx | 2 +- .../FontFamilySelectorModal/index.tsx | 2 +- .../tabs/custom/components/CustomFontCard.tsx | 2 +- .../google/contexts/GoogleFontContext.tsx | 2 +- .../components/FontFamilySelector/index.tsx | 2 +- .../components/FontScaleSelector.tsx | 2 +- .../components/LanguageSelector.tsx | 2 +- .../components/ThemeColorSelector/index.tsx | 2 +- .../components/ThemeSelector.tsx | 2 +- .../features/APIKeyStatusProvider.tsx | 2 +- .../features/UserPersonalizationProvider.tsx | 8 +- client/src/providers/index.tsx | 8 +- client/src/routes/components/RootLayout.tsx | 2 +- .../components/Sidebar/MainSidebarTitle.tsx | 3 +- .../src/routes/components/Sidebar/Sidebar.tsx | 2 +- .../components/Sidebar/SidebarBottomBar.tsx | 6 +- .../components/Sidebar/SidebarEventBanner.tsx | 9 ++- .../components/Sidebar/SidebarHeader.tsx | 2 +- .../components/Sidebar/SidebarItems.tsx | 11 +-- client/src/routes/hooks/useAppRouter.ts | 4 +- client/src/routes/hooks/useTitleEffect.ts | 2 +- .../routes/providers/AppRoutesProvider.tsx | 2 +- client/src/routes/utils/routeBuilder.tsx | 2 +- client/src/routes/utils/routerFactory.tsx | 4 +- docs/package.json | 1 - docs/src/App.tsx | 6 +- docs/src/Router.tsx | 2 +- .../Boilerplate/components/NavigationBar.tsx | 2 +- docs/src/components/Boilerplate/index.tsx | 2 +- docs/src/components/CustomLink.tsx | 3 +- docs/src/components/Header.tsx | 4 +- docs/src/components/Layout.tsx | 2 +- docs/src/components/MdxComponents.tsx | 3 +- docs/src/components/Rightbar.tsx | 2 +- docs/src/components/Sidebar.tsx | 2 +- .../02.user-guide/components/BgTemp.tsx | 2 +- .../components/CustomColorInput.tsx | 2 +- .../components/LightAndDarkMode.tsx | 2 +- .../02.user-guide/components/ThemeColors.tsx | 2 +- package.json | 5 +- .../configs/src/vite/client-vite.config.ts | 2 + .../configs/src/vite/module-vite.config.ts | 2 + packages/ui/package.json | 1 - .../CreatePasswordScreen.stories.tsx | 2 +- .../components/LockedScreen.stories.tsx | 2 +- packages/ui/src/components/auth/index.ts | 2 - .../SSOAppMainView/SSOAppMainView.stories.tsx | 33 -------- .../auth/sso/SSOAppMainView/index.tsx | 77 ------------------- .../auth/sso/SSOHeader/SSOHeader.stories.tsx | 31 -------- .../components/auth/sso/SSOHeader/index.tsx | 60 --------------- .../UnauthorizedScreen.stories.tsx | 25 ------ .../auth/sso/UnauthorizedScreen/index.tsx | 26 ------- packages/ui/src/components/auth/sso/index.ts | 3 - .../components/data-display/TagChip/index.tsx | 2 +- .../data-display/TagsFilter/index.tsx | 3 +- .../Button/hooks/useButtonStyleProps.ts | 2 +- .../src/components/inputs/Checkbox/index.tsx | 3 +- .../components/PaletteButtons.tsx | 4 +- .../modals/FlatUIColorsModal/index.tsx | 3 +- .../modals/ModandiColorPaletteModal/index.tsx | 3 +- .../components/ColorItem.tsx | 3 +- .../src/components/inputs/DateInput/index.tsx | 3 +- .../components/AIImageGenerator.tsx | 4 +- .../components/PreviewContainer.tsx | 1 - .../components/CategoryFilter.tsx | 6 +- .../components/ColorFilter.tsx | 6 +- .../components/EditorsChoiceSwitch.tsx | 2 +- .../components/ImageTypeFilter.tsx | 6 +- .../components/ChipSelector.tsx | 3 +- .../IconSetList/components/CategoryEntry.tsx | 2 +- .../IconSetList/components/IconSetEntry.tsx | 1 - .../LocationServiceStatusIndicator.tsx | 3 +- .../ui/src/components/inputs/Switch/index.tsx | 3 +- .../shared/components/InputLabel/index.tsx | 2 +- .../components/layout/ModuleHeader/index.tsx | 4 +- .../components/layout/ModuleWrapper/index.tsx | 8 +- .../sidebar/MainSidebarItem/index.tsx | 3 +- .../components/SidebarActionButton.tsx | 3 +- .../components/SidebarCancelButton.tsx | 3 +- .../components/SidebarItemSubsection.tsx | 3 +- .../components/SidebarSubsectionItemLink.tsx | 3 +- .../SidebarSubsectionItemWithOnClick.tsx | 3 +- .../navigation/sidebar/SidebarItem/index.tsx | 3 +- .../sidebar/SidebarWrapper/index.tsx | 3 +- .../components/navigation/sidebar/index.ts | 2 +- .../components/utilities/PrintArea/index.tsx | 2 +- .../components/utilities/Tooltip/index.tsx | 3 +- .../providers/MainSidebarStateProvider.tsx | 2 +- .../providers/ModuleHeaderStateProvider.tsx | 6 +- .../providers/ModuleSidebarStateProvider.tsx | 8 +- .../PersonalizationProvider/index.tsx | 12 ++- packages/ui/src/providers/ToastProvider.tsx | 4 +- packages/ui/src/providers/index.ts | 17 ++-- packages/ui/tsconfig.json | 18 +++-- packages/ui/vite.config.ts | 1 - shared/package.json | 2 - shared/src/api/core/forgeEndpoint.ts | 1 + shared/src/api/core/helpers/config.ts | 5 +- .../src/api/core/helpers/createCoreHelper.ts | 2 +- shared/src/index.ts | 36 +++++---- shared/tsconfig.json | 5 -- 120 files changed, 202 insertions(+), 469 deletions(-) create mode 160000 apps/lifeforge--achievements create mode 160000 apps/lifeforge--utility-widgets create mode 160000 apps/lifeforge--wallet create mode 160000 apps/melvinchia3636--modrinth delete mode 100644 packages/ui/src/components/auth/sso/SSOAppMainView/SSOAppMainView.stories.tsx delete mode 100644 packages/ui/src/components/auth/sso/SSOAppMainView/index.tsx delete mode 100644 packages/ui/src/components/auth/sso/SSOHeader/SSOHeader.stories.tsx delete mode 100644 packages/ui/src/components/auth/sso/SSOHeader/index.tsx delete mode 100644 packages/ui/src/components/auth/sso/UnauthorizedScreen/UnauthorizedScreen.stories.tsx delete mode 100644 packages/ui/src/components/auth/sso/UnauthorizedScreen/index.tsx delete mode 100644 packages/ui/src/components/auth/sso/index.ts rename shared/src/providers/SidebarStateProvider.tsx => packages/ui/src/providers/MainSidebarStateProvider.tsx (95%) diff --git a/apps/lifeforge--achievements b/apps/lifeforge--achievements new file mode 160000 index 000000000..f46ef9fd0 --- /dev/null +++ b/apps/lifeforge--achievements @@ -0,0 +1 @@ +Subproject commit f46ef9fd0d48cc5243ccb1b55144603aa1785c33 diff --git a/apps/lifeforge--utility-widgets b/apps/lifeforge--utility-widgets new file mode 160000 index 000000000..b427ac07e --- /dev/null +++ b/apps/lifeforge--utility-widgets @@ -0,0 +1 @@ +Subproject commit b427ac07e42950a052e7d2b0ca2388f9c87db712 diff --git a/apps/lifeforge--wallet b/apps/lifeforge--wallet new file mode 160000 index 000000000..31ab0c14a --- /dev/null +++ b/apps/lifeforge--wallet @@ -0,0 +1 @@ +Subproject commit 31ab0c14ae1c44150a5d79d79c78a17ff78df07d diff --git a/apps/melvinchia3636--modrinth b/apps/melvinchia3636--modrinth new file mode 160000 index 000000000..a5b4f230e --- /dev/null +++ b/apps/melvinchia3636--modrinth @@ -0,0 +1 @@ +Subproject commit a5b4f230ec077ee415c3ee33523da33d47da3c98 diff --git a/bun.lock b/bun.lock index 0c24a0159..f1b12dc6d 100644 --- a/bun.lock +++ b/bun.lock @@ -15,11 +15,13 @@ "dotenv": "^17.2.3", "i18next": "^25.7.4", "lodash": "^4.17.21", + "nuqs": "^2.7.1", "opentype.js": "^2.0.0", "react": "^19.2.0", "react-dom": "^19.2.0", "react-hook-form": "^7.77.0", "react-i18next": "^16.5.1", + "react-router": "^7.9.4", "react-toastify": "^11.0.5", "tinycolor2": "^1.6.0", "zod": "4.3.5", @@ -163,7 +165,6 @@ "react-dropzone": "^14.3.8", "react-error-boundary": "^6.0.0", "react-grid-layout": "^1.5.2", - "react-router": "^7.9.4", "react-virtualized": "^9.22.6", "recharts": "^2.15.0", "socket.io-client": "^4.8.1", @@ -207,7 +208,6 @@ "react-dom": "^19.2.0", "react-error-boundary": "^6.0.0", "react-medium-image-zoom": "^5.3.0", - "react-router": "^7.9.4", "react-syntax-highlighter": "^15.6.1", "remark-gfm": "^4.0.1", "vite-plugin-mdx": "^3.6.1", @@ -344,7 +344,6 @@ "react-number-format": "^5.4.5", "react-otp-input": "^3.1.1", "react-photo-album": "^2.4.1", - "react-router": "^7.9.4", "react-tooltip": "^5.30.0", "react-virtualized": "^9.22.6", "rrule": "^2.8.1", @@ -442,8 +441,6 @@ "culori": "^4.0.2", "javascript-color-gradient": "^2.5.0", "json-schema-to-ts": "^3.1.1", - "nuqs": "^2.7.1", - "react-router": "^7.9.4", "socket.io-client": "^4.8.1", }, "devDependencies": { diff --git a/client/package.json b/client/package.json index 89ee1a45e..d266364fa 100644 --- a/client/package.json +++ b/client/package.json @@ -42,7 +42,6 @@ "react-dropzone": "^14.3.8", "react-error-boundary": "^6.0.0", "react-grid-layout": "^1.5.2", - "react-router": "^7.9.4", "react-virtualized": "^9.22.6", "recharts": "^2.15.0", "socket.io-client": "^4.8.1", diff --git a/client/src/core/accountSettings/modals/EnableTwoFAModal/components/QRCodeDisplay.tsx b/client/src/core/accountSettings/modals/EnableTwoFAModal/components/QRCodeDisplay.tsx index 13aa2946c..dd6dc07d8 100644 --- a/client/src/core/accountSettings/modals/EnableTwoFAModal/components/QRCodeDisplay.tsx +++ b/client/src/core/accountSettings/modals/EnableTwoFAModal/components/QRCodeDisplay.tsx @@ -2,8 +2,8 @@ import { QRCodeSVG } from 'qrcode.react' import { useEffect, useState } from 'react' import { toast } from 'react-toastify' -import { decrypt, usePersonalization } from '@lifeforge/shared' -import { Box, Flex, LoadingScreen } from '@lifeforge/ui' +import { decrypt } from '@lifeforge/shared' +import { Box, Flex, LoadingScreen, usePersonalization } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/auth/components/AuthForm.tsx b/client/src/core/auth/components/AuthForm.tsx index 392f47842..c0df0d1c3 100644 --- a/client/src/core/auth/components/AuthForm.tsx +++ b/client/src/core/auth/components/AuthForm.tsx @@ -3,10 +3,11 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'react-toastify' -import { useAuth, usePromiseLoading, useSearchParams } from '@lifeforge/shared' +import { useAuth, usePromiseLoading } from '@lifeforge/shared' import { Stack, TextInput } from '@lifeforge/ui' import AuthSignInButton from './AuthSignInButtons' +import { useSearchParams } from 'react-router' function AuthForm({ providers }: { providers: string[] }) { const [emailOrUsername, setEmail] = useState('') diff --git a/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx b/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx index b9d228e01..64f4037f8 100644 --- a/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx +++ b/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx @@ -2,10 +2,11 @@ import _ from 'lodash' import { memo, useCallback } from 'react' import { toast } from 'react-toastify' -import { useAuth, useSearchParams } from '@lifeforge/shared' +import { useAuth } from '@lifeforge/shared' import { Button } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' +import { useSearchParams } from 'react-router' function SigninWithProviderButton({ provider, diff --git a/client/src/core/dashboard/components/DashboardGrid.tsx b/client/src/core/dashboard/components/DashboardGrid.tsx index b22aa346b..f649e31fc 100644 --- a/client/src/core/dashboard/components/DashboardGrid.tsx +++ b/client/src/core/dashboard/components/DashboardGrid.tsx @@ -2,13 +2,14 @@ import { useMemo } from 'react' import { Responsive as ResponsiveGridLayout } from 'react-grid-layout' import { useTranslation } from 'react-i18next' -import { useDivSize, usePersonalization } from '@lifeforge/shared' +import { useDivSize } from '@lifeforge/shared' import { Box, EmptyStateScreen, Icon, LoadingScreen, - colorWithOpacity + colorWithOpacity, + usePersonalization } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/dashboard/components/NotFoundWidget.tsx b/client/src/core/dashboard/components/NotFoundWidget.tsx index a0c88cd34..972c06ccf 100644 --- a/client/src/core/dashboard/components/NotFoundWidget.tsx +++ b/client/src/core/dashboard/components/NotFoundWidget.tsx @@ -1,10 +1,11 @@ -import { type IDashboardLayout, usePersonalization } from '@lifeforge/shared' import { Button, ConfirmationModal, EmptyStateScreen, + type IDashboardLayout, Widget, - useModalStore + useModalStore, + usePersonalization } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/dashboard/modals/ManageWidgetsModal/components/ComponentItem.tsx b/client/src/core/dashboard/modals/ManageWidgetsModal/components/ComponentItem.tsx index b41b097b9..683aad4f8 100644 --- a/client/src/core/dashboard/modals/ManageWidgetsModal/components/ComponentItem.tsx +++ b/client/src/core/dashboard/modals/ManageWidgetsModal/components/ComponentItem.tsx @@ -1,17 +1,18 @@ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { type IDashboardLayout, usePersonalization } from '@lifeforge/shared' import { Box, Card, Flex, + type IDashboardLayout, Icon, Stack, Switch, Text, Transition, - colorWithOpacity + colorWithOpacity, + usePersonalization } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/documentation/index.tsx b/client/src/core/documentation/index.tsx index ae23f6e79..80e82717f 100644 --- a/client/src/core/documentation/index.tsx +++ b/client/src/core/documentation/index.tsx @@ -1,8 +1,8 @@ import { useEffect } from 'react' import { useTranslation } from 'react-i18next' +import { useNavigate } from 'react-router' import { toast } from 'react-toastify' -import { useNavigate } from '@lifeforge/shared' function index() { const navigate = useNavigate() diff --git a/client/src/core/moduleManager/pages/Modules/index.tsx b/client/src/core/moduleManager/pages/Modules/index.tsx index e6912a415..f31b1ca45 100644 --- a/client/src/core/moduleManager/pages/Modules/index.tsx +++ b/client/src/core/moduleManager/pages/Modules/index.tsx @@ -3,7 +3,7 @@ import { useMemo } from 'react' import { toast } from 'react-toastify' import { useFederation } from '@lifeforge/federation' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { EmptyStateScreen, Grid, diff --git a/client/src/core/personalization/components/BgImageSelector/index.tsx b/client/src/core/personalization/components/BgImageSelector/index.tsx index a7cac8634..c4f7298a2 100644 --- a/client/src/core/personalization/components/BgImageSelector/index.tsx +++ b/client/src/core/personalization/components/BgImageSelector/index.tsx @@ -3,7 +3,7 @@ import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'react-toastify' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Button, ConfirmationModal, diff --git a/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/components/ResultShowcase.tsx b/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/components/ResultShowcase.tsx index 1808ebc81..122191096 100644 --- a/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/components/ResultShowcase.tsx +++ b/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/components/ResultShowcase.tsx @@ -1,4 +1,4 @@ -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Flex, diff --git a/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/index.tsx b/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/index.tsx index 0b6c4a7e7..8888373e0 100644 --- a/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/index.tsx +++ b/client/src/core/personalization/components/BgImageSelector/modals/AdjustBgImageModal/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Button, ModalHeader, Stack } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/personalization/components/BgTempSelector/index.tsx b/client/src/core/personalization/components/BgTempSelector/index.tsx index 9ceb2acd0..974def434 100644 --- a/client/src/core/personalization/components/BgTempSelector/index.tsx +++ b/client/src/core/personalization/components/BgTempSelector/index.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Button, diff --git a/client/src/core/personalization/components/BorderRadiusSelector/index.tsx b/client/src/core/personalization/components/BorderRadiusSelector/index.tsx index de2ca5f1d..8bfa741b0 100644 --- a/client/src/core/personalization/components/BorderRadiusSelector/index.tsx +++ b/client/src/core/personalization/components/BorderRadiusSelector/index.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Flex, Listbox, diff --git a/client/src/core/personalization/components/BorderedSelector.tsx b/client/src/core/personalization/components/BorderedSelector.tsx index 32b340634..e82c743be 100644 --- a/client/src/core/personalization/components/BorderedSelector.tsx +++ b/client/src/core/personalization/components/BorderedSelector.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { OptionsColumn, Switch } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/index.tsx b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/index.tsx index e7712fe58..7bb3a918c 100644 --- a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/index.tsx +++ b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/index.tsx @@ -2,7 +2,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'react-toastify' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Button, ModalHeader, Stack, Tabs } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/custom/components/CustomFontCard.tsx b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/custom/components/CustomFontCard.tsx index 74eefd7e6..d4be9ba90 100644 --- a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/custom/components/CustomFontCard.tsx +++ b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/custom/components/CustomFontCard.tsx @@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' import { toast } from 'react-toastify' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Card, diff --git a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/google/contexts/GoogleFontContext.tsx b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/google/contexts/GoogleFontContext.tsx index 1e30c8234..03430268a 100644 --- a/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/google/contexts/GoogleFontContext.tsx +++ b/client/src/core/personalization/components/FontFamilySelector/components/FontFamilySelectorModal/tabs/google/contexts/GoogleFontContext.tsx @@ -9,7 +9,7 @@ import { useState } from 'react' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/personalization/components/FontFamilySelector/index.tsx b/client/src/core/personalization/components/FontFamilySelector/index.tsx index 31e0289a5..991a6b66c 100644 --- a/client/src/core/personalization/components/FontFamilySelector/index.tsx +++ b/client/src/core/personalization/components/FontFamilySelector/index.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Button, diff --git a/client/src/core/personalization/components/FontScaleSelector.tsx b/client/src/core/personalization/components/FontScaleSelector.tsx index 57b771e4d..ca60df44b 100644 --- a/client/src/core/personalization/components/FontScaleSelector.tsx +++ b/client/src/core/personalization/components/FontScaleSelector.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Button, Flex, OptionsColumn, SliderInput } from '@lifeforge/ui' import { useUserPersonalization } from '@/providers/features/UserPersonalizationProvider' diff --git a/client/src/core/personalization/components/LanguageSelector.tsx b/client/src/core/personalization/components/LanguageSelector.tsx index 6e2fbf68a..f7e33cae0 100644 --- a/client/src/core/personalization/components/LanguageSelector.tsx +++ b/client/src/core/personalization/components/LanguageSelector.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Flex, Icon, diff --git a/client/src/core/personalization/components/ThemeColorSelector/index.tsx b/client/src/core/personalization/components/ThemeColorSelector/index.tsx index 75499c08c..756aa609f 100644 --- a/client/src/core/personalization/components/ThemeColorSelector/index.tsx +++ b/client/src/core/personalization/components/ThemeColorSelector/index.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Box, Button, diff --git a/client/src/core/personalization/components/ThemeSelector.tsx b/client/src/core/personalization/components/ThemeSelector.tsx index 6ab47e8d3..9146af892 100644 --- a/client/src/core/personalization/components/ThemeSelector.tsx +++ b/client/src/core/personalization/components/ThemeSelector.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Bordered, Box, diff --git a/client/src/providers/features/APIKeyStatusProvider.tsx b/client/src/providers/features/APIKeyStatusProvider.tsx index 6ac44e311..b5249228c 100644 --- a/client/src/providers/features/APIKeyStatusProvider.tsx +++ b/client/src/providers/features/APIKeyStatusProvider.tsx @@ -1,8 +1,8 @@ import { useQuery } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' +import { Link } from 'react-router' import { type ModuleCategory } from '@lifeforge/federation' -import { Link } from '@lifeforge/shared' import { Button, Card, diff --git a/client/src/providers/features/UserPersonalizationProvider.tsx b/client/src/providers/features/UserPersonalizationProvider.tsx index 2742e0452..5dadac024 100644 --- a/client/src/providers/features/UserPersonalizationProvider.tsx +++ b/client/src/providers/features/UserPersonalizationProvider.tsx @@ -1,8 +1,12 @@ import { createContext, useContext, useEffect } from 'react' import { toast } from 'react-toastify' -import { type IBackdropFilters, type IDashboardLayout } from '@lifeforge/shared' -import { useAuth, usePersonalization } from '@lifeforge/shared' +import { useAuth } from '@lifeforge/shared' +import { + type IBackdropFilters, + type IDashboardLayout, + usePersonalization +} from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/providers/index.tsx b/client/src/providers/index.tsx index be0228b96..52b9c4483 100644 --- a/client/src/providers/index.tsx +++ b/client/src/providers/index.tsx @@ -7,16 +7,16 @@ import { APIOnlineStatusProvider, AuthProvider, EncryptionProvider, - MainSidebarStateProvider, NuqsProvider, - PersonalizationProvider, - SocketProvider, - ToastProvider + SocketProvider } from '@lifeforge/shared' import { APIOnlineStatusWrapper, BackgroundProvider, EncryptionWrapper, + MainSidebarStateProvider, + PersonalizationProvider, + ToastProvider, useModalStore } from '@lifeforge/ui' diff --git a/client/src/routes/components/RootLayout.tsx b/client/src/routes/components/RootLayout.tsx index 4fc35a999..7a86102cd 100644 --- a/client/src/routes/components/RootLayout.tsx +++ b/client/src/routes/components/RootLayout.tsx @@ -1,6 +1,6 @@ import { ErrorBoundary } from 'react-error-boundary' +import { Outlet } from 'react-router' -import { Outlet } from '@lifeforge/shared' import { ErrorScreen, Flex } from '@lifeforge/ui' import useTitleEffect from '../hooks/useTitleEffect' diff --git a/client/src/routes/components/Sidebar/MainSidebarTitle.tsx b/client/src/routes/components/Sidebar/MainSidebarTitle.tsx index b19c6b78e..cfe1a0986 100644 --- a/client/src/routes/components/Sidebar/MainSidebarTitle.tsx +++ b/client/src/routes/components/Sidebar/MainSidebarTitle.tsx @@ -1,8 +1,7 @@ import { useMemo } from 'react' import { useFederation } from '@lifeforge/federation' -import { usePersonalization } from '@lifeforge/shared' -import { SidebarTitle } from '@lifeforge/ui' +import { SidebarTitle, usePersonalization } from '@lifeforge/ui' function MainSidebarTitle({ title }: { title: string }) { const { categoryTranslations } = useFederation() diff --git a/client/src/routes/components/Sidebar/Sidebar.tsx b/client/src/routes/components/Sidebar/Sidebar.tsx index b5ae243fb..c30965445 100644 --- a/client/src/routes/components/Sidebar/Sidebar.tsx +++ b/client/src/routes/components/Sidebar/Sidebar.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' -import { useMainSidebarState } from '@lifeforge/shared' +import { useMainSidebarState } from '@lifeforge/ui' import { Flex, SidebarItem, Transition } from '@lifeforge/ui' import SidebarBottomBar from './SidebarBottomBar' diff --git a/client/src/routes/components/Sidebar/SidebarBottomBar.tsx b/client/src/routes/components/Sidebar/SidebarBottomBar.tsx index fa8e23992..a588ccd92 100644 --- a/client/src/routes/components/Sidebar/SidebarBottomBar.tsx +++ b/client/src/routes/components/Sidebar/SidebarBottomBar.tsx @@ -1,7 +1,8 @@ import { useCallback } from 'react' +import { useNavigate } from 'react-router' import { toast } from 'react-toastify' -import { useAuth, useMainSidebarState, useNavigate } from '@lifeforge/shared' +import { useAuth } from '@lifeforge/shared' import { Box, Card, @@ -11,7 +12,8 @@ import { Icon, Text, Transition, - surface + surface, + useMainSidebarState } from '@lifeforge/ui' function SidebarBottomBar() { diff --git a/client/src/routes/components/Sidebar/SidebarEventBanner.tsx b/client/src/routes/components/Sidebar/SidebarEventBanner.tsx index 2678a3cc8..24a92673a 100644 --- a/client/src/routes/components/Sidebar/SidebarEventBanner.tsx +++ b/client/src/routes/components/Sidebar/SidebarEventBanner.tsx @@ -2,12 +2,15 @@ import dayjs from 'dayjs' import { useMemo } from 'react' import tinycolor from 'tinycolor2' +import { useAuth } from '@lifeforge/shared' import { - useAuth, + COLORS, + Flex, + Icon, + Text, useMainSidebarState, usePersonalization -} from '@lifeforge/shared' -import { COLORS, Flex, Icon, Text } from '@lifeforge/ui' +} from '@lifeforge/ui' function addNumberSuffix(number: number): string { const suffixes = ['th', 'st', 'nd', 'rd'] diff --git a/client/src/routes/components/Sidebar/SidebarHeader.tsx b/client/src/routes/components/Sidebar/SidebarHeader.tsx index c55ffe127..af85dc8c3 100644 --- a/client/src/routes/components/Sidebar/SidebarHeader.tsx +++ b/client/src/routes/components/Sidebar/SidebarHeader.tsx @@ -1,4 +1,4 @@ -import { useMainSidebarState } from '@lifeforge/shared' +import { useMainSidebarState } from '@lifeforge/ui' import { Box, Button, diff --git a/client/src/routes/components/Sidebar/SidebarItems.tsx b/client/src/routes/components/Sidebar/SidebarItems.tsx index 8b65d8bc1..ca2b168c3 100644 --- a/client/src/routes/components/Sidebar/SidebarItems.tsx +++ b/client/src/routes/components/Sidebar/SidebarItems.tsx @@ -2,22 +2,19 @@ import _ from 'lodash' import { Fragment, useEffect, useMemo, useState } from 'react' import { useFederation } from '@lifeforge/federation' -import { - normalizeSubnamespace, - useAuth, - useLocation, - useMainSidebarState -} from '@lifeforge/shared' +import { normalizeSubnamespace, useAuth } from '@lifeforge/shared' import { Box, EmptyStateScreen, Flex, MainSidebarItem, Scrollbar, - SidebarDivider + SidebarDivider, + useMainSidebarState } from '@lifeforge/ui' import MainSidebarTitle from './MainSidebarTitle' +import { useLocation } from 'react-router' function SidebarItems({ query }: { query: string }) { const { userData } = useAuth() diff --git a/client/src/routes/hooks/useAppRouter.ts b/client/src/routes/hooks/useAppRouter.ts index 06dac9e0b..7e53ba52f 100644 --- a/client/src/routes/hooks/useAppRouter.ts +++ b/client/src/routes/hooks/useAppRouter.ts @@ -1,9 +1,9 @@ import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' +import { type DataRouter, createBrowserRouter } from 'react-router' import { useFederation } from '@lifeforge/federation' -import type { DataRouter } from '@lifeforge/shared' -import { createBrowserRouter, useAuth } from '@lifeforge/shared' +import { useAuth } from '@lifeforge/shared' import { createAuthLoadingConfig, diff --git a/client/src/routes/hooks/useTitleEffect.ts b/client/src/routes/hooks/useTitleEffect.ts index 7849fea7f..4b8ac4ad5 100644 --- a/client/src/routes/hooks/useTitleEffect.ts +++ b/client/src/routes/hooks/useTitleEffect.ts @@ -2,7 +2,7 @@ import _ from 'lodash' import { useEffect } from 'react' import { useFederation } from '@lifeforge/federation' -import { useLocation } from '@lifeforge/shared' +import { useLocation } from 'react-router' function useTitleEffect() { const { modules } = useFederation() diff --git a/client/src/routes/providers/AppRoutesProvider.tsx b/client/src/routes/providers/AppRoutesProvider.tsx index a49bdf904..996dc6334 100644 --- a/client/src/routes/providers/AppRoutesProvider.tsx +++ b/client/src/routes/providers/AppRoutesProvider.tsx @@ -1,4 +1,4 @@ -import { RouterProvider } from '@lifeforge/shared' +import { RouterProvider } from 'react-router' import { useAppRouter } from '../hooks/useAppRouter' diff --git a/client/src/routes/utils/routeBuilder.tsx b/client/src/routes/utils/routeBuilder.tsx index 5b78d1da0..b425e0a16 100644 --- a/client/src/routes/utils/routeBuilder.tsx +++ b/client/src/routes/utils/routeBuilder.tsx @@ -1,10 +1,10 @@ import { Suspense } from 'react' import type { ModuleCategory, ModuleConfig } from '@lifeforge/federation' -import type { RouteObject } from '@lifeforge/shared' import { LoadingScreen, ModalManager, ModuleWrapper } from '@lifeforge/ui' import APIKeyStatusProvider from '@/providers/features/APIKeyStatusProvider' +import type { RouteObject } from 'react-router' interface RouteBuilderOptions { routes: ModuleConfig['routes'] diff --git a/client/src/routes/utils/routerFactory.tsx b/client/src/routes/utils/routerFactory.tsx index 09f6c1e9f..8131fb217 100644 --- a/client/src/routes/utils/routerFactory.tsx +++ b/client/src/routes/utils/routerFactory.tsx @@ -1,6 +1,6 @@ +import { Navigate, type RouteObject } from 'react-router' + import type { ModuleCategory } from '@lifeforge/federation' -import { Navigate } from '@lifeforge/shared' -import type { RouteObject } from '@lifeforge/shared' import { LoadingScreen, NotFoundScreen } from '@lifeforge/ui' import Auth from '@/core/auth' diff --git a/docs/package.json b/docs/package.json index 3b591a174..f72ae2eb8 100644 --- a/docs/package.json +++ b/docs/package.json @@ -37,7 +37,6 @@ "react-dom": "^19.2.0", "react-error-boundary": "^6.0.0", "react-medium-image-zoom": "^5.3.0", - "react-router": "^7.9.4", "react-syntax-highlighter": "^15.6.1", "remark-gfm": "^4.0.1", "@lifeforge/shared": "workspace:*", diff --git a/docs/src/App.tsx b/docs/src/App.tsx index 86b42fca9..2f7429dcb 100644 --- a/docs/src/App.tsx +++ b/docs/src/App.tsx @@ -1,11 +1,7 @@ import { useEffect } from 'react' import { ErrorBoundary } from 'react-error-boundary' -import { - Navigate, - RouterProvider, - createBrowserRouter -} from '@lifeforge/shared' +import { Navigate, RouterProvider, createBrowserRouter } from 'react-router' import { ErrorScreen, NotFoundScreen } from '@lifeforge/ui' import ROUTES from './Router' diff --git a/docs/src/Router.tsx b/docs/src/Router.tsx index a1424091e..3398c271c 100644 --- a/docs/src/Router.tsx +++ b/docs/src/Router.tsx @@ -1,6 +1,6 @@ import _ from 'lodash' -import type { RouteObject } from '@lifeforge/shared' +import type { RouteObject } from 'react-router' import { components as COMPONENTS } from './components/MdxComponents' diff --git a/docs/src/components/Boilerplate/components/NavigationBar.tsx b/docs/src/components/Boilerplate/components/NavigationBar.tsx index b4852534a..7b6ec4040 100644 --- a/docs/src/components/Boilerplate/components/NavigationBar.tsx +++ b/docs/src/components/Boilerplate/components/NavigationBar.tsx @@ -2,7 +2,7 @@ import { Icon } from '@iconify/react' import _ from 'lodash' import { useMemo } from 'react' -import { Link, useLocation } from '@lifeforge/shared' +import { Link, useLocation } from 'react-router' import ROUTES from '../../../Router' diff --git a/docs/src/components/Boilerplate/index.tsx b/docs/src/components/Boilerplate/index.tsx index ae6061ae8..882a31409 100644 --- a/docs/src/components/Boilerplate/index.tsx +++ b/docs/src/components/Boilerplate/index.tsx @@ -2,7 +2,7 @@ import { Icon } from '@iconify/react' import { useEffect } from 'react' import Scrollbars from 'react-custom-scrollbars' -import { useLocation } from '@lifeforge/shared' +import { useLocation } from 'react-router' import { BLACKLISTED_PAGES } from '../Rightbar' import NavigationBar from './components/NavigationBar' diff --git a/docs/src/components/CustomLink.tsx b/docs/src/components/CustomLink.tsx index 6f678409f..15d583fd5 100644 --- a/docs/src/components/CustomLink.tsx +++ b/docs/src/components/CustomLink.tsx @@ -1,6 +1,5 @@ import { Icon } from '@iconify/react' - -import { Link } from '@lifeforge/shared' +import { Link } from 'react-router' function CustomLink({ text, to }: { text: string; to: string }) { return ( diff --git a/docs/src/components/Header.tsx b/docs/src/components/Header.tsx index d34ad17af..ba8ff85b8 100644 --- a/docs/src/components/Header.tsx +++ b/docs/src/components/Header.tsx @@ -1,7 +1,7 @@ import { Icon } from '@iconify/react' +import { Link } from 'react-router' -import { Link } from '@lifeforge/shared' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import GithubStarCount from './GithubStarCount' diff --git a/docs/src/components/Layout.tsx b/docs/src/components/Layout.tsx index b66920a8d..21fd45331 100644 --- a/docs/src/components/Layout.tsx +++ b/docs/src/components/Layout.tsx @@ -1,6 +1,6 @@ import { useState } from 'react' -import { Outlet } from '@lifeforge/shared' +import { Outlet } from 'react-router' import Boilerplate from './Boilerplate' import Header from './Header' diff --git a/docs/src/components/MdxComponents.tsx b/docs/src/components/MdxComponents.tsx index 9fab2f463..7fa1b7b61 100644 --- a/docs/src/components/MdxComponents.tsx +++ b/docs/src/components/MdxComponents.tsx @@ -1,7 +1,6 @@ import type { MDXComponents } from 'mdx/types' import Zoom from 'react-medium-image-zoom' - -import { Link } from '@lifeforge/shared' +import { Link } from 'react-router' import Code from './Code' diff --git a/docs/src/components/Rightbar.tsx b/docs/src/components/Rightbar.tsx index 0b2e201c0..2a20047e5 100644 --- a/docs/src/components/Rightbar.tsx +++ b/docs/src/components/Rightbar.tsx @@ -2,7 +2,7 @@ import { Icon } from '@iconify/react' import _ from 'lodash' import { useEffect, useRef, useState } from 'react' -import { useLocation } from '@lifeforge/shared' +import { useLocation } from 'react-router' export const BLACKLISTED_PAGES = ['/progress/changelog'] diff --git a/docs/src/components/Sidebar.tsx b/docs/src/components/Sidebar.tsx index a99608317..590c578db 100644 --- a/docs/src/components/Sidebar.tsx +++ b/docs/src/components/Sidebar.tsx @@ -1,7 +1,7 @@ import _ from 'lodash' import { Scrollbars } from 'react-custom-scrollbars' -import { Link, useLocation } from '@lifeforge/shared' +import { Link, useLocation } from 'react-router' import ROUTES from '../Router' diff --git a/docs/src/contents/02.user-guide/components/BgTemp.tsx b/docs/src/contents/02.user-guide/components/BgTemp.tsx index 9c0ccb572..4343ca064 100644 --- a/docs/src/contents/02.user-guide/components/BgTemp.tsx +++ b/docs/src/contents/02.user-guide/components/BgTemp.tsx @@ -1,4 +1,4 @@ -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' const COLORS = ['bg-slate', 'bg-gray', 'bg-zinc', 'bg-neutral', 'bg-stone'] diff --git a/docs/src/contents/02.user-guide/components/CustomColorInput.tsx b/docs/src/contents/02.user-guide/components/CustomColorInput.tsx index 2608fc78c..ca491b58a 100644 --- a/docs/src/contents/02.user-guide/components/CustomColorInput.tsx +++ b/docs/src/contents/02.user-guide/components/CustomColorInput.tsx @@ -1,7 +1,7 @@ import { Icon } from '@iconify/react' import { useEffect, useState } from 'react' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' import { Button, ColorInput, Switch } from '@lifeforge/ui' function CustomColorInput() { diff --git a/docs/src/contents/02.user-guide/components/LightAndDarkMode.tsx b/docs/src/contents/02.user-guide/components/LightAndDarkMode.tsx index 2a35a824a..0a79ab242 100644 --- a/docs/src/contents/02.user-guide/components/LightAndDarkMode.tsx +++ b/docs/src/contents/02.user-guide/components/LightAndDarkMode.tsx @@ -1,6 +1,6 @@ import { Icon } from '@iconify/react' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' function LightAndDarkMode() { const { derivedTheme, setTheme } = usePersonalization() diff --git a/docs/src/contents/02.user-guide/components/ThemeColors.tsx b/docs/src/contents/02.user-guide/components/ThemeColors.tsx index e857dc1d1..23549281d 100644 --- a/docs/src/contents/02.user-guide/components/ThemeColors.tsx +++ b/docs/src/contents/02.user-guide/components/ThemeColors.tsx @@ -1,6 +1,6 @@ import { Icon } from '@iconify/react' -import { usePersonalization } from '@lifeforge/shared' +import { usePersonalization } from '@lifeforge/ui' function ThemeColors() { const { setRawThemeColor, rawThemeColor } = usePersonalization() diff --git a/package.json b/package.json index 2848c264d..f938bf72d 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,12 @@ "scripts": { "forge": "bun run tools/src/index.ts", "build-configs": "bun --cwd=packages/configs run build", + "build-federation": "bun --cwd=packages/federation run build", "build-logger": "bun --cwd=packages/log run build", "build-server-utils": "bun --cwd=packages/server-utils run build", "build-shared": "bun --cwd=shared run build", "build-ui": "bun --cwd=packages/ui run build", - "postinstall": "bun build-configs && bun build-logger && bun build-server-utils && bun build-shared && bun build-ui" + "postinstall": "bun build-configs && bun build-federation && bun build-logger && bun build-server-utils && bun build-shared && bun build-ui" }, "keywords": [ "lifeforge" @@ -75,11 +76,13 @@ "dotenv": "^17.2.3", "i18next": "^25.7.4", "lodash": "^4.17.21", + "nuqs": "^2.7.1", "opentype.js": "^2.0.0", "react": "^19.2.0", "react-dom": "^19.2.0", "react-hook-form": "^7.77.0", "react-i18next": "^16.5.1", + "react-router": "^7.9.4", "react-toastify": "^11.0.5", "tinycolor2": "^1.6.0", "zod": "4.3.5" diff --git a/packages/configs/src/vite/client-vite.config.ts b/packages/configs/src/vite/client-vite.config.ts index df78f9a2d..c83eddfa9 100644 --- a/packages/configs/src/vite/client-vite.config.ts +++ b/packages/configs/src/vite/client-vite.config.ts @@ -68,6 +68,8 @@ export function defineClientConfig(dirname: string) { '@tanstack/react-query', 'i18next', 'react-i18next', + 'react-router', + 'nuqs', ...Object.keys(SHARED_PACKAGES) ] }) diff --git a/packages/configs/src/vite/module-vite.config.ts b/packages/configs/src/vite/module-vite.config.ts index b6ca7160c..1c1fa041b 100644 --- a/packages/configs/src/vite/module-vite.config.ts +++ b/packages/configs/src/vite/module-vite.config.ts @@ -71,6 +71,8 @@ export function defineModuleConfig( 'react-i18next': { generate: false }, i18next: { generate: false }, '@tanstack/react-query': { generate: false }, + 'react-router': { generate: false }, + 'nuqs': { generate: false }, ...Object.fromEntries( Object.keys(SHARED_PACKAGES).map(e => [e, { generate: false }]) ) diff --git a/packages/ui/package.json b/packages/ui/package.json index 0d4a4d07d..4ae0ded65 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -60,7 +60,6 @@ "react-number-format": "^5.4.5", "react-otp-input": "^3.1.1", "react-photo-album": "^2.4.1", - "react-router": "^7.9.4", "react-tooltip": "^5.30.0", "react-virtualized": "^9.22.6", "rrule": "^2.8.1", diff --git a/packages/ui/src/components/auth/WithMasterPassword/components/CreatePasswordScreen.stories.tsx b/packages/ui/src/components/auth/WithMasterPassword/components/CreatePasswordScreen.stories.tsx index 128f0b9b4..f8ba9ff42 100644 --- a/packages/ui/src/components/auth/WithMasterPassword/components/CreatePasswordScreen.stories.tsx +++ b/packages/ui/src/components/auth/WithMasterPassword/components/CreatePasswordScreen.stories.tsx @@ -1,8 +1,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite' import { Box } from '@/components/primitives' +import { mockController } from '@/storybook/mockController' -import { mockController } from '../../../../storybook/mockController' import { CreatePasswordScreen } from './CreatePasswordScreen' const meta = { diff --git a/packages/ui/src/components/auth/WithMasterPassword/components/LockedScreen.stories.tsx b/packages/ui/src/components/auth/WithMasterPassword/components/LockedScreen.stories.tsx index 2c8df5d10..e15dc7fa8 100644 --- a/packages/ui/src/components/auth/WithMasterPassword/components/LockedScreen.stories.tsx +++ b/packages/ui/src/components/auth/WithMasterPassword/components/LockedScreen.stories.tsx @@ -1,8 +1,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite' import { Box } from '@/components/primitives' +import { mockController } from '@/storybook/mockController' -import { mockController } from '../../../../storybook/mockController' import { LockedScreen } from './LockedScreen' const meta = { diff --git a/packages/ui/src/components/auth/index.ts b/packages/ui/src/components/auth/index.ts index 27b565752..af66679c2 100644 --- a/packages/ui/src/components/auth/index.ts +++ b/packages/ui/src/components/auth/index.ts @@ -1,5 +1,3 @@ export * from './OTPInputBox' export * from './WithMasterPassword' - -export * from './sso' diff --git a/packages/ui/src/components/auth/sso/SSOAppMainView/SSOAppMainView.stories.tsx b/packages/ui/src/components/auth/sso/SSOAppMainView/SSOAppMainView.stories.tsx deleted file mode 100644 index e663c8f2c..000000000 --- a/packages/ui/src/components/auth/sso/SSOAppMainView/SSOAppMainView.stories.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' - -import { Box } from '@/components/primitives' - -import { SSOAppMainView } from '.' - -const meta = { - component: SSOAppMainView, - title: 'Auth/SSO/SSOAppMainView' -} satisfies Meta - -export default meta - -type Story = StoryObj - -export const Default: Story = { - args: { - children:
, - config: { - apiEndpoint: 'https://api.example.com', - forgeAPI: {} as never, - frontendURL: 'https://example.com', - icon: 'tabler:world', - link: 'https://github.com', - namespace: 'common.misc' - } - }, - render: props => ( - - - - ) -} diff --git a/packages/ui/src/components/auth/sso/SSOAppMainView/index.tsx b/packages/ui/src/components/auth/sso/SSOAppMainView/index.tsx deleted file mode 100644 index 30f282f5e..000000000 --- a/packages/ui/src/components/auth/sso/SSOAppMainView/index.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import React from 'react' - -import { PersonalizationProvider, ToastProvider } from '../../../../providers' -import { - APIEndpointProvider, - EncryptionProvider, - SSOAuthProvider -} from '@lifeforge/shared' - -import { LoadingScreen } from '@/components/feedback' -import { ModalManager } from '@/components/overlays' -import { Flex } from '@/components/primitives' - -import { SSOHeader } from '../SSOHeader' -import { UnauthorizedScreen } from '../UnauthorizedScreen' - -export type SSOAppConfig = { - apiEndpoint: string - forgeAPI: any - namespace: string - icon: string - link: string - frontendURL: string -} - -const queryClient = new QueryClient() - -export function SSOAppMainView({ - config: { apiEndpoint, forgeAPI, namespace, icon, link, frontendURL }, - children -}: { - config: SSOAppConfig - children: React.ReactNode -}) { - return ( - - - - - - - - {isAuthed => - isAuthed === 'loading' ? ( - - ) : isAuthed ? ( - children - ) : ( - <> - - - - ) - } - - - - - - - - - ) -} diff --git a/packages/ui/src/components/auth/sso/SSOHeader/SSOHeader.stories.tsx b/packages/ui/src/components/auth/sso/SSOHeader/SSOHeader.stories.tsx deleted file mode 100644 index 27faa3c12..000000000 --- a/packages/ui/src/components/auth/sso/SSOHeader/SSOHeader.stories.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' - -import { Box } from '@/components/primitives' - -import { SSOHeader } from '.' - -const meta = { - component: SSOHeader, - title: 'Auth/SSO/SSOHeader' -} satisfies Meta - -export default meta - -type Story = StoryObj - -export const Default: Story = { - args: { - actionButtonProps: { - children: 'Settings', - icon: 'tabler:settings' - }, - icon: 'tabler:world', - link: 'https://github.com', - namespace: 'common.misc' - }, - render: props => ( - - - - ) -} diff --git a/packages/ui/src/components/auth/sso/SSOHeader/index.tsx b/packages/ui/src/components/auth/sso/SSOHeader/index.tsx deleted file mode 100644 index 106cb008b..000000000 --- a/packages/ui/src/components/auth/sso/SSOHeader/index.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { useTranslation } from 'react-i18next' - -import { Button } from '@/components/inputs' -import { Box, Flex, Icon, Text } from '@/components/primitives' - -export function SSOHeader({ - icon, - namespace, - link, - className, - actionButtonProps -}: { - icon: string - namespace: string - link: string - className?: string - actionButtonProps?: React.ComponentProps -}) { - const { t } = useTranslation(namespace) - - return ( - - - - - - LifeForge - - . - - - - {t('title')} - - - - - {actionButtonProps && - - - ) -} diff --git a/packages/ui/src/components/auth/sso/UnauthorizedScreen/UnauthorizedScreen.stories.tsx b/packages/ui/src/components/auth/sso/UnauthorizedScreen/UnauthorizedScreen.stories.tsx deleted file mode 100644 index e87f766ca..000000000 --- a/packages/ui/src/components/auth/sso/UnauthorizedScreen/UnauthorizedScreen.stories.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react-vite' - -import { Box } from '@/components/primitives' - -import { UnauthorizedScreen } from '.' - -const meta = { - component: UnauthorizedScreen, - title: 'Auth/SSO/UnauthorizedScreen' -} satisfies Meta - -export default meta - -type Story = StoryObj - -export const Default: Story = { - args: { - frontendURL: 'https://example.com' - }, - render: props => ( - - - - ) -} diff --git a/packages/ui/src/components/auth/sso/UnauthorizedScreen/index.tsx b/packages/ui/src/components/auth/sso/UnauthorizedScreen/index.tsx deleted file mode 100644 index a91d956bd..000000000 --- a/packages/ui/src/components/auth/sso/UnauthorizedScreen/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Button } from '@/components/inputs' -import { Flex, Icon, Text } from '@/components/primitives' - -export function UnauthorizedScreen({ frontendURL }: { frontendURL: string }) { - return ( - - - - Unauthorized Personnel - - - Please authenticate through single sign-on (SSO) in the system to access - the locale editor. - - - - ) -} diff --git a/packages/ui/src/components/auth/sso/index.ts b/packages/ui/src/components/auth/sso/index.ts deleted file mode 100644 index db3654000..000000000 --- a/packages/ui/src/components/auth/sso/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { SSOAppMainView } from './SSOAppMainView' - -export { SSOHeader } from './SSOHeader' diff --git a/packages/ui/src/components/data-display/TagChip/index.tsx b/packages/ui/src/components/data-display/TagChip/index.tsx index 5f5271138..c25dc5209 100644 --- a/packages/ui/src/components/data-display/TagChip/index.tsx +++ b/packages/ui/src/components/data-display/TagChip/index.tsx @@ -1,7 +1,6 @@ import { type ComponentPropsWithoutRef, type ElementType } from 'react' import tinycolor from 'tinycolor2' -import { usePersonalization } from '../../../providers' import { anyColorToHex } from '@lifeforge/shared' import { @@ -13,6 +12,7 @@ import { Text, Transition } from '@/components/primitives' +import { usePersonalization } from '@/providers' type TagChipProps = Omit< BorderedOwnProps, diff --git a/packages/ui/src/components/data-display/TagsFilter/index.tsx b/packages/ui/src/components/data-display/TagsFilter/index.tsx index f29790308..418b21432 100644 --- a/packages/ui/src/components/data-display/TagsFilter/index.tsx +++ b/packages/ui/src/components/data-display/TagsFilter/index.tsx @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { usePersonalization } from '../../../providers' - import { Flex } from '@/components/primitives' +import { usePersonalization } from '@/providers' import { TagChip } from '../TagChip' diff --git a/packages/ui/src/components/inputs/Button/hooks/useButtonStyleProps.ts b/packages/ui/src/components/inputs/Button/hooks/useButtonStyleProps.ts index a46f1cac7..9cc70c473 100644 --- a/packages/ui/src/components/inputs/Button/hooks/useButtonStyleProps.ts +++ b/packages/ui/src/components/inputs/Button/hooks/useButtonStyleProps.ts @@ -1,10 +1,10 @@ import { type CSSProperties } from 'react' import tinycolor from 'tinycolor2' -import { usePersonalization } from '../../../../providers' import { anyColorToHex } from '@lifeforge/shared' import { type FlexProps } from '@/components/primitives' +import { usePersonalization } from '@/providers' export function useButtonStyleProps({ variant, diff --git a/packages/ui/src/components/inputs/Checkbox/index.tsx b/packages/ui/src/components/inputs/Checkbox/index.tsx index 48cbb1e17..aade8ed50 100644 --- a/packages/ui/src/components/inputs/Checkbox/index.tsx +++ b/packages/ui/src/components/inputs/Checkbox/index.tsx @@ -1,9 +1,8 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox' import clsx from 'clsx' -import { usePersonalization } from '../../../providers' - import { Bordered, Flex, Icon, Text, Transition } from '@/components/primitives' +import { usePersonalization } from '@/providers' import { checkboxRootRecipe } from './Checkbox.css' diff --git a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/PaletteButtons.tsx b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/PaletteButtons.tsx index 42a85061d..23955a129 100644 --- a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/PaletteButtons.tsx +++ b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/PaletteButtons.tsx @@ -1,9 +1,9 @@ import { useCallback } from 'react' +import { Button } from '@/components/inputs/Button' +import { Box, Flex } from '@/components/primitives' import { useModalStore } from '@/providers' -import { Button } from '../../../../..' -import { Box, Flex } from '../../../../../components/primitives' import { useColorPickerModalStore } from '../stores/useColorPickerModalStore' import { FlatUIColorsModal } from './modals/FlatUIColorsModal' import { MorandiColorPaletteModal } from './modals/ModandiColorPaletteModal' diff --git a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/FlatUIColorsModal/index.tsx b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/FlatUIColorsModal/index.tsx index d21bb76b6..83faf08fb 100644 --- a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/FlatUIColorsModal/index.tsx +++ b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/FlatUIColorsModal/index.tsx @@ -1,8 +1,7 @@ -import { usePersonalization } from '../../../../../../../../providers' - import { Card } from '@/components/layout' import { ModalHeader } from '@/components/overlays' import { Box, Flex, Grid, Icon, Text } from '@/components/primitives' +import { usePersonalization } from '@/providers' import PALETTES from './constants/palettes.json' diff --git a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/ModandiColorPaletteModal/index.tsx b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/ModandiColorPaletteModal/index.tsx index 5b64974e2..8aee0f5bc 100644 --- a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/ModandiColorPaletteModal/index.tsx +++ b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/ModandiColorPaletteModal/index.tsx @@ -1,10 +1,9 @@ import clsx from 'clsx' import { sortFn } from 'color-sorter' -import { usePersonalization } from '../../../../../../../../providers' - import { ModalHeader } from '@/components/overlays' import { Box, Flex, Grid, Icon } from '@/components/primitives' +import { usePersonalization } from '@/providers' import * as styles from './MorandiColorPaletteModal.css' import { MORANDI_COLORS } from './constants/morandi_colors' diff --git a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/TailwindCSSColorsModal/components/ColorItem.tsx b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/TailwindCSSColorsModal/components/ColorItem.tsx index 48ee4c75f..8d3fa832a 100644 --- a/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/TailwindCSSColorsModal/components/ColorItem.tsx +++ b/packages/ui/src/components/inputs/ColorInput/ColorPickerModal/components/modals/TailwindCSSColorsModal/components/ColorItem.tsx @@ -1,9 +1,8 @@ import { converter, formatHex, parse } from 'culori' import { memo, useMemo } from 'react' -import { usePersonalization } from '../../../../../../../../../providers' - import { Box, Flex, Icon, Text } from '@/components/primitives' +import { usePersonalization } from '@/providers' function _ColorItem({ name, diff --git a/packages/ui/src/components/inputs/DateInput/index.tsx b/packages/ui/src/components/inputs/DateInput/index.tsx index 5ffbb3acd..22eefd940 100644 --- a/packages/ui/src/components/inputs/DateInput/index.tsx +++ b/packages/ui/src/components/inputs/DateInput/index.tsx @@ -3,9 +3,8 @@ import { useRef } from 'react' import DatePicker from 'react-datepicker' import tinycolor from 'tinycolor2' -import { usePersonalization } from '../../../providers' - import { Flex } from '@/components/primitives' +import { usePersonalization } from '@/providers' import { InputActionButton } from '../shared/components/InputActionButton' import { InputIcon } from '../shared/components/InputIcon' diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/AIImageGenerator.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/AIImageGenerator.tsx index 5c583d8f2..9cf438132 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/AIImageGenerator.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/AIImageGenerator.tsx @@ -4,13 +4,11 @@ import { toast } from 'react-toastify' import { useAPIEndpoint, usePromiseLoading } from '@lifeforge/shared' import { EmptyStateScreen } from '@/components/feedback' -import { Button } from '@/components/inputs' +import { Button, TextAreaInput } from '@/components/inputs' import { Box, Flex } from '@/components/primitives' import { WithQueryData } from '@/components/utilities' import { forgeAPI } from '@/utils/forgeAPI' -import { TextAreaInput } from '../../../TextAreaInput' - export function AIImageGenerator({ file, setFile, diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/LocalUpload/components/PreviewContainer.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/LocalUpload/components/PreviewContainer.tsx index edf145c65..e48a90e95 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/LocalUpload/components/PreviewContainer.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/LocalUpload/components/PreviewContainer.tsx @@ -2,7 +2,6 @@ import { useMemo } from 'react' import { Button } from '@/components/inputs' import { Box, Flex, Icon, Text } from '@/components/primitives' - import { FILE_ICONS } from '../../../constants/file_icons' export function PreviewContainer({ diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/CategoryFilter.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/CategoryFilter.tsx index 90e0ae7a1..2b2ddcf34 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/CategoryFilter.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/CategoryFilter.tsx @@ -1,9 +1,9 @@ import { ListboxInput, ListboxOption } from '@/components/inputs' import { Icon, Text } from '@/components/primitives' -import { - type IPixabaySearchFilter, - type PixabaySearchFilterAction +import type { + IPixabaySearchFilter, + PixabaySearchFilterAction } from '../../../typescript/pixabay_interfaces' import { CATEGORIES } from '../constants/filterOptions' diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ColorFilter.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ColorFilter.tsx index ae95d0828..a94ebe872 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ColorFilter.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ColorFilter.tsx @@ -1,9 +1,9 @@ import { ListboxInput, ListboxOption } from '@/components/inputs' import { Bordered, Text } from '@/components/primitives' -import { - type IPixabaySearchFilter, - type PixabaySearchFilterAction +import type { + IPixabaySearchFilter, + PixabaySearchFilterAction } from '../../../typescript/pixabay_interfaces' import { COLORS } from '../constants/filterOptions' diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/EditorsChoiceSwitch.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/EditorsChoiceSwitch.tsx index b4a89cd74..38cd673c5 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/EditorsChoiceSwitch.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/EditorsChoiceSwitch.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { Switch } from '@/components/inputs' import { Flex, Icon, Text } from '@/components/primitives' -import { type PixabaySearchFilterAction } from '../../../typescript/pixabay_interfaces' +import type { PixabaySearchFilterAction } from '../../../typescript/pixabay_interfaces' interface EditorsChoiceSwitchProps { isEditorsChoice: boolean diff --git a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ImageTypeFilter.tsx b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ImageTypeFilter.tsx index 5ddef0d71..40c531a26 100644 --- a/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ImageTypeFilter.tsx +++ b/packages/ui/src/components/inputs/FileInput/FilePickerModal/components/Pixabay/components/SearchFilterModal/components/ImageTypeFilter.tsx @@ -3,9 +3,9 @@ import { useTranslation } from 'react-i18next' import { ListboxInput, ListboxOption } from '@/components/inputs' import { Icon, Text } from '@/components/primitives' -import { - type IPixabaySearchFilter, - type PixabaySearchFilterAction +import type { + IPixabaySearchFilter, + PixabaySearchFilterAction } from '../../../typescript/pixabay_interfaces' import { IMAGE_TYPES } from '../constants/filterOptions' diff --git a/packages/ui/src/components/inputs/IconInput/IconPickerModal/components/ChipSelector.tsx b/packages/ui/src/components/inputs/IconInput/IconPickerModal/components/ChipSelector.tsx index a2ba167b1..65018208f 100644 --- a/packages/ui/src/components/inputs/IconInput/IconPickerModal/components/ChipSelector.tsx +++ b/packages/ui/src/components/inputs/IconInput/IconPickerModal/components/ChipSelector.tsx @@ -1,9 +1,8 @@ import { useCallback, useMemo, useState } from 'react' -import { usePersonalization } from '../../../../../providers' - import { TagChip } from '@/components/data-display' import { Flex, Icon, Text, Transition } from '@/components/primitives' +import { usePersonalization } from '@/providers' export function ChipSelector({ options, diff --git a/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/CategoryEntry.tsx b/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/CategoryEntry.tsx index d19ef7a65..9a4e32992 100644 --- a/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/CategoryEntry.tsx +++ b/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/CategoryEntry.tsx @@ -2,8 +2,8 @@ import { memo } from 'react' import { Bordered, Box, Grid, Text } from '@/components/primitives' -import type { IIconSet } from '../../../typescript/icon_selector_interfaces' import { IconSetEntry } from './IconSetEntry' +import type { IIconSet } from '../../../typescript/icon_selector_interfaces' function _CategoryEntry({ category, diff --git a/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/IconSetEntry.tsx b/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/IconSetEntry.tsx index ac8552025..60344dc0f 100644 --- a/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/IconSetEntry.tsx +++ b/packages/ui/src/components/inputs/IconInput/IconPickerModal/pages/IconSetList/components/IconSetEntry.tsx @@ -2,7 +2,6 @@ import { memo, useCallback } from 'react' import { Card } from '@/components/layout' import { Bordered, Box, Flex, Icon, Text } from '@/components/primitives' - import type { IIconSet } from '../../../typescript/icon_selector_interfaces' function _IconSetEntry({ diff --git a/packages/ui/src/components/inputs/LocationInput/components/LocationServiceStatusIndicator.tsx b/packages/ui/src/components/inputs/LocationInput/components/LocationServiceStatusIndicator.tsx index 4654ab59f..dd9fd5341 100644 --- a/packages/ui/src/components/inputs/LocationInput/components/LocationServiceStatusIndicator.tsx +++ b/packages/ui/src/components/inputs/LocationInput/components/LocationServiceStatusIndicator.tsx @@ -1,8 +1,7 @@ import { useTranslation } from 'react-i18next' import { Box, Flex, Icon, Text } from '@/components/primitives' - -import { Tooltip } from '../../../utilities' +import { Tooltip } from '@/components/utilities' export function LocationServiceStatusIndicator({ enabled diff --git a/packages/ui/src/components/inputs/Switch/index.tsx b/packages/ui/src/components/inputs/Switch/index.tsx index 9cfb0e8af..a42a30fff 100644 --- a/packages/ui/src/components/inputs/Switch/index.tsx +++ b/packages/ui/src/components/inputs/Switch/index.tsx @@ -1,8 +1,7 @@ import { Switch as HeadlessSwitch } from '@headlessui/react' -import { usePersonalization } from '../../../providers' - import { Box, Flex, Transition } from '@/components/primitives' +import { usePersonalization } from '@/providers' import { COLORS } from '@/system' interface SwitchProps { diff --git a/packages/ui/src/components/inputs/shared/components/InputLabel/index.tsx b/packages/ui/src/components/inputs/shared/components/InputLabel/index.tsx index 9c3024a86..bba1cf2e0 100644 --- a/packages/ui/src/components/inputs/shared/components/InputLabel/index.tsx +++ b/packages/ui/src/components/inputs/shared/components/InputLabel/index.tsx @@ -3,11 +3,11 @@ import { type CSSProperties, memo } from 'react' import { Flex, Icon, Text, Transition } from '@/components/primitives' -import { useInputFocused } from '../../contexts/InputFocusContext' import { inputLabelActiveStyle, inputLabelInactiveStyle } from './InputLabel.css' +import { useInputFocused } from '../../contexts/InputFocusContext' interface InputLabelProps { label: string diff --git a/packages/ui/src/components/layout/ModuleHeader/index.tsx b/packages/ui/src/components/layout/ModuleHeader/index.tsx index bae682fc7..ab7bebb18 100644 --- a/packages/ui/src/components/layout/ModuleHeader/index.tsx +++ b/packages/ui/src/components/layout/ModuleHeader/index.tsx @@ -1,11 +1,11 @@ import { Menu, MenuButton, MenuItems } from '@headlessui/react' import { useTranslation } from 'react-i18next' -import { useModuleHeaderState } from '../../../providers' -import { useMainSidebarState } from '@lifeforge/shared' +import { useMainSidebarState } from '../../../providers' import { Button } from '@/components/inputs' import { Box, Flex, Icon, Text, Transition } from '@/components/primitives' +import { useModuleHeaderState } from '@/providers' import { colorWithOpacity } from '@/system' import { ContextMenu } from '../../overlays/ContextMenu' diff --git a/packages/ui/src/components/layout/ModuleWrapper/index.tsx b/packages/ui/src/components/layout/ModuleWrapper/index.tsx index b8cfbc94f..380744d17 100644 --- a/packages/ui/src/components/layout/ModuleWrapper/index.tsx +++ b/packages/ui/src/components/layout/ModuleWrapper/index.tsx @@ -2,14 +2,14 @@ import { useQueryClient } from '@tanstack/react-query' import _ from 'lodash' import { useEffect } from 'react' -import { - ModuleHeaderStateProvider, - ModuleSidebarStateProvider -} from '../../../providers' import { normalizeSubnamespace } from '@lifeforge/shared' import { Flex } from '@/components/primitives' import { Scrollbar } from '@/components/utilities' +import { + ModuleHeaderStateProvider, + ModuleSidebarStateProvider +} from '@/providers' /** * The wrapper component for all modules in the app. It provides the layout and context for the module header and sidebar, as well as handling query cleanup on unmount if specified. If being used within LifeForge instance, it will be automatically wrapped around the module content. Therefore, no explicit usage is needed in most cases. diff --git a/packages/ui/src/components/navigation/sidebar/MainSidebarItem/index.tsx b/packages/ui/src/components/navigation/sidebar/MainSidebarItem/index.tsx index a74f662fd..3a6003c8c 100644 --- a/packages/ui/src/components/navigation/sidebar/MainSidebarItem/index.tsx +++ b/packages/ui/src/components/navigation/sidebar/MainSidebarItem/index.tsx @@ -1,6 +1,5 @@ import { useCallback, useState } from 'react' - -import { useNavigate } from '@lifeforge/shared' +import { useNavigate } from 'react-router' import { SidebarItemContent } from '../SidebarItem/components/SidebarItemContent' import { SidebarItemIcon } from '../SidebarItem/components/SidebarItemIcon' diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarActionButton.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarActionButton.tsx index 5a9324902..911eb3123 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarActionButton.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarActionButton.tsx @@ -1,6 +1,5 @@ -import { useModuleSidebarState } from '../../../../../providers' - import { Box, Icon, Text, Transition } from '@/components/primitives' +import { useModuleSidebarState } from '@/providers' import { colorWithOpacity } from '@/system' export function SidebarActionButton({ diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarCancelButton.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarCancelButton.tsx index 0c07de1ff..9d58b9ba1 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarCancelButton.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarCancelButton.tsx @@ -1,6 +1,5 @@ -import { useModuleSidebarState } from '../../../../../providers' - import { Box, Icon, Text, Transition } from '@/components/primitives' +import { useModuleSidebarState } from '@/providers' export function SidebarCancelButton({ onClick }: { onClick: () => void }) { const { setIsSidebarOpen } = useModuleSidebarState() diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarItemSubsection.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarItemSubsection.tsx index b58817e44..12033a234 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarItemSubsection.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarItemSubsection.tsx @@ -1,6 +1,5 @@ -import { useMainSidebarState } from '@lifeforge/shared' - import { Flex, Transition } from '@/components/primitives' +import { useMainSidebarState } from '@/providers' import { SidebarSubsectionItemLink } from './SidebarSubsectionItemLink' import { SidebarSubsectionItemWithOnClick } from './SidebarSubsectionItemWithOnClick' diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemLink.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemLink.tsx index a23c01e74..caeb9ce0f 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemLink.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemLink.tsx @@ -2,10 +2,11 @@ import _ from 'lodash' import { useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Link, useLocation, useMainSidebarState } from '@lifeforge/shared' import { Flex, Icon, Text, Transition } from '@/components/primitives' +import { useMainSidebarState } from '@/providers' import { colorWithOpacity } from '@/system/colors/color-with-opacity' +import { Link, useLocation } from 'react-router' export function SidebarSubsectionItemLink({ subsectionLabel, diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemWithOnClick.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemWithOnClick.tsx index 18c2a21a1..fbf8f3895 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemWithOnClick.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/components/SidebarSubsectionItemWithOnClick.tsx @@ -2,9 +2,8 @@ import _ from 'lodash' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useModuleSidebarState } from '../../../../../providers' - import { Flex, Icon, Text, Transition } from '@/components/primitives' +import { useModuleSidebarState } from '@/providers' import { colorWithOpacity } from '@/system' export function SidebarSubsectionItemWithOnClick({ diff --git a/packages/ui/src/components/navigation/sidebar/SidebarItem/index.tsx b/packages/ui/src/components/navigation/sidebar/SidebarItem/index.tsx index 489bd1034..140b79430 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarItem/index.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarItem/index.tsx @@ -1,8 +1,7 @@ import { useCallback, useState } from 'react' -import { useModuleSidebarState } from '../../../../providers' - import { Box } from '@/components/primitives' +import { useModuleSidebarState } from '@/providers' import { SidebarCancelButton } from './components/SidebarCancelButton' import { SidebarItemContent } from './components/SidebarItemContent' diff --git a/packages/ui/src/components/navigation/sidebar/SidebarWrapper/index.tsx b/packages/ui/src/components/navigation/sidebar/SidebarWrapper/index.tsx index 77abf2ecc..819003693 100644 --- a/packages/ui/src/components/navigation/sidebar/SidebarWrapper/index.tsx +++ b/packages/ui/src/components/navigation/sidebar/SidebarWrapper/index.tsx @@ -1,7 +1,6 @@ -import { useModuleSidebarState } from '../../../../providers' - import { Box, Flex } from '@/components/primitives' import { Scrollbar } from '@/components/utilities' +import { useModuleSidebarState } from '@/providers' import { GoBackButton } from '../../GoBackButton' diff --git a/packages/ui/src/components/navigation/sidebar/index.ts b/packages/ui/src/components/navigation/sidebar/index.ts index fbb3b6660..ef3ddd1e2 100644 --- a/packages/ui/src/components/navigation/sidebar/index.ts +++ b/packages/ui/src/components/navigation/sidebar/index.ts @@ -8,4 +8,4 @@ export { SidebarWrapper } from './SidebarWrapper' export { MainSidebarItem } from './MainSidebarItem' -export { useModuleSidebarState } from '../../../providers' +export { useModuleSidebarState } from '@/providers' diff --git a/packages/ui/src/components/utilities/PrintArea/index.tsx b/packages/ui/src/components/utilities/PrintArea/index.tsx index f6771ba71..46f9f73a5 100644 --- a/packages/ui/src/components/utilities/PrintArea/index.tsx +++ b/packages/ui/src/components/utilities/PrintArea/index.tsx @@ -1,4 +1,4 @@ -import { usePersonalization } from '../../../providers' +import { usePersonalization } from '@/providers' function getBodyStyles(): Record { if (typeof document === 'undefined') return {} diff --git a/packages/ui/src/components/utilities/Tooltip/index.tsx b/packages/ui/src/components/utilities/Tooltip/index.tsx index 6c6a7ce5c..7c7476d87 100644 --- a/packages/ui/src/components/utilities/Tooltip/index.tsx +++ b/packages/ui/src/components/utilities/Tooltip/index.tsx @@ -2,9 +2,8 @@ import _ from 'lodash' import { Tooltip as ReactTooltip } from 'react-tooltip' import tinycolor from 'tinycolor2' -import { usePersonalization } from '../../../providers' - import { Box, Icon, Text } from '@/components/primitives' +import { usePersonalization } from '@/providers' /** * A tooltip component that displays informational content when hovering over an icon. diff --git a/shared/src/providers/SidebarStateProvider.tsx b/packages/ui/src/providers/MainSidebarStateProvider.tsx similarity index 95% rename from shared/src/providers/SidebarStateProvider.tsx rename to packages/ui/src/providers/MainSidebarStateProvider.tsx index d80b88dcd..33b5b19c1 100644 --- a/shared/src/providers/SidebarStateProvider.tsx +++ b/packages/ui/src/providers/MainSidebarStateProvider.tsx @@ -14,7 +14,7 @@ interface ISidebarState { const SidebarStateContext = createContext(undefined) -export default function MainSidebarStateProvider({ +export function MainSidebarStateProvider({ children }: { children: React.ReactNode diff --git a/packages/ui/src/providers/ModuleHeaderStateProvider.tsx b/packages/ui/src/providers/ModuleHeaderStateProvider.tsx index d55556911..b860e4416 100644 --- a/packages/ui/src/providers/ModuleHeaderStateProvider.tsx +++ b/packages/ui/src/providers/ModuleHeaderStateProvider.tsx @@ -1,6 +1,6 @@ import { createContext, useContext } from 'react' -const ModuleHeaderStateContext = createContext< +export const ModuleHeaderStateProvider = createContext< | { icon: string title: string @@ -8,10 +8,8 @@ const ModuleHeaderStateContext = createContext< | undefined >(undefined) -export default ModuleHeaderStateContext - export const useModuleHeaderState = () => { - const context = useContext(ModuleHeaderStateContext) + const context = useContext(ModuleHeaderStateProvider) if (!context) { return { diff --git a/packages/ui/src/providers/ModuleSidebarStateProvider.tsx b/packages/ui/src/providers/ModuleSidebarStateProvider.tsx index e57e17e1c..69aab8581 100644 --- a/packages/ui/src/providers/ModuleSidebarStateProvider.tsx +++ b/packages/ui/src/providers/ModuleSidebarStateProvider.tsx @@ -8,7 +8,7 @@ const ModuleSidebarStateContext = createContext< | undefined >(undefined) -const ModuleSidebarStateProvider = ({ +export const ModuleSidebarStateProvider = ({ children }: { children: React.ReactNode @@ -27,7 +27,7 @@ const ModuleSidebarStateProvider = ({ ) } -const useModuleSidebarState = () => { +export const useModuleSidebarState = () => { const context = useContext(ModuleSidebarStateContext) if (!context) { @@ -39,7 +39,3 @@ const useModuleSidebarState = () => { return context } - -export default ModuleSidebarStateProvider - -export { useModuleSidebarState } diff --git a/packages/ui/src/providers/PersonalizationProvider/index.tsx b/packages/ui/src/providers/PersonalizationProvider/index.tsx index a481d9705..c85fa0fc3 100644 --- a/packages/ui/src/providers/PersonalizationProvider/index.tsx +++ b/packages/ui/src/providers/PersonalizationProvider/index.tsx @@ -2,7 +2,8 @@ import _ from 'lodash' import { createContext, useContext, useMemo, useState } from 'react' import tinycolor from 'tinycolor2' -import type { ProxyTree } from '../../api/typescript/forge_proxy.types' +import type { ProxyTree } from '@lifeforge/shared' + import { BG_THEME } from './constants/bg_theme' import THEME_COLOR_HEX from './constants/theme_color_hex' import useBgTempEffect from './hooks/useBgTempEffect' @@ -60,7 +61,7 @@ const PersonalizationContext = createContext( DEFAULT_VALUE ) -export default function PersonalizationProvider({ +export function PersonalizationProvider({ forgeAPI, defaultValueOverride = {}, children @@ -245,3 +246,10 @@ export function usePersonalization(): IPersonalizationData { return context || DEFAULT_VALUE } + +export { BG_BLURS } from './constants/bg_blurs' + +export type { + IDashboardLayout, + IBackdropFilters +} from './interfaces/personalization_provider_interfaces' diff --git a/packages/ui/src/providers/ToastProvider.tsx b/packages/ui/src/providers/ToastProvider.tsx index 0eecc9f05..8aa4a3484 100644 --- a/packages/ui/src/providers/ToastProvider.tsx +++ b/packages/ui/src/providers/ToastProvider.tsx @@ -2,7 +2,7 @@ import { ToastContainer } from 'react-toastify' import { usePersonalization } from './PersonalizationProvider/index' -function ToastProvider({ children }: { children: React.ReactNode }) { +export function ToastProvider({ children }: { children: React.ReactNode }) { const { theme } = usePersonalization() return ( @@ -22,5 +22,3 @@ function ToastProvider({ children }: { children: React.ReactNode }) { ) } - -export default ToastProvider diff --git a/packages/ui/src/providers/index.ts b/packages/ui/src/providers/index.ts index bb864a064..d5d92c71f 100644 --- a/packages/ui/src/providers/index.ts +++ b/packages/ui/src/providers/index.ts @@ -2,17 +2,12 @@ export * from './BackgroundProvider' export * from './ModalProvider' -export { usePersonalization } from './PersonalizationProvider' -export { BG_BLURS } from './PersonalizationProvider/constants/bg_blurs' -export { default as PersonalizationProvider } from './PersonalizationProvider' -export type { - IDashboardLayout, - IBackdropFilters -} from './PersonalizationProvider/interfaces/personalization_provider_interfaces' +export * from './PersonalizationProvider' -export { default as ToastProvider } from './ToastProvider' +export * from './ToastProvider' -export { useModuleSidebarState } from './ModuleSidebarStateProvider' -export { default as ModuleSidebarStateProvider } from './ModuleSidebarStateProvider' +export * from './ModuleSidebarStateProvider' -export { useModuleHeaderState } from './ModuleHeaderStateProvider' +export * from './ModuleHeaderStateProvider' + +export * from './MainSidebarStateProvider' diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index 6abd68c2e..6bd503714 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -4,10 +4,15 @@ "jsx": "react-jsx", "module": "esnext", "moduleResolution": "bundler", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "paths": { - "@/components/*": ["./src/components/*"], - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] }, "declaration": true, "declarationMap": true, @@ -20,5 +25,8 @@ "skipLibCheck": true, "verbatimModuleSyntax": true }, - "include": ["./src/**/*", "./.storybook/*"] -} + "include": [ + "./src/**/*", + "./.storybook/*" + ] +} \ No newline at end of file diff --git a/packages/ui/vite.config.ts b/packages/ui/vite.config.ts index 4f79b5d20..28c4974e0 100644 --- a/packages/ui/vite.config.ts +++ b/packages/ui/vite.config.ts @@ -14,7 +14,6 @@ export default defineConfig({ ], resolve: { alias: { - '@/components': resolve(__dirname, 'src/components'), '@': resolve(__dirname, 'src') } }, diff --git a/shared/package.json b/shared/package.json index 879d59a94..4aa09d1f2 100644 --- a/shared/package.json +++ b/shared/package.json @@ -26,8 +26,6 @@ "culori": "^4.0.2", "javascript-color-gradient": "^2.5.0", "json-schema-to-ts": "^3.1.1", - "nuqs": "^2.7.1", - "react-router": "^7.9.4", "socket.io-client": "^4.8.1" } } diff --git a/shared/src/api/core/forgeEndpoint.ts b/shared/src/api/core/forgeEndpoint.ts index d4f078855..e23f64c61 100644 --- a/shared/src/api/core/forgeEndpoint.ts +++ b/shared/src/api/core/forgeEndpoint.ts @@ -9,6 +9,7 @@ import { isEncryptedResponse } from '../../utils/encryption' import fetchAPI from '../../utils/fetchAPI' + import type { InferInput, InferOutput } from '../typescript/forge_proxy.types' import { globalProxyRegistry } from './registry' import { getFormData, hasFile, joinObjectsRecursively } from './utils' diff --git a/shared/src/api/core/helpers/config.ts b/shared/src/api/core/helpers/config.ts index 60f5e7637..399130c05 100644 --- a/shared/src/api/core/helpers/config.ts +++ b/shared/src/api/core/helpers/config.ts @@ -1,8 +1,7 @@ import z from 'zod' -import type { UntypedEndpointType } from '@/api/typescript/forge_proxy.types' -import GetGoogleFontResponseSchema from '@/interfaces/google_fonts.types' - +import GetGoogleFontResponseSchema from '../../../interfaces/google_fonts.types' +import type { UntypedEndpointType } from '../../typescript/forge_proxy.types' import type ForgeEndpoint from '../forgeEndpoint' /** diff --git a/shared/src/api/core/helpers/createCoreHelper.ts b/shared/src/api/core/helpers/createCoreHelper.ts index 859823be2..30b51448a 100644 --- a/shared/src/api/core/helpers/createCoreHelper.ts +++ b/shared/src/api/core/helpers/createCoreHelper.ts @@ -1,6 +1,6 @@ import type z from 'zod' -import type { UntypedEndpointType } from '@/api/typescript/forge_proxy.types' +import type { UntypedEndpointType } from '../../typescript/forge_proxy.types' import ForgeEndpoint from '../forgeEndpoint' import CORE_HELPERS, { type CoreHelperName } from './config' diff --git a/shared/src/index.ts b/shared/src/index.ts index 9869444df..fc38fda75 100644 --- a/shared/src/index.ts +++ b/shared/src/index.ts @@ -1,38 +1,36 @@ -/* eslint-disable padding-line-between-statements */ -export * from 'react-router' - -// Re-export nuqs hooks and parsers due to version mismatch issues -export { - useQueryState, - useQueryStates, - parseAsString, - parseAsStringEnum, - parseAsBoolean, - parseAsInteger -} from 'nuqs' - // Context providers export { useEncryption } from './providers/EncryptionProvider' + export { useAPIEndpoint } from './providers/APIEndpointProvider' + export { useAPIOnlineStatus } from './providers/APIOnlineStatusProvider' -export { useMainSidebarState as useMainSidebarState } from './providers/SidebarStateProvider' + export { useAuth } from './providers/AuthProvider' + export { default as AuthProvider } from './providers/AuthProvider' + export { default as APIEndpointProvider } from './providers/APIEndpointProvider' + export { default as APIOnlineStatusProvider } from './providers/APIOnlineStatusProvider' -export { default as MainSidebarStateProvider } from './providers/SidebarStateProvider' + export { default as SocketProvider } from './providers/SocketProvider' + export { default as NuqsProvider } from './providers/NuqsProvider' + export { default as EncryptionProvider } from './providers/EncryptionProvider' + export { type SocketEvent, useSocketContext } from './providers/SocketProvider' // Useful hooks export { default as usePromiseLoading } from './hooks/usePromiseLoading' + export { default as useDivSize } from './hooks/useDivSize' // Useful utility functions export { default as anyColorToHex } from './utils/anyColorToHex' + export { default as forceDown } from './utils/forceDown' + export { encrypt, decrypt, @@ -41,14 +39,20 @@ export { encryptRequest, isEncryptedResponse } from './utils/encryption' + export { default as fetchAPI } from './utils/fetchAPI' export { default as getBrowserInfo } from './utils/getBrowserInfo' + export { default as normalizeSubnamespace } from './utils/normalizeSubnamespace' + export { default as parseCollectionName } from './utils/parseCollectionName' + // Forge API client and types export { default as createForgeProxy } from './api/core/createForgeProxy' + export { default as ForgeEndpoint } from './api/core/forgeEndpoint' + export type { ProxyTree, InferClientControllerOutput as InferOutput, @@ -57,5 +61,7 @@ export type { // Some shared types export type { default as WidgetConfig } from './interfaces/widget_config.types' + export { widgetConfigSchema } from './interfaces/widget_config.types' + export { globalProxyRegistry } from './api/core/registry' diff --git a/shared/tsconfig.json b/shared/tsconfig.json index 09ef255b1..9062b138b 100644 --- a/shared/tsconfig.json +++ b/shared/tsconfig.json @@ -19,11 +19,6 @@ // Additional checks "noFallthroughCasesInSwitch": true, "noUncheckedIndexedAccess": true, - "paths": { - "@/*": [ - "./src/*" - ] - } }, "include": [ "./src/**/*"