From fc71601d172ee2e6de9d4693c514af410fe5d634 Mon Sep 17 00:00:00 2001 From: Matthew Warman Date: Thu, 31 Oct 2024 07:57:48 -0400 Subject: [PATCH] common folder --- src/App.tsx | 18 +++++++++--------- src/__fixtures__/settings.ts | 2 +- src/__fixtures__/toasts.ts | 2 +- src/__fixtures__/tokens.ts | 2 +- src/__fixtures__/users.ts | 2 +- .../api/__tests__/useGetCurrentUser.test.ts | 4 ++-- .../api/__tests__/useGetSettings.test.ts | 6 +++--- .../api/__tests__/useGetUser.test.ts | 2 +- .../api/__tests__/useGetUserTokens.test.ts | 4 ++-- .../api/__tests__/useSetSettings.test.ts | 6 +++--- src/{ => common}/api/useGetCurrentUser.ts | 4 ++-- src/{ => common}/api/useGetSettings.ts | 4 ++-- src/{ => common}/api/useGetUser.ts | 6 +++--- src/{ => common}/api/useGetUserTokens.ts | 4 ++-- src/{ => common}/api/useSetSettings.ts | 4 ++-- src/{ => common}/components/Badge/Badge.tsx | 0 .../components/Badge/__tests__/Badge.test.tsx | 0 src/{ => common}/components/Button/Button.tsx | 0 .../components/Button/LanguageToggle.tsx | 12 ++++++------ .../components/Button/ThemeToggle.tsx | 6 +++--- .../Button/__tests__/Button.test.tsx | 0 .../Button/__tests__/LanguageToggle.test.tsx | 4 ++-- .../Button/__tests__/ThemeToggle.test.tsx | 6 +++--- src/{ => common}/components/Card/Card.tsx | 0 .../components/Card/MessageCard.tsx | 2 +- .../components/Card/__tests__/Card.test.tsx | 0 .../Card/__tests__/MessageCard.test.tsx | 0 .../components/Dropdown/Dropdown.tsx | 0 .../components/Dropdown/DropdownContent.tsx | 0 .../components/Dropdown/DropdownItem.tsx | 0 .../Dropdown/__tests__/Dropdown.test.tsx | 0 .../__tests__/DropdownContent.test.tsx | 0 .../Dropdown/__tests__/DropdownItem.test.tsx | 0 .../components/Errors/ErrorBoundary.tsx | 0 .../components/Errors/ErrorFallback.tsx | 0 .../Errors/__tests__/ErrorBoundary.test.tsx | 0 .../Errors/__tests__/ErrorFallback.test.tsx | 0 src/{ => common}/components/Footer/Footer.tsx | 2 +- .../Footer/__tests__/Footer.test.tsx | 0 .../components/Form/SearchField.tsx | 2 +- .../components/Form/SearchResult.tsx | 0 .../components/Form/SelectField.tsx | 2 +- .../components/Form/TextField.tsx | 0 .../Form/__tests__/SearchField.test.tsx | 0 .../Form/__tests__/SearchResult.test.tsx | 0 .../Form/__tests__/SelectField.test.tsx | 0 .../Form/__tests__/TextField.test.tsx | 0 .../components/Header/AppMenu.tsx | 12 ++++++------ src/{ => common}/components/Header/Header.tsx | 8 ++++---- .../Header/__tests__/AppMenu.test.tsx | 6 +++--- .../Header/__tests__/Header.test.tsx | 2 +- src/{ => common}/components/Header/logo.png | Bin src/{ => common}/components/Icon/Avatar.tsx | 0 src/{ => common}/components/Icon/FAIcon.tsx | 0 .../components/Icon/__tests__/Avatar.test.tsx | 0 .../components/Icon/__tests__/FAIcon.test.tsx | 0 .../components/Layout/StandardLayout.tsx | 6 +++--- .../Layout/__tests__/StandardLayout.test.tsx | 0 src/{ => common}/components/Link/Link.tsx | 0 .../components/Link/__tests__/Link.test.tsx | 0 .../components/Loader/LoaderSkeleton.tsx | 0 .../components/Loader/LoaderSpinner.tsx | 2 +- .../Loader/__tests__/LoaderSkeleton.test.tsx | 0 .../Loader/__tests__/LoaderSpinner.test.tsx | 0 src/{ => common}/components/Menu/Menu.tsx | 0 .../components/Menu/MenuButton.tsx | 4 ++-- .../components/Menu/MenuCloseButton.tsx | 4 ++-- .../components/Menu/MenuNavLink.tsx | 2 +- .../components/Menu/MenuSeparator.tsx | 0 .../components/Menu/SideMenu/SideMenu.tsx | 0 .../Menu/SideMenu/SideMenuHeader.tsx | 0 .../Menu/SideMenu/__tests__/SideMenu.test.tsx | 0 .../__tests__/SideMenuHeader.test.tsx | 0 .../Menu/__tests__/MenuButton.test.tsx | 0 .../Menu/__tests__/MenuCloseButton.test.tsx | 0 .../Menu/__tests__/MenuNavLink.test.tsx | 0 .../Menu/__tests__/MenuSeparator.test.tsx | 0 src/{ => common}/components/Page/Page.tsx | 0 .../components/Page/__tests__/Page.test.tsx | 0 .../components/Router/PrivateOutlet.tsx | 2 +- src/{ => common}/components/Router/Router.tsx | 2 +- .../Router/__tests__/PrivateOutlet.test.tsx | 2 +- src/{ => common}/components/Table/Table.tsx | 0 .../components/Table/__tests__/Table.test.tsx | 0 src/{ => common}/components/Tabs/Tab.tsx | 0 .../components/Tabs/TabContent.tsx | 0 src/{ => common}/components/Tabs/Tabs.tsx | 4 ++-- .../components/Tabs/__tests__/Tab.test.tsx | 0 .../Tabs/__tests__/TabContent.test.tsx | 0 .../components/Tabs/__tests__/Tabs.test.tsx | 0 .../components/Text/CodeSnippet.tsx | 2 +- src/{ => common}/components/Text/Text.tsx | 0 .../Text/__tests__/CodeSnippet.test.tsx | 2 +- .../components/Text/__tests__/Text.test.tsx | 0 src/{ => common}/components/Theme/Theme.tsx | 2 +- .../components/Theme/__tests__/Theme.test.tsx | 0 src/{ => common}/components/Toast/Toast.tsx | 8 ++++---- src/{ => common}/components/Toast/Toasts.tsx | 2 +- .../components/Toast/__tests__/Toast.test.tsx | 2 +- .../Toast/__tests__/Toasts.test.tsx | 2 +- .../hooks/__tests__/useAuth.test.ts | 4 ++-- .../hooks/__tests__/useAxios.test.ts | 4 ++-- .../hooks/__tests__/useConfig.test.ts | 2 +- .../hooks/__tests__/useDebounce.test.ts | 2 +- .../hooks/__tests__/useSettings.test.ts | 4 ++-- .../hooks/__tests__/useToasts.test.ts | 2 +- src/{ => common}/hooks/useAuth.ts | 2 +- src/{ => common}/hooks/useAxios.ts | 2 +- src/{ => common}/hooks/useConfig.ts | 2 +- src/{ => common}/hooks/useDebounce.ts | 0 src/{ => common}/hooks/useSettings.ts | 4 ++-- src/{ => common}/hooks/useToasts.ts | 2 +- src/{ => common}/providers/AuthContext.ts | 2 +- src/{ => common}/providers/AuthProvider.tsx | 4 ++-- src/{ => common}/providers/AxiosContext.ts | 0 src/{ => common}/providers/AxiosProvider.tsx | 2 +- src/{ => common}/providers/ConfigContext.ts | 0 src/{ => common}/providers/ConfigProvider.tsx | 0 src/{ => common}/providers/SettingsContext.ts | 2 +- .../providers/SettingsProvider.tsx | 2 +- src/{ => common}/providers/ToastsContext.ts | 0 src/{ => common}/providers/ToastsProvider.tsx | 0 .../providers/__tests__/AuthProvider.test.tsx | 4 ++-- .../__tests__/AxiosProvider.test.tsx | 6 +++--- .../__tests__/ConfigProvider.test.tsx | 2 +- .../__tests__/SettingsProvider.test.tsx | 4 ++-- .../__tests__/ToastsProvider.test.tsx | 2 +- .../utils/__tests__/numbers.test.ts | 2 +- .../utils/__tests__/storage.test.ts | 2 +- src/{ => common}/utils/constants.ts | 2 +- .../utils/i18n/__tests__/i18n.test.ts | 2 +- src/{ => common}/utils/i18n/index.ts | 2 +- .../utils/i18n/locales/en/common.json | 0 .../utils/i18n/locales/en/index.ts | 0 .../utils/i18n/locales/en/users.json | 0 .../utils/i18n/locales/es/common.json | 0 .../utils/i18n/locales/es/index.ts | 0 .../utils/i18n/locales/es/users.json | 0 .../utils/i18n/locales/fr/common.json | 0 .../utils/i18n/locales/fr/index.ts | 0 .../utils/i18n/locales/fr/users.json | 0 src/{ => common}/utils/numbers.ts | 0 src/{ => common}/utils/storage.ts | 0 src/main.tsx | 2 +- src/pages/ComponentsPage/ComponentsPage.tsx | 6 +++--- .../components/AvatarComponents.tsx | 8 ++++---- .../components/BadgeComponents.tsx | 8 ++++---- .../components/ButtonComponents.tsx | 8 ++++---- .../components/CardComponents.tsx | 10 +++++----- .../components/TextComponents.tsx | 6 +++--- src/pages/DashboardPage/DashboardPage.tsx | 6 +++--- .../__tests__/DashboardPage.test.tsx | 4 ++-- src/pages/LandingPage/LandingPage.tsx | 4 ++-- .../__tests__/LandingPage.test.tsx | 2 +- src/pages/SettingsPage/SettingsPage.tsx | 10 +++++----- .../__tests__/SettingsPage.test.tsx | 4 ++-- .../components/AppearanceSettings.tsx | 4 ++-- .../__tests__/AppearanceSettings.test.tsx | 8 ++++---- src/pages/SigninPage/SigninPage.tsx | 2 +- .../api/__tests__/useSignin.test.ts | 2 +- src/pages/SigninPage/api/useSignin.ts | 12 ++++++------ .../SigninPage/components/SigninForm.tsx | 4 ++-- src/pages/SignoutPage/SignoutPage.tsx | 4 ++-- .../api/__tests__/useSignout.test.ts | 2 +- src/pages/SignoutPage/api/useSignout.ts | 4 ++-- .../Tasks/api/__tests__/useUpdateTask.test.ts | 2 +- src/pages/UsersPage/Tasks/api/useGetTask.ts | 6 +++--- .../UsersPage/Tasks/api/useUpdateTask.ts | 6 +++--- .../Tasks/components/TaskCompleteToggle.tsx | 4 ++-- .../UsersPage/Tasks/components/TaskDetail.tsx | 12 ++++++------ .../__tests__/TaskCompleteToggle.test.tsx | 2 +- .../components/__tests__/TaskDetail.test.tsx | 2 +- src/pages/UsersPage/UsersPage.tsx | 6 +++--- src/pages/UsersPage/api/useGetUserTasks.ts | 6 +++--- src/pages/UsersPage/api/useGetUsers.ts | 8 ++++---- src/pages/UsersPage/components/UserDetail.tsx | 8 ++++---- .../UsersPage/components/UserDetailEmpty.tsx | 2 +- .../UsersPage/components/UserDetailLayout.tsx | 10 +++++----- src/pages/UsersPage/components/UserList.tsx | 2 +- .../UsersPage/components/UserListItem.tsx | 2 +- .../UsersPage/components/UserTaskList.tsx | 8 ++++---- .../UsersPage/components/UserTaskListItem.tsx | 2 +- src/pages/UsersPage/components/UserTasks.tsx | 10 +++++----- .../UsersPage/components/UserTasksCard.tsx | 4 ++-- .../components/__tests__/UserDetail.test.tsx | 2 +- .../__tests__/UserDetailLayout.test.tsx | 2 +- .../components/__tests__/UserList.test.tsx | 2 +- src/test/test-utils.tsx | 2 +- .../wrappers/AllProvidersExceptRouter.tsx | 8 ++++---- src/test/wrappers/WithAllProviders.tsx | 8 ++++---- tsconfig.json | 8 ++------ vite.config.ts | 6 +----- 192 files changed, 252 insertions(+), 260 deletions(-) rename src/{ => common}/api/__tests__/useGetCurrentUser.test.ts (93%) rename src/{ => common}/api/__tests__/useGetSettings.test.ts (89%) rename src/{ => common}/api/__tests__/useGetUser.test.ts (91%) rename src/{ => common}/api/__tests__/useGetUserTokens.test.ts (94%) rename src/{ => common}/api/__tests__/useSetSettings.test.ts (89%) rename src/{ => common}/api/useGetCurrentUser.ts (87%) rename src/{ => common}/api/useGetSettings.ts (88%) rename src/{ => common}/api/useGetUser.ts (89%) rename src/{ => common}/api/useGetUserTokens.ts (94%) rename src/{ => common}/api/useSetSettings.ts (92%) rename src/{ => common}/components/Badge/Badge.tsx (100%) rename src/{ => common}/components/Badge/__tests__/Badge.test.tsx (100%) rename src/{ => common}/components/Button/Button.tsx (100%) rename src/{ => common}/components/Button/LanguageToggle.tsx (84%) rename src/{ => common}/components/Button/ThemeToggle.tsx (89%) rename src/{ => common}/components/Button/__tests__/Button.test.tsx (100%) rename src/{ => common}/components/Button/__tests__/LanguageToggle.test.tsx (95%) rename src/{ => common}/components/Button/__tests__/ThemeToggle.test.tsx (93%) rename src/{ => common}/components/Card/Card.tsx (100%) rename src/{ => common}/components/Card/MessageCard.tsx (95%) rename src/{ => common}/components/Card/__tests__/Card.test.tsx (100%) rename src/{ => common}/components/Card/__tests__/MessageCard.test.tsx (100%) rename src/{ => common}/components/Dropdown/Dropdown.tsx (100%) rename src/{ => common}/components/Dropdown/DropdownContent.tsx (100%) rename src/{ => common}/components/Dropdown/DropdownItem.tsx (100%) rename src/{ => common}/components/Dropdown/__tests__/Dropdown.test.tsx (100%) rename src/{ => common}/components/Dropdown/__tests__/DropdownContent.test.tsx (100%) rename src/{ => common}/components/Dropdown/__tests__/DropdownItem.test.tsx (100%) rename src/{ => common}/components/Errors/ErrorBoundary.tsx (100%) rename src/{ => common}/components/Errors/ErrorFallback.tsx (100%) rename src/{ => common}/components/Errors/__tests__/ErrorBoundary.test.tsx (100%) rename src/{ => common}/components/Errors/__tests__/ErrorFallback.test.tsx (100%) rename src/{ => common}/components/Footer/Footer.tsx (97%) rename src/{ => common}/components/Footer/__tests__/Footer.test.tsx (100%) rename src/{ => common}/components/Form/SearchField.tsx (98%) rename src/{ => common}/components/Form/SearchResult.tsx (100%) rename src/{ => common}/components/Form/SelectField.tsx (99%) rename src/{ => common}/components/Form/TextField.tsx (100%) rename src/{ => common}/components/Form/__tests__/SearchField.test.tsx (100%) rename src/{ => common}/components/Form/__tests__/SearchResult.test.tsx (100%) rename src/{ => common}/components/Form/__tests__/SelectField.test.tsx (100%) rename src/{ => common}/components/Form/__tests__/TextField.test.tsx (100%) rename src/{ => common}/components/Header/AppMenu.tsx (85%) rename src/{ => common}/components/Header/Header.tsx (83%) rename src/{ => common}/components/Header/__tests__/AppMenu.test.tsx (93%) rename src/{ => common}/components/Header/__tests__/Header.test.tsx (97%) rename src/{ => common}/components/Header/logo.png (100%) rename src/{ => common}/components/Icon/Avatar.tsx (100%) rename src/{ => common}/components/Icon/FAIcon.tsx (100%) rename src/{ => common}/components/Icon/__tests__/Avatar.test.tsx (100%) rename src/{ => common}/components/Icon/__tests__/FAIcon.test.tsx (100%) rename src/{ => common}/components/Layout/StandardLayout.tsx (84%) rename src/{ => common}/components/Layout/__tests__/StandardLayout.test.tsx (100%) rename src/{ => common}/components/Link/Link.tsx (100%) rename src/{ => common}/components/Link/__tests__/Link.test.tsx (100%) rename src/{ => common}/components/Loader/LoaderSkeleton.tsx (100%) rename src/{ => common}/components/Loader/LoaderSpinner.tsx (95%) rename src/{ => common}/components/Loader/__tests__/LoaderSkeleton.test.tsx (100%) rename src/{ => common}/components/Loader/__tests__/LoaderSpinner.test.tsx (100%) rename src/{ => common}/components/Menu/Menu.tsx (100%) rename src/{ => common}/components/Menu/MenuButton.tsx (93%) rename src/{ => common}/components/Menu/MenuCloseButton.tsx (91%) rename src/{ => common}/components/Menu/MenuNavLink.tsx (97%) rename src/{ => common}/components/Menu/MenuSeparator.tsx (100%) rename src/{ => common}/components/Menu/SideMenu/SideMenu.tsx (100%) rename src/{ => common}/components/Menu/SideMenu/SideMenuHeader.tsx (100%) rename src/{ => common}/components/Menu/SideMenu/__tests__/SideMenu.test.tsx (100%) rename src/{ => common}/components/Menu/SideMenu/__tests__/SideMenuHeader.test.tsx (100%) rename src/{ => common}/components/Menu/__tests__/MenuButton.test.tsx (100%) rename src/{ => common}/components/Menu/__tests__/MenuCloseButton.test.tsx (100%) rename src/{ => common}/components/Menu/__tests__/MenuNavLink.test.tsx (100%) rename src/{ => common}/components/Menu/__tests__/MenuSeparator.test.tsx (100%) rename src/{ => common}/components/Page/Page.tsx (100%) rename src/{ => common}/components/Page/__tests__/Page.test.tsx (100%) rename src/{ => common}/components/Router/PrivateOutlet.tsx (93%) rename src/{ => common}/components/Router/Router.tsx (98%) rename src/{ => common}/components/Router/__tests__/PrivateOutlet.test.tsx (97%) rename src/{ => common}/components/Table/Table.tsx (100%) rename src/{ => common}/components/Table/__tests__/Table.test.tsx (100%) rename src/{ => common}/components/Tabs/Tab.tsx (100%) rename src/{ => common}/components/Tabs/TabContent.tsx (100%) rename src/{ => common}/components/Tabs/Tabs.tsx (96%) rename src/{ => common}/components/Tabs/__tests__/Tab.test.tsx (100%) rename src/{ => common}/components/Tabs/__tests__/TabContent.test.tsx (100%) rename src/{ => common}/components/Tabs/__tests__/Tabs.test.tsx (100%) rename src/{ => common}/components/Text/CodeSnippet.tsx (97%) rename src/{ => common}/components/Text/Text.tsx (100%) rename src/{ => common}/components/Text/__tests__/CodeSnippet.test.tsx (96%) rename src/{ => common}/components/Text/__tests__/Text.test.tsx (100%) rename src/{ => common}/components/Theme/Theme.tsx (94%) rename src/{ => common}/components/Theme/__tests__/Theme.test.tsx (100%) rename src/{ => common}/components/Toast/Toast.tsx (92%) rename src/{ => common}/components/Toast/Toasts.tsx (94%) rename src/{ => common}/components/Toast/__tests__/Toast.test.tsx (96%) rename src/{ => common}/components/Toast/__tests__/Toasts.test.tsx (96%) rename src/{ => common}/hooks/__tests__/useAuth.test.ts (88%) rename src/{ => common}/hooks/__tests__/useAxios.test.ts (88%) rename src/{ => common}/hooks/__tests__/useConfig.test.ts (93%) rename src/{ => common}/hooks/__tests__/useDebounce.test.ts (97%) rename src/{ => common}/hooks/__tests__/useSettings.test.ts (90%) rename src/{ => common}/hooks/__tests__/useToasts.test.ts (97%) rename src/{ => common}/hooks/useAuth.ts (78%) rename src/{ => common}/hooks/useAxios.ts (83%) rename src/{ => common}/hooks/useConfig.ts (84%) rename src/{ => common}/hooks/useDebounce.ts (100%) rename src/{ => common}/hooks/useSettings.ts (78%) rename src/{ => common}/hooks/useToasts.ts (83%) rename src/{ => common}/providers/AuthContext.ts (91%) rename src/{ => common}/providers/AuthProvider.tsx (89%) rename src/{ => common}/providers/AxiosContext.ts (100%) rename src/{ => common}/providers/AxiosProvider.tsx (98%) rename src/{ => common}/providers/ConfigContext.ts (100%) rename src/{ => common}/providers/ConfigProvider.tsx (100%) rename src/{ => common}/providers/SettingsContext.ts (75%) rename src/{ => common}/providers/SettingsProvider.tsx (92%) rename src/{ => common}/providers/ToastsContext.ts (100%) rename src/{ => common}/providers/ToastsProvider.tsx (100%) rename src/{ => common}/providers/__tests__/AuthProvider.test.tsx (93%) rename src/{ => common}/providers/__tests__/AxiosProvider.test.tsx (93%) rename src/{ => common}/providers/__tests__/ConfigProvider.test.tsx (93%) rename src/{ => common}/providers/__tests__/SettingsProvider.test.tsx (87%) rename src/{ => common}/providers/__tests__/ToastsProvider.test.tsx (89%) rename src/{ => common}/utils/__tests__/numbers.test.ts (97%) rename src/{ => common}/utils/__tests__/storage.test.ts (96%) rename src/{ => common}/utils/constants.ts (91%) rename src/{ => common}/utils/i18n/__tests__/i18n.test.ts (81%) rename src/{ => common}/utils/i18n/index.ts (93%) rename src/{ => common}/utils/i18n/locales/en/common.json (100%) rename src/{ => common}/utils/i18n/locales/en/index.ts (100%) rename src/{ => common}/utils/i18n/locales/en/users.json (100%) rename src/{ => common}/utils/i18n/locales/es/common.json (100%) rename src/{ => common}/utils/i18n/locales/es/index.ts (100%) rename src/{ => common}/utils/i18n/locales/es/users.json (100%) rename src/{ => common}/utils/i18n/locales/fr/common.json (100%) rename src/{ => common}/utils/i18n/locales/fr/index.ts (100%) rename src/{ => common}/utils/i18n/locales/fr/users.json (100%) rename src/{ => common}/utils/numbers.ts (100%) rename src/{ => common}/utils/storage.ts (100%) diff --git a/src/App.tsx b/src/App.tsx index ff0fc98..e3d9248 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,15 +2,15 @@ import { RouterProvider } from 'react-router-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; -import ErrorBoundary from 'components/Errors/ErrorBoundary'; -import ErrorFallback from 'components/Errors/ErrorFallback'; -import ConfigContextProvider from 'providers/ConfigProvider'; -import SettingsContextProvider from 'providers/SettingsProvider'; -import AxiosContextProvider from 'providers/AxiosProvider'; -import { router } from 'components/Router/Router'; -import Theme from 'components/Theme/Theme'; -import AuthContextProvider from 'providers/AuthProvider'; -import ToastsProvider from 'providers/ToastsProvider'; +import ErrorBoundary from 'common/components/Errors/ErrorBoundary'; +import ErrorFallback from 'common/components/Errors/ErrorFallback'; +import ConfigContextProvider from 'common/providers/ConfigProvider'; +import SettingsContextProvider from 'common/providers/SettingsProvider'; +import AxiosContextProvider from 'common/providers/AxiosProvider'; +import { router } from 'common/components/Router/Router'; +import Theme from 'common/components/Theme/Theme'; +import AuthContextProvider from 'common/providers/AuthProvider'; +import ToastsProvider from 'common/providers/ToastsProvider'; /** * React Query `QueryClient` and configuration. diff --git a/src/__fixtures__/settings.ts b/src/__fixtures__/settings.ts index 2f33049..5edcdc6 100644 --- a/src/__fixtures__/settings.ts +++ b/src/__fixtures__/settings.ts @@ -1,3 +1,3 @@ -import { Settings } from 'api/useGetSettings'; +import { Settings } from 'common/api/useGetSettings'; export const settingsFixture: Settings = { theme: 'dark' }; diff --git a/src/__fixtures__/toasts.ts b/src/__fixtures__/toasts.ts index 9f18227..f1fe23b 100644 --- a/src/__fixtures__/toasts.ts +++ b/src/__fixtures__/toasts.ts @@ -1,4 +1,4 @@ -import { ToastDetail } from 'providers/ToastsContext'; +import { ToastDetail } from 'common/providers/ToastsContext'; export const toastFixture: ToastDetail = { id: 'toast1', diff --git a/src/__fixtures__/tokens.ts b/src/__fixtures__/tokens.ts index 9462e22..5d70ab2 100644 --- a/src/__fixtures__/tokens.ts +++ b/src/__fixtures__/tokens.ts @@ -1,4 +1,4 @@ -import { UserTokens } from 'api/useGetUserTokens'; +import { UserTokens } from 'common/api/useGetUserTokens'; export const userTokensFixture: UserTokens = { id_token: 'id-token', diff --git a/src/__fixtures__/users.ts b/src/__fixtures__/users.ts index 8fbacf3..6e9b9a5 100644 --- a/src/__fixtures__/users.ts +++ b/src/__fixtures__/users.ts @@ -1,4 +1,4 @@ -import { User } from 'api/useGetUser'; +import { User } from 'common/api/useGetUser'; export const userFixture1: User = { id: 1, diff --git a/src/api/__tests__/useGetCurrentUser.test.ts b/src/common/api/__tests__/useGetCurrentUser.test.ts similarity index 93% rename from src/api/__tests__/useGetCurrentUser.test.ts rename to src/common/api/__tests__/useGetCurrentUser.test.ts index 2155b3d..079439a 100644 --- a/src/api/__tests__/useGetCurrentUser.test.ts +++ b/src/common/api/__tests__/useGetCurrentUser.test.ts @@ -2,9 +2,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; import { userFixture1 } from '__fixtures__/users'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; -import { useGetCurrentUser } from 'api/useGetCurrentUser'; +import { useGetCurrentUser } from 'common/api/useGetCurrentUser'; describe('useGetCurrentUser', () => { const getItemSpy = vi.spyOn(storage, 'getItem'); diff --git a/src/api/__tests__/useGetSettings.test.ts b/src/common/api/__tests__/useGetSettings.test.ts similarity index 89% rename from src/api/__tests__/useGetSettings.test.ts rename to src/common/api/__tests__/useGetSettings.test.ts index 3c2a797..0cdc598 100644 --- a/src/api/__tests__/useGetSettings.test.ts +++ b/src/common/api/__tests__/useGetSettings.test.ts @@ -2,10 +2,10 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; import { settingsFixture } from '__fixtures__/settings'; -import { DEFAULT_SETTINGS, StorageKeys } from 'utils/constants'; -import storage from 'utils/storage'; +import { DEFAULT_SETTINGS, StorageKeys } from 'common/utils/constants'; +import storage from 'common/utils/storage'; -import { useGetSettings } from 'api/useGetSettings'; +import { useGetSettings } from 'common/api/useGetSettings'; describe('useGetSettings', () => { const getItemSpy = vi.spyOn(storage, 'getItem'); diff --git a/src/api/__tests__/useGetUser.test.ts b/src/common/api/__tests__/useGetUser.test.ts similarity index 91% rename from src/api/__tests__/useGetUser.test.ts rename to src/common/api/__tests__/useGetUser.test.ts index f4e3e56..4ff0d75 100644 --- a/src/api/__tests__/useGetUser.test.ts +++ b/src/common/api/__tests__/useGetUser.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { useGetUser } from 'api/useGetUser'; +import { useGetUser } from 'common/api/useGetUser'; import { renderHook, waitFor } from 'test/test-utils'; describe('useGetUser', () => { diff --git a/src/api/__tests__/useGetUserTokens.test.ts b/src/common/api/__tests__/useGetUserTokens.test.ts similarity index 94% rename from src/api/__tests__/useGetUserTokens.test.ts rename to src/common/api/__tests__/useGetUserTokens.test.ts index 0aa2511..e696647 100644 --- a/src/api/__tests__/useGetUserTokens.test.ts +++ b/src/common/api/__tests__/useGetUserTokens.test.ts @@ -3,10 +3,10 @@ import dayjs from 'dayjs'; import { renderHook, waitFor } from 'test/test-utils'; import WithQueryClientProvider from 'test/wrappers/WithQueryClientProvider'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; import { userTokensFixture } from '__fixtures__/tokens'; -import { UserTokens, useGetUserTokens } from 'api/useGetUserTokens'; +import { UserTokens, useGetUserTokens } from 'common/api/useGetUserTokens'; describe('useGetTokens', () => { const getItemSpy = vi.spyOn(storage, 'getItem'); diff --git a/src/api/__tests__/useSetSettings.test.ts b/src/common/api/__tests__/useSetSettings.test.ts similarity index 89% rename from src/api/__tests__/useSetSettings.test.ts rename to src/common/api/__tests__/useSetSettings.test.ts index ce542a6..5733517 100644 --- a/src/api/__tests__/useSetSettings.test.ts +++ b/src/common/api/__tests__/useSetSettings.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; -import storage from 'utils/storage'; -import { Settings } from 'api/useGetSettings'; +import storage from 'common/utils/storage'; +import { Settings } from 'common/api/useGetSettings'; -import { useSetSettings } from 'api/useSetSettings'; +import { useSetSettings } from 'common/api/useSetSettings'; describe('useSetSettings', () => { const setItemSpy = vi.spyOn(storage, 'setItem'); diff --git a/src/api/useGetCurrentUser.ts b/src/common/api/useGetCurrentUser.ts similarity index 87% rename from src/api/useGetCurrentUser.ts rename to src/common/api/useGetCurrentUser.ts index 5772ee4..515f646 100644 --- a/src/api/useGetCurrentUser.ts +++ b/src/common/api/useGetCurrentUser.ts @@ -1,8 +1,8 @@ import { useQuery } from '@tanstack/react-query'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; import { User } from './useGetUser'; -import { QueryKeys, StorageKeys } from 'utils/constants'; +import { QueryKeys, StorageKeys } from 'common/utils/constants'; /** * An API hook which fetches the currently authenticated `User`. diff --git a/src/api/useGetSettings.ts b/src/common/api/useGetSettings.ts similarity index 88% rename from src/api/useGetSettings.ts rename to src/common/api/useGetSettings.ts index 8b6739c..98c7249 100644 --- a/src/api/useGetSettings.ts +++ b/src/common/api/useGetSettings.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; -import { DEFAULT_SETTINGS, QueryKeys, StorageKeys } from 'utils/constants'; -import storage from 'utils/storage'; +import { DEFAULT_SETTINGS, QueryKeys, StorageKeys } from 'common/utils/constants'; +import storage from 'common/utils/storage'; /** * The `Settings` are user preferences. diff --git a/src/api/useGetUser.ts b/src/common/api/useGetUser.ts similarity index 89% rename from src/api/useGetUser.ts rename to src/common/api/useGetUser.ts index 00b65ed..45c2743 100644 --- a/src/api/useGetUser.ts +++ b/src/common/api/useGetUser.ts @@ -1,8 +1,8 @@ import { UseQueryResult, useQuery } from '@tanstack/react-query'; -import { useAxios } from 'hooks/useAxios'; -import { useConfig } from 'hooks/useConfig'; -import { QueryKeys } from 'utils/constants'; +import { useAxios } from 'common/hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; +import { QueryKeys } from 'common/utils/constants'; /** * The `Address` type. diff --git a/src/api/useGetUserTokens.ts b/src/common/api/useGetUserTokens.ts similarity index 94% rename from src/api/useGetUserTokens.ts rename to src/common/api/useGetUserTokens.ts index bdfdfbb..8e322ec 100644 --- a/src/api/useGetUserTokens.ts +++ b/src/common/api/useGetUserTokens.ts @@ -1,8 +1,8 @@ import { UseQueryOptions, UseQueryResult, useQuery } from '@tanstack/react-query'; import dayjs from 'dayjs'; -import { QueryKeys, StorageKeys } from 'utils/constants'; -import storage from 'utils/storage'; +import { QueryKeys, StorageKeys } from 'common/utils/constants'; +import storage from 'common/utils/storage'; /** * A `UserTokens` object contains OAuth access, id, and refresh tokens diff --git a/src/api/useSetSettings.ts b/src/common/api/useSetSettings.ts similarity index 92% rename from src/api/useSetSettings.ts rename to src/common/api/useSetSettings.ts index aeb9a17..0d5262d 100644 --- a/src/api/useSetSettings.ts +++ b/src/common/api/useSetSettings.ts @@ -1,7 +1,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; -import storage from 'utils/storage'; -import { DEFAULT_SETTINGS, QueryKeys, StorageKeys } from 'utils/constants'; +import storage from 'common/utils/storage'; +import { DEFAULT_SETTINGS, QueryKeys, StorageKeys } from 'common/utils/constants'; import { Settings } from './useGetSettings'; /** diff --git a/src/components/Badge/Badge.tsx b/src/common/components/Badge/Badge.tsx similarity index 100% rename from src/components/Badge/Badge.tsx rename to src/common/components/Badge/Badge.tsx diff --git a/src/components/Badge/__tests__/Badge.test.tsx b/src/common/components/Badge/__tests__/Badge.test.tsx similarity index 100% rename from src/components/Badge/__tests__/Badge.test.tsx rename to src/common/components/Badge/__tests__/Badge.test.tsx diff --git a/src/components/Button/Button.tsx b/src/common/components/Button/Button.tsx similarity index 100% rename from src/components/Button/Button.tsx rename to src/common/components/Button/Button.tsx diff --git a/src/components/Button/LanguageToggle.tsx b/src/common/components/Button/LanguageToggle.tsx similarity index 84% rename from src/components/Button/LanguageToggle.tsx rename to src/common/components/Button/LanguageToggle.tsx index 97b0daf..3c7ee37 100644 --- a/src/components/Button/LanguageToggle.tsx +++ b/src/common/components/Button/LanguageToggle.tsx @@ -1,12 +1,12 @@ import { ButtonVariant, PropsWithClassName } from '@leanstacks/react-common'; import { useTranslation } from 'react-i18next'; -import { StorageKeys } from 'utils/constants'; -import storage from 'utils/storage'; -import Dropdown from 'components/Dropdown/Dropdown'; -import FAIcon from 'components/Icon/FAIcon'; -import DropdownContent from 'components/Dropdown/DropdownContent'; -import DropdownItem from 'components/Dropdown/DropdownItem'; +import { StorageKeys } from 'common/utils/constants'; +import storage from 'common/utils/storage'; +import Dropdown from 'common/components/Dropdown/Dropdown'; +import FAIcon from 'common/components/Icon/FAIcon'; +import DropdownContent from 'common/components/Dropdown/DropdownContent'; +import DropdownItem from 'common/components/Dropdown/DropdownItem'; import Button from './Button'; /** diff --git a/src/components/Button/ThemeToggle.tsx b/src/common/components/Button/ThemeToggle.tsx similarity index 89% rename from src/components/Button/ThemeToggle.tsx rename to src/common/components/Button/ThemeToggle.tsx index 9ece960..0ba1d33 100644 --- a/src/components/Button/ThemeToggle.tsx +++ b/src/common/components/Button/ThemeToggle.tsx @@ -1,10 +1,10 @@ import { ButtonVariant, PropsWithClassName } from '@leanstacks/react-common'; import classNames from 'classnames'; -import { useSetSettings } from 'api/useSetSettings'; -import { useSettings } from 'hooks/useSettings'; +import { useSetSettings } from 'common/api/useSetSettings'; +import { useSettings } from 'common/hooks/useSettings'; import Button from './Button'; -import FAIcon from 'components/Icon/FAIcon'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `ThemeToggle` component. diff --git a/src/components/Button/__tests__/Button.test.tsx b/src/common/components/Button/__tests__/Button.test.tsx similarity index 100% rename from src/components/Button/__tests__/Button.test.tsx rename to src/common/components/Button/__tests__/Button.test.tsx diff --git a/src/components/Button/__tests__/LanguageToggle.test.tsx b/src/common/components/Button/__tests__/LanguageToggle.test.tsx similarity index 95% rename from src/components/Button/__tests__/LanguageToggle.test.tsx rename to src/common/components/Button/__tests__/LanguageToggle.test.tsx index ca97bc9..1f26a35 100644 --- a/src/components/Button/__tests__/LanguageToggle.test.tsx +++ b/src/common/components/Button/__tests__/LanguageToggle.test.tsx @@ -1,9 +1,9 @@ import userEvent from '@testing-library/user-event'; import { describe, expect, it, vi } from 'vitest'; -import { StorageKeys } from 'utils/constants'; +import { StorageKeys } from 'common/utils/constants'; import { render, screen } from 'test/test-utils'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; import LanguageToggle from '../LanguageToggle'; diff --git a/src/components/Button/__tests__/ThemeToggle.test.tsx b/src/common/components/Button/__tests__/ThemeToggle.test.tsx similarity index 93% rename from src/components/Button/__tests__/ThemeToggle.test.tsx rename to src/common/components/Button/__tests__/ThemeToggle.test.tsx index 5b99fb2..98b9dca 100644 --- a/src/components/Button/__tests__/ThemeToggle.test.tsx +++ b/src/common/components/Button/__tests__/ThemeToggle.test.tsx @@ -3,9 +3,9 @@ import { UseMutationResult } from '@tanstack/react-query'; import userEvent from '@testing-library/user-event'; import { render, screen } from 'test/test-utils'; -import { Settings } from 'api/useGetSettings'; -import * as UseSettings from 'hooks/useSettings'; -import * as UseSetSettings from 'api/useSetSettings'; +import { Settings } from 'common/api/useGetSettings'; +import * as UseSettings from 'common/hooks/useSettings'; +import * as UseSetSettings from 'common/api/useSetSettings'; import { settingsFixture } from '__fixtures__/settings'; import ThemeToggle from '../ThemeToggle'; diff --git a/src/components/Card/Card.tsx b/src/common/components/Card/Card.tsx similarity index 100% rename from src/components/Card/Card.tsx rename to src/common/components/Card/Card.tsx diff --git a/src/components/Card/MessageCard.tsx b/src/common/components/Card/MessageCard.tsx similarity index 95% rename from src/components/Card/MessageCard.tsx rename to src/common/components/Card/MessageCard.tsx index 4aca8e5..e484322 100644 --- a/src/components/Card/MessageCard.tsx +++ b/src/common/components/Card/MessageCard.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import Card, { CardProps } from './Card'; -import FAIcon, { FAIconProps } from 'components/Icon/FAIcon'; +import FAIcon, { FAIconProps } from 'common/components/Icon/FAIcon'; /** * Properties for the `MessageCard` React component. diff --git a/src/components/Card/__tests__/Card.test.tsx b/src/common/components/Card/__tests__/Card.test.tsx similarity index 100% rename from src/components/Card/__tests__/Card.test.tsx rename to src/common/components/Card/__tests__/Card.test.tsx diff --git a/src/components/Card/__tests__/MessageCard.test.tsx b/src/common/components/Card/__tests__/MessageCard.test.tsx similarity index 100% rename from src/components/Card/__tests__/MessageCard.test.tsx rename to src/common/components/Card/__tests__/MessageCard.test.tsx diff --git a/src/components/Dropdown/Dropdown.tsx b/src/common/components/Dropdown/Dropdown.tsx similarity index 100% rename from src/components/Dropdown/Dropdown.tsx rename to src/common/components/Dropdown/Dropdown.tsx diff --git a/src/components/Dropdown/DropdownContent.tsx b/src/common/components/Dropdown/DropdownContent.tsx similarity index 100% rename from src/components/Dropdown/DropdownContent.tsx rename to src/common/components/Dropdown/DropdownContent.tsx diff --git a/src/components/Dropdown/DropdownItem.tsx b/src/common/components/Dropdown/DropdownItem.tsx similarity index 100% rename from src/components/Dropdown/DropdownItem.tsx rename to src/common/components/Dropdown/DropdownItem.tsx diff --git a/src/components/Dropdown/__tests__/Dropdown.test.tsx b/src/common/components/Dropdown/__tests__/Dropdown.test.tsx similarity index 100% rename from src/components/Dropdown/__tests__/Dropdown.test.tsx rename to src/common/components/Dropdown/__tests__/Dropdown.test.tsx diff --git a/src/components/Dropdown/__tests__/DropdownContent.test.tsx b/src/common/components/Dropdown/__tests__/DropdownContent.test.tsx similarity index 100% rename from src/components/Dropdown/__tests__/DropdownContent.test.tsx rename to src/common/components/Dropdown/__tests__/DropdownContent.test.tsx diff --git a/src/components/Dropdown/__tests__/DropdownItem.test.tsx b/src/common/components/Dropdown/__tests__/DropdownItem.test.tsx similarity index 100% rename from src/components/Dropdown/__tests__/DropdownItem.test.tsx rename to src/common/components/Dropdown/__tests__/DropdownItem.test.tsx diff --git a/src/components/Errors/ErrorBoundary.tsx b/src/common/components/Errors/ErrorBoundary.tsx similarity index 100% rename from src/components/Errors/ErrorBoundary.tsx rename to src/common/components/Errors/ErrorBoundary.tsx diff --git a/src/components/Errors/ErrorFallback.tsx b/src/common/components/Errors/ErrorFallback.tsx similarity index 100% rename from src/components/Errors/ErrorFallback.tsx rename to src/common/components/Errors/ErrorFallback.tsx diff --git a/src/components/Errors/__tests__/ErrorBoundary.test.tsx b/src/common/components/Errors/__tests__/ErrorBoundary.test.tsx similarity index 100% rename from src/components/Errors/__tests__/ErrorBoundary.test.tsx rename to src/common/components/Errors/__tests__/ErrorBoundary.test.tsx diff --git a/src/components/Errors/__tests__/ErrorFallback.test.tsx b/src/common/components/Errors/__tests__/ErrorFallback.test.tsx similarity index 100% rename from src/components/Errors/__tests__/ErrorFallback.test.tsx rename to src/common/components/Errors/__tests__/ErrorFallback.test.tsx diff --git a/src/components/Footer/Footer.tsx b/src/common/components/Footer/Footer.tsx similarity index 97% rename from src/components/Footer/Footer.tsx rename to src/common/components/Footer/Footer.tsx index dcbf54f..2b678cd 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/common/components/Footer/Footer.tsx @@ -3,7 +3,7 @@ import classNames from 'classnames'; import dayjs from 'dayjs'; import { useTranslation } from 'react-i18next'; -import Link from 'components/Link/Link'; +import Link from 'common/components/Link/Link'; /** * Properties for the `Footer` component. diff --git a/src/components/Footer/__tests__/Footer.test.tsx b/src/common/components/Footer/__tests__/Footer.test.tsx similarity index 100% rename from src/components/Footer/__tests__/Footer.test.tsx rename to src/common/components/Footer/__tests__/Footer.test.tsx diff --git a/src/components/Form/SearchField.tsx b/src/common/components/Form/SearchField.tsx similarity index 98% rename from src/components/Form/SearchField.tsx rename to src/common/components/Form/SearchField.tsx index 9e0cb05..5069ec3 100644 --- a/src/components/Form/SearchField.tsx +++ b/src/common/components/Form/SearchField.tsx @@ -2,7 +2,7 @@ import { ChangeEvent, ReactElement, useEffect, useRef } from 'react'; import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; -import FAIcon from 'components/Icon/FAIcon'; +import FAIcon from 'common/components/Icon/FAIcon'; import { SearchResultProps } from './SearchResult'; /** diff --git a/src/components/Form/SearchResult.tsx b/src/common/components/Form/SearchResult.tsx similarity index 100% rename from src/components/Form/SearchResult.tsx rename to src/common/components/Form/SearchResult.tsx diff --git a/src/components/Form/SelectField.tsx b/src/common/components/Form/SelectField.tsx similarity index 99% rename from src/components/Form/SelectField.tsx rename to src/common/components/Form/SelectField.tsx index b1de7ba..aca47e6 100644 --- a/src/components/Form/SelectField.tsx +++ b/src/common/components/Form/SelectField.tsx @@ -3,7 +3,7 @@ import { PropsWithTestId } from '@leanstacks/react-common'; import { useField } from 'formik'; import classNames from 'classnames'; -import FAIcon from 'components/Icon/FAIcon'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Describes a single option for a `SelectField`. If `label` is omitted, diff --git a/src/components/Form/TextField.tsx b/src/common/components/Form/TextField.tsx similarity index 100% rename from src/components/Form/TextField.tsx rename to src/common/components/Form/TextField.tsx diff --git a/src/components/Form/__tests__/SearchField.test.tsx b/src/common/components/Form/__tests__/SearchField.test.tsx similarity index 100% rename from src/components/Form/__tests__/SearchField.test.tsx rename to src/common/components/Form/__tests__/SearchField.test.tsx diff --git a/src/components/Form/__tests__/SearchResult.test.tsx b/src/common/components/Form/__tests__/SearchResult.test.tsx similarity index 100% rename from src/components/Form/__tests__/SearchResult.test.tsx rename to src/common/components/Form/__tests__/SearchResult.test.tsx diff --git a/src/components/Form/__tests__/SelectField.test.tsx b/src/common/components/Form/__tests__/SelectField.test.tsx similarity index 100% rename from src/components/Form/__tests__/SelectField.test.tsx rename to src/common/components/Form/__tests__/SelectField.test.tsx diff --git a/src/components/Form/__tests__/TextField.test.tsx b/src/common/components/Form/__tests__/TextField.test.tsx similarity index 100% rename from src/components/Form/__tests__/TextField.test.tsx rename to src/common/components/Form/__tests__/TextField.test.tsx diff --git a/src/components/Header/AppMenu.tsx b/src/common/components/Header/AppMenu.tsx similarity index 85% rename from src/components/Header/AppMenu.tsx rename to src/common/components/Header/AppMenu.tsx index 5f3ec03..26a3428 100644 --- a/src/components/Header/AppMenu.tsx +++ b/src/common/components/Header/AppMenu.tsx @@ -1,11 +1,11 @@ -import { useAuth } from 'hooks/useAuth'; -import { useGetCurrentUser } from 'api/useGetCurrentUser'; +import { useAuth } from 'common/hooks/useAuth'; +import { useGetCurrentUser } from 'common/api/useGetCurrentUser'; import logo from './logo.png'; -import SideMenu, { SideMenuProps } from 'components/Menu/SideMenu/SideMenu'; -import MenuNavLink from 'components/Menu/MenuNavLink'; -import Avatar from 'components/Icon/Avatar'; -import MenuSeparator from 'components/Menu/MenuSeparator'; +import SideMenu, { SideMenuProps } from 'common/components/Menu/SideMenu/SideMenu'; +import MenuNavLink from 'common/components/Menu/MenuNavLink'; +import Avatar from 'common/components/Icon/Avatar'; +import MenuSeparator from 'common/components/Menu/MenuSeparator'; /** * Properties fro the `AppMenu` component. diff --git a/src/components/Header/Header.tsx b/src/common/components/Header/Header.tsx similarity index 83% rename from src/components/Header/Header.tsx rename to src/common/components/Header/Header.tsx index bd03029..a9c39ff 100644 --- a/src/components/Header/Header.tsx +++ b/src/common/components/Header/Header.tsx @@ -1,12 +1,12 @@ import { Link } from 'react-router-dom'; import { PropsWithTestId } from '@leanstacks/react-common'; -import { useAuth } from 'hooks/useAuth'; +import { useAuth } from 'common/hooks/useAuth'; import logo from './logo.png'; -import ThemeToggle from 'components/Button/ThemeToggle'; +import ThemeToggle from 'common/components/Button/ThemeToggle'; import AppMenu from './AppMenu'; -import MenuButton from 'components/Menu/MenuButton'; -import LanguageToggle from 'components/Button/LanguageToggle'; +import MenuButton from 'common/components/Menu/MenuButton'; +import LanguageToggle from 'common/components/Button/LanguageToggle'; /** * Properties for the `Header` component. diff --git a/src/components/Header/__tests__/AppMenu.test.tsx b/src/common/components/Header/__tests__/AppMenu.test.tsx similarity index 93% rename from src/components/Header/__tests__/AppMenu.test.tsx rename to src/common/components/Header/__tests__/AppMenu.test.tsx index 5ee63ba..aa8f53b 100644 --- a/src/components/Header/__tests__/AppMenu.test.tsx +++ b/src/common/components/Header/__tests__/AppMenu.test.tsx @@ -3,9 +3,9 @@ import { render, screen } from 'test/test-utils'; import { queryClient } from 'test/query-client'; import { UseQueryResult } from '@tanstack/react-query'; -import { User } from 'api/useGetUser'; -import * as UseAuth from 'hooks/useAuth'; -import * as UseGetCurrentUser from 'api/useGetCurrentUser'; +import { User } from 'common/api/useGetUser'; +import * as UseAuth from 'common/hooks/useAuth'; +import * as UseGetCurrentUser from 'common/api/useGetCurrentUser'; import { userFixture1 } from '__fixtures__/users'; import AppMenu from '../AppMenu'; diff --git a/src/components/Header/__tests__/Header.test.tsx b/src/common/components/Header/__tests__/Header.test.tsx similarity index 97% rename from src/components/Header/__tests__/Header.test.tsx rename to src/common/components/Header/__tests__/Header.test.tsx index 8679df2..c4ae953 100644 --- a/src/components/Header/__tests__/Header.test.tsx +++ b/src/common/components/Header/__tests__/Header.test.tsx @@ -4,7 +4,7 @@ import { Route, Routes } from 'react-router-dom'; import { render, screen } from 'test/test-utils'; -import * as UseAuth from 'hooks/useAuth'; +import * as UseAuth from 'common/hooks/useAuth'; import Header from '../Header'; diff --git a/src/components/Header/logo.png b/src/common/components/Header/logo.png similarity index 100% rename from src/components/Header/logo.png rename to src/common/components/Header/logo.png diff --git a/src/components/Icon/Avatar.tsx b/src/common/components/Icon/Avatar.tsx similarity index 100% rename from src/components/Icon/Avatar.tsx rename to src/common/components/Icon/Avatar.tsx diff --git a/src/components/Icon/FAIcon.tsx b/src/common/components/Icon/FAIcon.tsx similarity index 100% rename from src/components/Icon/FAIcon.tsx rename to src/common/components/Icon/FAIcon.tsx diff --git a/src/components/Icon/__tests__/Avatar.test.tsx b/src/common/components/Icon/__tests__/Avatar.test.tsx similarity index 100% rename from src/components/Icon/__tests__/Avatar.test.tsx rename to src/common/components/Icon/__tests__/Avatar.test.tsx diff --git a/src/components/Icon/__tests__/FAIcon.test.tsx b/src/common/components/Icon/__tests__/FAIcon.test.tsx similarity index 100% rename from src/components/Icon/__tests__/FAIcon.test.tsx rename to src/common/components/Icon/__tests__/FAIcon.test.tsx diff --git a/src/components/Layout/StandardLayout.tsx b/src/common/components/Layout/StandardLayout.tsx similarity index 84% rename from src/components/Layout/StandardLayout.tsx rename to src/common/components/Layout/StandardLayout.tsx index 1c7aa1c..0bfacd3 100644 --- a/src/components/Layout/StandardLayout.tsx +++ b/src/common/components/Layout/StandardLayout.tsx @@ -1,9 +1,9 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { Outlet } from 'react-router-dom'; -import Header from 'components/Header/Header'; -import Footer from 'components/Footer/Footer'; -import Toasts from 'components/Toast/Toasts'; +import Header from 'common/components/Header/Header'; +import Footer from 'common/components/Footer/Footer'; +import Toasts from 'common/components/Toast/Toasts'; /** * Properties for the `StandardLayout` component. diff --git a/src/components/Layout/__tests__/StandardLayout.test.tsx b/src/common/components/Layout/__tests__/StandardLayout.test.tsx similarity index 100% rename from src/components/Layout/__tests__/StandardLayout.test.tsx rename to src/common/components/Layout/__tests__/StandardLayout.test.tsx diff --git a/src/components/Link/Link.tsx b/src/common/components/Link/Link.tsx similarity index 100% rename from src/components/Link/Link.tsx rename to src/common/components/Link/Link.tsx diff --git a/src/components/Link/__tests__/Link.test.tsx b/src/common/components/Link/__tests__/Link.test.tsx similarity index 100% rename from src/components/Link/__tests__/Link.test.tsx rename to src/common/components/Link/__tests__/Link.test.tsx diff --git a/src/components/Loader/LoaderSkeleton.tsx b/src/common/components/Loader/LoaderSkeleton.tsx similarity index 100% rename from src/components/Loader/LoaderSkeleton.tsx rename to src/common/components/Loader/LoaderSkeleton.tsx diff --git a/src/components/Loader/LoaderSpinner.tsx b/src/common/components/Loader/LoaderSpinner.tsx similarity index 95% rename from src/components/Loader/LoaderSpinner.tsx rename to src/common/components/Loader/LoaderSpinner.tsx index fc633d0..afbb6da 100644 --- a/src/components/Loader/LoaderSpinner.tsx +++ b/src/common/components/Loader/LoaderSpinner.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import { BaseComponentProps } from '@leanstacks/react-common'; -import FAIcon, { FAIconProps } from 'components/Icon/FAIcon'; +import FAIcon, { FAIconProps } from 'common/components/Icon/FAIcon'; /** * Properties for the `LoaderSpinner` component. diff --git a/src/components/Loader/__tests__/LoaderSkeleton.test.tsx b/src/common/components/Loader/__tests__/LoaderSkeleton.test.tsx similarity index 100% rename from src/components/Loader/__tests__/LoaderSkeleton.test.tsx rename to src/common/components/Loader/__tests__/LoaderSkeleton.test.tsx diff --git a/src/components/Loader/__tests__/LoaderSpinner.test.tsx b/src/common/components/Loader/__tests__/LoaderSpinner.test.tsx similarity index 100% rename from src/components/Loader/__tests__/LoaderSpinner.test.tsx rename to src/common/components/Loader/__tests__/LoaderSpinner.test.tsx diff --git a/src/components/Menu/Menu.tsx b/src/common/components/Menu/Menu.tsx similarity index 100% rename from src/components/Menu/Menu.tsx rename to src/common/components/Menu/Menu.tsx diff --git a/src/components/Menu/MenuButton.tsx b/src/common/components/Menu/MenuButton.tsx similarity index 93% rename from src/components/Menu/MenuButton.tsx rename to src/common/components/Menu/MenuButton.tsx index 7c9ab71..dfbf74c 100644 --- a/src/components/Menu/MenuButton.tsx +++ b/src/common/components/Menu/MenuButton.tsx @@ -3,8 +3,8 @@ import { ButtonVariant, PropsWithClassName, PropsWithTestId } from '@leanstacks/ import classNames from 'classnames'; import { MenuProps } from './Menu'; -import Button from 'components/Button/Button'; -import FAIcon from 'components/Icon/FAIcon'; +import Button from 'common/components/Button/Button'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `MenuButton` component. diff --git a/src/components/Menu/MenuCloseButton.tsx b/src/common/components/Menu/MenuCloseButton.tsx similarity index 91% rename from src/components/Menu/MenuCloseButton.tsx rename to src/common/components/Menu/MenuCloseButton.tsx index 7a385d9..c2d8a0a 100644 --- a/src/components/Menu/MenuCloseButton.tsx +++ b/src/common/components/Menu/MenuCloseButton.tsx @@ -1,8 +1,8 @@ import { ButtonVariant, PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; -import Button from 'components/Button/Button'; -import FAIcon from 'components/Icon/FAIcon'; +import Button from 'common/components/Button/Button'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `MenuCloseButton` component. diff --git a/src/components/Menu/MenuNavLink.tsx b/src/common/components/Menu/MenuNavLink.tsx similarity index 97% rename from src/components/Menu/MenuNavLink.tsx rename to src/common/components/Menu/MenuNavLink.tsx index d427e21..45b19ff 100644 --- a/src/components/Menu/MenuNavLink.tsx +++ b/src/common/components/Menu/MenuNavLink.tsx @@ -2,7 +2,7 @@ import { NavLink, NavLinkProps } from 'react-router-dom'; import { PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; -import FAIcon, { FAIconProps } from 'components/Icon/FAIcon'; +import FAIcon, { FAIconProps } from 'common/components/Icon/FAIcon'; /** * Properties for the `MenuNavLink` component. diff --git a/src/components/Menu/MenuSeparator.tsx b/src/common/components/Menu/MenuSeparator.tsx similarity index 100% rename from src/components/Menu/MenuSeparator.tsx rename to src/common/components/Menu/MenuSeparator.tsx diff --git a/src/components/Menu/SideMenu/SideMenu.tsx b/src/common/components/Menu/SideMenu/SideMenu.tsx similarity index 100% rename from src/components/Menu/SideMenu/SideMenu.tsx rename to src/common/components/Menu/SideMenu/SideMenu.tsx diff --git a/src/components/Menu/SideMenu/SideMenuHeader.tsx b/src/common/components/Menu/SideMenu/SideMenuHeader.tsx similarity index 100% rename from src/components/Menu/SideMenu/SideMenuHeader.tsx rename to src/common/components/Menu/SideMenu/SideMenuHeader.tsx diff --git a/src/components/Menu/SideMenu/__tests__/SideMenu.test.tsx b/src/common/components/Menu/SideMenu/__tests__/SideMenu.test.tsx similarity index 100% rename from src/components/Menu/SideMenu/__tests__/SideMenu.test.tsx rename to src/common/components/Menu/SideMenu/__tests__/SideMenu.test.tsx diff --git a/src/components/Menu/SideMenu/__tests__/SideMenuHeader.test.tsx b/src/common/components/Menu/SideMenu/__tests__/SideMenuHeader.test.tsx similarity index 100% rename from src/components/Menu/SideMenu/__tests__/SideMenuHeader.test.tsx rename to src/common/components/Menu/SideMenu/__tests__/SideMenuHeader.test.tsx diff --git a/src/components/Menu/__tests__/MenuButton.test.tsx b/src/common/components/Menu/__tests__/MenuButton.test.tsx similarity index 100% rename from src/components/Menu/__tests__/MenuButton.test.tsx rename to src/common/components/Menu/__tests__/MenuButton.test.tsx diff --git a/src/components/Menu/__tests__/MenuCloseButton.test.tsx b/src/common/components/Menu/__tests__/MenuCloseButton.test.tsx similarity index 100% rename from src/components/Menu/__tests__/MenuCloseButton.test.tsx rename to src/common/components/Menu/__tests__/MenuCloseButton.test.tsx diff --git a/src/components/Menu/__tests__/MenuNavLink.test.tsx b/src/common/components/Menu/__tests__/MenuNavLink.test.tsx similarity index 100% rename from src/components/Menu/__tests__/MenuNavLink.test.tsx rename to src/common/components/Menu/__tests__/MenuNavLink.test.tsx diff --git a/src/components/Menu/__tests__/MenuSeparator.test.tsx b/src/common/components/Menu/__tests__/MenuSeparator.test.tsx similarity index 100% rename from src/components/Menu/__tests__/MenuSeparator.test.tsx rename to src/common/components/Menu/__tests__/MenuSeparator.test.tsx diff --git a/src/components/Page/Page.tsx b/src/common/components/Page/Page.tsx similarity index 100% rename from src/components/Page/Page.tsx rename to src/common/components/Page/Page.tsx diff --git a/src/components/Page/__tests__/Page.test.tsx b/src/common/components/Page/__tests__/Page.test.tsx similarity index 100% rename from src/components/Page/__tests__/Page.test.tsx rename to src/common/components/Page/__tests__/Page.test.tsx diff --git a/src/components/Router/PrivateOutlet.tsx b/src/common/components/Router/PrivateOutlet.tsx similarity index 93% rename from src/components/Router/PrivateOutlet.tsx rename to src/common/components/Router/PrivateOutlet.tsx index 4d0f8d0..a94b909 100644 --- a/src/components/Router/PrivateOutlet.tsx +++ b/src/common/components/Router/PrivateOutlet.tsx @@ -1,4 +1,4 @@ -import { useAuth } from 'hooks/useAuth'; +import { useAuth } from 'common/hooks/useAuth'; import { Navigate, Outlet } from 'react-router-dom'; /** diff --git a/src/components/Router/Router.tsx b/src/common/components/Router/Router.tsx similarity index 98% rename from src/components/Router/Router.tsx rename to src/common/components/Router/Router.tsx index 5230034..ad1e089 100644 --- a/src/components/Router/Router.tsx +++ b/src/common/components/Router/Router.tsx @@ -1,6 +1,6 @@ import { Navigate, RouteObject, createBrowserRouter } from 'react-router-dom'; -import StandardLayout from 'components/Layout/StandardLayout'; +import StandardLayout from 'common/components/Layout/StandardLayout'; import ErrorPage from 'pages/ErrorPage/ErrorPage'; import PrivateOutlet from './PrivateOutlet'; import LandingPage from 'pages/LandingPage/LandingPage'; diff --git a/src/components/Router/__tests__/PrivateOutlet.test.tsx b/src/common/components/Router/__tests__/PrivateOutlet.test.tsx similarity index 97% rename from src/components/Router/__tests__/PrivateOutlet.test.tsx rename to src/common/components/Router/__tests__/PrivateOutlet.test.tsx index a7d19f7..ee6c75f 100644 --- a/src/components/Router/__tests__/PrivateOutlet.test.tsx +++ b/src/common/components/Router/__tests__/PrivateOutlet.test.tsx @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { Navigate, Route, Routes } from 'react-router-dom'; import { render, screen } from 'test/test-utils'; -import * as UseAuth from 'hooks/useAuth'; +import * as UseAuth from 'common/hooks/useAuth'; import PrivateOutlet from '../PrivateOutlet'; diff --git a/src/components/Table/Table.tsx b/src/common/components/Table/Table.tsx similarity index 100% rename from src/components/Table/Table.tsx rename to src/common/components/Table/Table.tsx diff --git a/src/components/Table/__tests__/Table.test.tsx b/src/common/components/Table/__tests__/Table.test.tsx similarity index 100% rename from src/components/Table/__tests__/Table.test.tsx rename to src/common/components/Table/__tests__/Table.test.tsx diff --git a/src/components/Tabs/Tab.tsx b/src/common/components/Tabs/Tab.tsx similarity index 100% rename from src/components/Tabs/Tab.tsx rename to src/common/components/Tabs/Tab.tsx diff --git a/src/components/Tabs/TabContent.tsx b/src/common/components/Tabs/TabContent.tsx similarity index 100% rename from src/components/Tabs/TabContent.tsx rename to src/common/components/Tabs/TabContent.tsx diff --git a/src/components/Tabs/Tabs.tsx b/src/common/components/Tabs/Tabs.tsx similarity index 96% rename from src/components/Tabs/Tabs.tsx rename to src/common/components/Tabs/Tabs.tsx index 698c55b..a5068a9 100644 --- a/src/components/Tabs/Tabs.tsx +++ b/src/common/components/Tabs/Tabs.tsx @@ -2,8 +2,8 @@ import { PropsWithTestId } from '@leanstacks/react-common'; import { useSearchParams } from 'react-router-dom'; import classNames from 'classnames'; -import { toNumberBetween } from 'utils/numbers'; -import { SearchParam } from 'utils/constants'; +import { toNumberBetween } from 'common/utils/numbers'; +import { SearchParam } from 'common/utils/constants'; import Tab, { TabProps } from './Tab'; import TabContent, { TabContentProps } from './TabContent'; diff --git a/src/components/Tabs/__tests__/Tab.test.tsx b/src/common/components/Tabs/__tests__/Tab.test.tsx similarity index 100% rename from src/components/Tabs/__tests__/Tab.test.tsx rename to src/common/components/Tabs/__tests__/Tab.test.tsx diff --git a/src/components/Tabs/__tests__/TabContent.test.tsx b/src/common/components/Tabs/__tests__/TabContent.test.tsx similarity index 100% rename from src/components/Tabs/__tests__/TabContent.test.tsx rename to src/common/components/Tabs/__tests__/TabContent.test.tsx diff --git a/src/components/Tabs/__tests__/Tabs.test.tsx b/src/common/components/Tabs/__tests__/Tabs.test.tsx similarity index 100% rename from src/components/Tabs/__tests__/Tabs.test.tsx rename to src/common/components/Tabs/__tests__/Tabs.test.tsx diff --git a/src/components/Text/CodeSnippet.tsx b/src/common/components/Text/CodeSnippet.tsx similarity index 97% rename from src/components/Text/CodeSnippet.tsx rename to src/common/components/Text/CodeSnippet.tsx index 5f06716..71bbafc 100644 --- a/src/components/Text/CodeSnippet.tsx +++ b/src/common/components/Text/CodeSnippet.tsx @@ -1,6 +1,6 @@ import { SandpackProvider, SandpackLayout, SandpackCodeEditor } from '@codesandbox/sandpack-react'; import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; -import { useSettings } from 'hooks/useSettings'; +import { useSettings } from 'common/hooks/useSettings'; /** * The GitHub light Sandpack theme. diff --git a/src/components/Text/Text.tsx b/src/common/components/Text/Text.tsx similarity index 100% rename from src/components/Text/Text.tsx rename to src/common/components/Text/Text.tsx diff --git a/src/components/Text/__tests__/CodeSnippet.test.tsx b/src/common/components/Text/__tests__/CodeSnippet.test.tsx similarity index 96% rename from src/components/Text/__tests__/CodeSnippet.test.tsx rename to src/common/components/Text/__tests__/CodeSnippet.test.tsx index 7309711..c99aa40 100644 --- a/src/components/Text/__tests__/CodeSnippet.test.tsx +++ b/src/common/components/Text/__tests__/CodeSnippet.test.tsx @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { render, screen } from 'test/test-utils'; -import * as UseSettings from 'hooks/useSettings'; +import * as UseSettings from 'common/hooks/useSettings'; import CodeSnippet from '../CodeSnippet'; diff --git a/src/components/Text/__tests__/Text.test.tsx b/src/common/components/Text/__tests__/Text.test.tsx similarity index 100% rename from src/components/Text/__tests__/Text.test.tsx rename to src/common/components/Text/__tests__/Text.test.tsx diff --git a/src/components/Theme/Theme.tsx b/src/common/components/Theme/Theme.tsx similarity index 94% rename from src/components/Theme/Theme.tsx rename to src/common/components/Theme/Theme.tsx index d64c2a3..aae269d 100644 --- a/src/components/Theme/Theme.tsx +++ b/src/common/components/Theme/Theme.tsx @@ -2,7 +2,7 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { PropsWithChildren } from 'react'; import classNames from 'classnames'; -import { useSettings } from 'hooks/useSettings'; +import { useSettings } from 'common/hooks/useSettings'; /** * Properties for the `Theme` component. diff --git a/src/components/Theme/__tests__/Theme.test.tsx b/src/common/components/Theme/__tests__/Theme.test.tsx similarity index 100% rename from src/components/Theme/__tests__/Theme.test.tsx rename to src/common/components/Theme/__tests__/Theme.test.tsx diff --git a/src/components/Toast/Toast.tsx b/src/common/components/Toast/Toast.tsx similarity index 92% rename from src/components/Toast/Toast.tsx rename to src/common/components/Toast/Toast.tsx index 8829841..fba99da 100644 --- a/src/components/Toast/Toast.tsx +++ b/src/common/components/Toast/Toast.tsx @@ -4,11 +4,11 @@ import classNames from 'classnames'; import dayjs from 'dayjs'; import { animated, useSpring } from '@react-spring/web'; -import { ToastDetail } from 'providers/ToastsContext'; -import { useConfig } from 'hooks/useConfig'; +import { ToastDetail } from 'common/providers/ToastsContext'; +import { useConfig } from 'common/hooks/useConfig'; -import Button from 'components/Button/Button'; -import FAIcon from 'components/Icon/FAIcon'; +import Button from 'common/components/Button/Button'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `Toast` component. diff --git a/src/components/Toast/Toasts.tsx b/src/common/components/Toast/Toasts.tsx similarity index 94% rename from src/components/Toast/Toasts.tsx rename to src/common/components/Toast/Toasts.tsx index c6c5f56..ff41d6b 100644 --- a/src/components/Toast/Toasts.tsx +++ b/src/common/components/Toast/Toasts.tsx @@ -1,6 +1,6 @@ import { PropsWithTestId } from '@leanstacks/react-common'; -import { useToasts } from 'hooks/useToasts'; +import { useToasts } from 'common/hooks/useToasts'; import Toast from './Toast'; /** diff --git a/src/components/Toast/__tests__/Toast.test.tsx b/src/common/components/Toast/__tests__/Toast.test.tsx similarity index 96% rename from src/components/Toast/__tests__/Toast.test.tsx rename to src/common/components/Toast/__tests__/Toast.test.tsx index 1a94ac5..87e177e 100644 --- a/src/components/Toast/__tests__/Toast.test.tsx +++ b/src/common/components/Toast/__tests__/Toast.test.tsx @@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event'; import { render, screen, waitFor } from 'test/test-utils'; -import { ToastDetail } from 'providers/ToastsContext'; +import { ToastDetail } from 'common/providers/ToastsContext'; import { toastFixture } from '__fixtures__/toasts'; import Toast from '../Toast'; diff --git a/src/components/Toast/__tests__/Toasts.test.tsx b/src/common/components/Toast/__tests__/Toasts.test.tsx similarity index 96% rename from src/components/Toast/__tests__/Toasts.test.tsx rename to src/common/components/Toast/__tests__/Toasts.test.tsx index 7e3dda9..69fdab5 100644 --- a/src/components/Toast/__tests__/Toasts.test.tsx +++ b/src/common/components/Toast/__tests__/Toasts.test.tsx @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import userEvent from '@testing-library/user-event'; import { render, screen, waitFor } from 'test/test-utils'; -import * as UseToasts from 'hooks/useToasts'; +import * as UseToasts from 'common/hooks/useToasts'; import { toastFixture } from '__fixtures__/toasts'; import Toasts from '../Toasts'; diff --git a/src/hooks/__tests__/useAuth.test.ts b/src/common/hooks/__tests__/useAuth.test.ts similarity index 88% rename from src/hooks/__tests__/useAuth.test.ts rename to src/common/hooks/__tests__/useAuth.test.ts index 3acf9eb..bea4150 100644 --- a/src/hooks/__tests__/useAuth.test.ts +++ b/src/common/hooks/__tests__/useAuth.test.ts @@ -4,9 +4,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; import { userTokensFixture } from '__fixtures__/tokens'; -import * as UseGetUserTokens from 'api/useGetUserTokens'; +import * as UseGetUserTokens from 'common/api/useGetUserTokens'; -import { useAuth } from 'hooks/useAuth'; +import { useAuth } from 'common/hooks/useAuth'; describe('useAuth', () => { const useGetUserTokensSpy = vi.spyOn(UseGetUserTokens, 'useGetUserTokens'); diff --git a/src/hooks/__tests__/useAxios.test.ts b/src/common/hooks/__tests__/useAxios.test.ts similarity index 88% rename from src/hooks/__tests__/useAxios.test.ts rename to src/common/hooks/__tests__/useAxios.test.ts index 487fdb3..529ae36 100644 --- a/src/hooks/__tests__/useAxios.test.ts +++ b/src/common/hooks/__tests__/useAxios.test.ts @@ -1,10 +1,10 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; -import * as UseAuth from 'hooks/useAuth'; +import * as UseAuth from 'common/hooks/useAuth'; import { userTokensFixture } from '__fixtures__/tokens'; -import { useAxios } from 'hooks/useAxios'; +import { useAxios } from 'common/hooks/useAxios'; describe('useAxios', () => { const useAuthSpy = vi.spyOn(UseAuth, 'useAuth'); diff --git a/src/hooks/__tests__/useConfig.test.ts b/src/common/hooks/__tests__/useConfig.test.ts similarity index 93% rename from src/hooks/__tests__/useConfig.test.ts rename to src/common/hooks/__tests__/useConfig.test.ts index 652f051..eab2bb9 100644 --- a/src/hooks/__tests__/useConfig.test.ts +++ b/src/common/hooks/__tests__/useConfig.test.ts @@ -3,7 +3,7 @@ import { renderHook as renderHookWithoutWrapper } from '@testing-library/react'; import { renderHook, waitFor } from 'test/test-utils'; -import { useConfig } from 'hooks/useConfig'; +import { useConfig } from 'common/hooks/useConfig'; describe('useConfig', () => { it('should return the context', async () => { diff --git a/src/hooks/__tests__/useDebounce.test.ts b/src/common/hooks/__tests__/useDebounce.test.ts similarity index 97% rename from src/hooks/__tests__/useDebounce.test.ts rename to src/common/hooks/__tests__/useDebounce.test.ts index 456beb7..9816f0e 100644 --- a/src/hooks/__tests__/useDebounce.test.ts +++ b/src/common/hooks/__tests__/useDebounce.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; import { renderHook, waitFor } from '@testing-library/react'; -import { useDebounce } from 'hooks/useDebounce'; +import { useDebounce } from 'common/hooks/useDebounce'; describe('useDebounce', () => { it('should return debounced value', async () => { diff --git a/src/hooks/__tests__/useSettings.test.ts b/src/common/hooks/__tests__/useSettings.test.ts similarity index 90% rename from src/hooks/__tests__/useSettings.test.ts rename to src/common/hooks/__tests__/useSettings.test.ts index 74f343e..26c57f6 100644 --- a/src/hooks/__tests__/useSettings.test.ts +++ b/src/common/hooks/__tests__/useSettings.test.ts @@ -3,10 +3,10 @@ import { renderHook as renderHookWithoutWrapper } from '@testing-library/react'; import { UseQueryResult } from '@tanstack/react-query'; import { renderHook, waitFor } from 'test/test-utils'; -import * as UseGetSettings from 'api/useGetSettings'; +import * as UseGetSettings from 'common/api/useGetSettings'; import { settingsFixture } from '__fixtures__/settings'; -import { useSettings } from 'hooks/useSettings'; +import { useSettings } from 'common/hooks/useSettings'; describe('useSettings', () => { const useGetSettingsSpy = vi.spyOn(UseGetSettings, 'useGetSettings'); diff --git a/src/hooks/__tests__/useToasts.test.ts b/src/common/hooks/__tests__/useToasts.test.ts similarity index 97% rename from src/hooks/__tests__/useToasts.test.ts rename to src/common/hooks/__tests__/useToasts.test.ts index 747f27d..09fa73c 100644 --- a/src/hooks/__tests__/useToasts.test.ts +++ b/src/common/hooks/__tests__/useToasts.test.ts @@ -3,7 +3,7 @@ import { renderHook as renderHookWithoutWrapper } from '@testing-library/react'; import { act, renderHook, waitFor } from 'test/test-utils'; -import { useToasts } from 'hooks/useToasts'; +import { useToasts } from 'common/hooks/useToasts'; describe('useToasts', () => { it('should return the context', async () => { diff --git a/src/hooks/useAuth.ts b/src/common/hooks/useAuth.ts similarity index 78% rename from src/hooks/useAuth.ts rename to src/common/hooks/useAuth.ts index a24b0e0..e2956bf 100644 --- a/src/hooks/useAuth.ts +++ b/src/common/hooks/useAuth.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { AuthContext, AuthContextValue } from 'providers/AuthContext'; +import { AuthContext, AuthContextValue } from 'common/providers/AuthContext'; /** * The `useAuth` hook returns the current `AuthContext` value. diff --git a/src/hooks/useAxios.ts b/src/common/hooks/useAxios.ts similarity index 83% rename from src/hooks/useAxios.ts rename to src/common/hooks/useAxios.ts index 181d23c..96b08b4 100644 --- a/src/hooks/useAxios.ts +++ b/src/common/hooks/useAxios.ts @@ -1,7 +1,7 @@ import { useContext } from 'react'; import { AxiosInstance } from 'axios'; -import { AxiosContext } from 'providers/AxiosContext'; +import { AxiosContext } from 'common/providers/AxiosContext'; /** * The `useAxios` hook returns the current `AxiosContext` value. diff --git a/src/hooks/useConfig.ts b/src/common/hooks/useConfig.ts similarity index 84% rename from src/hooks/useConfig.ts rename to src/common/hooks/useConfig.ts index 2a194ac..6be331e 100644 --- a/src/hooks/useConfig.ts +++ b/src/common/hooks/useConfig.ts @@ -1,4 +1,4 @@ -import { Config, ConfigContext } from 'providers/ConfigContext'; +import { Config, ConfigContext } from 'common/providers/ConfigContext'; import { useContext } from 'react'; /** diff --git a/src/hooks/useDebounce.ts b/src/common/hooks/useDebounce.ts similarity index 100% rename from src/hooks/useDebounce.ts rename to src/common/hooks/useDebounce.ts diff --git a/src/hooks/useSettings.ts b/src/common/hooks/useSettings.ts similarity index 78% rename from src/hooks/useSettings.ts rename to src/common/hooks/useSettings.ts index 33f0eb3..9bdff34 100644 --- a/src/hooks/useSettings.ts +++ b/src/common/hooks/useSettings.ts @@ -1,7 +1,7 @@ import { useContext } from 'react'; -import { Settings } from 'api/useGetSettings'; -import { SettingsContext } from 'providers/SettingsContext'; +import { Settings } from 'common/api/useGetSettings'; +import { SettingsContext } from 'common/providers/SettingsContext'; /** * The `useSettings` hook returns the current `SettingsContext` value. diff --git a/src/hooks/useToasts.ts b/src/common/hooks/useToasts.ts similarity index 83% rename from src/hooks/useToasts.ts rename to src/common/hooks/useToasts.ts index 7ae3e22..5b83170 100644 --- a/src/hooks/useToasts.ts +++ b/src/common/hooks/useToasts.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { ToastsContext, ToastsContextValue } from 'providers/ToastsContext'; +import { ToastsContext, ToastsContextValue } from 'common/providers/ToastsContext'; /** * The `useToasts` hook returns the current `ToastsContext` value. diff --git a/src/providers/AuthContext.ts b/src/common/providers/AuthContext.ts similarity index 91% rename from src/providers/AuthContext.ts rename to src/common/providers/AuthContext.ts index 8263e65..cf255d1 100644 --- a/src/providers/AuthContext.ts +++ b/src/common/providers/AuthContext.ts @@ -1,7 +1,7 @@ import { createContext } from 'react'; import { QueryObserverBaseResult } from '@tanstack/react-query'; -import { UserTokens } from 'api/useGetUserTokens'; +import { UserTokens } from 'common/api/useGetUserTokens'; /** * The `value` provided by the `AuthContext`. diff --git a/src/providers/AuthProvider.tsx b/src/common/providers/AuthProvider.tsx similarity index 89% rename from src/providers/AuthProvider.tsx rename to src/common/providers/AuthProvider.tsx index 3f85976..87ac220 100644 --- a/src/providers/AuthProvider.tsx +++ b/src/common/providers/AuthProvider.tsx @@ -1,8 +1,8 @@ import { PropsWithChildren } from 'react'; import { AuthContext, AuthContextValue } from './AuthContext'; -import { useGetUserTokens } from 'api/useGetUserTokens'; -import LoaderSpinner from 'components/Loader/LoaderSpinner'; +import { useGetUserTokens } from 'common/api/useGetUserTokens'; +import LoaderSpinner from 'common/components/Loader/LoaderSpinner'; /** * The `AuthContextProvider` React component creates, maintains, and provides diff --git a/src/providers/AxiosContext.ts b/src/common/providers/AxiosContext.ts similarity index 100% rename from src/providers/AxiosContext.ts rename to src/common/providers/AxiosContext.ts diff --git a/src/providers/AxiosProvider.tsx b/src/common/providers/AxiosProvider.tsx similarity index 98% rename from src/providers/AxiosProvider.tsx rename to src/common/providers/AxiosProvider.tsx index 6be6abd..322f743 100644 --- a/src/providers/AxiosProvider.tsx +++ b/src/common/providers/AxiosProvider.tsx @@ -3,7 +3,7 @@ import axios, { AxiosError, InternalAxiosRequestConfig } from 'axios'; import { AxiosContext, customAxios } from './AxiosContext'; import { AuthContextValue } from './AuthContext'; -import { useAuth } from 'hooks/useAuth'; +import { useAuth } from 'common/hooks/useAuth'; /** * An Axios request interceptor that adds user authentication headers to diff --git a/src/providers/ConfigContext.ts b/src/common/providers/ConfigContext.ts similarity index 100% rename from src/providers/ConfigContext.ts rename to src/common/providers/ConfigContext.ts diff --git a/src/providers/ConfigProvider.tsx b/src/common/providers/ConfigProvider.tsx similarity index 100% rename from src/providers/ConfigProvider.tsx rename to src/common/providers/ConfigProvider.tsx diff --git a/src/providers/SettingsContext.ts b/src/common/providers/SettingsContext.ts similarity index 75% rename from src/providers/SettingsContext.ts rename to src/common/providers/SettingsContext.ts index 746d34a..31652e0 100644 --- a/src/providers/SettingsContext.ts +++ b/src/common/providers/SettingsContext.ts @@ -1,6 +1,6 @@ import { createContext } from 'react'; -import { Settings } from 'api/useGetSettings'; +import { Settings } from 'common/api/useGetSettings'; /** * The `SettingsContext` instance. diff --git a/src/providers/SettingsProvider.tsx b/src/common/providers/SettingsProvider.tsx similarity index 92% rename from src/providers/SettingsProvider.tsx rename to src/common/providers/SettingsProvider.tsx index 3408907..8519ab7 100644 --- a/src/providers/SettingsProvider.tsx +++ b/src/common/providers/SettingsProvider.tsx @@ -1,6 +1,6 @@ import { PropsWithChildren, useMemo } from 'react'; -import { useGetSettings } from 'api/useGetSettings'; +import { useGetSettings } from 'common/api/useGetSettings'; import { SettingsContext } from './SettingsContext'; /** diff --git a/src/providers/ToastsContext.ts b/src/common/providers/ToastsContext.ts similarity index 100% rename from src/providers/ToastsContext.ts rename to src/common/providers/ToastsContext.ts diff --git a/src/providers/ToastsProvider.tsx b/src/common/providers/ToastsProvider.tsx similarity index 100% rename from src/providers/ToastsProvider.tsx rename to src/common/providers/ToastsProvider.tsx diff --git a/src/providers/__tests__/AuthProvider.test.tsx b/src/common/providers/__tests__/AuthProvider.test.tsx similarity index 93% rename from src/providers/__tests__/AuthProvider.test.tsx rename to src/common/providers/__tests__/AuthProvider.test.tsx index 949b5ee..a7106fe 100644 --- a/src/providers/__tests__/AuthProvider.test.tsx +++ b/src/common/providers/__tests__/AuthProvider.test.tsx @@ -4,9 +4,9 @@ import { UseQueryResult } from '@tanstack/react-query'; import { render, screen } from 'test/test-utils'; import { userTokensFixture } from '__fixtures__/tokens'; -import * as UseGetUserTokens from 'api/useGetUserTokens'; +import * as UseGetUserTokens from 'common/api/useGetUserTokens'; -import AuthContextProvider from 'providers/AuthProvider'; +import AuthContextProvider from 'common/providers/AuthProvider'; describe('AuthProvider', () => { const useGetUserTokensSpy = vi.spyOn(UseGetUserTokens, 'useGetUserTokens'); diff --git a/src/providers/__tests__/AxiosProvider.test.tsx b/src/common/providers/__tests__/AxiosProvider.test.tsx similarity index 93% rename from src/providers/__tests__/AxiosProvider.test.tsx rename to src/common/providers/__tests__/AxiosProvider.test.tsx index e5ef75e..e88c7d5 100644 --- a/src/providers/__tests__/AxiosProvider.test.tsx +++ b/src/common/providers/__tests__/AxiosProvider.test.tsx @@ -3,11 +3,11 @@ import { useEffect, useState } from 'react'; import { InternalAxiosRequestConfig } from 'axios'; import { render, screen } from 'test/test-utils'; -import { useAxios } from 'hooks/useAxios'; -import * as UseAuth from 'hooks/useAuth'; +import { useAxios } from 'common/hooks/useAxios'; +import * as UseAuth from 'common/hooks/useAuth'; import { userTokensFixture } from '__fixtures__/tokens'; -import AxiosContextProvider from 'providers/AxiosProvider'; +import AxiosContextProvider from 'common/providers/AxiosProvider'; describe('AxiosProvider', () => { const useAuthSpy = vi.spyOn(UseAuth, 'useAuth'); diff --git a/src/providers/__tests__/ConfigProvider.test.tsx b/src/common/providers/__tests__/ConfigProvider.test.tsx similarity index 93% rename from src/providers/__tests__/ConfigProvider.test.tsx rename to src/common/providers/__tests__/ConfigProvider.test.tsx index 0c9bdfe..d07e30b 100644 --- a/src/providers/__tests__/ConfigProvider.test.tsx +++ b/src/common/providers/__tests__/ConfigProvider.test.tsx @@ -2,7 +2,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { render, screen } from 'test/test-utils'; -import ConfigContextProvider from 'providers/ConfigProvider'; +import ConfigContextProvider from 'common/providers/ConfigProvider'; describe('ConfigProvider', () => { it('should render successfully', async () => { diff --git a/src/providers/__tests__/SettingsProvider.test.tsx b/src/common/providers/__tests__/SettingsProvider.test.tsx similarity index 87% rename from src/providers/__tests__/SettingsProvider.test.tsx rename to src/common/providers/__tests__/SettingsProvider.test.tsx index ca5c026..89a43f0 100644 --- a/src/providers/__tests__/SettingsProvider.test.tsx +++ b/src/common/providers/__tests__/SettingsProvider.test.tsx @@ -3,9 +3,9 @@ import { render as renderWithoutWrapper } from '@testing-library/react'; import { screen } from 'test/test-utils'; -import SettingsContextProvider from 'providers/SettingsProvider'; +import SettingsContextProvider from 'common/providers/SettingsProvider'; import { settingsFixture } from '__fixtures__/settings'; -import * as UseGetSettings from 'api/useGetSettings'; +import * as UseGetSettings from 'common/api/useGetSettings'; import { UseQueryResult } from '@tanstack/react-query'; const useGetSettingsSpy = vi.spyOn(UseGetSettings, 'useGetSettings'); diff --git a/src/providers/__tests__/ToastsProvider.test.tsx b/src/common/providers/__tests__/ToastsProvider.test.tsx similarity index 89% rename from src/providers/__tests__/ToastsProvider.test.tsx rename to src/common/providers/__tests__/ToastsProvider.test.tsx index df874b0..1019dd6 100644 --- a/src/providers/__tests__/ToastsProvider.test.tsx +++ b/src/common/providers/__tests__/ToastsProvider.test.tsx @@ -3,7 +3,7 @@ import { render as renderWithoutWrapper } from '@testing-library/react'; import { screen } from 'test/test-utils'; -import ToastsProvider from 'providers/ToastsProvider'; +import ToastsProvider from 'common/providers/ToastsProvider'; describe('ToastsProvider', () => { it('should render successfully', async () => { diff --git a/src/utils/__tests__/numbers.test.ts b/src/common/utils/__tests__/numbers.test.ts similarity index 97% rename from src/utils/__tests__/numbers.test.ts rename to src/common/utils/__tests__/numbers.test.ts index b576a0c..9743d55 100644 --- a/src/utils/__tests__/numbers.test.ts +++ b/src/common/utils/__tests__/numbers.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { toNumberBetween } from 'utils/numbers'; +import { toNumberBetween } from 'common/utils/numbers'; describe('numbers', () => { it('should convert to number successfully', () => { diff --git a/src/utils/__tests__/storage.test.ts b/src/common/utils/__tests__/storage.test.ts similarity index 96% rename from src/utils/__tests__/storage.test.ts rename to src/common/utils/__tests__/storage.test.ts index 6ecdeae..5d35243 100644 --- a/src/utils/__tests__/storage.test.ts +++ b/src/common/utils/__tests__/storage.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; describe('storage', () => { const originalLocalStorage = global.localStorage; diff --git a/src/utils/constants.ts b/src/common/utils/constants.ts similarity index 91% rename from src/utils/constants.ts rename to src/common/utils/constants.ts index fd000cd..43bf2b6 100644 --- a/src/utils/constants.ts +++ b/src/common/utils/constants.ts @@ -1,4 +1,4 @@ -import { Settings } from 'api/useGetSettings'; +import { Settings } from 'common/api/useGetSettings'; /** * Keys used with React Query cache. diff --git a/src/utils/i18n/__tests__/i18n.test.ts b/src/common/utils/i18n/__tests__/i18n.test.ts similarity index 81% rename from src/utils/i18n/__tests__/i18n.test.ts rename to src/common/utils/i18n/__tests__/i18n.test.ts index d031303..a63c52d 100644 --- a/src/utils/i18n/__tests__/i18n.test.ts +++ b/src/common/utils/i18n/__tests__/i18n.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import i18n from 'utils/i18n'; +import i18n from 'common/utils/i18n'; describe('i18n', () => { it('should initialize i18n', () => { diff --git a/src/utils/i18n/index.ts b/src/common/utils/i18n/index.ts similarity index 93% rename from src/utils/i18n/index.ts rename to src/common/utils/i18n/index.ts index ef16402..fcb008a 100644 --- a/src/utils/i18n/index.ts +++ b/src/common/utils/i18n/index.ts @@ -2,7 +2,7 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; -import { StorageKeys } from 'utils/constants'; +import { StorageKeys } from 'common/utils/constants'; // translation resources import en from './locales/en'; diff --git a/src/utils/i18n/locales/en/common.json b/src/common/utils/i18n/locales/en/common.json similarity index 100% rename from src/utils/i18n/locales/en/common.json rename to src/common/utils/i18n/locales/en/common.json diff --git a/src/utils/i18n/locales/en/index.ts b/src/common/utils/i18n/locales/en/index.ts similarity index 100% rename from src/utils/i18n/locales/en/index.ts rename to src/common/utils/i18n/locales/en/index.ts diff --git a/src/utils/i18n/locales/en/users.json b/src/common/utils/i18n/locales/en/users.json similarity index 100% rename from src/utils/i18n/locales/en/users.json rename to src/common/utils/i18n/locales/en/users.json diff --git a/src/utils/i18n/locales/es/common.json b/src/common/utils/i18n/locales/es/common.json similarity index 100% rename from src/utils/i18n/locales/es/common.json rename to src/common/utils/i18n/locales/es/common.json diff --git a/src/utils/i18n/locales/es/index.ts b/src/common/utils/i18n/locales/es/index.ts similarity index 100% rename from src/utils/i18n/locales/es/index.ts rename to src/common/utils/i18n/locales/es/index.ts diff --git a/src/utils/i18n/locales/es/users.json b/src/common/utils/i18n/locales/es/users.json similarity index 100% rename from src/utils/i18n/locales/es/users.json rename to src/common/utils/i18n/locales/es/users.json diff --git a/src/utils/i18n/locales/fr/common.json b/src/common/utils/i18n/locales/fr/common.json similarity index 100% rename from src/utils/i18n/locales/fr/common.json rename to src/common/utils/i18n/locales/fr/common.json diff --git a/src/utils/i18n/locales/fr/index.ts b/src/common/utils/i18n/locales/fr/index.ts similarity index 100% rename from src/utils/i18n/locales/fr/index.ts rename to src/common/utils/i18n/locales/fr/index.ts diff --git a/src/utils/i18n/locales/fr/users.json b/src/common/utils/i18n/locales/fr/users.json similarity index 100% rename from src/utils/i18n/locales/fr/users.json rename to src/common/utils/i18n/locales/fr/users.json diff --git a/src/utils/numbers.ts b/src/common/utils/numbers.ts similarity index 100% rename from src/utils/numbers.ts rename to src/common/utils/numbers.ts diff --git a/src/utils/storage.ts b/src/common/utils/storage.ts similarity index 100% rename from src/utils/storage.ts rename to src/common/utils/storage.ts diff --git a/src/main.tsx b/src/main.tsx index b7eca5a..f917a2a 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; -import 'utils/i18n'; +import 'common/utils/i18n'; import App from './App.tsx'; import './index.css'; diff --git a/src/pages/ComponentsPage/ComponentsPage.tsx b/src/pages/ComponentsPage/ComponentsPage.tsx index f7ba234..c344972 100644 --- a/src/pages/ComponentsPage/ComponentsPage.tsx +++ b/src/pages/ComponentsPage/ComponentsPage.tsx @@ -1,8 +1,8 @@ import { Outlet } from 'react-router-dom'; -import Page from 'components/Page/Page'; -import Text from 'components/Text/Text'; -import MenuNavLink from 'components/Menu/MenuNavLink'; +import Page from 'common/components/Page/Page'; +import Text from 'common/components/Text/Text'; +import MenuNavLink from 'common/components/Menu/MenuNavLink'; /** * The `ComponentsPage` component renders the layout for the components page. diff --git a/src/pages/ComponentsPage/components/AvatarComponents.tsx b/src/pages/ComponentsPage/components/AvatarComponents.tsx index 69441f9..67e4511 100644 --- a/src/pages/ComponentsPage/components/AvatarComponents.tsx +++ b/src/pages/ComponentsPage/components/AvatarComponents.tsx @@ -3,10 +3,10 @@ import { createColumnHelper } from '@tanstack/react-table'; import avatarPicture from './avatar-picture.png'; import { ComponentProperty } from '../model/components'; -import Text from 'components/Text/Text'; -import Table from 'components/Table/Table'; -import CodeSnippet from 'components/Text/CodeSnippet'; -import Avatar from 'components/Icon/Avatar'; +import Text from 'common/components/Text/Text'; +import Table from 'common/components/Table/Table'; +import CodeSnippet from 'common/components/Text/CodeSnippet'; +import Avatar from 'common/components/Icon/Avatar'; /** * Properties for the `AvatarComponents` React component. diff --git a/src/pages/ComponentsPage/components/BadgeComponents.tsx b/src/pages/ComponentsPage/components/BadgeComponents.tsx index 62b2d3f..cc29fe2 100644 --- a/src/pages/ComponentsPage/components/BadgeComponents.tsx +++ b/src/pages/ComponentsPage/components/BadgeComponents.tsx @@ -2,10 +2,10 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { createColumnHelper } from '@tanstack/react-table'; import { ComponentProperty } from '../model/components'; -import Text from 'components/Text/Text'; -import Table from 'components/Table/Table'; -import CodeSnippet from 'components/Text/CodeSnippet'; -import Badge from 'components/Badge/Badge'; +import Text from 'common/components/Text/Text'; +import Table from 'common/components/Table/Table'; +import CodeSnippet from 'common/components/Text/CodeSnippet'; +import Badge from 'common/components/Badge/Badge'; /** * Properties for the `BadgeComponents` React component. diff --git a/src/pages/ComponentsPage/components/ButtonComponents.tsx b/src/pages/ComponentsPage/components/ButtonComponents.tsx index b1b521b..eb10b28 100644 --- a/src/pages/ComponentsPage/components/ButtonComponents.tsx +++ b/src/pages/ComponentsPage/components/ButtonComponents.tsx @@ -1,11 +1,11 @@ import { ButtonVariant, PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; -import Button from 'components/Button/Button'; -import CodeSnippet from 'components/Text/CodeSnippet'; -import Text from 'components/Text/Text'; +import Button from 'common/components/Button/Button'; +import CodeSnippet from 'common/components/Text/CodeSnippet'; +import Text from 'common/components/Text/Text'; import { ComponentProperty } from '../model/components'; import { createColumnHelper } from '@tanstack/react-table'; -import Table from 'components/Table/Table'; +import Table from 'common/components/Table/Table'; /** * Properties for the `ButtonComponents` React component. diff --git a/src/pages/ComponentsPage/components/CardComponents.tsx b/src/pages/ComponentsPage/components/CardComponents.tsx index bcecf26..43ec3f5 100644 --- a/src/pages/ComponentsPage/components/CardComponents.tsx +++ b/src/pages/ComponentsPage/components/CardComponents.tsx @@ -2,11 +2,11 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { createColumnHelper } from '@tanstack/react-table'; import { ComponentProperty } from '../model/components'; -import Text from 'components/Text/Text'; -import Table from 'components/Table/Table'; -import CodeSnippet from 'components/Text/CodeSnippet'; -import Card from 'components/Card/Card'; -import MessageCard from 'components/Card/MessageCard'; +import Text from 'common/components/Text/Text'; +import Table from 'common/components/Table/Table'; +import CodeSnippet from 'common/components/Text/CodeSnippet'; +import Card from 'common/components/Card/Card'; +import MessageCard from 'common/components/Card/MessageCard'; /** * Properties for the `CardComponents` React component. diff --git a/src/pages/ComponentsPage/components/TextComponents.tsx b/src/pages/ComponentsPage/components/TextComponents.tsx index f27c95a..b164b3a 100644 --- a/src/pages/ComponentsPage/components/TextComponents.tsx +++ b/src/pages/ComponentsPage/components/TextComponents.tsx @@ -1,10 +1,10 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { createColumnHelper } from '@tanstack/react-table'; -import CodeSnippet from 'components/Text/CodeSnippet'; -import Text from 'components/Text/Text'; +import CodeSnippet from 'common/components/Text/CodeSnippet'; +import Text from 'common/components/Text/Text'; import { ComponentProperty } from '../model/components'; -import Table from 'components/Table/Table'; +import Table from 'common/components/Table/Table'; /** * Properties for the `TextComponents` React component. diff --git a/src/pages/DashboardPage/DashboardPage.tsx b/src/pages/DashboardPage/DashboardPage.tsx index 8a9d538..3c134f2 100644 --- a/src/pages/DashboardPage/DashboardPage.tsx +++ b/src/pages/DashboardPage/DashboardPage.tsx @@ -1,8 +1,8 @@ import { useTranslation } from 'react-i18next'; -import { useGetCurrentUser } from 'api/useGetCurrentUser'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import Page from 'components/Page/Page'; +import { useGetCurrentUser } from 'common/api/useGetCurrentUser'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import Page from 'common/components/Page/Page'; import UserTasksCard from 'pages/UsersPage/components/UserTasksCard'; /** diff --git a/src/pages/DashboardPage/__tests__/DashboardPage.test.tsx b/src/pages/DashboardPage/__tests__/DashboardPage.test.tsx index 33bc175..ecf50d6 100644 --- a/src/pages/DashboardPage/__tests__/DashboardPage.test.tsx +++ b/src/pages/DashboardPage/__tests__/DashboardPage.test.tsx @@ -2,9 +2,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { render, screen } from 'test/test-utils'; import { UseQueryResult } from '@tanstack/react-query'; -import { User } from 'api/useGetUser'; +import { User } from 'common/api/useGetUser'; import { userFixture1 } from '__fixtures__/users'; -import * as UseGetCurrentUser from 'api/useGetCurrentUser'; +import * as UseGetCurrentUser from 'common/api/useGetCurrentUser'; import DashboardPage from '../DashboardPage'; diff --git a/src/pages/LandingPage/LandingPage.tsx b/src/pages/LandingPage/LandingPage.tsx index ef4360e..7369a13 100644 --- a/src/pages/LandingPage/LandingPage.tsx +++ b/src/pages/LandingPage/LandingPage.tsx @@ -1,8 +1,8 @@ import { Navigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { useAuth } from 'hooks/useAuth'; -import Page from 'components/Page/Page'; +import { useAuth } from 'common/hooks/useAuth'; +import Page from 'common/components/Page/Page'; /** * The `LandingPage` component renders the content of the landing page diff --git a/src/pages/LandingPage/__tests__/LandingPage.test.tsx b/src/pages/LandingPage/__tests__/LandingPage.test.tsx index 95251ba..63803a5 100644 --- a/src/pages/LandingPage/__tests__/LandingPage.test.tsx +++ b/src/pages/LandingPage/__tests__/LandingPage.test.tsx @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { render, screen } from 'test/test-utils'; -import * as UseAuth from 'hooks/useAuth'; +import * as UseAuth from 'common/hooks/useAuth'; import LandingPage from '../LandingPage'; import { Route, Routes } from 'react-router-dom'; diff --git a/src/pages/SettingsPage/SettingsPage.tsx b/src/pages/SettingsPage/SettingsPage.tsx index 409ab27..349de10 100644 --- a/src/pages/SettingsPage/SettingsPage.tsx +++ b/src/pages/SettingsPage/SettingsPage.tsx @@ -1,10 +1,10 @@ import { Outlet } from 'react-router-dom'; -import { useGetCurrentUser } from 'api/useGetCurrentUser'; -import Avatar from 'components/Icon/Avatar'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import MenuNavLink from 'components/Menu/MenuNavLink'; -import Page from 'components/Page/Page'; +import { useGetCurrentUser } from 'common/api/useGetCurrentUser'; +import Avatar from 'common/components/Icon/Avatar'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import MenuNavLink from 'common/components/Menu/MenuNavLink'; +import Page from 'common/components/Page/Page'; /** * The `SettingsPage` component renders the layout for the settings page. It diff --git a/src/pages/SettingsPage/__tests__/SettingsPage.test.tsx b/src/pages/SettingsPage/__tests__/SettingsPage.test.tsx index d22a975..c016ee8 100644 --- a/src/pages/SettingsPage/__tests__/SettingsPage.test.tsx +++ b/src/pages/SettingsPage/__tests__/SettingsPage.test.tsx @@ -3,8 +3,8 @@ import { UseQueryResult } from '@tanstack/react-query'; import { render, screen } from 'test/test-utils'; -import { User } from 'api/useGetUser'; -import * as UseGetCurrentUser from 'api/useGetCurrentUser'; +import { User } from 'common/api/useGetUser'; +import * as UseGetCurrentUser from 'common/api/useGetCurrentUser'; import { userFixture1 } from '__fixtures__/users'; import SettingsPage from '../SettingsPage'; diff --git a/src/pages/SettingsPage/components/AppearanceSettings.tsx b/src/pages/SettingsPage/components/AppearanceSettings.tsx index f702998..663e244 100644 --- a/src/pages/SettingsPage/components/AppearanceSettings.tsx +++ b/src/pages/SettingsPage/components/AppearanceSettings.tsx @@ -1,8 +1,8 @@ import { PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; -import { useSettings } from 'hooks/useSettings'; -import { useSetSettings } from 'api/useSetSettings'; +import { useSettings } from 'common/hooks/useSettings'; +import { useSetSettings } from 'common/api/useSetSettings'; import SettingsHeading from './SettingsHeading'; /** diff --git a/src/pages/SettingsPage/components/__tests__/AppearanceSettings.test.tsx b/src/pages/SettingsPage/components/__tests__/AppearanceSettings.test.tsx index b0fd69f..1ef6502 100644 --- a/src/pages/SettingsPage/components/__tests__/AppearanceSettings.test.tsx +++ b/src/pages/SettingsPage/components/__tests__/AppearanceSettings.test.tsx @@ -3,10 +3,10 @@ import { UseMutationResult } from '@tanstack/react-query'; import userEvent from '@testing-library/user-event'; import { render, screen } from 'test/test-utils'; -import { Settings } from 'api/useGetSettings'; -import { DEFAULT_SETTINGS } from 'utils/constants'; -import * as UseSettings from 'hooks/useSettings'; -import * as UseSetSettings from 'api/useSetSettings'; +import { Settings } from 'common/api/useGetSettings'; +import { DEFAULT_SETTINGS } from 'common/utils/constants'; +import * as UseSettings from 'common/hooks/useSettings'; +import * as UseSetSettings from 'common/api/useSetSettings'; import AppearanceSettings from '../AppearanceSettings'; diff --git a/src/pages/SigninPage/SigninPage.tsx b/src/pages/SigninPage/SigninPage.tsx index 23cabe7..b5fa64f 100644 --- a/src/pages/SigninPage/SigninPage.tsx +++ b/src/pages/SigninPage/SigninPage.tsx @@ -1,4 +1,4 @@ -import Page from 'components/Page/Page'; +import Page from 'common/components/Page/Page'; import SigninForm from './components/SigninForm'; /** diff --git a/src/pages/SigninPage/api/__tests__/useSignin.test.ts b/src/pages/SigninPage/api/__tests__/useSignin.test.ts index 39f952f..16977ac 100644 --- a/src/pages/SigninPage/api/__tests__/useSignin.test.ts +++ b/src/pages/SigninPage/api/__tests__/useSignin.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; import { useSignin } from '../useSignin'; diff --git a/src/pages/SigninPage/api/useSignin.ts b/src/pages/SigninPage/api/useSignin.ts index d33b442..c24d070 100644 --- a/src/pages/SigninPage/api/useSignin.ts +++ b/src/pages/SigninPage/api/useSignin.ts @@ -2,12 +2,12 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import dayjs from 'dayjs'; import find from 'lodash/find'; -import { User } from 'api/useGetUser'; -import { UserTokens } from 'api/useGetUserTokens'; -import { useAxios } from 'hooks/useAxios'; -import { useConfig } from 'hooks/useConfig'; -import storage from 'utils/storage'; -import { QueryKeys, StorageKeys } from 'utils/constants'; +import { User } from 'common/api/useGetUser'; +import { UserTokens } from 'common/api/useGetUserTokens'; +import { useAxios } from 'common/hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; +import storage from 'common/utils/storage'; +import { QueryKeys, StorageKeys } from 'common/utils/constants'; /** * An API hook which performs user authentication. diff --git a/src/pages/SigninPage/components/SigninForm.tsx b/src/pages/SigninPage/components/SigninForm.tsx index 82cc442..1eb7fff 100644 --- a/src/pages/SigninPage/components/SigninForm.tsx +++ b/src/pages/SigninPage/components/SigninForm.tsx @@ -7,8 +7,8 @@ import { useNavigate } from 'react-router-dom'; import { Button } from '@leanstacks/react-common'; import { useSignin } from '../api/useSignin'; -import TextField from 'components/Form/TextField'; -import FAIcon from 'components/Icon/FAIcon'; +import TextField from 'common/components/Form/TextField'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `SigninForm` component. diff --git a/src/pages/SignoutPage/SignoutPage.tsx b/src/pages/SignoutPage/SignoutPage.tsx index b9b6206..4e2172c 100644 --- a/src/pages/SignoutPage/SignoutPage.tsx +++ b/src/pages/SignoutPage/SignoutPage.tsx @@ -2,8 +2,8 @@ import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { useSignout } from './api/useSignout'; -import LoaderSpinner from 'components/Loader/LoaderSpinner'; -import Page from 'components/Page/Page'; +import LoaderSpinner from 'common/components/Loader/LoaderSpinner'; +import Page from 'common/components/Page/Page'; /** * The `SignoutPage` component deauthenticates the current user and redirects diff --git a/src/pages/SignoutPage/api/__tests__/useSignout.test.ts b/src/pages/SignoutPage/api/__tests__/useSignout.test.ts index c5d45a9..b7d9bc4 100644 --- a/src/pages/SignoutPage/api/__tests__/useSignout.test.ts +++ b/src/pages/SignoutPage/api/__tests__/useSignout.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; -import storage from 'utils/storage'; +import storage from 'common/utils/storage'; import { renderHook, waitFor } from 'test/test-utils'; import { useSignout } from '../useSignout'; diff --git a/src/pages/SignoutPage/api/useSignout.ts b/src/pages/SignoutPage/api/useSignout.ts index b710703..dacd4cf 100644 --- a/src/pages/SignoutPage/api/useSignout.ts +++ b/src/pages/SignoutPage/api/useSignout.ts @@ -1,6 +1,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { QueryKeys, StorageKeys } from 'utils/constants'; -import storage from 'utils/storage'; +import { QueryKeys, StorageKeys } from 'common/utils/constants'; +import storage from 'common/utils/storage'; /** * An API hook which deauthenticates the currently authenticated user. diff --git a/src/pages/UsersPage/Tasks/api/__tests__/useUpdateTask.test.ts b/src/pages/UsersPage/Tasks/api/__tests__/useUpdateTask.test.ts index 254786f..1e68530 100644 --- a/src/pages/UsersPage/Tasks/api/__tests__/useUpdateTask.test.ts +++ b/src/pages/UsersPage/Tasks/api/__tests__/useUpdateTask.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest'; import { renderHook, waitFor } from 'test/test-utils'; import { queryClient } from 'test/query-client'; import { todosFixture } from '__fixtures__/todos'; -import { QueryKeys } from 'utils/constants'; +import { QueryKeys } from 'common/utils/constants'; import { Task } from '../../../api/useGetUserTasks'; import { useUpdateTask } from '../useUpdateTask'; diff --git a/src/pages/UsersPage/Tasks/api/useGetTask.ts b/src/pages/UsersPage/Tasks/api/useGetTask.ts index c4ae4b6..729d619 100644 --- a/src/pages/UsersPage/Tasks/api/useGetTask.ts +++ b/src/pages/UsersPage/Tasks/api/useGetTask.ts @@ -1,9 +1,9 @@ import { UseQueryResult, useQuery } from '@tanstack/react-query'; -import { useAxios } from 'hooks/useAxios'; -import { useConfig } from 'hooks/useConfig'; +import { useAxios } from 'common/hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; import { Task } from 'pages/UsersPage/api/useGetUserTasks'; -import { QueryKeys } from 'utils/constants'; +import { QueryKeys } from 'common/utils/constants'; /** * Properties for the `useGetTask` hook. diff --git a/src/pages/UsersPage/Tasks/api/useUpdateTask.ts b/src/pages/UsersPage/Tasks/api/useUpdateTask.ts index ff54df2..90cac4c 100644 --- a/src/pages/UsersPage/Tasks/api/useUpdateTask.ts +++ b/src/pages/UsersPage/Tasks/api/useUpdateTask.ts @@ -1,10 +1,10 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import reject from 'lodash/reject'; -import { QueryKeys } from 'utils/constants'; +import { QueryKeys } from 'common/utils/constants'; import { Task } from 'pages/UsersPage/api/useGetUserTasks'; -import { useConfig } from 'hooks/useConfig'; -import { useAxios } from 'hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; +import { useAxios } from 'common/hooks/useAxios'; /** * The `useUpdateTask` mutation function variables. diff --git a/src/pages/UsersPage/Tasks/components/TaskCompleteToggle.tsx b/src/pages/UsersPage/Tasks/components/TaskCompleteToggle.tsx index 1be769d..947fb54 100644 --- a/src/pages/UsersPage/Tasks/components/TaskCompleteToggle.tsx +++ b/src/pages/UsersPage/Tasks/components/TaskCompleteToggle.tsx @@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next'; import { Task } from 'pages/UsersPage/api/useGetUserTasks'; import { useUpdateTask } from '../api/useUpdateTask'; -import { useToasts } from 'hooks/useToasts'; -import FAIcon from 'components/Icon/FAIcon'; +import { useToasts } from 'common/hooks/useToasts'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Propeties for the `TaskCompleteToggle` component. diff --git a/src/pages/UsersPage/Tasks/components/TaskDetail.tsx b/src/pages/UsersPage/Tasks/components/TaskDetail.tsx index b8e277f..4acd597 100644 --- a/src/pages/UsersPage/Tasks/components/TaskDetail.tsx +++ b/src/pages/UsersPage/Tasks/components/TaskDetail.tsx @@ -9,13 +9,13 @@ import { import { useNavigate, useParams } from 'react-router-dom'; import classNames from 'classnames'; -import Text from 'components/Text/Text'; +import Text from 'common/components/Text/Text'; import { useGetTask } from '../api/useGetTask'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import { useGetUser } from 'api/useGetUser'; -import LoaderSpinner from 'components/Loader/LoaderSpinner'; -import Badge from 'components/Badge/Badge'; -import FAIcon from 'components/Icon/FAIcon'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import { useGetUser } from 'common/api/useGetUser'; +import LoaderSpinner from 'common/components/Loader/LoaderSpinner'; +import Badge from 'common/components/Badge/Badge'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `TaskDetail` component. diff --git a/src/pages/UsersPage/Tasks/components/__tests__/TaskCompleteToggle.test.tsx b/src/pages/UsersPage/Tasks/components/__tests__/TaskCompleteToggle.test.tsx index d5b2d9f..0fbc9b5 100644 --- a/src/pages/UsersPage/Tasks/components/__tests__/TaskCompleteToggle.test.tsx +++ b/src/pages/UsersPage/Tasks/components/__tests__/TaskCompleteToggle.test.tsx @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event'; import { render, screen } from 'test/test-utils'; import { todosFixture } from '__fixtures__/todos'; -import * as UseToasts from 'hooks/useToasts'; +import * as UseToasts from 'common/hooks/useToasts'; import TaskCompleteToggle from '../TaskCompleteToggle'; diff --git a/src/pages/UsersPage/Tasks/components/__tests__/TaskDetail.test.tsx b/src/pages/UsersPage/Tasks/components/__tests__/TaskDetail.test.tsx index 85a28e4..92f7287 100644 --- a/src/pages/UsersPage/Tasks/components/__tests__/TaskDetail.test.tsx +++ b/src/pages/UsersPage/Tasks/components/__tests__/TaskDetail.test.tsx @@ -4,7 +4,7 @@ import { UseQueryResult } from '@tanstack/react-query'; import { render, screen } from 'test/test-utils'; import * as UseGetTask from 'pages/UsersPage/Tasks/api/useGetTask'; -import * as UseGetUser from 'api/useGetUser'; +import * as UseGetUser from 'common/api/useGetUser'; import { Task } from 'pages/UsersPage/api/useGetUserTasks'; import { userFixture1 } from '__fixtures__/users'; import { todosFixture } from '__fixtures__/todos'; diff --git a/src/pages/UsersPage/UsersPage.tsx b/src/pages/UsersPage/UsersPage.tsx index 5958e16..ee3bcac 100644 --- a/src/pages/UsersPage/UsersPage.tsx +++ b/src/pages/UsersPage/UsersPage.tsx @@ -1,9 +1,9 @@ import { Outlet } from 'react-router-dom'; -import Page from 'components/Page/Page'; -import Text from 'components/Text/Text'; +import Page from 'common/components/Page/Page'; +import Text from 'common/components/Text/Text'; import UserList from './components/UserList'; -import Tabs from 'components/Tabs/Tabs'; +import Tabs from 'common/components/Tabs/Tabs'; /** * The `UsersPage` component renders the layout for the users page. It diff --git a/src/pages/UsersPage/api/useGetUserTasks.ts b/src/pages/UsersPage/api/useGetUserTasks.ts index 6c955ba..5659294 100644 --- a/src/pages/UsersPage/api/useGetUserTasks.ts +++ b/src/pages/UsersPage/api/useGetUserTasks.ts @@ -1,8 +1,8 @@ import { UseQueryResult, useQuery } from '@tanstack/react-query'; -import { useAxios } from 'hooks/useAxios'; -import { useConfig } from 'hooks/useConfig'; -import { QueryKeys } from 'utils/constants'; +import { useAxios } from 'common/hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; +import { QueryKeys } from 'common/utils/constants'; /** * The `Task` type. diff --git a/src/pages/UsersPage/api/useGetUsers.ts b/src/pages/UsersPage/api/useGetUsers.ts index 64329b7..c9c1ae7 100644 --- a/src/pages/UsersPage/api/useGetUsers.ts +++ b/src/pages/UsersPage/api/useGetUsers.ts @@ -1,9 +1,9 @@ import { UseQueryResult, useQuery } from '@tanstack/react-query'; -import { User } from 'api/useGetUser'; +import { User } from 'common/api/useGetUser'; -import { useAxios } from 'hooks/useAxios'; -import { useConfig } from 'hooks/useConfig'; -import { QueryKeys } from 'utils/constants'; +import { useAxios } from 'common/hooks/useAxios'; +import { useConfig } from 'common/hooks/useConfig'; +import { QueryKeys } from 'common/utils/constants'; /** * An API hook which fetches a collection of `User` objects. diff --git a/src/pages/UsersPage/components/UserDetail.tsx b/src/pages/UsersPage/components/UserDetail.tsx index f8f0170..99849ce 100644 --- a/src/pages/UsersPage/components/UserDetail.tsx +++ b/src/pages/UsersPage/components/UserDetail.tsx @@ -1,10 +1,10 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { useParams } from 'react-router-dom'; -import { useGetUser } from 'api/useGetUser'; -import Text from 'components/Text/Text'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import FAIcon from 'components/Icon/FAIcon'; +import { useGetUser } from 'common/api/useGetUser'; +import Text from 'common/components/Text/Text'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import FAIcon from 'common/components/Icon/FAIcon'; import UserTasks from './UserTasks'; /** diff --git a/src/pages/UsersPage/components/UserDetailEmpty.tsx b/src/pages/UsersPage/components/UserDetailEmpty.tsx index 8ebc0a8..3c41036 100644 --- a/src/pages/UsersPage/components/UserDetailEmpty.tsx +++ b/src/pages/UsersPage/components/UserDetailEmpty.tsx @@ -1,6 +1,6 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; -import MessageCard from 'components/Card/MessageCard'; +import MessageCard from 'common/components/Card/MessageCard'; /** * Properties for the `UserDetailEmpty` component. diff --git a/src/pages/UsersPage/components/UserDetailLayout.tsx b/src/pages/UsersPage/components/UserDetailLayout.tsx index 316bce7..219472b 100644 --- a/src/pages/UsersPage/components/UserDetailLayout.tsx +++ b/src/pages/UsersPage/components/UserDetailLayout.tsx @@ -1,11 +1,11 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { Outlet, useParams } from 'react-router-dom'; -import { useGetUser } from 'api/useGetUser'; -import Text from 'components/Text/Text'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import Avatar from 'components/Icon/Avatar'; -import FAIcon from 'components/Icon/FAIcon'; +import { useGetUser } from 'common/api/useGetUser'; +import Text from 'common/components/Text/Text'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import Avatar from 'common/components/Icon/Avatar'; +import FAIcon from 'common/components/Icon/FAIcon'; /** * Properties for the `UserDetailLayout` React component. diff --git a/src/pages/UsersPage/components/UserList.tsx b/src/pages/UsersPage/components/UserList.tsx index c0a2668..10f7520 100644 --- a/src/pages/UsersPage/components/UserList.tsx +++ b/src/pages/UsersPage/components/UserList.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames'; import { useGetUsers } from '../api/useGetUsers'; import UserListItem from './UserListItem'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; /** * Properties for the `UserList` component. diff --git a/src/pages/UsersPage/components/UserListItem.tsx b/src/pages/UsersPage/components/UserListItem.tsx index c8a481b..31ac088 100644 --- a/src/pages/UsersPage/components/UserListItem.tsx +++ b/src/pages/UsersPage/components/UserListItem.tsx @@ -2,7 +2,7 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; import { useNavigate } from 'react-router-dom'; -import { User } from 'api/useGetUser'; +import { User } from 'common/api/useGetUser'; /** * Properties for the `UserListItem` component. diff --git a/src/pages/UsersPage/components/UserTaskList.tsx b/src/pages/UsersPage/components/UserTaskList.tsx index 531f0f6..756b623 100644 --- a/src/pages/UsersPage/components/UserTaskList.tsx +++ b/src/pages/UsersPage/components/UserTaskList.tsx @@ -3,11 +3,11 @@ import { useParams } from 'react-router-dom'; import filter from 'lodash/filter'; import { useGetUserTasks } from '../api/useGetUserTasks'; -import FAIcon from 'components/Icon/FAIcon'; -import Text from 'components/Text/Text'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; +import FAIcon from 'common/components/Icon/FAIcon'; +import Text from 'common/components/Text/Text'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; import UserTaskListItem from './UserTaskListItem'; -import Badge from 'components/Badge/Badge'; +import Badge from 'common/components/Badge/Badge'; /** * Propeties for the `UserTaskList` React component. diff --git a/src/pages/UsersPage/components/UserTaskListItem.tsx b/src/pages/UsersPage/components/UserTaskListItem.tsx index 0a299fb..1516dc7 100644 --- a/src/pages/UsersPage/components/UserTaskListItem.tsx +++ b/src/pages/UsersPage/components/UserTaskListItem.tsx @@ -2,7 +2,7 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import { Task } from '../api/useGetUserTasks'; import TaskCompleteToggle from '../Tasks/components/TaskCompleteToggle'; -import Link from 'components/Link/Link'; +import Link from 'common/components/Link/Link'; /** * Properties for the `UserTaskListItem` React component. diff --git a/src/pages/UsersPage/components/UserTasks.tsx b/src/pages/UsersPage/components/UserTasks.tsx index 9e5a607..f30f9d1 100644 --- a/src/pages/UsersPage/components/UserTasks.tsx +++ b/src/pages/UsersPage/components/UserTasks.tsx @@ -2,11 +2,11 @@ import { PropsWithClassName, PropsWithTestId } from '@leanstacks/react-common'; import classNames from 'classnames'; import { useGetUserTasks } from '../api/useGetUserTasks'; -import FAIcon from 'components/Icon/FAIcon'; -import Text from 'components/Text/Text'; -import Link from 'components/Link/Link'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; -import Badge from 'components/Badge/Badge'; +import FAIcon from 'common/components/Icon/FAIcon'; +import Text from 'common/components/Text/Text'; +import Link from 'common/components/Link/Link'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; +import Badge from 'common/components/Badge/Badge'; /** * Properties for the `UserTasks` component. diff --git a/src/pages/UsersPage/components/UserTasksCard.tsx b/src/pages/UsersPage/components/UserTasksCard.tsx index aeaeff1..0dff799 100644 --- a/src/pages/UsersPage/components/UserTasksCard.tsx +++ b/src/pages/UsersPage/components/UserTasksCard.tsx @@ -5,8 +5,8 @@ import classNames from 'classnames'; import { useTranslation } from 'react-i18next'; import { useGetUserTasks } from '../api/useGetUserTasks'; -import Card, { CardProps } from 'components/Card/Card'; -import LoaderSkeleton from 'components/Loader/LoaderSkeleton'; +import Card, { CardProps } from 'common/components/Card/Card'; +import LoaderSkeleton from 'common/components/Loader/LoaderSkeleton'; /** * Properties for the `UserTasksCard` React component. diff --git a/src/pages/UsersPage/components/__tests__/UserDetail.test.tsx b/src/pages/UsersPage/components/__tests__/UserDetail.test.tsx index 5486a18..fa88de9 100644 --- a/src/pages/UsersPage/components/__tests__/UserDetail.test.tsx +++ b/src/pages/UsersPage/components/__tests__/UserDetail.test.tsx @@ -3,7 +3,7 @@ import { UseQueryResult } from '@tanstack/react-query'; import { AxiosError } from 'axios'; import { render, screen } from 'test/test-utils'; -import * as UseGetUser from 'api/useGetUser'; +import * as UseGetUser from 'common/api/useGetUser'; import UserDetail from '../UserDetail'; // mock select functions from react-router-dom diff --git a/src/pages/UsersPage/components/__tests__/UserDetailLayout.test.tsx b/src/pages/UsersPage/components/__tests__/UserDetailLayout.test.tsx index 5054043..e68b66c 100644 --- a/src/pages/UsersPage/components/__tests__/UserDetailLayout.test.tsx +++ b/src/pages/UsersPage/components/__tests__/UserDetailLayout.test.tsx @@ -3,7 +3,7 @@ import { UseQueryResult } from '@tanstack/react-query'; import { AxiosError } from 'axios'; import { render, screen } from 'test/test-utils'; -import * as UseGetUser from 'api/useGetUser'; +import * as UseGetUser from 'common/api/useGetUser'; import UserDetailLayout from '../UserDetailLayout'; // mock select functions from react-router-dom diff --git a/src/pages/UsersPage/components/__tests__/UserList.test.tsx b/src/pages/UsersPage/components/__tests__/UserList.test.tsx index 1ba68e2..ebe2a21 100644 --- a/src/pages/UsersPage/components/__tests__/UserList.test.tsx +++ b/src/pages/UsersPage/components/__tests__/UserList.test.tsx @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest'; import { render, screen } from 'test/test-utils'; -import * as UseGetUser from 'api/useGetUser'; +import * as UseGetUser from 'common/api/useGetUser'; import * as UseGetUsers from '../../api/useGetUsers'; import UserList from '../UserList'; import { UseQueryResult } from '@tanstack/react-query'; diff --git a/src/test/test-utils.tsx b/src/test/test-utils.tsx index 47cf2c9..4a3425f 100644 --- a/src/test/test-utils.tsx +++ b/src/test/test-utils.tsx @@ -7,7 +7,7 @@ import { RenderOptions, } from '@testing-library/react'; -import 'utils/i18n'; +import 'common/utils/i18n'; import WithAllProviders from './wrappers/WithAllProviders'; const customRender = (ui: React.ReactElement, options?: RenderOptions, { route = '/' } = {}) => { diff --git a/src/test/wrappers/AllProvidersExceptRouter.tsx b/src/test/wrappers/AllProvidersExceptRouter.tsx index 5d302c2..ae2a69b 100644 --- a/src/test/wrappers/AllProvidersExceptRouter.tsx +++ b/src/test/wrappers/AllProvidersExceptRouter.tsx @@ -1,10 +1,10 @@ import { PropsWithChildren } from 'react'; import { QueryClientProvider } from '@tanstack/react-query'; -import ConfigContextProvider from 'providers/ConfigProvider'; -import SettingsContextProvider from 'providers/SettingsProvider'; -import AuthContextProvider from 'providers/AuthProvider'; -import ToastsProvider from 'providers/ToastsProvider'; +import ConfigContextProvider from 'common/providers/ConfigProvider'; +import SettingsContextProvider from 'common/providers/SettingsProvider'; +import AuthContextProvider from 'common/providers/AuthProvider'; +import ToastsProvider from 'common/providers/ToastsProvider'; import { queryClient } from '../query-client'; diff --git a/src/test/wrappers/WithAllProviders.tsx b/src/test/wrappers/WithAllProviders.tsx index cdcdcdd..20b8461 100644 --- a/src/test/wrappers/WithAllProviders.tsx +++ b/src/test/wrappers/WithAllProviders.tsx @@ -2,10 +2,10 @@ import { PropsWithChildren } from 'react'; import { MemoryRouter } from 'react-router-dom'; import { QueryClientProvider } from '@tanstack/react-query'; -import ConfigContextProvider from 'providers/ConfigProvider'; -import SettingsContextProvider from 'providers/SettingsProvider'; -import AuthContextProvider from 'providers/AuthProvider'; -import ToastsProvider from 'providers/ToastsProvider'; +import ConfigContextProvider from 'common/providers/ConfigProvider'; +import SettingsContextProvider from 'common/providers/SettingsProvider'; +import AuthContextProvider from 'common/providers/AuthProvider'; +import ToastsProvider from 'common/providers/ToastsProvider'; import { queryClient } from '../query-client'; diff --git a/tsconfig.json b/tsconfig.json index 37849a7..d77bbfd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,14 +24,10 @@ "baseUrl": ".", "paths": { "__fixtures__/*": ["./src/__fixtures__/*"], - "api/*": ["./src/api/*"], "assets/*": ["./src/assets/*"], - "components/*": ["./src/components/*"], - "hooks/*": ["./src/hooks/*"], + "common/*": ["./src/common/*"], "pages/*": ["./src/pages/*"], - "providers/*": ["./src/providers/*"], - "test/*": ["./src/test/*"], - "utils/*": ["./src/utils/*"] + "test/*": ["./src/test/*"] } }, "include": ["src", "./vitest.setup.ts"], diff --git a/vite.config.ts b/vite.config.ts index 5b64b7c..d3498d2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,14 +9,10 @@ export default defineConfig({ resolve: { alias: { __fixtures__: '/src/__fixtures__', - api: '/src/api', assets: '/src/assets', - components: '/src/components', - hooks: '/src/hooks', + common: '/src/common', pages: '/src/pages', - providers: '/src/providers', test: '/src/test', - utils: '/src/utils', }, }, test: {