diff --git a/.gitignore b/.gitignore index 4476310c..13098df9 100644 --- a/.gitignore +++ b/.gitignore @@ -174,4 +174,6 @@ fabric.properties !.yarn/plugins !.yarn/releases !.yarn/sdks -!.yarn/versions \ No newline at end of file +!.yarn/versions + +*.code-workspace \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index d00a600f..5fcd5d82 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -11,10 +11,10 @@ "importOrderSeparation": true, "importOrderSortSpecifiers": true, "importOrder": [ - "react[^-/]", - "^next/(.*)$", - "@[^/](.*)$", - "@/(.*)$", + "", + "^@/components/(.*)$", + "^@/features/(.*)$", + "^@/(.*)$", "^[./]" ] } diff --git a/.storybook/main.ts b/.storybook/main.ts index 6da7a01e..3dacdba7 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,6 +1,5 @@ -import { dirname, join } from 'path'; - import type { StorybookConfig } from '@storybook/nextjs'; +import { dirname, join } from 'path'; /** * This function is used to resolve the absolute path of a package. diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f98aa715 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "editor.snippetSuggestions": "top", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } +} diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/index.ts b/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/index.ts deleted file mode 100644 index a6827c71..00000000 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AnimeListNavbar from './anime-list-navbar'; - -export default AnimeListNavbar; diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list/index.ts b/app/(pages)/(content)/anime/(animeList)/components/anime-list/index.ts deleted file mode 100644 index 49bf3c6a..00000000 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AnimeList from './anime-list'; - -export default AnimeList; diff --git a/app/(pages)/(content)/anime/(animeList)/layout.tsx b/app/(pages)/(content)/anime/(animeList)/layout.tsx index 002bfe12..62bc31b0 100644 --- a/app/(pages)/(content)/anime/(animeList)/layout.tsx +++ b/app/(pages)/(content)/anime/(animeList)/layout.tsx @@ -1,10 +1,10 @@ import { FC, ReactNode } from 'react'; -import Filters from '@/components/filters/anime-filters'; import Block from '@/components/ui/block'; import Card from '@/components/ui/card'; -import NavBar from './components/anime-list-navbar'; +import NavBar from '@/features/anime/anime-list-navbar/anime-list-navbar'; +import Filters from '@/features/filters/anime-filters'; interface Props { children: ReactNode; diff --git a/app/(pages)/(content)/anime/(animeList)/page.tsx b/app/(pages)/(content)/anime/(animeList)/page.tsx index 9daa684d..043b5653 100644 --- a/app/(pages)/(content)/anime/(animeList)/page.tsx +++ b/app/(pages)/(content)/anime/(animeList)/page.tsx @@ -1,8 +1,7 @@ -import { FC } from 'react'; - import { redirect } from 'next/navigation'; +import { FC } from 'react'; -import AnimeList from './components/anime-list'; +import AnimeList from '@/features/anime/anime-list/anime-list'; interface Props { searchParams: Record; diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/characters/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/characters/page.tsx index 919060ae..3ce5f877 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/characters/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/characters/page.tsx @@ -2,7 +2,7 @@ import { Metadata, ResolvingMetadata } from 'next'; import _generateMetadata from '@/utils/generateMetadata'; -import Characters from '../../components/characters/characters'; +import Characters from '../../../../../../../features/anime/anime-view/characters/characters'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/comments/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/comments/page.tsx index 3a711dca..0b88f1fe 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/comments/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/comments/page.tsx @@ -1,8 +1,8 @@ +import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; import { Metadata, ResolvingMetadata } from 'next'; -import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; +import Comments from '@/features/comments/comment-list/comment-list'; -import Comments from '@/components/comments/comments'; import getComments from '@/services/api/comments/getComments'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/franchise/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/franchise/page.tsx index af99027a..031e76b6 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/franchise/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/franchise/page.tsx @@ -2,7 +2,7 @@ import { Metadata, ResolvingMetadata } from 'next'; import _generateMetadata from '@/utils/generateMetadata'; -import Franchise from '../../components/franchise'; +import Franchise from '../../../../../../../features/anime/anime-view/franchise'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/links/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/links/page.tsx index c1b02e9c..19c7b0b8 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/links/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/links/page.tsx @@ -2,7 +2,7 @@ import { Metadata, ResolvingMetadata } from 'next'; import _generateMetadata from '@/utils/generateMetadata'; -import Links from '../../components/links'; +import Links from '../../../../../../../features/anime/anime-view/links'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/media/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/media/page.tsx index cc9a3e58..e3cec8f3 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/media/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/media/page.tsx @@ -2,7 +2,7 @@ import { Metadata, ResolvingMetadata } from 'next'; import _generateMetadata from '@/utils/generateMetadata'; -import Media from '../../components/media/media'; +import Media from '../../../../../../../features/anime/anime-view/media/media'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/anime/[slug]/(animeDetails)/staff/page.tsx b/app/(pages)/(content)/anime/[slug]/(animeDetails)/staff/page.tsx index 47795105..fd8e6520 100644 --- a/app/(pages)/(content)/anime/[slug]/(animeDetails)/staff/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/(animeDetails)/staff/page.tsx @@ -2,7 +2,7 @@ import { Metadata, ResolvingMetadata } from 'next'; import _generateMetadata from '@/utils/generateMetadata'; -import Staff from '../../components/staff'; +import Staff from '../../../../../../../features/anime/anime-view/staff'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/anime/[slug]/components/actions/index.ts b/app/(pages)/(content)/anime/[slug]/components/actions/index.ts deleted file mode 100644 index ed1a44a8..00000000 --- a/app/(pages)/(content)/anime/[slug]/components/actions/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Actions from './actions'; - -export default Actions; diff --git a/app/(pages)/(content)/anime/[slug]/layout.metadata.ts b/app/(pages)/(content)/anime/[slug]/layout.metadata.ts index 3f812012..772c746e 100644 --- a/app/(pages)/(content)/anime/[slug]/layout.metadata.ts +++ b/app/(pages)/(content)/anime/[slug]/layout.metadata.ts @@ -8,8 +8,8 @@ import parseTextFromMarkDown from '@/utils/parseTextFromMarkDown'; import truncateText from '@/utils/truncateText'; export interface MetadataProps { - params: { slug: string } - searchParams: { [key: string]: string | string[] | undefined } + params: { slug: string }; + searchParams: { [key: string]: string | string[] | undefined }; } export default async function generateMetadata({ diff --git a/app/(pages)/(content)/anime/[slug]/layout.tsx b/app/(pages)/(content)/anime/[slug]/layout.tsx index ef96624e..6e8d6363 100644 --- a/app/(pages)/(content)/anime/[slug]/layout.tsx +++ b/app/(pages)/(content)/anime/[slug]/layout.tsx @@ -1,23 +1,23 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; -import { FC, PropsWithChildren } from 'react'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; - -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import { FC, PropsWithChildren } from 'react'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import InternalNavBar from '@/components/navigation/nav-tabs'; import SubBar from '@/components/navigation/sub-nav'; + +import Actions from '@/features/anime/anime-view/actions/actions'; +import Cover from '@/features/anime/anime-view/cover'; +import Title from '@/features/anime/anime-view/title'; + import getAnimeInfo from '@/services/api/anime/getAnimeInfo'; import { ANIME_NAV_ROUTES, RELEASE_STATUS } from '@/utils/constants'; import getQueryClient from '@/utils/getQueryClient'; -import Actions from './components/actions'; -import Cover from './components/cover'; -import Title from './components/title'; import _generateMetadata, { MetadataProps } from './layout.metadata'; import prefetchQueries from './layout.queries'; diff --git a/app/(pages)/(content)/anime/[slug]/page.tsx b/app/(pages)/(content)/anime/[slug]/page.tsx index 355ac8d2..d5c80a6c 100644 --- a/app/(pages)/(content)/anime/[slug]/page.tsx +++ b/app/(pages)/(content)/anime/[slug]/page.tsx @@ -1,19 +1,20 @@ -import React, { FC } from 'react'; +import { FC } from 'react'; + +import Characters from '@/features/anime/anime-view/characters/characters'; +import Description from '@/features/anime/anime-view/description'; +import Details from '@/features/anime/anime-view/details/details'; +import Followings from '@/features/anime/anime-view/followings/followings'; +import Franchise from '@/features/anime/anime-view/franchise'; +import Links from '@/features/anime/anime-view/links'; +import Media from '@/features/anime/anime-view/media/media'; +import Staff from '@/features/anime/anime-view/staff'; +import WatchStats from '@/features/anime/anime-view/watch-stats/watch-stats'; import getAnimeInfo, { Response as AnimeResponse, } from '@/services/api/anime/getAnimeInfo'; import jsonSchema from './anime.schema'; -import Characters from './components/characters/characters'; -import Description from './components/description'; -import Details from './components/details/details'; -import Followings from './components/followings/followings'; -import Franchise from './components/franchise'; -import Links from './components/links'; -import Media from './components/media/media'; -import Staff from './components/staff'; -import WatchStats from './components/watch-stats/watch-stats'; interface Props { params: { diff --git a/app/(pages)/(content)/characters/[slug]/(characterDetails)/anime/page.tsx b/app/(pages)/(content)/characters/[slug]/(characterDetails)/anime/page.tsx index cd457e61..4143df8c 100644 --- a/app/(pages)/(content)/characters/[slug]/(characterDetails)/anime/page.tsx +++ b/app/(pages)/(content)/characters/[slug]/(characterDetails)/anime/page.tsx @@ -1,6 +1,6 @@ import { Metadata, ResolvingMetadata } from 'next'; -import Anime from '../../components/anime'; +import Anime from '../../../../../../../features/characters/character-view/anime'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/characters/[slug]/(characterDetails)/voices/page.tsx b/app/(pages)/(content)/characters/[slug]/(characterDetails)/voices/page.tsx index 0e047ae0..7b177f28 100644 --- a/app/(pages)/(content)/characters/[slug]/(characterDetails)/voices/page.tsx +++ b/app/(pages)/(content)/characters/[slug]/(characterDetails)/voices/page.tsx @@ -1,6 +1,6 @@ import { Metadata, ResolvingMetadata } from 'next'; -import Voices from '../../components/voices'; +import Voices from '../../../../../../../features/characters/character-view/voices'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/characters/[slug]/layout.tsx b/app/(pages)/(content)/characters/[slug]/layout.tsx index b930800e..c63569cf 100644 --- a/app/(pages)/(content)/characters/[slug]/layout.tsx +++ b/app/(pages)/(content)/characters/[slug]/layout.tsx @@ -1,22 +1,22 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata, ResolvingMetadata } from 'next'; -import { FC, PropsWithChildren } from 'react'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; - -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import { FC, PropsWithChildren } from 'react'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import InternalNavBar from '@/components/navigation/nav-tabs'; import SubBar from '@/components/navigation/sub-nav'; + +import Cover from '@/features/characters/character-view/cover'; +import Title from '@/features/characters/character-view/title'; + import getCharacterInfo from '@/services/api/characters/getCharacterInfo'; import { CHARACTER_NAV_ROUTES } from '@/utils/constants'; import getQueryClient from '@/utils/getQueryClient'; -import Cover from './components/cover'; -import Title from './components/title'; import _generateMetadata, { MetadataProps } from './layout.metadata'; import prefetchQueries from './layout.queries'; diff --git a/app/(pages)/(content)/characters/[slug]/page.tsx b/app/(pages)/(content)/characters/[slug]/page.tsx index 768faaa2..80bf251f 100644 --- a/app/(pages)/(content)/characters/[slug]/page.tsx +++ b/app/(pages)/(content)/characters/[slug]/page.tsx @@ -1,8 +1,6 @@ -import React from 'react'; - -import Anime from './components/anime'; -import Description from './components/description'; -import Voices from './components/voices'; +import Anime from '@/features/characters/character-view/anime'; +import Description from '@/features/characters/character-view/description'; +import Voices from '@/features/characters/character-view/voices'; const CharacterPage = () => { return ( diff --git a/app/(pages)/(content)/people/[slug]/(personDetails)/anime/page.tsx b/app/(pages)/(content)/people/[slug]/(personDetails)/anime/page.tsx index 3c1c6cca..fc3d014d 100644 --- a/app/(pages)/(content)/people/[slug]/(personDetails)/anime/page.tsx +++ b/app/(pages)/(content)/people/[slug]/(personDetails)/anime/page.tsx @@ -1,6 +1,6 @@ import { Metadata, ResolvingMetadata } from 'next'; -import Anime from '../../components/anime'; +import Anime from '../../../../../../../features/people/person-view/anime'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/people/[slug]/(personDetails)/characters/page.tsx b/app/(pages)/(content)/people/[slug]/(personDetails)/characters/page.tsx index 99a92b5f..08211ea9 100644 --- a/app/(pages)/(content)/people/[slug]/(personDetails)/characters/page.tsx +++ b/app/(pages)/(content)/people/[slug]/(personDetails)/characters/page.tsx @@ -1,6 +1,6 @@ import { Metadata, ResolvingMetadata } from 'next'; -import Characters from '@/app/(pages)/(content)/people/[slug]/components/characters'; +import Characters from '@/features/people/person-view/characters'; export async function generateMetadata( { params }: { params: { slug: string } }, diff --git a/app/(pages)/(content)/people/[slug]/layout.tsx b/app/(pages)/(content)/people/[slug]/layout.tsx index 62dcd008..bac7a8b7 100644 --- a/app/(pages)/(content)/people/[slug]/layout.tsx +++ b/app/(pages)/(content)/people/[slug]/layout.tsx @@ -1,22 +1,22 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata, ResolvingMetadata } from 'next'; -import { FC, PropsWithChildren } from 'react'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; - -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import { FC, PropsWithChildren } from 'react'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import InternalNavBar from '@/components/navigation/nav-tabs'; import SubBar from '@/components/navigation/sub-nav'; + +import Cover from '@/features/people/person-view/cover'; +import Title from '@/features/people/person-view/title'; + import getPersonInfo from '@/services/api/people/getPersonInfo'; import { PERSON_NAV_ROUTES } from '@/utils/constants'; import getQueryClient from '@/utils/getQueryClient'; -import Cover from './components/cover'; -import Title from './components/title'; import _generateMetadata, { MetadataProps } from './layout.metadata'; import prefetchQueries from './layout.queries'; diff --git a/app/(pages)/(content)/people/[slug]/page.tsx b/app/(pages)/(content)/people/[slug]/page.tsx index 65c7dc2e..4542980d 100644 --- a/app/(pages)/(content)/people/[slug]/page.tsx +++ b/app/(pages)/(content)/people/[slug]/page.tsx @@ -1,7 +1,5 @@ -import React from 'react'; - -import Anime from './components/anime'; -import Characters from './components/characters'; +import Anime from '@/features/people/person-view/anime'; +import Characters from '@/features/people/person-view/characters'; const PersonPage = () => { return ( diff --git a/app/(pages)/(root)/page.queries.ts b/app/(pages)/(home)/page.queries.ts similarity index 100% rename from app/(pages)/(root)/page.queries.ts rename to app/(pages)/(home)/page.queries.ts diff --git a/app/(pages)/(root)/page.tsx b/app/(pages)/(home)/page.tsx similarity index 78% rename from app/(pages)/(root)/page.tsx rename to app/(pages)/(home)/page.tsx index 4b7a9d5d..a2d36ee4 100644 --- a/app/(pages)/(root)/page.tsx +++ b/app/(pages)/(home)/page.tsx @@ -1,18 +1,19 @@ import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; -import Ongoings from '@/app/(pages)/(root)/components/ongoings'; -import prefetchQueries from '@/app/(pages)/(root)/page.queries'; import UserCover from '@/components/user-cover'; + +import Collections from '@/features/home/collections'; +import Comments from '@/features/home/comments'; +import History from '@/features/home/history'; +import Ongoings from '@/features/home/ongoings'; +import Profile from '@/features/home/profile'; +import Schedule from '@/features/home/schedule/schedule'; + +import prefetchQueries from '@/app/(pages)/(home)/page.queries'; import getLoggedUserInfo from '@/services/api/user/getLoggedUserInfo'; import getQueryClient from '@/utils/getQueryClient'; -import Collections from './components/collections'; -import Comments from './components/comments'; -import History from './components/history'; -import Profile from './components/profile'; -import Schedule from './components/schedule/schedule'; - const Page = async () => { const queryClient = await getQueryClient(); diff --git a/app/(pages)/(user)/u/[username]/components/collections/index.ts b/app/(pages)/(user)/u/[username]/components/collections/index.ts deleted file mode 100644 index 5ee6a035..00000000 --- a/app/(pages)/(user)/u/[username]/components/collections/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Collections from './collections'; - -export default Collections; diff --git a/app/(pages)/(user)/u/[username]/components/history/index.ts b/app/(pages)/(user)/u/[username]/components/history/index.ts deleted file mode 100644 index 272f54e9..00000000 --- a/app/(pages)/(user)/u/[username]/components/history/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import History from './history'; - -export default History; diff --git a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/index.ts b/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/index.ts deleted file mode 100644 index 5fd83dbb..00000000 --- a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ActivityStats from './activity-stats'; - -export default ActivityStats; diff --git a/app/(pages)/(user)/u/[username]/components/statistics/index.ts b/app/(pages)/(user)/u/[username]/components/statistics/index.ts deleted file mode 100644 index 9bbe382b..00000000 --- a/app/(pages)/(user)/u/[username]/components/statistics/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Statistics from './statistics'; - -export default Statistics; diff --git a/app/(pages)/(user)/u/[username]/favorites/page.tsx b/app/(pages)/(user)/u/[username]/favorites/page.tsx index 81e93c4f..8cf1d531 100644 --- a/app/(pages)/(user)/u/[username]/favorites/page.tsx +++ b/app/(pages)/(user)/u/[username]/favorites/page.tsx @@ -1,6 +1,7 @@ import { Metadata, ResolvingMetadata } from 'next'; -import Favorites from '@/app/(pages)/(user)/u/[username]/components/favorites/favorites'; +import Favorites from '@/features/users/user-profile/favorites/favorites'; + import _generateMetadata from '@/utils/generateMetadata'; export async function generateMetadata( diff --git a/app/(pages)/(user)/u/[username]/history/page.tsx b/app/(pages)/(user)/u/[username]/history/page.tsx index c9a9d716..fb3a4e8b 100644 --- a/app/(pages)/(user)/u/[username]/history/page.tsx +++ b/app/(pages)/(user)/u/[username]/history/page.tsx @@ -1,16 +1,15 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; import { FC } from 'react'; -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import History from '@/features/users/user-history/user-history'; import getFollowingHistory from '@/services/api/history/getFollowingHistory'; import { getCookie } from '@/utils/cookies'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; -import History from './components/history/history'; - export const metadata: Metadata = _generateMetadata({ title: 'Активність', }); diff --git a/app/(pages)/(user)/u/[username]/layout.tsx b/app/(pages)/(user)/u/[username]/layout.tsx index c5e78ea2..7863cdcf 100644 --- a/app/(pages)/(user)/u/[username]/layout.tsx +++ b/app/(pages)/(user)/u/[username]/layout.tsx @@ -1,26 +1,26 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata, ResolvingMetadata } from 'next'; -import React, { FC, PropsWithChildren } from 'react'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; - -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import { FC, PropsWithChildren } from 'react'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import InternalNavBar from '@/components/navigation/nav-tabs'; import SubBar from '@/components/navigation/sub-nav'; import UserCover from '@/components/user-cover'; + +import ActivationAlert from '@/features/users/user-profile/activation-alert'; +import FollowButton from '@/features/users/user-profile/follow-button'; +import FollowStats from '@/features/users/user-profile/follow-stats'; +import ListStats from '@/features/users/user-profile/list-stats'; +import UserInfo from '@/features/users/user-profile/user-info'; +import UserTitle from '@/features/users/user-profile/user-title'; + import { USER_NAV_ROUTES } from '@/utils/constants'; import getQueryClient from '@/utils/getQueryClient'; -import ActivationAlert from './components/activation-alert'; -import FollowButton from './components/follow-button'; -import FollowStats from './components/follow-stats'; -import ListStats from './components/list-stats'; -import UserInfo from './components/user-info'; -import UserTitle from './components/user-title'; import _generateMetadata, { MetadataProps } from './layout.metadata'; import prefetchQueries from './layout.queries'; diff --git a/app/(pages)/(user)/u/[username]/list/page.tsx b/app/(pages)/(user)/u/[username]/list/page.tsx index 244df83a..1d0ef499 100644 --- a/app/(pages)/(user)/u/[username]/list/page.tsx +++ b/app/(pages)/(user)/u/[username]/list/page.tsx @@ -1,14 +1,15 @@ import { Metadata, ResolvingMetadata } from 'next'; -import { FC } from 'react'; - import { redirect } from 'next/navigation'; +import { FC } from 'react'; -import List from '@/app/(pages)/(user)/u/[username]/list/components/list/list'; -import StatusCombobox from '@/app/(pages)/(user)/u/[username]/list/components/status-combobox'; -import ToolsCombobox from '@/app/(pages)/(user)/u/[username]/list/components/tools-combobox'; -import ViewCombobox from '@/app/(pages)/(user)/u/[username]/list/components/view-combobox'; -import Filters from '@/components/filters/anime-filters'; import Block from '@/components/ui/block'; + +import Filters from '@/features/filters/anime-filters'; +import StatusCombobox from '@/features/users/user-watchlist/status-combobox'; +import ToolsCombobox from '@/features/users/user-watchlist/tools-combobox'; +import ViewCombobox from '@/features/users/user-watchlist/view-combobox'; +import List from '@/features/users/user-watchlist/watchlist/watchlist'; + import _generateMetadata from '@/utils/generateMetadata'; export async function generateMetadata( diff --git a/app/(pages)/(user)/u/[username]/page.tsx b/app/(pages)/(user)/u/[username]/page.tsx index d23d95d9..9dc3380e 100644 --- a/app/(pages)/(user)/u/[username]/page.tsx +++ b/app/(pages)/(user)/u/[username]/page.tsx @@ -1,18 +1,17 @@ -import { FC } from 'react'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { FC } from 'react'; + +import Favorites from '@/features/users/user-profile/favorites/favorites'; +import History from '@/features/users/user-profile/history/history'; +import Collections from '@/features/users/user-profile/user-collections/user-collections'; +import Statistics from '@/features/users/user-profile/user-statistics/user-statistics'; import getFavouriteList from '@/services/api/favourite/getFavouriteList'; import getUserActivity from '@/services/api/user/getUserActivity'; import getUserHistory from '@/services/api/user/getUserHistory'; import getQueryClient from '@/utils/getQueryClient'; -import Collections from './components/collections'; -import Favorites from './components/favorites/favorites'; -import History from './components/history/history'; -import Statistics from './components/statistics'; - interface Props { params: { username: string; diff --git a/app/(pages)/collections/(collections)/page.tsx b/app/(pages)/collections/(collections)/page.tsx index e9bdd9b8..a26615a4 100644 --- a/app/(pages)/collections/(collections)/page.tsx +++ b/app/(pages)/collections/(collections)/page.tsx @@ -1,25 +1,24 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; -import { FC } from 'react'; -import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; - -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; +import { FC } from 'react'; +import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; import PagePagination from '@/components/page-pagination'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; + +import CollectionList from '@/features/collections/collection-list/collection-list'; +import CollectionSort from '@/features/collections/collection-list/collection-sort'; + import getCollections from '@/services/api/collections/getCollections'; import { getCookie } from '@/utils/cookies'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; -import CollectionList from './components/collection-list'; -import CollectionSort from './components/collection-sort'; - export async function generateMetadata(): Promise { return _generateMetadata({ title: { diff --git a/app/(pages)/collections/[reference]/page.tsx b/app/(pages)/collections/[reference]/page.tsx index e8270f5d..1c4637c7 100644 --- a/app/(pages)/collections/[reference]/page.tsx +++ b/app/(pages)/collections/[reference]/page.tsx @@ -1,16 +1,16 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; - -import CollectionGroups from '@/app/(pages)/collections/[reference]/components/collection-groups'; -import CollectionInfo from '@/app/(pages)/collections/[reference]/components/collection-info/collection-info'; -import CollectionTitle from '@/app/(pages)/collections/[reference]/components/collection-title'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import Block from '@/components/ui/block'; + +import CollectionGroups from '@/features/collections/collection-view/collection-groups/collection-groups'; +import CollectionInfo from '@/features/collections/collection-view/collection-info/collection-info'; +import CollectionTitle from '@/features/collections/collection-view/collection-title'; + import getCollection from '@/services/api/collections/getCollection'; import CollectionProvider from '@/services/providers/collection-provider'; import _generateMetadata from '@/utils/generateMetadata'; diff --git a/app/(pages)/collections/[reference]/update/page.tsx b/app/(pages)/collections/[reference]/update/page.tsx index b2835cb6..e11af999 100644 --- a/app/(pages)/collections/[reference]/update/page.tsx +++ b/app/(pages)/collections/[reference]/update/page.tsx @@ -1,10 +1,10 @@ -import React from 'react'; - -import CollectionGroups from '@/app/(pages)/collections/new/components/collection-groups'; -import CollectionSettings from '@/app/(pages)/collections/new/components/collection-settings'; -import CollectionTitle from '@/app/(pages)/collections/new/components/collection-title'; import Block from '@/components/ui/block'; import Card from '@/components/ui/card'; + +import CollectionGroups from '@/features/collections/collection-edit/collection-groups'; +import CollectionSettings from '@/features/collections/collection-edit/collection-settings/collection-settings'; +import CollectionTitle from '@/features/collections/collection-edit/collection-title'; + import CollectionProvider from '@/services/providers/collection-provider'; const CollectionUpdatePage = () => { diff --git a/app/(pages)/collections/new/components/collection-grid/index.ts b/app/(pages)/collections/new/components/collection-grid/index.ts deleted file mode 100644 index 1efd3577..00000000 --- a/app/(pages)/collections/new/components/collection-grid/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import CollectionGrid from './collection-grid'; - -export default CollectionGrid; diff --git a/app/(pages)/collections/new/components/collection-settings/index.ts b/app/(pages)/collections/new/components/collection-settings/index.ts deleted file mode 100644 index 59206af5..00000000 --- a/app/(pages)/collections/new/components/collection-settings/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import CollectionSettings from './collection-settings'; - -export default CollectionSettings; diff --git a/app/(pages)/collections/new/page.tsx b/app/(pages)/collections/new/page.tsx index a1a4bbb6..ec11f67c 100644 --- a/app/(pages)/collections/new/page.tsx +++ b/app/(pages)/collections/new/page.tsx @@ -1,13 +1,14 @@ import { Metadata } from 'next'; -import React from 'react'; -import CollectionGroups from '@/app/(pages)/collections/new/components/collection-groups'; -import CollectionSettings from '@/app/(pages)/collections/new/components/collection-settings'; -import CollectionTitle from '@/app/(pages)/collections/new/components/collection-title'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import Block from '@/components/ui/block'; import Card from '@/components/ui/card'; import { Label } from '@/components/ui/label'; + +import CollectionGroups from '@/features/collections/collection-edit/collection-groups'; +import CollectionSettings from '@/features/collections/collection-edit/collection-settings/collection-settings'; +import CollectionTitle from '@/features/collections/collection-edit/collection-title'; + import CollectionProvider from '@/services/providers/collection-provider'; import _generateMetadata from '@/utils/generateMetadata'; diff --git a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx b/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx index e6f2fa97..61b8332e 100644 --- a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx +++ b/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx @@ -1,19 +1,18 @@ +import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; import { Metadata } from 'next'; -import { FC } from 'react'; - import { redirect } from 'next/navigation'; +import { FC } from 'react'; -import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; +import Comments from '@/features/comments/comment-list/comment-list'; -import Comments from '@/components/comments'; import getCommentThread from '@/services/api/comments/getCommentThread'; import getComments from '@/services/api/comments/getComments'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; -import Content from './components/content'; -import ContentHeader from './components/content-header'; -import { getContent } from './components/useContent'; +import Content from '../../../../../../features/comments/comment-content'; +import ContentHeader from '../../../../../../features/comments/comment-content-header'; +import { getContent } from '../../../../../../features/comments/useContent'; export async function generateMetadata(): Promise { return _generateMetadata({ diff --git a/app/(pages)/comments/latest/page.tsx b/app/(pages)/comments/latest/page.tsx index 6f9a1133..27413d78 100644 --- a/app/(pages)/comments/latest/page.tsx +++ b/app/(pages)/comments/latest/page.tsx @@ -1,14 +1,13 @@ -import { Metadata } from 'next'; -import { FC } from 'react'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { Metadata } from 'next'; +import { FC } from 'react'; import getGlobalComments from '@/services/api/comments/getGlobalComments'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; -import Comments from './components/comments'; +import Comments from '../../../../features/comments/latest-comments'; export const metadata: Metadata = _generateMetadata({ title: 'Останні коментарі', diff --git a/app/(pages)/components/navbar/components/notifications-menu/index.ts b/app/(pages)/components/navbar/components/notifications-menu/index.ts deleted file mode 100644 index 9152a00c..00000000 --- a/app/(pages)/components/navbar/components/notifications-menu/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import NotificationsMenu from './notifications-menu'; - -export default NotificationsMenu; diff --git a/app/(pages)/edit/[editId]/layout.tsx b/app/(pages)/edit/[editId]/layout.tsx index 0cf3a876..7e512a4b 100644 --- a/app/(pages)/edit/[editId]/layout.tsx +++ b/app/(pages)/edit/[editId]/layout.tsx @@ -1,22 +1,22 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; import { redirect } from 'next/navigation'; +import * as React from 'react'; +import { FC } from 'react'; -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; - -import Author from '@/app/(pages)/edit/[editId]/components/author'; -import Moderator from '@/app/(pages)/edit/[editId]/components/moderator'; -import Content from '@/app/(pages)/edit/components/content/content'; -import EditStatus from '@/app/(pages)/edit/components/ui/edit-status'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import Block from '@/components/ui/block'; import Card from '@/components/ui/card'; import Header from '@/components/ui/header'; + +import Author from '@/features/edit/edit-author'; +import Content from '@/features/edit/edit-content/edit-content'; +import EditStatus from '@/features/edit/edit-forms/edit-status'; +import Moderator from '@/features/edit/edit-moderator'; + import getComments from '@/services/api/comments/getComments'; import getEdit from '@/services/api/edit/getEdit'; import { EDIT_NAV_ROUTES } from '@/utils/constants'; diff --git a/app/(pages)/edit/[editId]/page.tsx b/app/(pages)/edit/[editId]/page.tsx index c6a98671..c0523bde 100644 --- a/app/(pages)/edit/[editId]/page.tsx +++ b/app/(pages)/edit/[editId]/page.tsx @@ -1,9 +1,8 @@ -import * as React from 'react'; import { FC } from 'react'; -import Actions from '@/app/(pages)/edit/[editId]/components/actions/actions'; -import EditView from '@/app/(pages)/edit/components/edit-view'; -import Comments from '@/components/comments/comments'; +import Comments from '@/features/comments/comment-list/comment-list'; +import Actions from '@/features/edit/edit-actions/edit-actions'; +import EditView from '@/features/edit/edit-forms/edit-view-form'; interface Props { params: { editId: string }; diff --git a/app/(pages)/edit/[editId]/update/page.tsx b/app/(pages)/edit/[editId]/update/page.tsx index 942be593..1131b51e 100644 --- a/app/(pages)/edit/[editId]/update/page.tsx +++ b/app/(pages)/edit/[editId]/update/page.tsx @@ -1,7 +1,6 @@ -import * as React from 'react'; import { FC } from 'react'; -import EditView from '@/app/(pages)/edit/components/edit-view'; +import EditView from '@/features/edit/edit-forms/edit-view-form'; interface Props { params: { editId: string }; diff --git a/app/(pages)/edit/components/content/index.ts b/app/(pages)/edit/components/content/index.ts deleted file mode 100644 index 395ae0da..00000000 --- a/app/(pages)/edit/components/content/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Content from './content'; - -export default Content; diff --git a/app/(pages)/edit/components/edit-description/index.ts b/app/(pages)/edit/components/edit-description/index.ts deleted file mode 100644 index c744cf31..00000000 --- a/app/(pages)/edit/components/edit-description/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import EditDescription from './edit-description'; - -export default EditDescription; diff --git a/app/(pages)/edit/content/page.tsx b/app/(pages)/edit/content/page.tsx index bf429936..493ef93f 100644 --- a/app/(pages)/edit/content/page.tsx +++ b/app/(pages)/edit/content/page.tsx @@ -1,17 +1,16 @@ -import { Metadata } from 'next'; -import * as React from 'react'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { Metadata } from 'next'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; + +import ContentList from '@/features/edit/edit-content-list'; + import { EDIT_NAV_ROUTES } from '@/utils/constants'; import _generateMetadata from '@/utils/generateMetadata'; import getQueryClient from '@/utils/getQueryClient'; -import ContentList from './components/content-list'; - export async function generateMetadata(): Promise { return _generateMetadata({ title: `Контент`, diff --git a/app/(pages)/edit/layout.tsx b/app/(pages)/edit/layout.tsx index 0ffb7639..ebb1a0e8 100644 --- a/app/(pages)/edit/layout.tsx +++ b/app/(pages)/edit/layout.tsx @@ -3,6 +3,7 @@ import React, { FC, PropsWithChildren } from 'react'; import InternalNavBar from '@/components/navigation/nav-tabs'; import SubBar from '@/components/navigation/sub-nav'; + import { EDIT_NAV_ROUTES } from '@/utils/constants'; import _generateMetadata from '@/utils/generateMetadata'; diff --git a/app/(pages)/edit/new/page.tsx b/app/(pages)/edit/new/page.tsx index 6463f7bc..efac0356 100644 --- a/app/(pages)/edit/new/page.tsx +++ b/app/(pages)/edit/new/page.tsx @@ -1,15 +1,15 @@ -import { FC } from 'react'; - -import { redirect } from 'next/navigation'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { redirect } from 'next/navigation'; +import { FC } from 'react'; -import Content from '@/app/(pages)/edit/components/content/content'; -import EditForm from '@/app/(pages)/edit/components/edit-form'; -import RulesAlert from '@/app/(pages)/edit/new/components/rules-alert'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; + +import Content from '@/features/edit/edit-content/edit-content'; +import EditForm from '@/features/edit/edit-forms/edit-create-form'; +import RulesAlert from '@/features/edit/edit-rules-alert'; + import getAnimeInfo from '@/services/api/anime/getAnimeInfo'; import getCharacterInfo from '@/services/api/characters/getCharacterInfo'; import getPersonInfo from '@/services/api/people/getPersonInfo'; diff --git a/app/(pages)/edit/page.tsx b/app/(pages)/edit/page.tsx index 69ac4f36..11f99de1 100644 --- a/app/(pages)/edit/page.tsx +++ b/app/(pages)/edit/page.tsx @@ -1,26 +1,25 @@ -import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; - -import { redirect } from 'next/navigation'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { redirect } from 'next/navigation'; +import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; -import EditList from '@/app/(pages)/edit/components/edit-list/edit-list'; -import EditTopStats from '@/app/(pages)/edit/components/edit-top-stats/edit-top-stats'; -import EditFiltersModal from '@/components/modals/edit-filters-modal'; import Breadcrumbs from '@/components/navigation/nav-breadcrumbs'; import NavMenu from '@/components/navigation/nav-dropdown'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Card from '@/components/ui/card'; import Header from '@/components/ui/header'; + +import EditList from '@/features/edit/edit-list/edit-list'; +import EditTopStats from '@/features/edit/edit-top-stats/edit-top-stats'; +import Filters from '@/features/filters/edit-filters'; +import EditFiltersModal from '@/features/modals/edit-filters-modal'; + import getEditList from '@/services/api/edit/getEditList'; import getEditTop from '@/services/api/stats/edit/getEditTop'; import { EDIT_NAV_ROUTES } from '@/utils/constants'; import getQueryClient from '@/utils/getQueryClient'; -import Filters from '../../../components/filters/edit-filters'; - const EditListPage = async ({ searchParams: { page, content_type, order, sort, edit_status }, }: { diff --git a/app/(pages)/layout.tsx b/app/(pages)/layout.tsx index f431f4bf..035b8a5a 100644 --- a/app/(pages)/layout.tsx +++ b/app/(pages)/layout.tsx @@ -1,10 +1,10 @@ -import React, { FC, ReactNode, Suspense } from 'react'; +import { FC, ReactNode, Suspense } from 'react'; -import Footer from './components/footer'; -import ModalManager from './components/modal-manager'; -import NavBar from './components/navbar/navbar'; -import ScrollTop from './components/scroll-top'; -import SessionManager from './components/session-manager'; +import Footer from '@/features/common/footer'; +import ModalManager from '@/features/common/modal-manager'; +import NavBar from '@/features/common/navbar/navbar'; +import ScrollTop from '@/features/common/scroll-top'; +import SessionManager from '@/features/common/session-manager'; interface Props { children: ReactNode; diff --git a/app/(pages)/schedule/page.tsx b/app/(pages)/schedule/page.tsx index 70c38d80..d6661cae 100644 --- a/app/(pages)/schedule/page.tsx +++ b/app/(pages)/schedule/page.tsx @@ -1,23 +1,23 @@ +import { dehydrate } from '@tanstack/query-core'; +import { HydrationBoundary } from '@tanstack/react-query'; import { Metadata } from 'next'; import { FC } from 'react'; import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; -import { dehydrate } from '@tanstack/query-core'; -import { HydrationBoundary } from '@tanstack/react-query'; - -import ScheduleFiltersModal from '@/components/modals/schedule-filters-modal'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Card from '@/components/ui/card'; import Header from '@/components/ui/header'; + +import ScheduleFilters from '@/features/filters/schedule-filters'; +import ScheduleFiltersModal from '@/features/modals/schedule-filters-modal'; +import ScheduleList from '@/features/schedule/schedule-list/schedule-list'; + import getAnimeSchedule from '@/services/api/stats/getAnimeSchedule'; import _generateMetadata from '@/utils/generateMetadata'; import getCurrentSeason from '@/utils/getCurrentSeason'; import getQueryClient from '@/utils/getQueryClient'; -import ScheduleFilters from '../../../components/filters/schedule-filters'; -import ScheduleList from './components/schedule-list'; - export const metadata: Metadata = _generateMetadata({ title: { template: 'Календар / %s / Hikka', diff --git a/app/layout.tsx b/app/layout.tsx index 9f019091..6818e762 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,14 +1,14 @@ +import '@mdxeditor/editor/style.css'; import { Metadata, Viewport } from 'next'; import PlausibleProvider from 'next-plausible'; -import { ReactNode } from 'react'; - import { Inter } from 'next/font/google'; import localFont from 'next/font/local'; +import { ReactNode } from 'react'; -import '@mdxeditor/editor/style.css'; - -import Providers from '@/app/(pages)/components/providers'; import { TailwindIndicator } from '@/components/tailwind-indicator'; + +import Providers from '@/features/common/providers'; + import generateMetadata from '@/utils/generateMetadata'; import './globals.css'; diff --git a/app/not-found.tsx b/app/not-found.tsx index aa342ac2..6ef5a81c 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -1,6 +1,5 @@ -import React from 'react'; - import Link from 'next/link'; +import React from 'react'; import H1 from '@/components/typography/h1'; import P from '@/components/typography/p'; diff --git a/app/sitemap.ts b/app/sitemap.ts index a1a0ccef..c8d8dc20 100644 --- a/app/sitemap.ts +++ b/app/sitemap.ts @@ -3,7 +3,7 @@ import { MetadataRoute } from 'next'; import getAnimeSitemap from '@/services/api/sitemap/getAnimeSitemap'; -export const dynamic = "force-dynamic"; +export const dynamic = 'force-dynamic'; export default async function sitemap(): Promise { const res = await getAnimeSitemap(); diff --git a/app/(pages)/(content)/components/anime-card.tsx b/components/anime-card.tsx similarity index 99% rename from app/(pages)/(content)/components/anime-card.tsx rename to components/anime-card.tsx index 233f271f..36cb26d1 100644 --- a/app/(pages)/(content)/components/anime-card.tsx +++ b/components/anime-card.tsx @@ -3,6 +3,7 @@ import { FC } from 'react'; import ContentCard, { Props as ContentCardProps, } from '@/components/content-card/content-card'; + import { MEDIA_TYPE } from '@/utils/constants'; interface Props extends ContentCardProps { diff --git a/app/(pages)/(content)/components/character-anime-card.tsx b/components/character-anime-card.tsx similarity index 100% rename from app/(pages)/(content)/components/character-anime-card.tsx rename to components/character-anime-card.tsx diff --git a/app/(pages)/(content)/components/character-card.tsx b/components/character-card.tsx similarity index 100% rename from app/(pages)/(content)/components/character-card.tsx rename to components/character-card.tsx diff --git a/components/comments-button.tsx b/components/comments-button.tsx index 1b3bab0e..97bd7c58 100644 --- a/components/comments-button.tsx +++ b/components/comments-button.tsx @@ -1,13 +1,12 @@ 'use client'; +import Link from 'next/link'; import React, { FC } from 'react'; import IconamoonCommentFill from '~icons/iconamoon/comment-fill'; -import Link from 'next/link'; - import { Button } from '@/components/ui/button'; -import getDeclensionWord from '@/utils/getDeclensionWord'; +import getDeclensionWord from '@/utils/getDeclensionWord'; const COMMENT_DECLENSIONS: [string, string, string] = [ 'коментар', diff --git a/components/comments/index.ts b/components/comments/index.ts deleted file mode 100644 index bf7c36d4..00000000 --- a/components/comments/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Comments from './comments'; - -export default Comments; diff --git a/components/content-card/components/anime-tooltip.tsx b/components/content-card/anime-tooltip.tsx similarity index 100% rename from components/content-card/components/anime-tooltip.tsx rename to components/content-card/anime-tooltip.tsx index 2f863171..7f426a47 100644 --- a/components/content-card/components/anime-tooltip.tsx +++ b/components/content-card/anime-tooltip.tsx @@ -1,8 +1,7 @@ 'use client'; -import { FC, PropsWithChildren, memo } from 'react'; - import Link from 'next/link'; +import { FC, PropsWithChildren, memo } from 'react'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import H5 from '@/components/typography/h5'; @@ -16,6 +15,7 @@ import { } from '@/components/ui/hover-card'; import { Label } from '@/components/ui/label'; import WatchListButton from '@/components/watchlist-button/watchlist-button'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useSession from '@/services/hooks/auth/useSession'; import { MEDIA_TYPE, RELEASE_STATUS } from '@/utils/constants'; diff --git a/components/content-card/components/character-tooltip.tsx b/components/content-card/character-tooltip.tsx similarity index 99% rename from components/content-card/components/character-tooltip.tsx rename to components/content-card/character-tooltip.tsx index f81d9e12..37b18d4d 100644 --- a/components/content-card/components/character-tooltip.tsx +++ b/components/content-card/character-tooltip.tsx @@ -12,6 +12,7 @@ import { HoverCardTrigger, } from '@/components/ui/hover-card'; import { Label } from '@/components/ui/label'; + import useSession from '@/services/hooks/auth/useSession'; import useCharacterAnime from '@/services/hooks/characters/useCharacterAnime'; import useCharacterInfo from '@/services/hooks/characters/useCharacterInfo'; diff --git a/components/content-card/content-card.tsx b/components/content-card/content-card.tsx index 90b52499..b658680b 100644 --- a/components/content-card/content-card.tsx +++ b/components/content-card/content-card.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import Link from 'next/link'; import { FC, Fragment, @@ -10,18 +10,17 @@ import { import { UrlObject } from 'url'; import MaterialSymbolsImageNotSupportedOutlineRounded from '~icons/material-symbols/image-not-supported-outline-rounded'; -import Link from 'next/link'; - -import AnimeTooltip from '@/components/content-card/components/anime-tooltip'; -import CharacterTooltip from '@/components/content-card/components/character-tooltip'; +import AnimeTooltip from '@/components/content-card/anime-tooltip'; +import CharacterTooltip from '@/components/content-card/character-tooltip'; import P from '@/components/typography/p'; import Image from '@/components/ui/image'; import { Label } from '@/components/ui/label'; + import { cn } from '@/utils/utils'; import { AspectRatio } from '../ui/aspect-ratio'; -import ContextMenuOverlay from './components/context-menu-overlay'; -import WatchStatus from './components/watch-status'; +import ContextMenuOverlay from './context-menu-overlay'; +import WatchStatus from './watch-status'; export interface Props { target?: string; diff --git a/components/content-card/components/context-menu-overlay.tsx b/components/content-card/context-menu-overlay.tsx similarity index 100% rename from components/content-card/components/context-menu-overlay.tsx rename to components/content-card/context-menu-overlay.tsx index 61ddbca7..875638aa 100644 --- a/components/content-card/components/context-menu-overlay.tsx +++ b/components/content-card/context-menu-overlay.tsx @@ -1,15 +1,15 @@ +import Link from 'next/link'; import * as React from 'react'; import { FC, ReactNode } from 'react'; import MaterialSymbolsEditRounded from '~icons/material-symbols/edit-rounded'; -import Link from 'next/link'; - import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuTrigger, } from '@/components/ui/context-menu'; + import useSession from '@/services/hooks/auth/useSession'; interface Props { diff --git a/components/content-card/components/watch-status.tsx b/components/content-card/watch-status.tsx similarity index 100% rename from components/content-card/components/watch-status.tsx rename to components/content-card/watch-status.tsx diff --git a/app/(pages)/(content)/components/edit-button.tsx b/components/edit-button.tsx similarity index 93% rename from app/(pages)/(content)/components/edit-button.tsx rename to components/edit-button.tsx index 9c1ddaec..21720a27 100644 --- a/app/(pages)/(content)/components/edit-button.tsx +++ b/components/edit-button.tsx @@ -2,8 +2,10 @@ import clsx from 'clsx'; import { FC } from 'react'; import MaterialSymbolsEditRounded from '~icons/material-symbols/edit-rounded'; -import EditListModal from '@/components/modals/editlist-modal'; import { Button } from '@/components/ui/button'; + +import EditListModal from '@/features/modals/editlist-modal/editlist-modal'; + import { useModalContext } from '@/services/providers/modal-provider'; interface Props { diff --git a/components/favorite-button.tsx b/components/favorite-button.tsx index 6c3c9683..2bcbae23 100644 --- a/components/favorite-button.tsx +++ b/components/favorite-button.tsx @@ -9,6 +9,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import useAddFavorite from '@/services/hooks/favorite/useAddFavorite'; import useDeleteFavorite from '@/services/hooks/favorite/useDeleteFavorite'; import useFavorite from '@/services/hooks/favorite/useFavorite'; diff --git a/components/form/form-markdown.tsx b/components/form/form-markdown.tsx index 0ad12c08..f86bc35e 100644 --- a/components/form/form-markdown.tsx +++ b/components/form/form-markdown.tsx @@ -1,6 +1,5 @@ -import React, { forwardRef } from 'react'; - import { MDXEditorMethods, MDXEditorProps } from '@mdxeditor/editor'; +import React, { forwardRef } from 'react'; import MDEditor from '@/components/markdown/editor/MD-editor'; import { @@ -11,6 +10,7 @@ import { FormLabel, FormMessage, } from '@/components/ui/form'; + import { cn } from '@/utils/utils'; interface Props extends Omit { diff --git a/components/history-item.tsx b/components/history-item.tsx index 1c6daa61..5351e3bd 100644 --- a/components/history-item.tsx +++ b/components/history-item.tsx @@ -1,9 +1,8 @@ +import Link from 'next/link'; import * as React from 'react'; import { FC, Fragment, memo } from 'react'; import MaterialSymbolsInfoRounded from '~icons/material-symbols/info-rounded'; -import Link from 'next/link'; - import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import HorizontalCard from '@/components/ui/horizontal-card'; import { @@ -11,6 +10,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import { convertActivity } from '@/utils/convertActivity'; interface Props { @@ -58,7 +58,7 @@ const User: FC = memo(({ data }) => ( const HistoryItem: FC = (props) => { const { data, withUser, className } = props; - + return ( { +const Component = ({ + children, + className, + disableSpoiler, + ...props +}: Props) => { return ( { ], ]} components={{ - spoiler: Spoiler, + spoiler: disableSpoiler ? NoSpoiler : Spoiler, a: ({ node, children }) => ( > = ({ children, href, className }) => { ); } - } - if (href.includes("/characters")) { + } + if (href.includes('/characters')) { const link = href.split('/characters/')[1]?.split('/')[0]; if (link) { diff --git a/components/markdown/viewer/components/no-spoiler.tsx b/components/markdown/viewer/components/no-spoiler.tsx new file mode 100644 index 00000000..6e1757fd --- /dev/null +++ b/components/markdown/viewer/components/no-spoiler.tsx @@ -0,0 +1,15 @@ +import { ReactNode } from 'react'; + +interface Props { + children: ReactNode; +} + +const NoSpoiler = ({ children }: Props) => { + return ( +
+ {children} +
+ ); +}; + +export default NoSpoiler; diff --git a/components/modals/auth-modal/index.ts b/components/modals/auth-modal/index.ts deleted file mode 100644 index 7184e47f..00000000 --- a/components/modals/auth-modal/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import AuthModal from './auth-modal'; - -export default AuthModal; diff --git a/components/modals/editlist-modal/index.ts b/components/modals/editlist-modal/index.ts deleted file mode 100644 index be3ae3de..00000000 --- a/components/modals/editlist-modal/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import EditlistModal from './editlist-modal'; - -export default EditlistModal; diff --git a/components/modals/search-modal/components/ui/search-placeholders.tsx b/components/modals/search-modal/components/ui/search-placeholders.tsx deleted file mode 100644 index dc6fb752..00000000 --- a/components/modals/search-modal/components/ui/search-placeholders.tsx +++ /dev/null @@ -1,36 +0,0 @@ -'use client'; - -import * as React from 'react'; -import { memo } from 'react'; - -interface Props { - data?: API.WithPagination | Array; - isFetching: boolean; - isRefetching: boolean; -} - -const SearchPlaceholders = ({ data, isFetching, isRefetching }: Props) => { - return ( - <> - {data && ( - (Array.isArray(data) ? data.length === 0 : data.list.length === 0) && ( -

- За Вашим запитом нічого не знайдено -

- ) - )} - {isFetching && !isRefetching && ( -
- -
- )} - {!data && !isFetching && ( -

- Введіть назву, щоб розпочати пошук... -

- )} - - ); -}; - -export default memo(SearchPlaceholders); diff --git a/components/modals/search-modal/index.ts b/components/modals/search-modal/index.ts deleted file mode 100644 index 308faa78..00000000 --- a/components/modals/search-modal/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import SearchModal from './search-modal'; - -export default SearchModal; diff --git a/components/modals/user-settings-modal/components/watchlist-form/index.ts b/components/modals/user-settings-modal/components/watchlist-form/index.ts deleted file mode 100644 index 599fedc8..00000000 --- a/components/modals/user-settings-modal/components/watchlist-form/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import WatchlistForm from './watchlist-form'; - -export default WatchlistForm; diff --git a/components/modals/user-settings-modal/index.ts b/components/modals/user-settings-modal/index.ts deleted file mode 100644 index 593a7bd5..00000000 --- a/components/modals/user-settings-modal/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import UserSettingsModal from './user-settings-modal'; - -export default UserSettingsModal; diff --git a/components/navigation/nav-dropdown.tsx b/components/navigation/nav-dropdown.tsx index e69c9197..a8dad139 100644 --- a/components/navigation/nav-dropdown.tsx +++ b/components/navigation/nav-dropdown.tsx @@ -1,9 +1,8 @@ 'use client'; -import { createElement, memo } from 'react'; - import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import { createElement, memo } from 'react'; import P from '@/components/typography/p'; import { @@ -14,6 +13,7 @@ import { NavigationMenuList, NavigationMenuTrigger, } from '@/components/ui/navigation-menu'; + import { useMediaQuery } from '@/services/hooks/useMediaQuery'; interface Props { diff --git a/components/navigation/nav-tabs.tsx b/components/navigation/nav-tabs.tsx index d7ea6156..cd171402 100644 --- a/components/navigation/nav-tabs.tsx +++ b/components/navigation/nav-tabs.tsx @@ -1,9 +1,8 @@ 'use client'; -import { createElement } from 'react'; - import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import { createElement } from 'react'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; diff --git a/components/page-pagination.tsx b/components/page-pagination.tsx index cee0ea24..c047d26d 100644 --- a/components/page-pagination.tsx +++ b/components/page-pagination.tsx @@ -1,10 +1,10 @@ 'use client'; -import * as React from 'react'; - import { usePathname, useRouter, useSearchParams } from 'next/navigation'; +import * as React from 'react'; import Pagination from '@/components/ui/pagination'; + import createQueryString from '@/utils/createQueryString'; interface Props { diff --git a/app/(pages)/(content)/components/person-card.tsx b/components/person-card.tsx similarity index 100% rename from app/(pages)/(content)/components/person-card.tsx rename to components/person-card.tsx diff --git a/components/text-expand.tsx b/components/text-expand.tsx index 69aa937f..05faa427 100644 --- a/components/text-expand.tsx +++ b/components/text-expand.tsx @@ -7,6 +7,7 @@ import React, { } from 'react'; import { Button } from '@/components/ui/button'; + import { cn } from '@/utils/utils'; const TextExpand = ({ children }: PropsWithChildren) => { diff --git a/components/ui/alert-dialog.tsx b/components/ui/alert-dialog.tsx index 2fb8f06c..cf2cbf26 100644 --- a/components/ui/alert-dialog.tsx +++ b/components/ui/alert-dialog.tsx @@ -1,10 +1,10 @@ 'use client'; -import * as React from 'react'; - import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'; +import * as React from 'react'; import { buttonVariants } from '@/components/ui/button'; + import { cn } from '@/utils/utils'; const AlertDialog = AlertDialogPrimitive.Root; diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx index 72b92875..c32073a6 100644 --- a/components/ui/avatar.tsx +++ b/components/ui/avatar.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as AvatarPrimitive from '@radix-ui/react-avatar'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/button.tsx b/components/ui/button.tsx index 04a7e855..de6ba0af 100644 --- a/components/ui/button.tsx +++ b/components/ui/button.tsx @@ -1,8 +1,7 @@ +import { Slot } from '@radix-ui/react-slot'; import { type VariantProps, cva } from 'class-variance-authority'; import * as React from 'react'; -import { Slot } from '@radix-ui/react-slot'; - import { cn } from '@/utils/utils'; const buttonVariants = cva( diff --git a/components/ui/carousel.tsx b/components/ui/carousel.tsx index 72880ed1..64c2eff1 100644 --- a/components/ui/carousel.tsx +++ b/components/ui/carousel.tsx @@ -7,6 +7,7 @@ import { ArrowLeft, ArrowRight } from 'lucide-react'; import * as React from 'react'; import { Button } from '@/components/ui/button'; + import { cn } from '@/utils/utils'; type CarouselApi = UseEmblaCarouselType[1]; diff --git a/components/ui/checkbox.tsx b/components/ui/checkbox.tsx index 04528f97..e1cdf209 100644 --- a/components/ui/checkbox.tsx +++ b/components/ui/checkbox.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; import { Check } from 'lucide-react'; import * as React from 'react'; -import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; - import { cn } from '@/utils/utils'; const Checkbox = React.forwardRef< diff --git a/components/ui/command.tsx b/components/ui/command.tsx index f262dd94..728580a9 100644 --- a/components/ui/command.tsx +++ b/components/ui/command.tsx @@ -1,12 +1,12 @@ 'use client'; +import { type DialogProps } from '@radix-ui/react-dialog'; import { Command as CommandPrimitive } from 'cmdk'; import { Search } from 'lucide-react'; import * as React from 'react'; -import { type DialogProps } from '@radix-ui/react-dialog'; - import { Dialog, DialogContent } from '@/components/ui/dialog'; + import { cn } from '@/utils/utils'; const Command = React.forwardRef< diff --git a/components/ui/context-menu.tsx b/components/ui/context-menu.tsx index e45e22cb..ca24806d 100644 --- a/components/ui/context-menu.tsx +++ b/components/ui/context-menu.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as ContextMenuPrimitive from '@radix-ui/react-context-menu'; import { Check, ChevronRight, Circle } from 'lucide-react'; import * as React from 'react'; -import * as ContextMenuPrimitive from '@radix-ui/react-context-menu'; - import { cn } from '@/utils/utils'; const ContextMenu = ContextMenuPrimitive.Root; diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 577ba99f..47d2ba20 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as DialogPrimitive from '@radix-ui/react-dialog'; import { X } from 'lucide-react'; import * as React from 'react'; -import * as DialogPrimitive from '@radix-ui/react-dialog'; - import { cn } from '@/utils/utils'; const Dialog = DialogPrimitive.Root; diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx index 76a32690..7bd6b891 100644 --- a/components/ui/dropdown-menu.tsx +++ b/components/ui/dropdown-menu.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; import { Check, ChevronRight, Circle } from 'lucide-react'; import * as React from 'react'; -import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; - import { cn } from '@/utils/utils'; const DropdownMenu = DropdownMenuPrimitive.Root; diff --git a/components/ui/form.tsx b/components/ui/form.tsx index 81fe9944..3b331e44 100644 --- a/components/ui/form.tsx +++ b/components/ui/form.tsx @@ -1,3 +1,5 @@ +import * as LabelPrimitive from '@radix-ui/react-label'; +import { Slot } from '@radix-ui/react-slot'; import * as React from 'react'; import { Controller, @@ -8,10 +10,8 @@ import { useFormContext, } from 'react-hook-form'; -import * as LabelPrimitive from '@radix-ui/react-label'; -import { Slot } from '@radix-ui/react-slot'; - import { Label } from '@/components/ui/label'; + import { cn } from '@/utils/utils'; const Form = FormProvider; diff --git a/components/ui/header.tsx b/components/ui/header.tsx index 304c0a8e..2674845e 100644 --- a/components/ui/header.tsx +++ b/components/ui/header.tsx @@ -1,9 +1,8 @@ import clsx from 'clsx'; +import Link from 'next/link'; import { PropsWithChildren, ReactNode, memo } from 'react'; import MaterialSymbolsArrowRightAltRounded from '~icons/material-symbols/arrow-right-alt-rounded'; -import Link from 'next/link'; - import H1 from '@/components/typography/h1'; import H2 from '@/components/typography/h2'; import H3 from '@/components/typography/h3'; diff --git a/components/ui/horizontal-card.tsx b/components/ui/horizontal-card.tsx index 858cbf72..a3a65c3a 100644 --- a/components/ui/horizontal-card.tsx +++ b/components/ui/horizontal-card.tsx @@ -1,14 +1,15 @@ import { formatDistance } from 'date-fns'; -import React, { ComponentProps, FC, ReactNode } from 'react'; - import Link from 'next/link'; +import { ComponentProps, FC, ReactNode } from 'react'; import ContentCard from '@/components/content-card/content-card'; import Small from '@/components/typography/small'; import { Label } from '@/components/ui/label'; -import parseTextFromMarkDown from '@/utils/parseTextFromMarkDown'; + import { cn } from '@/utils/utils'; +import MDViewer from '../markdown/viewer/MD-viewer'; + interface Props extends ComponentProps<'div'> { title: string; titleMeta?: ReactNode; @@ -73,13 +74,17 @@ const HorizontalCard: FC = ({ - {typeof description === 'string' - ? parseTextFromMarkDown(description) - : description} + {typeof description === 'string' ? ( + + {description} + + ) : ( + description + )} )} diff --git a/components/horizontal-content-card.tsx b/components/ui/horizontal-content-card.tsx similarity index 100% rename from components/horizontal-content-card.tsx rename to components/ui/horizontal-content-card.tsx index 7d5bd1cb..a6e98cf7 100644 --- a/components/horizontal-content-card.tsx +++ b/components/ui/horizontal-content-card.tsx @@ -1,12 +1,12 @@ +import Link from 'next/link'; import * as React from 'react'; import { ComponentPropsWithoutRef, forwardRef, memo } from 'react'; -import Link from 'next/link'; - import ContentCard from '@/components/content-card/content-card'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import H5 from '@/components/typography/h5'; import { Label } from '@/components/ui/label'; + import { cn } from '@/utils/utils'; export interface Props extends ComponentPropsWithoutRef<'div'> { diff --git a/components/ui/hover-card.tsx b/components/ui/hover-card.tsx index d423d3b0..d76c7d7b 100644 --- a/components/ui/hover-card.tsx +++ b/components/ui/hover-card.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as HoverCardPrimitive from '@radix-ui/react-hover-card'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/image.tsx b/components/ui/image.tsx index bb34d78d..5748a8e4 100644 --- a/components/ui/image.tsx +++ b/components/ui/image.tsx @@ -1,9 +1,8 @@ 'use client'; import clsx from 'clsx'; -import React, { Ref, forwardRef, useState } from 'react'; - import NextImage, { ImageProps } from 'next/image'; +import React, { Ref, forwardRef, useState } from 'react'; interface Props extends ImageProps { transitionDisabled?: boolean; diff --git a/components/ui/label.tsx b/components/ui/label.tsx index 1494a19d..d97becc1 100644 --- a/components/ui/label.tsx +++ b/components/ui/label.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as LabelPrimitive from '@radix-ui/react-label'; import { type VariantProps, cva } from 'class-variance-authority'; import * as React from 'react'; -import * as LabelPrimitive from '@radix-ui/react-label'; - import { cn } from '@/utils/utils'; const labelVariants = cva( diff --git a/components/ui/navigation-menu.tsx b/components/ui/navigation-menu.tsx index 14ffe4c9..06f49fc9 100644 --- a/components/ui/navigation-menu.tsx +++ b/components/ui/navigation-menu.tsx @@ -1,9 +1,8 @@ +import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'; import { cva } from 'class-variance-authority'; import { ChevronDown } from 'lucide-react'; import * as React from 'react'; -import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'; - import { cn } from '@/utils/utils'; const NavigationMenu = React.forwardRef< diff --git a/components/ui/pagination.tsx b/components/ui/pagination.tsx index 20163d03..e94202a8 100644 --- a/components/ui/pagination.tsx +++ b/components/ui/pagination.tsx @@ -1,13 +1,13 @@ 'use client'; +import { range } from '@antfu/utils'; import { ChangeEvent, FC, useEffect, useState } from 'react'; import AntDesignArrowLeftOutlined from '~icons/ant-design/arrow-left-outlined'; import AntDesignArrowRightOutlined from '~icons/ant-design/arrow-right-outlined'; -import { range } from '@antfu/utils'; - import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; + import { cn } from '@/utils/utils'; interface Props { diff --git a/components/ui/popover.tsx b/components/ui/popover.tsx index 955e3cda..7835cfd4 100644 --- a/components/ui/popover.tsx +++ b/components/ui/popover.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as PopoverPrimitive from '@radix-ui/react-popover'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/progress.tsx b/components/ui/progress.tsx index 729d8478..6688f39a 100644 --- a/components/ui/progress.tsx +++ b/components/ui/progress.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as ProgressPrimitive from '@radix-ui/react-progress'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/scroll-area.tsx b/components/ui/scroll-area.tsx index 124f2d6f..9b72e4e1 100644 --- a/components/ui/scroll-area.tsx +++ b/components/ui/scroll-area.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/select.tsx b/components/ui/select.tsx index cdac04aa..4f225be6 100644 --- a/components/ui/select.tsx +++ b/components/ui/select.tsx @@ -1,18 +1,18 @@ 'use client'; -import { ChevronsUpDown, X } from 'lucide-react'; -import React, { FC, Fragment, ReactNode } from 'react'; -import { createPortal } from 'react-dom'; - import * as PopoverPrimitive from '@radix-ui/react-popover'; import { type ComponentPropsWithoutRef, Primitive, } from '@radix-ui/react-primitive'; import { useControllableState } from '@radix-ui/react-use-controllable-state'; +import { ChevronsUpDown, X } from 'lucide-react'; +import React, { FC, Fragment, ReactNode } from 'react'; +import { createPortal } from 'react-dom'; import { buttonVariants } from '@/components/ui/button'; import { Checkbox } from '@/components/ui/checkbox'; + import { cn } from '@/utils/utils'; import { Badge } from './badge'; diff --git a/components/ui/separator.tsx b/components/ui/separator.tsx index b2235b6a..4aa52874 100644 --- a/components/ui/separator.tsx +++ b/components/ui/separator.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as SeparatorPrimitive from '@radix-ui/react-separator'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx index cd62d451..5c3c5afa 100644 --- a/components/ui/sheet.tsx +++ b/components/ui/sheet.tsx @@ -1,11 +1,10 @@ 'use client'; +import * as SheetPrimitive from '@radix-ui/react-dialog'; import { type VariantProps, cva } from 'class-variance-authority'; import { X } from 'lucide-react'; import * as React from 'react'; -import * as SheetPrimitive from '@radix-ui/react-dialog'; - import { cn } from '@/utils/utils'; const Sheet = SheetPrimitive.Root; diff --git a/components/ui/slider.tsx b/components/ui/slider.tsx index 536cd697..57c40b65 100644 --- a/components/ui/slider.tsx +++ b/components/ui/slider.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as SliderPrimitive from '@radix-ui/react-slider'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/switch.tsx b/components/ui/switch.tsx index 9edbc953..4064bdae 100644 --- a/components/ui/switch.tsx +++ b/components/ui/switch.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as SwitchPrimitives from '@radix-ui/react-switch'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/tabs.tsx b/components/ui/tabs.tsx index 44090165..add7df99 100644 --- a/components/ui/tabs.tsx +++ b/components/ui/tabs.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as TabsPrimitive from '@radix-ui/react-tabs'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/ui/toggle-group.tsx b/components/ui/toggle-group.tsx index ecdadfbb..f4771c6b 100644 --- a/components/ui/toggle-group.tsx +++ b/components/ui/toggle-group.tsx @@ -1,11 +1,11 @@ 'use client'; +import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'; import { VariantProps } from 'class-variance-authority'; import * as React from 'react'; -import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'; - import { toggleVariants } from '@/components/ui/toggle'; + import { cn } from '@/utils/utils'; const ToggleGroupContext = React.createContext< diff --git a/components/ui/toggle.tsx b/components/ui/toggle.tsx index 13d78ecb..80f9f6cf 100644 --- a/components/ui/toggle.tsx +++ b/components/ui/toggle.tsx @@ -1,10 +1,9 @@ 'use client'; +import * as TogglePrimitive from '@radix-ui/react-toggle'; import { type VariantProps, cva } from 'class-variance-authority'; import * as React from 'react'; -import * as TogglePrimitive from '@radix-ui/react-toggle'; - import { cn } from '@/utils/utils'; const toggleVariants = cva( diff --git a/components/ui/tooltip.tsx b/components/ui/tooltip.tsx index 605ff393..515217ac 100644 --- a/components/ui/tooltip.tsx +++ b/components/ui/tooltip.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import * as TooltipPrimitive from '@radix-ui/react-tooltip'; +import * as React from 'react'; import { cn } from '@/utils/utils'; diff --git a/components/user-cover.tsx b/components/user-cover.tsx index 687271cb..dd7335ab 100644 --- a/components/user-cover.tsx +++ b/components/user-cover.tsx @@ -3,6 +3,7 @@ import React, { FC } from 'react'; import Image from '@/components/ui/image'; + import useSession from '@/services/hooks/auth/useSession'; import useUser from '@/services/hooks/user/useUser'; diff --git a/app/(pages)/(content)/components/voice-card.tsx b/components/voice-card.tsx similarity index 100% rename from app/(pages)/(content)/components/voice-card.tsx rename to components/voice-card.tsx diff --git a/components/watchlist-button/components/new-status-trigger.tsx b/components/watchlist-button/new-status-trigger.tsx similarity index 99% rename from components/watchlist-button/components/new-status-trigger.tsx rename to components/watchlist-button/new-status-trigger.tsx index bbfe25d4..21638995 100644 --- a/components/watchlist-button/components/new-status-trigger.tsx +++ b/components/watchlist-button/new-status-trigger.tsx @@ -5,6 +5,7 @@ import MaterialSymbolsArrowDropDownRounded from '~icons/material-symbols/arrow-d import Planned from '@/components/icons/watch-status/planned'; import { Button } from '@/components/ui/button'; import { SelectTrigger } from '@/components/ui/select'; + import { cn } from '@/utils/utils'; interface NewStatusTriggerProps { diff --git a/components/watchlist-button/components/watch-status-trigger.tsx b/components/watchlist-button/watch-status-trigger.tsx similarity index 99% rename from components/watchlist-button/components/watch-status-trigger.tsx rename to components/watchlist-button/watch-status-trigger.tsx index 0dd84513..3d90f28d 100644 --- a/components/watchlist-button/components/watch-status-trigger.tsx +++ b/components/watchlist-button/watch-status-trigger.tsx @@ -4,6 +4,7 @@ import IcBaselineRemoveCircle from '~icons/ic/baseline-remove-circle'; import { Button } from '@/components/ui/button'; import { SelectTrigger } from '@/components/ui/select'; + import { WATCH_STATUS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/components/watchlist-button/watchlist-button.tsx b/components/watchlist-button/watchlist-button.tsx index 64d227d8..bf6b013d 100644 --- a/components/watchlist-button/watchlist-button.tsx +++ b/components/watchlist-button/watchlist-button.tsx @@ -1,10 +1,8 @@ 'use client'; -import * as React from 'react'; import { createElement } from 'react'; import MaterialSymbolsSettingsOutline from '~icons/material-symbols/settings-outline'; -import WatchEditModal from '@/components/modals/watch-edit-modal'; import { Select, SelectContent, @@ -13,6 +11,9 @@ import { SelectList, SelectSeparator, } from '@/components/ui/select'; + +import WatchEditModal from '@/features/modals/watch-edit-modal'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useAddToList from '@/services/hooks/watch/useAddToList'; import useDeleteFromList from '@/services/hooks/watch/useDeleteFromList'; @@ -20,8 +21,8 @@ import useWatch from '@/services/hooks/watch/useWatch'; import { useModalContext } from '@/services/providers/modal-provider'; import { WATCH_STATUS } from '@/utils/constants'; -import NewStatusTrigger from './components/new-status-trigger'; -import WatchStatusTrigger from './components/watch-status-trigger'; +import NewStatusTrigger from './new-status-trigger'; +import WatchStatusTrigger from './watch-status-trigger'; interface Props { slug: string; diff --git a/emails/confirm-email.tsx b/emails/confirm-email.tsx index 6a639593..9c0a3c5c 100644 --- a/emails/confirm-email.tsx +++ b/emails/confirm-email.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { Body, Button, @@ -14,6 +12,7 @@ import { Tailwind, Text, } from '@react-email/components'; +import * as React from 'react'; export const ConfirmEmail = () => { const previewText = `{username}, підтвердіть вашу електронну пошту`; diff --git a/emails/password-reset.tsx b/emails/password-reset.tsx index eaed3191..a1642233 100644 --- a/emails/password-reset.tsx +++ b/emails/password-reset.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { Body, Button, @@ -14,6 +12,7 @@ import { Tailwind, Text, } from '@react-email/components'; +import * as React from 'react'; export const ConfirmEmail = () => { const previewText = `Відновлення паролю {username}`; diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/anime-list-navbar.tsx b/features/anime/anime-list-navbar/anime-list-navbar.tsx similarity index 82% rename from app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/anime-list-navbar.tsx rename to features/anime/anime-list-navbar/anime-list-navbar.tsx index 90bcb8ed..2389f197 100644 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/anime-list-navbar.tsx +++ b/features/anime/anime-list-navbar/anime-list-navbar.tsx @@ -1,9 +1,10 @@ import { Suspense } from 'react'; -import FiltersModal from '@/components/modals/anime-filters-modal'; +import FiltersModal from '@/features/modals/anime-filters-modal'; + import { cn } from '@/utils/utils'; -import Search from './_components/search'; +import Search from './search'; const AnimeListNavbar = () => { return ( diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/_components/search.tsx b/features/anime/anime-list-navbar/search.tsx similarity index 100% rename from app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/_components/search.tsx rename to features/anime/anime-list-navbar/search.tsx index 7bafe7c1..29dfbaac 100644 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list-navbar/_components/search.tsx +++ b/features/anime/anime-list-navbar/search.tsx @@ -1,10 +1,10 @@ 'use client'; -import { useState } from 'react'; - import { usePathname, useRouter, useSearchParams } from 'next/navigation'; +import { useState } from 'react'; import { Input } from '@/components/ui/input'; + import createQueryString from '@/utils/createQueryString'; const Search = () => { diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list/components/anime-list-skeleton.tsx b/features/anime/anime-list/anime-list-skeleton.tsx similarity index 99% rename from app/(pages)/(content)/anime/(animeList)/components/anime-list/components/anime-list-skeleton.tsx rename to features/anime/anime-list/anime-list-skeleton.tsx index de8e9feb..1ada1a94 100644 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list/components/anime-list-skeleton.tsx +++ b/features/anime/anime-list/anime-list-skeleton.tsx @@ -1,6 +1,5 @@ -import * as React from 'react'; - import { range } from '@antfu/utils'; +import * as React from 'react'; import SkeletonCard from '@/components/skeletons/content-card'; diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.hooks.ts b/features/anime/anime-list/anime-list.hooks.ts similarity index 99% rename from app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.hooks.ts rename to features/anime/anime-list/anime-list.hooks.ts index e70f8c98..877681c8 100644 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.hooks.ts +++ b/features/anime/anime-list/anime-list.hooks.ts @@ -1,6 +1,5 @@ -import { usePathname, useRouter, useSearchParams } from 'next/navigation'; - import { useQueryClient } from '@tanstack/react-query'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import useAnimeCatalog, { Props } from '@/services/hooks/anime/useAnimeCatalog'; import createQueryString from '@/utils/createQueryString'; diff --git a/app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.tsx b/features/anime/anime-list/anime-list.tsx similarity index 89% rename from app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.tsx rename to features/anime/anime-list/anime-list.tsx index 0198c169..1c055835 100644 --- a/app/(pages)/(content)/anime/(animeList)/components/anime-list/anime-list.tsx +++ b/features/anime/anime-list/anime-list.tsx @@ -1,18 +1,19 @@ 'use client'; -import * as React from 'react'; import { FC } from 'react'; -import AnimeCard from '@/app/(pages)/(content)/components/anime-card'; -import FiltersNotFound from '@/components/filters/components/filters-not-found'; +import AnimeCard from '@/components/anime-card'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Pagination from '@/components/ui/pagination'; import Stack from '@/components/ui/stack'; + +import FiltersNotFound from '@/features/filters/filters-not-found'; + import useAnimeCatalog from '@/services/hooks/anime/useAnimeCatalog'; +import AnimeListSkeleton from './anime-list-skeleton'; import { useNextPage, useUpdatePage } from './anime-list.hooks'; -import AnimeListSkeleton from './components/anime-list-skeleton'; interface Props { searchParams: Record; diff --git a/app/(pages)/(content)/anime/[slug]/components/actions/actions.tsx b/features/anime/anime-view/actions/actions.tsx similarity index 89% rename from app/(pages)/(content)/anime/[slug]/components/actions/actions.tsx rename to features/anime/anime-view/actions/actions.tsx index f675b860..bcb35b49 100644 --- a/app/(pages)/(content)/anime/[slug]/components/actions/actions.tsx +++ b/features/anime/anime-view/actions/actions.tsx @@ -1,16 +1,15 @@ 'use client'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import WatchListButton from '@/components/watchlist-button/watchlist-button'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useSession from '@/services/hooks/auth/useSession'; -import CommentsButton from '../../../../../../../components/comments-button'; -import WatchStats from './components/watch-stats'; - +import CommentsButton from '../../../../components/comments-button'; +import WatchStats from './watch-stats'; const Actions: FC = () => { const params = useParams(); diff --git a/app/(pages)/(content)/anime/[slug]/components/actions/components/watch-stats.tsx b/features/anime/anime-view/actions/watch-stats.tsx similarity index 96% rename from app/(pages)/(content)/anime/[slug]/components/actions/components/watch-stats.tsx rename to features/anime/anime-view/actions/watch-stats.tsx index ecce671e..21d68c37 100644 --- a/app/(pages)/(content)/anime/[slug]/components/actions/components/watch-stats.tsx +++ b/features/anime/anime-view/actions/watch-stats.tsx @@ -1,21 +1,20 @@ 'use client'; +import { useParams } from 'next/navigation'; import React from 'react'; import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; import MaterialSymbolsRemoveRounded from '~icons/material-symbols/remove-rounded'; -import { useParams } from 'next/navigation'; - import H3 from '@/components/typography/h3'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { Progress } from '@/components/ui/progress'; import Rating from '@/components/ui/rating'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useAddWatch from '@/services/hooks/watch/useAddWatch'; import useWatch from '@/services/hooks/watch/useWatch'; - const WatchStats = () => { const params = useParams(); @@ -31,7 +30,11 @@ const WatchStats = () => { const episodes = (variables?.params?.episodes || watch.episodes) + 1; - if (watch.anime.episodes_total && episodes > watch.anime.episodes_total) return; + if ( + watch.anime.episodes_total && + episodes > watch.anime.episodes_total + ) + return; let status = watch.status; diff --git a/app/(pages)/(content)/anime/[slug]/components/characters/characters.tsx b/features/anime/anime-view/characters/characters.tsx similarity index 85% rename from app/(pages)/(content)/anime/[slug]/components/characters/characters.tsx rename to features/anime/anime-view/characters/characters.tsx index 556fb81a..2d233c56 100644 --- a/app/(pages)/(content)/anime/[slug]/components/characters/characters.tsx +++ b/features/anime/anime-view/characters/characters.tsx @@ -1,14 +1,14 @@ 'use client'; -import React, { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import LoadMoreButton from '@/components/load-more-button'; + import useCharacters from '@/services/hooks/anime/useCharacters'; -import MainCharacters from './components/main-characters'; -import OtherCharacters from './components/other-characters'; +import MainCharacters from './main-characters'; +import OtherCharacters from './other-characters'; interface Props { extended?: boolean; diff --git a/app/(pages)/(content)/anime/[slug]/components/characters/components/main-characters.tsx b/features/anime/anime-view/characters/main-characters.tsx similarity index 94% rename from app/(pages)/(content)/anime/[slug]/components/characters/components/main-characters.tsx rename to features/anime/anime-view/characters/main-characters.tsx index b67bbd24..9dddd231 100644 --- a/app/(pages)/(content)/anime/[slug]/components/characters/components/main-characters.tsx +++ b/features/anime/anime-view/characters/main-characters.tsx @@ -1,15 +1,15 @@ 'use client'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useCharacters from '@/services/hooks/anime/useCharacters'; -import CharacterCard from '../../../../../components/character-card'; +import CharacterCard from '../../../../components/character-card'; interface Props { extended?: boolean; diff --git a/app/(pages)/(content)/anime/[slug]/components/characters/components/other-characters.tsx b/features/anime/anime-view/characters/other-characters.tsx similarity index 93% rename from app/(pages)/(content)/anime/[slug]/components/characters/components/other-characters.tsx rename to features/anime/anime-view/characters/other-characters.tsx index ad95a32c..3f11f5cb 100644 --- a/app/(pages)/(content)/anime/[slug]/components/characters/components/other-characters.tsx +++ b/features/anime/anime-view/characters/other-characters.tsx @@ -1,13 +1,13 @@ 'use client'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import CharacterCard from '@/app/(pages)/(content)/components/character-card'; +import CharacterCard from '@/components/character-card'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useCharacters from '@/services/hooks/anime/useCharacters'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/cover.tsx b/features/anime/anime-view/cover.tsx similarity index 87% rename from app/(pages)/(content)/anime/[slug]/components/cover.tsx rename to features/anime/anime-view/cover.tsx index 328a1359..d2f0b18d 100644 --- a/app/(pages)/(content)/anime/[slug]/components/cover.tsx +++ b/features/anime/anime-view/cover.tsx @@ -1,13 +1,12 @@ 'use client'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import FavoriteButton from '@/components/favorite-button'; -import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; +import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; const Cover: FC = () => { const params = useParams(); @@ -15,7 +14,10 @@ const Cover: FC = () => { return (
- +
{ diff --git a/app/(pages)/(content)/anime/[slug]/components/details/details.tsx b/features/anime/anime-view/details/details.tsx similarity index 78% rename from app/(pages)/(content)/anime/[slug]/components/details/details.tsx rename to features/anime/anime-view/details/details.tsx index 13a0fa78..50a7a151 100644 --- a/app/(pages)/(content)/anime/[slug]/components/details/details.tsx +++ b/features/anime/anime-view/details/details.tsx @@ -5,15 +5,16 @@ import { useParams } from 'next/navigation'; import Block from '@/components/ui/block'; import Card from '@/components/ui/card'; import Header from '@/components/ui/header'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; -import Duration from './components/duration'; -import EpisodeSchedule from './components/episode-schedule'; -import Episodes from './components/episodes'; -import MediaType from './components/media-type'; -import Rating from './components/rating'; -import Status from './components/status'; -import Studio from './components/studio'; +import Duration from './duration'; +import EpisodeSchedule from './episode-schedule'; +import Episodes from './episodes'; +import MediaType from './media-type'; +import Rating from './rating'; +import Status from './status'; +import Studio from './studio'; const Details = () => { const params = useParams(); diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/duration.tsx b/features/anime/anime-view/details/duration.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/details/components/duration.tsx rename to features/anime/anime-view/details/duration.tsx diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/episode-schedule.tsx b/features/anime/anime-view/details/episode-schedule.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/details/components/episode-schedule.tsx rename to features/anime/anime-view/details/episode-schedule.tsx diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/episodes.tsx b/features/anime/anime-view/details/episodes.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/details/components/episodes.tsx rename to features/anime/anime-view/details/episodes.tsx diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/media-type.tsx b/features/anime/anime-view/details/media-type.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/details/components/media-type.tsx rename to features/anime/anime-view/details/media-type.tsx index a8c4e00b..b5efdfd9 100644 --- a/app/(pages)/(content)/anime/[slug]/components/details/components/media-type.tsx +++ b/features/anime/anime-view/details/media-type.tsx @@ -1,6 +1,7 @@ import { FC } from 'react'; import { Label } from '@/components/ui/label'; + import { MEDIA_TYPE } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/rating.tsx b/features/anime/anime-view/details/rating.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/details/components/rating.tsx rename to features/anime/anime-view/details/rating.tsx index 7b6ded78..94469016 100644 --- a/app/(pages)/(content)/anime/[slug]/components/details/components/rating.tsx +++ b/features/anime/anime-view/details/rating.tsx @@ -1,6 +1,7 @@ import { FC } from 'react'; import { Label } from '@/components/ui/label'; + import { AGE_RATING } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/status.tsx b/features/anime/anime-view/details/status.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/details/components/status.tsx rename to features/anime/anime-view/details/status.tsx index 424147db..92c61d47 100644 --- a/app/(pages)/(content)/anime/[slug]/components/details/components/status.tsx +++ b/features/anime/anime-view/details/status.tsx @@ -2,6 +2,7 @@ import { FC } from 'react'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; + import { RELEASE_STATUS } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/details/components/studio.tsx b/features/anime/anime-view/details/studio.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/details/components/studio.tsx rename to features/anime/anime-view/details/studio.tsx index 0447f4d4..eb1f2c3d 100644 --- a/app/(pages)/(content)/anime/[slug]/components/details/components/studio.tsx +++ b/features/anime/anime-view/details/studio.tsx @@ -1,7 +1,6 @@ -import { FC } from 'react'; - import Image from 'next/image'; import Link from 'next/link'; +import { FC } from 'react'; import P from '@/components/typography/p'; import { Label } from '@/components/ui/label'; diff --git a/app/(pages)/(content)/anime/[slug]/components/followings/components/ui/following-item.tsx b/features/anime/anime-view/followings/following-item.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/followings/components/ui/following-item.tsx rename to features/anime/anime-view/followings/following-item.tsx index afa9c267..93a8b1a6 100644 --- a/app/(pages)/(content)/anime/[slug]/components/followings/components/ui/following-item.tsx +++ b/features/anime/anime-view/followings/following-item.tsx @@ -1,11 +1,11 @@ +import Link from 'next/link'; import React, { FC } from 'react'; import MaterialSymbolsStarRounded from '~icons/material-symbols/star-rounded'; -import Link from 'next/link'; - import P from '@/components/typography/p'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; + import { WATCH_STATUS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(content)/anime/[slug]/components/followings/components/followings-modal.tsx b/features/anime/anime-view/followings/followings-modal.tsx similarity index 94% rename from app/(pages)/(content)/anime/[slug]/components/followings/components/followings-modal.tsx rename to features/anime/anime-view/followings/followings-modal.tsx index c3de1e82..e64de75d 100644 --- a/app/(pages)/(content)/anime/[slug]/components/followings/components/followings-modal.tsx +++ b/features/anime/anime-view/followings/followings-modal.tsx @@ -1,13 +1,12 @@ 'use client'; -import * as React from 'react'; - import { useParams } from 'next/navigation'; import LoadMoreButton from '@/components/load-more-button'; + import useFollowingWatchList from '@/services/hooks/watch/useFollowingWatchList'; -import FollowingItem from './ui/following-item'; +import FollowingItem from './following-item'; const FollowingsModal = () => { const params = useParams(); diff --git a/app/(pages)/(content)/anime/[slug]/components/followings/followings.tsx b/features/anime/anime-view/followings/followings.tsx similarity index 89% rename from app/(pages)/(content)/anime/[slug]/components/followings/followings.tsx rename to features/anime/anime-view/followings/followings.tsx index a83b4c01..e76b20a7 100644 --- a/app/(pages)/(content)/anime/[slug]/components/followings/followings.tsx +++ b/features/anime/anime-view/followings/followings.tsx @@ -1,16 +1,15 @@ 'use client'; -import React from 'react'; - import { useParams } from 'next/navigation'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; + import useFollowingWatchList from '@/services/hooks/watch/useFollowingWatchList'; import { useModalContext } from '@/services/providers/modal-provider'; -import FollowingsModal from './components/followings-modal'; -import FollowingItem from './components/ui/following-item'; +import FollowingItem from './following-item'; +import FollowingsModal from './followings-modal'; const Followings = () => { const params = useParams(); diff --git a/app/(pages)/(content)/anime/[slug]/components/franchise.tsx b/features/anime/anime-view/franchise.tsx similarity index 94% rename from app/(pages)/(content)/anime/[slug]/components/franchise.tsx rename to features/anime/anime-view/franchise.tsx index 23e42f52..a58fdc22 100644 --- a/app/(pages)/(content)/anime/[slug]/components/franchise.tsx +++ b/features/anime/anime-view/franchise.tsx @@ -1,15 +1,14 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import AnimeCard from '@/app/(pages)/(content)/components/anime-card'; +import AnimeCard from '@/components/anime-card'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useFranchise from '@/services/hooks/anime/useFranchise'; diff --git a/app/(pages)/(content)/anime/[slug]/components/links.tsx b/features/anime/anime-view/links.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/links.tsx rename to features/anime/anime-view/links.tsx index 9b884828..a1d03c18 100644 --- a/app/(pages)/(content)/anime/[slug]/components/links.tsx +++ b/features/anime/anime-view/links.tsx @@ -1,9 +1,8 @@ 'use client'; -import { FC, useState } from 'react'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import { FC, useState } from 'react'; import H4 from '@/components/typography/h4'; import P from '@/components/typography/p'; @@ -12,6 +11,7 @@ import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/media/media.tsx b/features/anime/anime-view/media/media.tsx similarity index 96% rename from app/(pages)/(content)/anime/[slug]/components/media/media.tsx rename to features/anime/anime-view/media/media.tsx index 0dbcf3b9..5001c7f5 100644 --- a/app/(pages)/(content)/anime/[slug]/components/media/media.tsx +++ b/features/anime/anime-view/media/media.tsx @@ -1,16 +1,16 @@ 'use client'; -import { FC, useState } from 'react'; - import { useParams } from 'next/navigation'; +import { FC, useState } from 'react'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; -import Ost from './components/ost'; -import Video from './components/video'; +import Ost from './ost'; +import Video from './video'; interface Props { extended?: boolean; diff --git a/app/(pages)/(content)/anime/[slug]/components/media/components/ost.tsx b/features/anime/anime-view/media/ost.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/media/components/ost.tsx rename to features/anime/anime-view/media/ost.tsx index 25a58395..47582a0f 100644 --- a/app/(pages)/(content)/anime/[slug]/components/media/components/ost.tsx +++ b/features/anime/anime-view/media/ost.tsx @@ -3,6 +3,7 @@ import IcBaselineLibraryMusic from '~icons/ic/baseline-library-music'; import ContentCard from '@/components/content-card/content-card'; import Stack from '@/components/ui/stack'; + import { OST } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/media/components/video.tsx b/features/anime/anime-view/media/video.tsx similarity index 99% rename from app/(pages)/(content)/anime/[slug]/components/media/components/video.tsx rename to features/anime/anime-view/media/video.tsx index ddd1611c..2c131a04 100644 --- a/app/(pages)/(content)/anime/[slug]/components/media/components/video.tsx +++ b/features/anime/anime-view/media/video.tsx @@ -2,6 +2,7 @@ import { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import Stack from '@/components/ui/stack'; + import { VIDEO } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/staff.tsx b/features/anime/anime-view/staff.tsx similarity index 93% rename from app/(pages)/(content)/anime/[slug]/components/staff.tsx rename to features/anime/anime-view/staff.tsx index f238cba0..cccc1d67 100644 --- a/app/(pages)/(content)/anime/[slug]/components/staff.tsx +++ b/features/anime/anime-view/staff.tsx @@ -1,15 +1,14 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import PersonCard from '@/app/(pages)/(content)/components/person-card'; import LoadMoreButton from '@/components/load-more-button'; +import PersonCard from '@/components/person-card'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useStaff from '@/services/hooks/anime/useStaff'; interface Props { diff --git a/app/(pages)/(content)/anime/[slug]/components/title.tsx b/features/anime/anime-view/title.tsx similarity index 96% rename from app/(pages)/(content)/anime/[slug]/components/title.tsx rename to features/anime/anime-view/title.tsx index 29d308f8..9e7025f8 100644 --- a/app/(pages)/(content)/anime/[slug]/components/title.tsx +++ b/features/anime/anime-view/title.tsx @@ -1,13 +1,13 @@ 'use client'; -import MaterialSymbolsStarRounded from '~icons/material-symbols/star-rounded'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import MaterialSymbolsStarRounded from '~icons/material-symbols/star-rounded'; -import EditButton from '@/app/(pages)/(content)/components/edit-button'; +import EditButton from '@/components/edit-button'; import H2 from '@/components/typography/h2'; import P from '@/components/typography/p'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useSession from '@/services/hooks/auth/useSession'; @@ -46,7 +46,9 @@ const Title = () => { /> )}
-

{data.title_ja}

+

+ {data.title_ja} +

{data.score > 0 && ( diff --git a/app/(pages)/(content)/anime/[slug]/components/watch-stats/components/score.tsx b/features/anime/anime-view/watch-stats/score.tsx similarity index 97% rename from app/(pages)/(content)/anime/[slug]/components/watch-stats/components/score.tsx rename to features/anime/anime-view/watch-stats/score.tsx index 6bcb2b22..346e8bec 100644 --- a/app/(pages)/(content)/anime/[slug]/components/watch-stats/components/score.tsx +++ b/features/anime/anime-view/watch-stats/score.tsx @@ -3,9 +3,10 @@ import { useParams } from 'next/navigation'; import Small from '@/components/typography/small'; + import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; -import Stats from './ui/stats'; +import Stats from './stats'; const Score = () => { const params = useParams(); diff --git a/app/(pages)/(content)/anime/[slug]/components/watch-stats/components/ui/stats.tsx b/features/anime/anime-view/watch-stats/stats.tsx similarity index 100% rename from app/(pages)/(content)/anime/[slug]/components/watch-stats/components/ui/stats.tsx rename to features/anime/anime-view/watch-stats/stats.tsx diff --git a/app/(pages)/(content)/anime/[slug]/components/watch-stats/watch-stats.tsx b/features/anime/anime-view/watch-stats/watch-stats.tsx similarity index 93% rename from app/(pages)/(content)/anime/[slug]/components/watch-stats/watch-stats.tsx rename to features/anime/anime-view/watch-stats/watch-stats.tsx index 51ceec6a..496129ab 100644 --- a/app/(pages)/(content)/anime/[slug]/components/watch-stats/watch-stats.tsx +++ b/features/anime/anime-view/watch-stats/watch-stats.tsx @@ -3,8 +3,8 @@ import Header from '@/components/ui/header'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; -import Score from './components/score'; -import Watchlist from './components/watchlist'; +import Score from './score'; +import Watchlist from './watchlist'; const WatchStats = () => { return ( diff --git a/app/(pages)/(content)/anime/[slug]/components/watch-stats/components/watchlist.tsx b/features/anime/anime-view/watch-stats/watchlist.tsx similarity index 97% rename from app/(pages)/(content)/anime/[slug]/components/watch-stats/components/watchlist.tsx rename to features/anime/anime-view/watch-stats/watchlist.tsx index cb2850a3..58b12c60 100644 --- a/app/(pages)/(content)/anime/[slug]/components/watch-stats/components/watchlist.tsx +++ b/features/anime/anime-view/watch-stats/watchlist.tsx @@ -1,13 +1,12 @@ 'use client'; -import { createElement } from 'react'; - import { useParams } from 'next/navigation'; +import { createElement } from 'react'; import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import { WATCH_STATUS } from '@/utils/constants'; -import Stats from './ui/stats'; +import Stats from './stats'; const Watchlist = () => { const params = useParams(); diff --git a/app/(pages)/(content)/characters/[slug]/components/anime.tsx b/features/characters/character-view/anime.tsx similarity index 93% rename from app/(pages)/(content)/characters/[slug]/components/anime.tsx rename to features/characters/character-view/anime.tsx index 4caa370b..408a073a 100644 --- a/app/(pages)/(content)/characters/[slug]/components/anime.tsx +++ b/features/characters/character-view/anime.tsx @@ -1,15 +1,14 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import AnimeCard from '@/app/(pages)/(content)/components/anime-card'; +import AnimeCard from '@/components/anime-card'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useCharacterAnime from '@/services/hooks/characters/useCharacterAnime'; interface Props { diff --git a/app/(pages)/(content)/characters/[slug]/components/cover.tsx b/features/characters/character-view/cover.tsx similarity index 99% rename from app/(pages)/(content)/characters/[slug]/components/cover.tsx rename to features/characters/character-view/cover.tsx index ba3c3b46..02611ab0 100644 --- a/app/(pages)/(content)/characters/[slug]/components/cover.tsx +++ b/features/characters/character-view/cover.tsx @@ -4,6 +4,7 @@ import { useParams } from 'next/navigation'; import ContentCard from '@/components/content-card/content-card'; import FavoriteButton from '@/components/favorite-button'; + import useCharacterInfo from '@/services/hooks/characters/useCharacterInfo'; const Cover = () => { diff --git a/app/(pages)/(content)/characters/[slug]/components/description.tsx b/features/characters/character-view/description.tsx similarity index 100% rename from app/(pages)/(content)/characters/[slug]/components/description.tsx rename to features/characters/character-view/description.tsx index 1354bbce..1180fa5f 100644 --- a/app/(pages)/(content)/characters/[slug]/components/description.tsx +++ b/features/characters/character-view/description.tsx @@ -1,14 +1,14 @@ 'use client'; -import { useState } from 'react'; - import { useParams } from 'next/navigation'; +import { useState } from 'react'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import TextExpand from '@/components/text-expand'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; + import useCharacterInfo from '@/services/hooks/characters/useCharacterInfo'; const Description = () => { diff --git a/app/(pages)/(content)/characters/[slug]/components/title.tsx b/features/characters/character-view/title.tsx similarity index 96% rename from app/(pages)/(content)/characters/[slug]/components/title.tsx rename to features/characters/character-view/title.tsx index 5e6b2869..d4181822 100644 --- a/app/(pages)/(content)/characters/[slug]/components/title.tsx +++ b/features/characters/character-view/title.tsx @@ -2,9 +2,10 @@ import { useParams } from 'next/navigation'; -import EditButton from '@/app/(pages)/(content)/components/edit-button'; +import EditButton from '@/components/edit-button'; import H2 from '@/components/typography/h2'; import P from '@/components/typography/p'; + import useSession from '@/services/hooks/auth/useSession'; import useCharacterInfo from '@/services/hooks/characters/useCharacterInfo'; diff --git a/app/(pages)/(content)/characters/[slug]/components/voices.tsx b/features/characters/character-view/voices.tsx similarity index 98% rename from app/(pages)/(content)/characters/[slug]/components/voices.tsx rename to features/characters/character-view/voices.tsx index e68fcd54..313e19ac 100644 --- a/app/(pages)/(content)/characters/[slug]/components/voices.tsx +++ b/features/characters/character-view/voices.tsx @@ -1,14 +1,13 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useCharacterVoices from '@/services/hooks/characters/useCharacterVoices'; import VoiceCard from '../../../components/voice-card'; diff --git a/app/(pages)/collections/new/components/anilist-collection.tsx b/features/collections/collection-edit/anilist-collection.tsx similarity index 100% rename from app/(pages)/collections/new/components/anilist-collection.tsx rename to features/collections/collection-edit/anilist-collection.tsx index 42c444b8..ff63bb40 100644 --- a/app/(pages)/collections/new/components/anilist-collection.tsx +++ b/features/collections/collection-edit/anilist-collection.tsx @@ -1,14 +1,13 @@ 'use client'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useMutation } from '@tanstack/react-query'; import { useSnackbar } from 'notistack'; import * as React from 'react'; import { Dispatch, FC, SetStateAction, useState } from 'react'; import { useForm } from 'react-hook-form'; import MaterialSymbolsCheckSmallRounded from '~icons/material-symbols/check-small-rounded'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { useMutation } from '@tanstack/react-query'; - import FormInput from '@/components/form/form-input'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; @@ -22,6 +21,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select'; + import getAnimeFromMAL from '@/services/api/integrations/mal/getAnimeFromMAL'; import importAnilistWatch from '@/services/api/settings/importAnilistWatch'; import { State } from '@/services/providers/collection-provider'; diff --git a/app/(pages)/collections/new/components/collection-grid/collection-grid.tsx b/features/collections/collection-edit/collection-grid/collection-grid.tsx similarity index 93% rename from app/(pages)/collections/new/components/collection-grid/collection-grid.tsx rename to features/collections/collection-edit/collection-grid/collection-grid.tsx index 048af70b..2584bef7 100644 --- a/app/(pages)/collections/new/components/collection-grid/collection-grid.tsx +++ b/features/collections/collection-edit/collection-grid/collection-grid.tsx @@ -1,8 +1,5 @@ 'use client'; -import React, { FC } from 'react'; -import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; - import { DndContext, DragEndEvent, @@ -17,11 +14,15 @@ import { arrayMove, rectSortingStrategy, } from '@dnd-kit/sortable'; +import { FC } from 'react'; +import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; -import SortableCard from '@/app/(pages)/collections/new/components/collection-grid/components/ui/sortable-card'; import ContentCard from '@/components/content-card/content-card'; -import SearchModal from '@/components/modals/search-modal'; import Header from '@/components/ui/header'; + +import SortableCard from '@/features/collections/collection-edit/collection-grid/sortable-card'; +import SearchModal from '@/features/modals/search-modal/search-modal'; + import { Group as CollectionGroup, Item as CollectionItem, @@ -154,7 +155,9 @@ const CollectionGrid: FC = ({ group }) => { handleAddItem(value as API.MainContent)} + onClick={(value) => + handleAddItem(value as API.MainContent) + } type="button" > { const { groups: items, setState: setCollectionState } = diff --git a/app/(pages)/collections/new/components/collection-settings/components/ui/sortable-input.tsx b/features/collections/collection-edit/collection-settings/sortable-input.tsx similarity index 99% rename from app/(pages)/collections/new/components/collection-settings/components/ui/sortable-input.tsx rename to features/collections/collection-edit/collection-settings/sortable-input.tsx index 12d6dd36..1512d5aa 100644 --- a/app/(pages)/collections/new/components/collection-settings/components/ui/sortable-input.tsx +++ b/features/collections/collection-edit/collection-settings/sortable-input.tsx @@ -1,10 +1,9 @@ +import { useSortable } from '@dnd-kit/sortable'; +import { CSS } from '@dnd-kit/utilities'; import React, { FC } from 'react'; import MaterialSymbolsDeleteForever from '~icons/material-symbols/delete-forever'; import MaterialSymbolsDragIndicator from '~icons/material-symbols/drag-indicator'; -import { useSortable } from '@dnd-kit/sortable'; -import { CSS } from '@dnd-kit/utilities'; - import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; diff --git a/app/(pages)/collections/new/components/collection-title.tsx b/features/collections/collection-edit/collection-title.tsx similarity index 100% rename from app/(pages)/collections/new/components/collection-title.tsx rename to features/collections/collection-edit/collection-title.tsx index 8488b8f0..9bd8d03d 100644 --- a/app/(pages)/collections/new/components/collection-title.tsx +++ b/features/collections/collection-edit/collection-title.tsx @@ -1,11 +1,11 @@ 'use client'; -import React, { useEffect, useRef } from 'react'; - import { MDXEditorMethods } from '@mdxeditor/editor'; +import React, { useEffect, useRef } from 'react'; import MDEditor from '@/components/markdown/editor/MD-editor'; import Header from '@/components/ui/header'; + import { useCollectionContext } from '@/services/providers/collection-provider'; const CollectionTitle = () => { diff --git a/app/(pages)/collections/(collections)/components/ui/collection-item.tsx b/features/collections/collection-list/collection-item.tsx similarity index 100% rename from app/(pages)/collections/(collections)/components/ui/collection-item.tsx rename to features/collections/collection-list/collection-item.tsx index 81abd30a..80952c8d 100644 --- a/app/(pages)/collections/(collections)/components/ui/collection-item.tsx +++ b/features/collections/collection-list/collection-item.tsx @@ -1,19 +1,19 @@ 'use client'; +import Link from 'next/link'; import React, { FC, memo } from 'react'; import BxBxsUpvote from '~icons/bx/bxs-upvote'; import IconamoonCommentFill from '~icons/iconamoon/comment-fill'; import MaterialSymbolsGridViewRounded from '~icons/material-symbols/grid-view-rounded'; import MaterialSymbolsMoreHoriz from '~icons/material-symbols/more-horiz'; -import Link from 'next/link'; - import ContentCard from '@/components/content-card/content-card'; import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; import Stack from '@/components/ui/stack'; + import { CONTENT_TYPE_LINKS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/collections/(collections)/components/collection-list.tsx b/features/collections/collection-list/collection-list.tsx similarity index 91% rename from app/(pages)/collections/(collections)/components/collection-list.tsx rename to features/collections/collection-list/collection-list.tsx index 1e484dd7..06fac33b 100644 --- a/app/(pages)/collections/(collections)/components/collection-list.tsx +++ b/features/collections/collection-list/collection-list.tsx @@ -1,12 +1,12 @@ 'use client'; -import * as React from 'react'; import { FC, Fragment } from 'react'; import { Separator } from '@/components/ui/separator'; + import useCollections from '@/services/hooks/collections/useCollections'; -import CollectionItem from './ui/collection-item'; +import CollectionItem from './collection-item'; interface Props { page: number; diff --git a/app/(pages)/collections/(collections)/components/collection-sort.tsx b/features/collections/collection-list/collection-sort.tsx similarity index 100% rename from app/(pages)/collections/(collections)/components/collection-sort.tsx rename to features/collections/collection-list/collection-sort.tsx index c95f2034..1edd4d07 100644 --- a/app/(pages)/collections/(collections)/components/collection-sort.tsx +++ b/features/collections/collection-list/collection-sort.tsx @@ -1,10 +1,10 @@ 'use client'; -import * as React from 'react'; - import { useRouter, useSearchParams } from 'next/navigation'; +import * as React from 'react'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; + import createQueryString from '@/utils/createQueryString'; const CollectionSort = () => { diff --git a/app/(pages)/collections/[reference]/components/collection-grid.tsx b/features/collections/collection-view/collection-groups/collection-grid.tsx similarity index 99% rename from app/(pages)/collections/[reference]/components/collection-grid.tsx rename to features/collections/collection-view/collection-groups/collection-grid.tsx index 64f9b8db..a4601635 100644 --- a/app/(pages)/collections/[reference]/components/collection-grid.tsx +++ b/features/collections/collection-view/collection-groups/collection-grid.tsx @@ -5,6 +5,7 @@ import React, { FC, memo } from 'react'; import ContentCard from '@/components/content-card/content-card'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import { Group as CollectionGroup, useCollectionContext, diff --git a/app/(pages)/collections/[reference]/components/collection-groups.tsx b/features/collections/collection-view/collection-groups/collection-groups.tsx similarity index 99% rename from app/(pages)/collections/[reference]/components/collection-groups.tsx rename to features/collections/collection-view/collection-groups/collection-groups.tsx index b8663433..ad2e7ef3 100644 --- a/app/(pages)/collections/[reference]/components/collection-groups.tsx +++ b/features/collections/collection-view/collection-groups/collection-groups.tsx @@ -1,8 +1,7 @@ 'use client'; -import React, { useEffect } from 'react'; - import { useParams } from 'next/navigation'; +import React, { useEffect } from 'react'; import useCollection from '@/services/hooks/collections/useCollection'; import { useCollectionContext } from '@/services/providers/collection-provider'; diff --git a/app/(pages)/collections/[reference]/components/collection-info/components/collection-author.tsx b/features/collections/collection-view/collection-info/collection-author.tsx similarity index 100% rename from app/(pages)/collections/[reference]/components/collection-info/components/collection-author.tsx rename to features/collections/collection-view/collection-info/collection-author.tsx index 755c4c1f..3408f96b 100644 --- a/app/(pages)/collections/[reference]/components/collection-info/components/collection-author.tsx +++ b/features/collections/collection-view/collection-info/collection-author.tsx @@ -1,13 +1,13 @@ 'use client'; -import React from 'react'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import React from 'react'; import H5 from '@/components/typography/h5'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; + import useCollection from '@/services/hooks/collections/useCollection'; const CollectionAuthor = () => { diff --git a/app/(pages)/collections/[reference]/components/collection-info/components/collection-delete-modal.tsx b/features/collections/collection-view/collection-info/collection-delete-modal.tsx similarity index 100% rename from app/(pages)/collections/[reference]/components/collection-info/components/collection-delete-modal.tsx rename to features/collections/collection-view/collection-info/collection-delete-modal.tsx index d9417911..9c4b3661 100644 --- a/app/(pages)/collections/[reference]/components/collection-info/components/collection-delete-modal.tsx +++ b/features/collections/collection-view/collection-info/collection-delete-modal.tsx @@ -1,10 +1,9 @@ 'use client'; +import { useParams } from 'next/navigation'; import React from 'react'; import MaterialSymbolsDeleteForeverRounded from '~icons/material-symbols/delete-forever-rounded'; -import { useParams } from 'next/navigation'; - import P from '@/components/typography/p'; import { AlertDialog, @@ -18,6 +17,7 @@ import { AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { Button } from '@/components/ui/button'; + import useCollection from '@/services/hooks/collections/useCollection'; import useDeleteCollection from '@/services/hooks/collections/useDeleteCollection'; diff --git a/app/(pages)/collections/[reference]/components/collection-info/collection-info.tsx b/features/collections/collection-view/collection-info/collection-info.tsx similarity index 93% rename from app/(pages)/collections/[reference]/components/collection-info/collection-info.tsx rename to features/collections/collection-view/collection-info/collection-info.tsx index 3919ee37..f053267a 100644 --- a/app/(pages)/collections/[reference]/components/collection-info/collection-info.tsx +++ b/features/collections/collection-view/collection-info/collection-info.tsx @@ -1,7 +1,5 @@ 'use client'; -import React from 'react'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; @@ -14,14 +12,14 @@ import Card from '@/components/ui/card'; import Header from '@/components/ui/header'; import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; + import useSession from '@/services/hooks/auth/useSession'; import useCollection from '@/services/hooks/collections/useCollection'; import { useCollectionContext } from '@/services/providers/collection-provider'; -import CollectionAuthor from './components/collection-author'; -import CollectionDeleteModal from './components/collection-delete-modal'; -import CollectionVote from './components/collection-vote'; - +import CollectionAuthor from './collection-author'; +import CollectionDeleteModal from './collection-delete-modal'; +import CollectionVote from './collection-vote'; const CollectionInfo = () => { const params = useParams(); @@ -45,7 +43,7 @@ const CollectionInfo = () => { return (
-
+
{tags.length > 0 && ( diff --git a/app/(pages)/collections/[reference]/components/collection-info/components/collection-vote.tsx b/features/collections/collection-view/collection-info/collection-vote.tsx similarity index 99% rename from app/(pages)/collections/[reference]/components/collection-info/components/collection-vote.tsx rename to features/collections/collection-view/collection-info/collection-vote.tsx index 7b3eeeba..e6be5c35 100644 --- a/app/(pages)/collections/[reference]/components/collection-info/components/collection-vote.tsx +++ b/features/collections/collection-view/collection-info/collection-vote.tsx @@ -1,18 +1,17 @@ 'use client'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useParams } from 'next/navigation'; import React from 'react'; import BxBxsDownvote from '~icons/bx/bxs-downvote'; import BxBxsUpvote from '~icons/bx/bxs-upvote'; import BxDownvote from '~icons/bx/downvote'; import BxUpvote from '~icons/bx/upvote'; -import { useParams } from 'next/navigation'; - -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; import Card from '@/components/ui/card'; import { Label } from '@/components/ui/label'; + import vote from '@/services/api/vote/vote'; import useSession from '@/services/hooks/auth/useSession'; import useCollection from '@/services/hooks/collections/useCollection'; diff --git a/app/(pages)/collections/[reference]/components/collection-title.tsx b/features/collections/collection-view/collection-title.tsx similarity index 99% rename from app/(pages)/collections/[reference]/components/collection-title.tsx rename to features/collections/collection-view/collection-title.tsx index cca2e474..1bc536d2 100644 --- a/app/(pages)/collections/[reference]/components/collection-title.tsx +++ b/features/collections/collection-view/collection-title.tsx @@ -5,6 +5,7 @@ import React from 'react'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import TextExpand from '@/components/text-expand'; import Header from '@/components/ui/header'; + import { useCollectionContext } from '@/services/providers/collection-provider'; const CollectionTitle = () => { diff --git a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content-header.tsx b/features/comments/comment-content-header.tsx similarity index 52% rename from app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content-header.tsx rename to features/comments/comment-content-header.tsx index 9bae0c8a..76f569bb 100644 --- a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content-header.tsx +++ b/features/comments/comment-content-header.tsx @@ -2,34 +2,34 @@ import { FC } from 'react'; - - -import useContent from '@/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/useContent'; import P from '@/components/typography/p'; import Header from '@/components/ui/header'; -import { CONTENT_TYPE_LINKS, CONTENT_TYPES } from '@/utils/constants'; +import useContent from '@/features/comments/useContent'; + +import { CONTENT_TYPES, CONTENT_TYPE_LINKS } from '@/utils/constants'; interface Props { slug: string; content_type: API.ContentType; } -const ContentHeader: FC = ({ slug, content_type }) => { +const CommentContentHeader: FC = ({ slug, content_type }) => { const { data } = useContent({ content_type, - slug - }) + slug, + }); const link = `${CONTENT_TYPE_LINKS[content_type]}/${slug}`; - return (
-

{CONTENT_TYPES[content_type].title_ua}

+

+ {CONTENT_TYPES[content_type].title_ua} +

- ) -} + ); +}; -export default ContentHeader; \ No newline at end of file +export default CommentContentHeader; diff --git a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content.tsx b/features/comments/comment-content.tsx similarity index 85% rename from app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content.tsx rename to features/comments/comment-content.tsx index d91c4c30..bde0fb07 100644 --- a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/content.tsx +++ b/features/comments/comment-content.tsx @@ -1,24 +1,21 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; +import { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import Block from '@/components/ui/block'; -import Header from '@/components/ui/header'; + import { CONTENT_TYPE_LINKS } from '@/utils/constants'; import useContent from './useContent'; - interface Props { slug: string; content_type: API.ContentType; } -const Content: FC = ({ slug, content_type }) => { +const CommentContent: FC = ({ slug, content_type }) => { const { data } = useContent({ content_type, slug }); const link = `${CONTENT_TYPE_LINKS[content_type]}/${slug}`; @@ -38,4 +35,4 @@ const Content: FC = ({ slug, content_type }) => { ); }; -export default Content; +export default CommentContent; diff --git a/components/comments/components/comment-input.tsx b/features/comments/comment-list/comment-input.tsx similarity index 98% rename from components/comments/components/comment-input.tsx rename to features/comments/comment-list/comment-input.tsx index 2cfbd956..0545938f 100644 --- a/components/comments/components/comment-input.tsx +++ b/features/comments/comment-list/comment-input.tsx @@ -1,12 +1,11 @@ 'use client'; -import React, { FC, ForwardedRef, forwardRef, useRef } from 'react'; -import { useForm } from 'react-hook-form'; -import MaterialSymbolsReplyRounded from '~icons/material-symbols/reply-rounded'; - import { zodResolver } from '@hookform/resolvers/zod'; import { MDXEditorMethods } from '@mdxeditor/editor'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { FC, ForwardedRef, forwardRef, useRef } from 'react'; +import { useForm } from 'react-hook-form'; +import MaterialSymbolsReplyRounded from '~icons/material-symbols/reply-rounded'; import FormMarkdown from '@/components/form/form-markdown'; import { Avatar, AvatarImage } from '@/components/ui/avatar'; @@ -14,6 +13,7 @@ import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; import { Label } from '@/components/ui/label'; + import addComment from '@/services/api/comments/addComment'; import editComment from '@/services/api/comments/editComment'; import { useCommentsContext } from '@/services/providers/comments-provider'; diff --git a/components/comments/comments.tsx b/features/comments/comment-list/comment-list.tsx similarity index 91% rename from components/comments/comments.tsx rename to features/comments/comment-list/comment-list.tsx index 4a88c7cf..727de448 100644 --- a/components/comments/comments.tsx +++ b/features/comments/comment-list/comment-list.tsx @@ -1,16 +1,17 @@ 'use client'; -import React, { FC } from 'react'; - import Link from 'next/link'; +import { FC } from 'react'; -import CommentInput from '@/components/comments/components/comment-input'; -import Comments from '@/components/comments/components/comments'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; import NotFound from '@/components/ui/not-found'; + +import CommentInput from '@/features/comments/comment-list/comment-input'; +import Comments from '@/features/comments/comment-list/comments'; + import useSession from '@/services/hooks/auth/useSession'; import useCommentThread from '@/services/hooks/comments/useCommentThread'; import useComments from '@/services/hooks/comments/useComments'; @@ -22,11 +23,7 @@ interface Props { comment_reference?: string; } -const CommentsBlock: FC = ({ - slug, - content_type, - comment_reference, -}) => { +const CommentList: FC = ({ slug, content_type, comment_reference }) => { const { user: loggedUser } = useSession(); const { list: comments, @@ -97,4 +94,4 @@ const CommentsBlock: FC = ({ ); }; -export default CommentsBlock; +export default CommentList; diff --git a/components/comments/components/comment-menu.tsx b/features/comments/comment-list/comment-menu.tsx similarity index 99% rename from components/comments/components/comment-menu.tsx rename to features/comments/comment-list/comment-menu.tsx index 67f9312b..6544795e 100644 --- a/components/comments/components/comment-menu.tsx +++ b/features/comments/comment-list/comment-menu.tsx @@ -1,11 +1,11 @@ +import { useQueryClient } from '@tanstack/react-query'; import { useSnackbar } from 'notistack'; import React, { FC } from 'react'; import MaterialSymbolsDeleteForeverRounded from '~icons/material-symbols/delete-forever-rounded'; import MaterialSymbolsEditRounded from '~icons/material-symbols/edit-rounded'; +import MaterialSymbolsLinkRounded from '~icons/material-symbols/link-rounded'; import MaterialSymbolsMoreHoriz from '~icons/material-symbols/more-horiz'; -import { useQueryClient } from '@tanstack/react-query'; - import { AlertDialog, AlertDialogAction, @@ -24,9 +24,9 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; + import deleteComment from '@/services/api/comments/deleteComment'; import { useCommentsContext } from '@/services/providers/comments-provider'; -import MaterialSymbolsLinkRounded from '~icons/material-symbols/link-rounded' interface Props { comment: API.Comment; diff --git a/components/comments/components/comment-vote.tsx b/features/comments/comment-list/comment-vote.tsx similarity index 100% rename from components/comments/components/comment-vote.tsx rename to features/comments/comment-list/comment-vote.tsx index fe7783f6..e85a5aca 100644 --- a/components/comments/components/comment-vote.tsx +++ b/features/comments/comment-list/comment-vote.tsx @@ -1,13 +1,13 @@ +import { useMutation, useQueryClient } from '@tanstack/react-query'; import { FC } from 'react'; import BxBxsDownvote from '~icons/bx/bxs-downvote'; import BxBxsUpvote from '~icons/bx/bxs-upvote'; import BxDownvote from '~icons/bx/downvote'; import BxUpvote from '~icons/bx/upvote'; -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; + import vote from '@/services/api/vote/vote'; import useSession from '@/services/hooks/auth/useSession'; import { cn } from '@/utils/utils'; diff --git a/components/comments/components/comment.tsx b/features/comments/comment-list/comment.tsx similarity index 94% rename from components/comments/components/comment.tsx rename to features/comments/comment-list/comment.tsx index c7786c5a..5ba6571e 100644 --- a/components/comments/components/comment.tsx +++ b/features/comments/comment-list/comment.tsx @@ -1,15 +1,10 @@ +import { useQueryClient } from '@tanstack/react-query'; import { formatDistance } from 'date-fns'; -import React, { FC, useEffect, useState } from 'react'; +import Link from 'next/link'; +import { FC, useEffect, useState } from 'react'; import MaterialSymbolsKeyboardArrowDownRounded from '~icons/material-symbols/keyboard-arrow-down-rounded'; import MaterialSymbolsLinkRounded from '~icons/material-symbols/link-rounded'; -import Link from 'next/link'; - -import { useQueryClient } from '@tanstack/react-query'; - -import CommentInput from '@/components/comments/components/comment-input'; -import CommentMenu from '@/components/comments/components/comment-menu'; -import CommentVote from '@/components/comments/components/comment-vote'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import TextExpand from '@/components/text-expand'; import H5 from '@/components/typography/h5'; @@ -17,12 +12,16 @@ import P from '@/components/typography/p'; import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Button } from '@/components/ui/button'; + +import CommentInput from '@/features/comments/comment-list/comment-input'; +import CommentMenu from '@/features/comments/comment-list/comment-menu'; +import CommentVote from '@/features/comments/comment-list/comment-vote'; + import { useCommentsContext } from '@/services/providers/comments-provider'; import getDeclensionWord from '@/utils/getDeclensionWord'; import Comments from './comments'; - interface Props { comment: API.Comment; slug: string; @@ -122,7 +121,9 @@ const Comment: FC = ({ comment, slug, content_type }) => { ) ) : ( -

Коментар видалено

+

+ Коментар видалено +

)}
diff --git a/components/comments/components/comments.tsx b/features/comments/comment-list/comments.tsx similarity index 100% rename from components/comments/components/comments.tsx rename to features/comments/comment-list/comments.tsx diff --git a/app/(pages)/comments/latest/components/comments.tsx b/features/comments/latest-comments.tsx similarity index 99% rename from app/(pages)/comments/latest/components/comments.tsx rename to features/comments/latest-comments.tsx index b65118fe..4f13b31e 100644 --- a/app/(pages)/comments/latest/components/comments.tsx +++ b/features/comments/latest-comments.tsx @@ -12,6 +12,7 @@ import Header from '@/components/ui/header'; import HorizontalCard from '@/components/ui/horizontal-card'; import NotFound from '@/components/ui/not-found'; import Stack from '@/components/ui/stack'; + import useGlobalComments from '@/services/hooks/comments/useGlobalComments'; import { CONTENT_TYPE_LINKS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/useContent.ts b/features/comments/useContent.ts similarity index 100% rename from app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/components/useContent.ts rename to features/comments/useContent.ts diff --git a/app/(pages)/components/footer.tsx b/features/common/footer.tsx similarity index 100% rename from app/(pages)/components/footer.tsx rename to features/common/footer.tsx index f7765529..41234931 100644 --- a/app/(pages)/components/footer.tsx +++ b/features/common/footer.tsx @@ -1,13 +1,12 @@ 'use client'; +import Link from 'next/link'; import * as React from 'react'; import ArcticonsMonobank from '~icons/arcticons/monobank'; import MdiGithub from '~icons/mdi/github'; import MingcuteTelegramFill from '~icons/mingcute/telegram-fill'; import SimpleIconsBuymeacoffee from '~icons/simple-icons/buymeacoffee'; -import Link from 'next/link'; - import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -16,6 +15,7 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Label } from '@/components/ui/label'; + import { useModalContext } from '@/services/providers/modal-provider'; import RightHolder from './rightholder'; diff --git a/app/(pages)/components/modal-manager.tsx b/features/common/modal-manager.tsx similarity index 88% rename from app/(pages)/components/modal-manager.tsx rename to features/common/modal-manager.tsx index 47c6313e..5c87d8d6 100644 --- a/app/(pages)/components/modal-manager.tsx +++ b/features/common/modal-manager.tsx @@ -1,10 +1,10 @@ 'use client'; -import React, { memo, useEffect } from 'react'; - import { useSearchParams } from 'next/navigation'; +import { memo, useEffect } from 'react'; + +import AuthModal from '@/features/modals/auth-modal/auth-modal'; -import AuthModal from '@/components/modals/auth-modal'; import { useModalContext } from '@/services/providers/modal-provider'; const ModalManager = () => { diff --git a/app/(pages)/components/navbar/navbar.tsx b/features/common/navbar/navbar.tsx similarity index 92% rename from app/(pages)/components/navbar/navbar.tsx rename to features/common/navbar/navbar.tsx index 56478d64..52332083 100644 --- a/app/(pages)/components/navbar/navbar.tsx +++ b/features/common/navbar/navbar.tsx @@ -1,22 +1,23 @@ 'use client'; import clsx from 'clsx'; -import React from 'react'; - import Link from 'next/link'; -import NotificationsMenu from '@/app/(pages)/components/navbar/components/notifications-menu'; -import ProfileMenu from '@/app/(pages)/components/navbar/components/profile-menu'; -import AuthModal from '@/components/modals/auth-modal/auth-modal'; -import SearchModal from '@/components/modals/search-modal/search-modal'; import NavMenu from '@/components/navigation/nav-dropdown'; import { Button } from '@/components/ui/button'; + +import ProfileMenu from '@/features/common/navbar/profile-menu'; +import AuthModal from '@/features/modals/auth-modal/auth-modal'; +import SearchModal from '@/features/modals/search-modal/search-modal'; + import useSession from '@/services/hooks/auth/useSession'; import { useMediaQuery } from '@/services/hooks/useMediaQuery'; import useScrollTrigger from '@/services/hooks/useScrollTrigger'; import { useModalContext } from '@/services/providers/modal-provider'; import { GENERAL_NAV_ROUTES } from '@/utils/constants'; +import NotificationsMenu from './notifications-menu/notifications-menu'; + const Navbar = () => { const isDesktop = useMediaQuery('(min-width: 768px)'); const { openModal } = useModalContext(); diff --git a/app/(pages)/components/navbar/components/notifications-menu/components/not-found-notifications.tsx b/features/common/navbar/notifications-menu/not-found-notifications.tsx similarity index 96% rename from app/(pages)/components/navbar/components/notifications-menu/components/not-found-notifications.tsx rename to features/common/navbar/notifications-menu/not-found-notifications.tsx index 398d1ae2..35cf8d5d 100644 --- a/app/(pages)/components/navbar/components/notifications-menu/components/not-found-notifications.tsx +++ b/features/common/navbar/notifications-menu/not-found-notifications.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { FC } from 'react'; +import { FC } from 'react'; import MaterialSymbolsNotificationImportantRounded from '~icons/material-symbols/notification-important-rounded'; import P from '@/components/typography/p'; diff --git a/app/(pages)/components/navbar/components/notifications-menu/components/ui/notification-item.tsx b/features/common/navbar/notifications-menu/notification-item.tsx similarity index 100% rename from app/(pages)/components/navbar/components/notifications-menu/components/ui/notification-item.tsx rename to features/common/navbar/notifications-menu/notification-item.tsx index b28e26bd..ea04b953 100644 --- a/app/(pages)/components/navbar/components/notifications-menu/components/ui/notification-item.tsx +++ b/features/common/navbar/notifications-menu/notification-item.tsx @@ -1,14 +1,14 @@ 'use client'; import { formatDistance } from 'date-fns'; -import React, { FC } from 'react'; - import Link from 'next/link'; +import React, { FC } from 'react'; import P from '@/components/typography/p'; import Small from '@/components/typography/small'; import { DropdownMenuItem } from '@/components/ui/dropdown-menu'; import { Label } from '@/components/ui/label'; + import useSeenNotification from '@/services/hooks/notifications/useSeenNotification'; interface Props { diff --git a/app/(pages)/components/navbar/components/notifications-menu/notifications-menu.tsx b/features/common/navbar/notifications-menu/notifications-menu.tsx similarity index 95% rename from app/(pages)/components/navbar/components/notifications-menu/notifications-menu.tsx rename to features/common/navbar/notifications-menu/notifications-menu.tsx index 4fa254f6..1a192aeb 100644 --- a/app/(pages)/components/navbar/components/notifications-menu/notifications-menu.tsx +++ b/features/common/navbar/notifications-menu/notifications-menu.tsx @@ -1,6 +1,5 @@ 'use client'; -import React from 'react'; import MaterialSymbolsNotificationsRounded from '~icons/material-symbols/notifications-rounded'; import LoadMoreButton from '@/components/load-more-button'; @@ -13,13 +12,14 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; + import useNotifications from '@/services/hooks/notifications/useNotifications'; import useNotificationsCount from '@/services/hooks/notifications/useNotificationsCount'; import useSeenNotification from '@/services/hooks/notifications/useSeenNotification'; import { convertNotification } from '@/utils/convertNotification'; -import NotFoundNotifications from './components/not-found-notifications'; -import NotificationItem from './components/ui/notification-item'; +import NotFoundNotifications from './not-found-notifications'; +import NotificationItem from './notification-item'; const NotificationsMenu = () => { const { data: countData } = useNotificationsCount(); diff --git a/app/(pages)/components/navbar/components/profile-menu.tsx b/features/common/navbar/profile-menu.tsx similarity index 97% rename from app/(pages)/components/navbar/components/profile-menu.tsx rename to features/common/navbar/profile-menu.tsx index a5ae93fd..11806604 100644 --- a/app/(pages)/components/navbar/components/profile-menu.tsx +++ b/features/common/navbar/profile-menu.tsx @@ -1,15 +1,12 @@ 'use client'; -import React from 'react'; +import Link from 'next/link'; import MaterialSymbolsEventList from '~icons/material-symbols/event-list'; import MaterialSymbolsFavoriteRounded from '~icons/material-symbols/favorite-rounded'; import MaterialSymbolsLogoutRounded from '~icons/material-symbols/logout-rounded'; import MaterialSymbolsPerson from '~icons/material-symbols/person'; import MaterialSymbolsSettingsOutline from '~icons/material-symbols/settings-outline'; -import Link from 'next/link'; - -import SettingsModal from '@/components/modals/user-settings-modal/user-settings-modal'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Button } from '@/components/ui/button'; import { @@ -21,6 +18,9 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; import { Label } from '@/components/ui/label'; + +import SettingsModal from '@/features/modals/user-settings-modal/user-settings-modal'; + import useSession from '@/services/hooks/auth/useSession'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/app/(pages)/components/providers.tsx b/features/common/providers.tsx similarity index 100% rename from app/(pages)/components/providers.tsx rename to features/common/providers.tsx index 04b19915..b5d9731e 100644 --- a/app/(pages)/components/providers.tsx +++ b/features/common/providers.tsx @@ -1,16 +1,16 @@ 'use client'; +import { MutationCache, QueryClientProvider } from '@tanstack/react-query'; +import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { uk } from 'date-fns/locale'; import setDefaultOptions from 'date-fns/setDefaultOptions'; import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; import { SnackbarProvider, enqueueSnackbar } from 'notistack'; import React, { FC, PropsWithChildren, useState } from 'react'; -import { MutationCache, QueryClientProvider } from '@tanstack/react-query'; -import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; - import SnackbarItem from '@/components/snackbar-item'; import { TooltipProvider } from '@/components/ui/tooltip'; + import ModalProvider from '@/services/providers/modal-provider'; import SettingsProvider from '@/services/providers/settings-provider'; import ThemeProvider from '@/services/providers/theme-provider'; diff --git a/app/(pages)/components/rightholder.tsx b/features/common/rightholder.tsx similarity index 100% rename from app/(pages)/components/rightholder.tsx rename to features/common/rightholder.tsx diff --git a/app/(pages)/components/scroll-top.tsx b/features/common/scroll-top.tsx similarity index 99% rename from app/(pages)/components/scroll-top.tsx rename to features/common/scroll-top.tsx index 4ce3bf9a..a475b191 100644 --- a/app/(pages)/components/scroll-top.tsx +++ b/features/common/scroll-top.tsx @@ -1,8 +1,7 @@ 'use client'; -import { useEffect } from 'react'; - import { usePathname } from 'next/navigation'; +import { useEffect } from 'react'; const ScrollTop = () => { const pathname = usePathname(); diff --git a/app/(pages)/components/session-manager.tsx b/features/common/session-manager.tsx similarity index 99% rename from app/(pages)/components/session-manager.tsx rename to features/common/session-manager.tsx index 9a906a76..037dad1a 100644 --- a/app/(pages)/components/session-manager.tsx +++ b/features/common/session-manager.tsx @@ -1,7 +1,6 @@ -import { PropsWithChildren } from 'react'; - import { dehydrate } from '@tanstack/query-core'; import { HydrationBoundary } from '@tanstack/react-query'; +import { PropsWithChildren } from 'react'; import getLoggedUserInfo from '@/services/api/user/getLoggedUserInfo'; import { getCookie } from '@/utils/cookies'; diff --git a/app/(pages)/edit/[editId]/components/actions/components/accept-action.tsx b/features/edit/edit-actions/accept-action.tsx similarity index 99% rename from app/(pages)/edit/[editId]/components/actions/components/accept-action.tsx rename to features/edit/edit-actions/accept-action.tsx index 4de51520..df365ff9 100644 --- a/app/(pages)/edit/[editId]/components/actions/components/accept-action.tsx +++ b/features/edit/edit-actions/accept-action.tsx @@ -1,13 +1,12 @@ 'use client'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; -import { useParams } from 'next/navigation'; - -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; + import acceptEdit from '@/services/api/edit/acceptEdit'; interface Props {} diff --git a/app/(pages)/edit/[editId]/components/actions/components/close-action.tsx b/features/edit/edit-actions/close-action.tsx similarity index 99% rename from app/(pages)/edit/[editId]/components/actions/components/close-action.tsx rename to features/edit/edit-actions/close-action.tsx index 4c72c089..659e60ed 100644 --- a/app/(pages)/edit/[editId]/components/actions/components/close-action.tsx +++ b/features/edit/edit-actions/close-action.tsx @@ -1,13 +1,12 @@ 'use client'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; -import { useParams } from 'next/navigation'; - -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; + import closeEdit from '@/services/api/edit/closeEdit'; interface Props {} diff --git a/app/(pages)/edit/[editId]/components/actions/components/deny-action.tsx b/features/edit/edit-actions/deny-action.tsx similarity index 99% rename from app/(pages)/edit/[editId]/components/actions/components/deny-action.tsx rename to features/edit/edit-actions/deny-action.tsx index 07d0bc99..c1c05bbe 100644 --- a/app/(pages)/edit/[editId]/components/actions/components/deny-action.tsx +++ b/features/edit/edit-actions/deny-action.tsx @@ -1,12 +1,10 @@ 'use client'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; -import { useParams } from 'next/navigation'; - -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { AlertDialog, AlertDialogAction, @@ -18,6 +16,7 @@ import { AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { Button } from '@/components/ui/button'; + import denyEdit from '@/services/api/edit/denyEdit'; interface Props {} diff --git a/app/(pages)/edit/[editId]/components/actions/actions.tsx b/features/edit/edit-actions/edit-actions.tsx similarity index 81% rename from app/(pages)/edit/[editId]/components/actions/actions.tsx rename to features/edit/edit-actions/edit-actions.tsx index 0e29a26a..6b508f4e 100644 --- a/app/(pages)/edit/[editId]/components/actions/actions.tsx +++ b/features/edit/edit-actions/edit-actions.tsx @@ -1,24 +1,23 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import { FC } from 'react'; import { Button } from '@/components/ui/button'; + import useSession from '@/services/hooks/auth/useSession'; import useEdit from '@/services/hooks/edit/useEdit'; -import AcceptAction from './components/accept-action'; -import CloseAction from './components/close-action'; -import DenyAction from './components/deny-action'; +import AcceptAction from './accept-action'; +import CloseAction from './close-action'; +import DenyAction from './deny-action'; interface Props { editId: string; } -const Actions: FC = ({ editId }) => { +const EditActions: FC = ({ editId }) => { const { data: edit } = useEdit({ editId: Number(editId) }); const params = useParams(); @@ -26,7 +25,8 @@ const Actions: FC = ({ editId }) => { const isPending = edit?.status === 'pending'; const isAuthor = loggedUser?.username === edit?.author?.username; - const isModeratorOrAdmin = loggedUser && ['moderator', 'admin'].includes(loggedUser?.role); + const isModeratorOrAdmin = + loggedUser && ['moderator', 'admin'].includes(loggedUser?.role); if (!isPending) { return null; @@ -58,4 +58,4 @@ const Actions: FC = ({ editId }) => { ); }; -export default Actions; \ No newline at end of file +export default EditActions; diff --git a/app/(pages)/edit/[editId]/components/author.tsx b/features/edit/edit-author.tsx similarity index 95% rename from app/(pages)/edit/[editId]/components/author.tsx rename to features/edit/edit-author.tsx index 6f9707df..407b313d 100644 --- a/app/(pages)/edit/[editId]/components/author.tsx +++ b/features/edit/edit-author.tsx @@ -1,22 +1,21 @@ 'use client'; import { format } from 'date-fns'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; +import { FC } from 'react'; import H5 from '@/components/typography/h5'; import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; + import useEdit from '@/services/hooks/edit/useEdit'; interface Props { editId: string; } -const Author: FC = ({ editId }) => { +const EditAuthor: FC = ({ editId }) => { const { data: edit } = useEdit({ editId: Number(editId) }); if (!edit) { @@ -56,4 +55,4 @@ const Author: FC = ({ editId }) => { ); }; -export default Author; +export default EditAuthor; diff --git a/app/(pages)/edit/content/components/content-list.tsx b/features/edit/edit-content-list.tsx similarity index 100% rename from app/(pages)/edit/content/components/content-list.tsx rename to features/edit/edit-content-list.tsx index f34533d6..7915b0f8 100644 --- a/app/(pages)/edit/content/components/content-list.tsx +++ b/features/edit/edit-content-list.tsx @@ -1,11 +1,10 @@ 'use client'; +import { range } from '@antfu/utils'; import clsx from 'clsx'; import * as React from 'react'; import { FC, useState } from 'react'; -import { range } from '@antfu/utils'; - import ContentCard from '@/components/content-card/content-card'; import LoadMoreButton from '@/components/load-more-button'; import SkeletonCard from '@/components/skeletons/content-card'; @@ -21,6 +20,7 @@ import { SelectList, SelectTrigger, } from '@/components/ui/select'; + import useTodoAnime from '@/services/hooks/edit/todo/useTodoAnime'; interface Props { diff --git a/app/(pages)/edit/components/content/components/details.tsx b/features/edit/edit-content/details.tsx similarity index 100% rename from app/(pages)/edit/components/content/components/details.tsx rename to features/edit/edit-content/details.tsx diff --git a/app/(pages)/edit/components/content/content.tsx b/features/edit/edit-content/edit-content.tsx similarity index 86% rename from app/(pages)/edit/components/content/content.tsx rename to features/edit/edit-content/edit-content.tsx index e36a07a7..ac9c9d6b 100644 --- a/app/(pages)/edit/components/content/content.tsx +++ b/features/edit/edit-content/edit-content.tsx @@ -3,11 +3,13 @@ import * as React from 'react'; import { FC } from 'react'; -import Details from '@/app/(pages)/edit/components/content/components/details'; -import General from '@/app/(pages)/edit/components/content/components/general'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; + +import Details from '@/features/edit/edit-content/details'; +import General from '@/features/edit/edit-content/general'; + import { CONTENT_TYPE_LINKS } from '@/utils/constants'; interface Props { @@ -16,7 +18,7 @@ interface Props { content?: API.MainContent; } -const Content: FC = ({ slug, content_type, content }) => { +const EditContent: FC = ({ slug, content_type, content }) => { const [type, setType] = React.useState<'general' | 'details'>('details'); if (!content) { @@ -58,4 +60,4 @@ const Content: FC = ({ slug, content_type, content }) => { ); }; -export default Content; +export default EditContent; diff --git a/app/(pages)/edit/components/content/components/general.tsx b/features/edit/edit-content/general.tsx similarity index 99% rename from app/(pages)/edit/components/content/components/general.tsx rename to features/edit/edit-content/general.tsx index ab6e59e7..eae42e44 100644 --- a/app/(pages)/edit/components/content/components/general.tsx +++ b/features/edit/edit-content/general.tsx @@ -1,8 +1,7 @@ +import Link from 'next/link'; import * as React from 'react'; import { FC } from 'react'; -import Link from 'next/link'; - import ContentCard from '@/components/content-card/content-card'; interface Props { diff --git a/app/(pages)/edit/components/ui/auto-button.tsx b/features/edit/edit-forms/auto-button.tsx similarity index 99% rename from app/(pages)/edit/components/ui/auto-button.tsx rename to features/edit/edit-forms/auto-button.tsx index 054e4286..7eed3ac8 100644 --- a/app/(pages)/edit/components/ui/auto-button.tsx +++ b/features/edit/edit-forms/auto-button.tsx @@ -4,6 +4,7 @@ import * as React from 'react'; import { FC } from 'react'; import { Button } from '@/components/ui/button'; + import useSession from '@/services/hooks/auth/useSession'; interface Props { diff --git a/app/(pages)/edit/components/edit-form.tsx b/features/edit/edit-forms/edit-create-form.tsx similarity index 95% rename from app/(pages)/edit/components/edit-form.tsx rename to features/edit/edit-forms/edit-create-form.tsx index 88cfba6b..da199dbb 100644 --- a/app/(pages)/edit/components/edit-form.tsx +++ b/features/edit/edit-forms/edit-create-form.tsx @@ -1,17 +1,16 @@ 'use client'; -import * as React from 'react'; +import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; +import { useMutation } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; import { FC, useRef } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; -import { useRouter } from 'next/navigation'; +import { Button } from '@/components/ui/button'; -import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; -import { useMutation } from '@tanstack/react-query'; +import AutoButton from '@/features/edit/edit-forms/auto-button'; +import EditGroup from '@/features/edit/edit-forms/edit-group'; -import EditGroup from '@/app/(pages)/edit/components/edit-group'; -import AutoButton from '@/app/(pages)/edit/components/ui/auto-button'; -import { Button } from '@/components/ui/button'; import addEdit from '@/services/api/edit/addEdit'; import { getEditGroups, @@ -20,7 +19,7 @@ import { getFilteredEditParams, } from '@/utils/editParamUtils'; -import EditDescription from './edit-description'; +import EditDescription from './edit-description/edit-description'; type FormValues = Record & { description: string; diff --git a/app/(pages)/edit/components/edit-description/edit-description.tsx b/features/edit/edit-forms/edit-description/edit-description.tsx similarity index 97% rename from app/(pages)/edit/components/edit-description/edit-description.tsx rename to features/edit/edit-forms/edit-description/edit-description.tsx index 1910c5ee..58d242ca 100644 --- a/app/(pages)/edit/components/edit-description/edit-description.tsx +++ b/features/edit/edit-forms/edit-description/edit-description.tsx @@ -1,17 +1,18 @@ 'use client'; -import * as React from 'react'; import { FC } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import TagsModal from '@/app/(pages)/edit/components/edit-description/components/tags-modal'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'; import { Textarea } from '@/components/ui/textarea'; + import { useModalContext } from '@/services/providers/modal-provider'; import { useSettingsContext } from '@/services/providers/settings-provider'; +import TagsModal from './tags-modal'; + interface Props { mode: 'edit' | 'view'; } diff --git a/app/(pages)/edit/components/edit-description/components/tags-modal.tsx b/features/edit/edit-forms/edit-description/tags-modal.tsx similarity index 99% rename from app/(pages)/edit/components/edit-description/components/tags-modal.tsx rename to features/edit/edit-forms/edit-description/tags-modal.tsx index d66f1a6b..87fcea02 100644 --- a/app/(pages)/edit/components/edit-description/components/tags-modal.tsx +++ b/features/edit/edit-forms/edit-description/tags-modal.tsx @@ -13,6 +13,7 @@ import MaterialSymbolsDeleteForeverRounded from '~icons/material-symbols/delete- import P from '@/components/typography/p'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; + import { useModalContext } from '@/services/providers/modal-provider'; import { useSettingsContext } from '@/services/providers/settings-provider'; diff --git a/app/(pages)/edit/components/edit-group.tsx b/features/edit/edit-forms/edit-group.tsx similarity index 99% rename from app/(pages)/edit/components/edit-group.tsx rename to features/edit/edit-forms/edit-group.tsx index 13396ac2..c3e3d03b 100644 --- a/app/(pages)/edit/components/edit-group.tsx +++ b/features/edit/edit-forms/edit-group.tsx @@ -11,6 +11,7 @@ import { CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible'; + import { getEditParamComponent } from '@/utils/editParamUtils'; interface Props { diff --git a/app/(pages)/edit/components/ui/edit-status.tsx b/features/edit/edit-forms/edit-status.tsx similarity index 99% rename from app/(pages)/edit/components/ui/edit-status.tsx rename to features/edit/edit-forms/edit-status.tsx index 10985f1e..35cdb434 100644 --- a/app/(pages)/edit/components/ui/edit-status.tsx +++ b/features/edit/edit-forms/edit-status.tsx @@ -4,6 +4,7 @@ import * as React from 'react'; import { FC } from 'react'; import { Badge } from '@/components/ui/badge'; + import useEdit from '@/services/hooks/edit/useEdit'; import { EDIT_STATUS } from '@/utils/constants'; diff --git a/app/(pages)/edit/components/edit-view.tsx b/features/edit/edit-forms/edit-view-form.tsx similarity index 94% rename from app/(pages)/edit/components/edit-view.tsx rename to features/edit/edit-forms/edit-view-form.tsx index ab06b47e..429bcde9 100644 --- a/app/(pages)/edit/components/edit-view.tsx +++ b/features/edit/edit-forms/edit-view-form.tsx @@ -1,18 +1,17 @@ 'use client'; -import * as React from 'react'; +import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; import { FC, useRef } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; -import { useRouter } from 'next/navigation'; +import { Button } from '@/components/ui/button'; -import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; -import { useMutation, useQueryClient } from '@tanstack/react-query'; +import AutoButton from '@/features/edit/edit-forms/auto-button'; +import EditDescription from '@/features/edit/edit-forms/edit-description/edit-description'; +import EditGroup from '@/features/edit/edit-forms/edit-group'; -import EditDescription from '@/app/(pages)/edit/components/edit-description/edit-description'; -import EditGroup from '@/app/(pages)/edit/components/edit-group'; -import AutoButton from '@/app/(pages)/edit/components/ui/auto-button'; -import { Button } from '@/components/ui/button'; import updateEdit from '@/services/api/edit/updateEdit'; import useEdit from '@/services/hooks/edit/useEdit'; import { diff --git a/app/(pages)/edit/components/ui/input-param.tsx b/features/edit/edit-forms/params/input-param.tsx similarity index 100% rename from app/(pages)/edit/components/ui/input-param.tsx rename to features/edit/edit-forms/params/input-param.tsx index bccc2eed..1320ad0f 100644 --- a/app/(pages)/edit/components/ui/input-param.tsx +++ b/features/edit/edit-forms/params/input-param.tsx @@ -1,14 +1,14 @@ 'use client'; +import { useParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import { useParams } from 'next/navigation'; - import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; + import useEdit from '@/services/hooks/edit/useEdit'; interface Props { diff --git a/app/(pages)/edit/components/ui/list-param.tsx b/features/edit/edit-forms/params/list-param.tsx similarity index 100% rename from app/(pages)/edit/components/ui/list-param.tsx rename to features/edit/edit-forms/params/list-param.tsx diff --git a/app/(pages)/edit/components/ui/markdown-param.tsx b/features/edit/edit-forms/params/markdown-param.tsx similarity index 100% rename from app/(pages)/edit/components/ui/markdown-param.tsx rename to features/edit/edit-forms/params/markdown-param.tsx index 77c5e1b3..05708f91 100644 --- a/app/(pages)/edit/components/ui/markdown-param.tsx +++ b/features/edit/edit-forms/params/markdown-param.tsx @@ -1,15 +1,15 @@ 'use client'; +import { useParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import { useParams } from 'next/navigation'; - import MDEditor from '@/components/markdown/editor/MD-editor'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; + import useEdit from '@/services/hooks/edit/useEdit'; interface Props { diff --git a/app/(pages)/edit/components/edit-list/components/edit-head.tsx b/features/edit/edit-list/edit-head.tsx similarity index 95% rename from app/(pages)/edit/components/edit-list/components/edit-head.tsx rename to features/edit/edit-list/edit-head.tsx index 2b1434f5..5748438c 100644 --- a/app/(pages)/edit/components/edit-list/components/edit-head.tsx +++ b/features/edit/edit-list/edit-head.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { TableHead, TableHeader, TableRow } from '@/components/ui/table'; const EditHead = () => { diff --git a/app/(pages)/edit/components/edit-list/edit-list.tsx b/features/edit/edit-list/edit-list.tsx similarity index 73% rename from app/(pages)/edit/components/edit-list/edit-list.tsx rename to features/edit/edit-list/edit-list.tsx index b91800cd..851e3114 100644 --- a/app/(pages)/edit/components/edit-list/edit-list.tsx +++ b/features/edit/edit-list/edit-list.tsx @@ -1,15 +1,16 @@ 'use client'; -import * as React from 'react'; import { FC } from 'react'; -import EditHead from '@/app/(pages)/edit/components/edit-list/components/edit-head'; -import EditRow from '@/app/(pages)/edit/components/edit-list/components/edit-row'; -import EditSkeleton from '@/app/(pages)/edit/components/edit-list/components/edit-skeleton'; -import FiltersNotFound from '@/components/filters/components/filters-not-found'; import PagePagination from '@/components/page-pagination'; import Block from '@/components/ui/block'; import { Table, TableBody } from '@/components/ui/table'; + +import EditHead from '@/features/edit/edit-list/edit-head'; +import EditRow from '@/features/edit/edit-list/edit-row'; +import EditSkeleton from '@/features/edit/edit-list/edit-skeleton'; +import FiltersNotFound from '@/features/filters/filters-not-found'; + import useEditList from '@/services/hooks/edit/useEditList'; interface Props { diff --git a/app/(pages)/edit/components/edit-list/components/edit-row.tsx b/features/edit/edit-list/edit-row.tsx similarity index 99% rename from app/(pages)/edit/components/edit-list/components/edit-row.tsx rename to features/edit/edit-list/edit-row.tsx index ec50ef89..4349fb3c 100644 --- a/app/(pages)/edit/components/edit-list/components/edit-row.tsx +++ b/features/edit/edit-list/edit-row.tsx @@ -2,17 +2,16 @@ import clsx from 'clsx'; import { format } from 'date-fns'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; import { useRouter } from 'next/navigation'; +import { FC } from 'react'; import Small from '@/components/typography/small'; import { Avatar, AvatarImage } from '@/components/ui/avatar'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; import { TableCell, TableRow } from '@/components/ui/table'; + import { CONTENT_TYPES, CONTENT_TYPE_LINKS, diff --git a/app/(pages)/edit/components/edit-list/components/edit-skeleton.tsx b/features/edit/edit-list/edit-skeleton.tsx similarity index 83% rename from app/(pages)/edit/components/edit-list/components/edit-skeleton.tsx rename to features/edit/edit-list/edit-skeleton.tsx index 482e2ad7..4df3dd7b 100644 --- a/app/(pages)/edit/components/edit-list/components/edit-skeleton.tsx +++ b/features/edit/edit-list/edit-skeleton.tsx @@ -1,12 +1,11 @@ -import * as React from 'react'; - import { range } from '@antfu/utils'; -import EditHead from '@/app/(pages)/edit/components/edit-list/components/edit-head'; import EntryTableRow from '@/components/skeletons/entry-table-row'; import Block from '@/components/ui/block'; import { Table, TableBody } from '@/components/ui/table'; +import EditHead from '@/features/edit/edit-list/edit-head'; + const EditSkeleton = () => { return ( diff --git a/app/(pages)/edit/[editId]/components/moderator.tsx b/features/edit/edit-moderator.tsx similarity index 95% rename from app/(pages)/edit/[editId]/components/moderator.tsx rename to features/edit/edit-moderator.tsx index aa642aeb..184da8f4 100644 --- a/app/(pages)/edit/[editId]/components/moderator.tsx +++ b/features/edit/edit-moderator.tsx @@ -1,22 +1,21 @@ 'use client'; import { format } from 'date-fns'; -import * as React from 'react'; -import { FC } from 'react'; - import Link from 'next/link'; +import { FC } from 'react'; import H5 from '@/components/typography/h5'; import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; + import useEdit from '@/services/hooks/edit/useEdit'; interface Props { editId: string; } -const Moderator: FC = ({ editId }) => { +const EditModerator: FC = ({ editId }) => { const { data: edit } = useEdit({ editId: Number(editId) }); if (!edit || !edit.moderator) { @@ -62,4 +61,4 @@ const Moderator: FC = ({ editId }) => { ); }; -export default Moderator; +export default EditModerator; diff --git a/app/(pages)/edit/new/components/rules-alert.tsx b/features/edit/edit-rules-alert.tsx similarity index 96% rename from app/(pages)/edit/new/components/rules-alert.tsx rename to features/edit/edit-rules-alert.tsx index 99dea9d0..7b93bbc6 100644 --- a/app/(pages)/edit/new/components/rules-alert.tsx +++ b/features/edit/edit-rules-alert.tsx @@ -6,9 +6,10 @@ import MaterialSymbolsInfoRounded from '~icons/material-symbols/info-rounded'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; import { Button } from '@/components/ui/button'; + import { useModalContext } from '@/services/providers/modal-provider'; -const RulesAlert = () => { +const EditRulesAlert = () => { const [rules, setRules] = React.useState(''); const { openModal } = useModalContext(); @@ -49,4 +50,4 @@ const RulesAlert = () => { ); }; -export default RulesAlert; +export default EditRulesAlert; diff --git a/app/(pages)/edit/components/edit-top-stats/components/ui/edit-top-item.tsx b/features/edit/edit-top-stats/edit-top-item.tsx similarity index 100% rename from app/(pages)/edit/components/edit-top-stats/components/ui/edit-top-item.tsx rename to features/edit/edit-top-stats/edit-top-item.tsx index 6ca83f6a..b663fbfa 100644 --- a/app/(pages)/edit/components/edit-top-stats/components/ui/edit-top-item.tsx +++ b/features/edit/edit-top-stats/edit-top-item.tsx @@ -1,9 +1,8 @@ +import Link from 'next/link'; import * as React from 'react'; import { FC } from 'react'; import MaterialSymbolsKidStar from '~icons/material-symbols/kid-star'; -import Link from 'next/link'; - import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; @@ -12,6 +11,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import { cn } from '@/utils/utils'; interface Props { diff --git a/app/(pages)/edit/components/edit-top-stats/edit-top-stats.tsx b/features/edit/edit-top-stats/edit-top-stats.tsx similarity index 92% rename from app/(pages)/edit/components/edit-top-stats/edit-top-stats.tsx rename to features/edit/edit-top-stats/edit-top-stats.tsx index 3dd33923..5d0c0933 100644 --- a/app/(pages)/edit/components/edit-top-stats/edit-top-stats.tsx +++ b/features/edit/edit-top-stats/edit-top-stats.tsx @@ -1,18 +1,19 @@ 'use client'; -import * as React from 'react'; import MaterialSymbolsMoreHoriz from '~icons/material-symbols/more-horiz'; -import EditTopStatsModal from '@/components/modals/edit-top-stats-modal/edit-top-stats-modal'; import { Carousel, CarouselContent, CarouselItem, } from '@/components/ui/carousel'; + +import EditTopStatsModal from '@/features/modals/edit-top-stats-modal/edit-top-stats-modal'; + import useEditTop from '@/services/hooks/stats/edit/useEditTop'; import { useModalContext } from '@/services/providers/modal-provider'; -import EditTopItem from './components/ui/edit-top-item'; +import EditTopItem from './edit-top-item'; function EditTopStats() { const { openModal } = useModalContext(); diff --git a/components/filters/anime-filters.tsx b/features/filters/anime-filters.tsx similarity index 94% rename from components/filters/anime-filters.tsx rename to features/filters/anime-filters.tsx index 6be63de4..ba19ce19 100644 --- a/components/filters/anime-filters.tsx +++ b/features/filters/anime-filters.tsx @@ -1,16 +1,12 @@ 'use client'; +import { useQuery } from '@tanstack/react-query'; import clsx from 'clsx'; -import * as React from 'react'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import { FC, useEffect, useState } from 'react'; import AntDesignClearOutlined from '~icons/ant-design/clear-outlined'; import MaterialSymbolsSortRounded from '~icons/material-symbols/sort-rounded'; -import { usePathname, useRouter, useSearchParams } from 'next/navigation'; - -import { useQuery } from '@tanstack/react-query'; - -import BadgeFilter from '@/components/filters/components/ui/badge-filter'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { ScrollArea } from '@/components/ui/scroll-area'; @@ -28,6 +24,9 @@ import { renderSelectOptions, } from '@/components/ui/select'; import { Slider } from '@/components/ui/slider'; + +import BadgeFilter from '@/features/filters/badge-filter'; + import getAnimeGenres from '@/services/api/anime/getAnimeGenres'; import useCompanies from '@/services/hooks/companies/useCompanies'; import { @@ -40,7 +39,7 @@ import { import createQueryString from '@/utils/createQueryString'; import { cn } from '@/utils/utils'; -import { Switch } from '../ui/switch'; +import { Switch } from '../../components/ui/switch'; const YEARS: [number, number] = [1965, new Date().getFullYear()]; @@ -112,10 +111,12 @@ const AnimeFilters: FC = ({ className, type }) => { }); const [studioSearch, setStudioSearch] = useState(); - const { data: studioList, isFetching: isStudioListFetching } = useCompanies({ - type: 'studio', - query: studioSearch, - }); + const { data: studioList, isFetching: isStudioListFetching } = useCompanies( + { + type: 'studio', + query: studioSearch, + }, + ); const [selectingYears, setSelectingYears] = useState( years.length > 0 ? years : YEARS.map((y) => String(y)), @@ -147,13 +148,13 @@ const AnimeFilters: FC = ({ className, type }) => { }; const handleStudioSearch = (keyword: string) => { - if(keyword.length < 3) { + if (keyword.length < 3) { setStudioSearch(undefined); return; } setStudioSearch(keyword); - } + }; useEffect(() => { if (JSON.stringify(selectingYears) !== JSON.stringify(years)) { @@ -308,14 +309,15 @@ const AnimeFilters: FC = ({ className, type }) => { - {!isStudioListFetching && studioList?.list.map((studio) => ( - - {studio.name} - - ))} + {!isStudioListFetching && + studioList?.list.map((studio) => ( + + {studio.name} + + ))} {isStudioListFetching ? 'Завантаження...' diff --git a/components/filters/components/ui/badge-filter.tsx b/features/filters/badge-filter.tsx similarity index 100% rename from components/filters/components/ui/badge-filter.tsx rename to features/filters/badge-filter.tsx diff --git a/components/filters/edit-filters.tsx b/features/filters/edit-filters.tsx similarity index 100% rename from components/filters/edit-filters.tsx rename to features/filters/edit-filters.tsx index d43ac1e5..b0001c9f 100644 --- a/components/filters/edit-filters.tsx +++ b/features/filters/edit-filters.tsx @@ -1,14 +1,13 @@ 'use client'; import clsx from 'clsx'; +import Link from 'next/link'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import * as React from 'react'; import { FC, useState } from 'react'; import AntDesignClearOutlined from '~icons/ant-design/clear-outlined'; import MaterialSymbolsSortRounded from '~icons/material-symbols/sort-rounded'; -import Link from 'next/link'; -import { usePathname, useRouter, useSearchParams } from 'next/navigation'; - import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { ScrollArea } from '@/components/ui/scroll-area'; @@ -23,6 +22,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select'; + import useUsers from '@/services/hooks/user/useUsers'; import { EDIT_STATUSES } from '@/utils/constants'; import createQueryString from '@/utils/createQueryString'; diff --git a/components/filters/components/filters-not-found.tsx b/features/filters/filters-not-found.tsx similarity index 99% rename from components/filters/components/filters-not-found.tsx rename to features/filters/filters-not-found.tsx index a7236b6a..327aa883 100644 --- a/components/filters/components/filters-not-found.tsx +++ b/features/filters/filters-not-found.tsx @@ -1,10 +1,9 @@ 'use client'; -import * as React from 'react'; -import AntDesignClearOutlined from '~icons/ant-design/clear-outlined'; - import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import * as React from 'react'; +import AntDesignClearOutlined from '~icons/ant-design/clear-outlined'; import { Button } from '@/components/ui/button'; import NotFound from '@/components/ui/not-found'; diff --git a/components/filters/schedule-filters.tsx b/features/filters/schedule-filters.tsx similarity index 99% rename from components/filters/schedule-filters.tsx rename to features/filters/schedule-filters.tsx index dfc0bfe7..49dde379 100644 --- a/components/filters/schedule-filters.tsx +++ b/features/filters/schedule-filters.tsx @@ -1,14 +1,12 @@ 'use client'; +import { range } from '@antfu/utils'; +import Link from 'next/link'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import * as React from 'react'; import { FC } from 'react'; import AntDesignClearOutlined from '~icons/ant-design/clear-outlined'; -import Link from 'next/link'; -import { usePathname, useRouter, useSearchParams } from 'next/navigation'; - -import { range } from '@antfu/utils'; - import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { @@ -21,6 +19,7 @@ import { SelectValue, } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; + import useSession from '@/services/hooks/auth/useSession'; import { RELEASE_STATUS, SEASON } from '@/utils/constants'; import createQueryString from '@/utils/createQueryString'; diff --git a/app/(pages)/(root)/components/collections.tsx b/features/home/collections.tsx similarity index 92% rename from app/(pages)/(root)/components/collections.tsx rename to features/home/collections.tsx index ea7ee5f2..207477d5 100644 --- a/app/(pages)/(root)/components/collections.tsx +++ b/features/home/collections.tsx @@ -1,14 +1,15 @@ 'use client'; +import Link from 'next/link'; import { FC } from 'react'; import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; -import Link from 'next/link'; - -import CollectionItem from '@/app/(pages)/(user)/u/[username]/components/collections/components/ui/collection-item'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; + +import CollectionItem from '@/features/users/user-profile/user-collections/collection-item'; + import useSession from '@/services/hooks/auth/useSession'; import useCollections from '@/services/hooks/collections/useCollections'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(root)/components/comments.tsx b/features/home/comments.tsx similarity index 99% rename from app/(pages)/(root)/components/comments.tsx rename to features/home/comments.tsx index db211539..b8b28f60 100644 --- a/app/(pages)/(root)/components/comments.tsx +++ b/features/home/comments.tsx @@ -7,6 +7,7 @@ import ContentCard from '@/components/content-card/content-card'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import HorizontalCard from '@/components/ui/horizontal-card'; + import useLatestComments from '@/services/hooks/comments/useLatestComments'; import { CONTENT_TYPE_LINKS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(root)/components/history.tsx b/features/home/history.tsx similarity index 99% rename from app/(pages)/(root)/components/history.tsx rename to features/home/history.tsx index ef29c89e..6c47386a 100644 --- a/app/(pages)/(root)/components/history.tsx +++ b/features/home/history.tsx @@ -6,6 +6,7 @@ import HistoryItem from '@/components/history-item'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import NotFound from '@/components/ui/not-found'; + import useSession from '@/services/hooks/auth/useSession'; import useUserHistory from '@/services/hooks/history/useFollowingHistory'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(root)/components/ongoings.tsx b/features/home/ongoings.tsx similarity index 79% rename from app/(pages)/(root)/components/ongoings.tsx rename to features/home/ongoings.tsx index 51516430..e997697b 100644 --- a/app/(pages)/(root)/components/ongoings.tsx +++ b/features/home/ongoings.tsx @@ -1,15 +1,14 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { range } from '@antfu/utils'; +import { FC } from 'react'; -import AnimeCard from '@/app/(pages)/(content)/components/anime-card'; +import AnimeCard from '@/components/anime-card'; import SkeletonCard from '@/components/skeletons/content-card'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useAnimeCatalog from '@/services/hooks/anime/useAnimeCatalog'; import { cn } from '@/utils/utils'; @@ -18,7 +17,7 @@ interface Props { } const Ongoings: FC = ({ className }) => { - const { list, isLoading } = useAnimeCatalog({ + const { list, isLoading } = useAnimeCatalog({ status: ['ongoing'], page: 1, iPage: 1, @@ -30,8 +29,7 @@ const Ongoings: FC = ({ className }) => {
- {isLoading && - range(0, 8).map((v) => )} + {isLoading && range(0, 8).map((v) => )} {filteredList?.map((item) => ( ))} diff --git a/app/(pages)/(root)/components/profile.tsx b/features/home/profile.tsx similarity index 97% rename from app/(pages)/(root)/components/profile.tsx rename to features/home/profile.tsx index 6e44cd58..984289ae 100644 --- a/app/(pages)/(root)/components/profile.tsx +++ b/features/home/profile.tsx @@ -1,15 +1,12 @@ 'use client'; -import * as React from 'react'; +import Link from 'next/link'; import { useEffect, useState } from 'react'; import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; import MaterialSymbolsRemoveRounded from '~icons/material-symbols/remove-rounded'; import MaterialSymbolsSettingsOutline from '~icons/material-symbols/settings-outline'; -import Link from 'next/link'; - import ContentCard from '@/components/content-card/content-card'; -import WatchEditModal from '@/components/modals/watch-edit-modal'; import H5 from '@/components/typography/h5'; import P from '@/components/typography/p'; import Block from '@/components/ui/block'; @@ -24,13 +21,15 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + +import WatchEditModal from '@/features/modals/watch-edit-modal'; + import useSession from '@/services/hooks/auth/useSession'; import useAddWatch from '@/services/hooks/watch/useAddWatch'; import useWatchList from '@/services/hooks/watch/useWatchList'; import { useModalContext } from '@/services/providers/modal-provider'; import { cn } from '@/utils/utils'; - const Profile = () => { const { openModal } = useModalContext(); const [selectedSlug, setSelectedSlug] = useState(); @@ -67,7 +66,11 @@ const Profile = () => { const episodes = (variables?.params?.episodes || selectedWatch.episodes) + 1; - if (selectedWatch.anime.episodes_total && episodes > selectedWatch.anime.episodes_total) return; + if ( + selectedWatch.anime.episodes_total && + episodes > selectedWatch.anime.episodes_total + ) + return; mutateAddWatch({ params: { diff --git a/app/(pages)/(root)/components/schedule/components/ui/schedule-item.tsx b/features/home/schedule/schedule-item.tsx similarity index 93% rename from app/(pages)/(root)/components/schedule/components/ui/schedule-item.tsx rename to features/home/schedule/schedule-item.tsx index b4a86f68..4f274e2d 100644 --- a/app/(pages)/(root)/components/schedule/components/ui/schedule-item.tsx +++ b/features/home/schedule/schedule-item.tsx @@ -1,10 +1,11 @@ 'use client'; -import React, { FC, memo } from 'react'; +import { FC, memo } from 'react'; -import HorizontalContentCard from '@/components/horizontal-content-card'; import H5 from '@/components/typography/h5'; import P from '@/components/typography/p'; +import HorizontalContentCard from '@/components/ui/horizontal-content-card'; + import getScheduleDuration from '@/utils/getScheduleDuration'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(root)/components/schedule/schedule.tsx b/features/home/schedule/schedule.tsx similarity index 93% rename from app/(pages)/(root)/components/schedule/schedule.tsx rename to features/home/schedule/schedule.tsx index 424e61ce..94007755 100644 --- a/app/(pages)/(root)/components/schedule/schedule.tsx +++ b/features/home/schedule/schedule.tsx @@ -3,9 +3,10 @@ import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import useAnimeSchedule from '@/services/hooks/stats/useAnimeSchedule'; -import ScheduleItem from './components/ui/schedule-item'; +import ScheduleItem from './schedule-item'; const Schedule = () => { const { list } = useAnimeSchedule(); diff --git a/components/modals/anime-filters-modal.tsx b/features/modals/anime-filters-modal.tsx similarity index 92% rename from components/modals/anime-filters-modal.tsx rename to features/modals/anime-filters-modal.tsx index 1d28ded1..284c854e 100644 --- a/components/modals/anime-filters-modal.tsx +++ b/features/modals/anime-filters-modal.tsx @@ -1,8 +1,6 @@ -import * as React from 'react'; import { ReactNode } from 'react'; import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; -import Filters from '@/components/filters/anime-filters'; import { Button } from '@/components/ui/button'; import { Drawer, @@ -13,6 +11,8 @@ import { } from '@/components/ui/drawer'; import { Separator } from '@/components/ui/separator'; +import Filters from '@/features/filters/anime-filters'; + interface Props { type: 'anime' | 'watchlist'; children?: ReactNode; diff --git a/components/modals/auth-modal/auth-modal.tsx b/features/modals/auth-modal/auth-modal.tsx similarity index 83% rename from components/modals/auth-modal/auth-modal.tsx rename to features/modals/auth-modal/auth-modal.tsx index d23d2523..369e9154 100644 --- a/components/modals/auth-modal/auth-modal.tsx +++ b/features/modals/auth-modal/auth-modal.tsx @@ -1,14 +1,15 @@ 'use client'; -import React from 'react'; import LogosGoogleIcon from '~icons/logos/google-icon'; -import ForgotPasswordForm from '@/components/modals/auth-modal/components/forgot-password-form'; -import LoginForm from '@/components/modals/auth-modal/components/login-form'; -import PasswordConfirmForm from '@/components/modals/auth-modal/components/password-confirm-form'; -import SignUpForm from '@/components/modals/auth-modal/components/signup-form'; import { Button } from '@/components/ui/button'; import Image from '@/components/ui/image'; + +import ForgotPasswordForm from '@/features/modals/auth-modal/forgot-password-form'; +import LoginForm from '@/features/modals/auth-modal/login-form'; +import PasswordConfirmForm from '@/features/modals/auth-modal/password-confirm-form'; +import SignUpForm from '@/features/modals/auth-modal/signup-form'; + import getOAuth from '@/services/api/auth/getOAuth'; const Component = ({ diff --git a/components/modals/auth-modal/components/forgot-password-form.tsx b/features/modals/auth-modal/forgot-password-form.tsx similarity index 97% rename from components/modals/auth-modal/components/forgot-password-form.tsx rename to features/modals/auth-modal/forgot-password-form.tsx index cd68d0b5..8b8f27f9 100644 --- a/components/modals/auth-modal/components/forgot-password-form.tsx +++ b/features/modals/auth-modal/forgot-password-form.tsx @@ -1,18 +1,18 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import React from 'react'; -import { useForm } from 'react-hook-form'; - import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation } from '@tanstack/react-query'; +import { useSnackbar } from 'notistack'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; -import AuthModal from '@/components/modals/auth-modal/auth-modal'; import H2 from '@/components/typography/h2'; import Small from '@/components/typography/small'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + +import AuthModal from '@/features/modals/auth-modal/auth-modal'; + import passwordReset from '@/services/api/auth/passwordReset'; import { useModalContext } from '@/services/providers/modal-provider'; import { z } from '@/utils/zod'; diff --git a/components/modals/auth-modal/components/login-form.tsx b/features/modals/auth-modal/login-form.tsx similarity index 97% rename from components/modals/auth-modal/components/login-form.tsx rename to features/modals/auth-modal/login-form.tsx index 061b8031..4842625c 100644 --- a/components/modals/auth-modal/components/login-form.tsx +++ b/features/modals/auth-modal/login-form.tsx @@ -1,20 +1,20 @@ 'use client'; -import React, { useRef } from 'react'; -import { useForm } from 'react-hook-form'; - -import { useRouter } from 'next/navigation'; - import { zodResolver } from '@hookform/resolvers/zod'; import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; import { useMutation } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useRef } from 'react'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; -import AuthModal from '@/components/modals/auth-modal/auth-modal'; import H2 from '@/components/typography/h2'; import Small from '@/components/typography/small'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + +import AuthModal from '@/features/modals/auth-modal/auth-modal'; + import login from '@/services/api/auth/login'; import { useModalContext } from '@/services/providers/modal-provider'; import { setCookie } from '@/utils/cookies'; diff --git a/components/modals/auth-modal/components/password-confirm-form.tsx b/features/modals/auth-modal/password-confirm-form.tsx similarity index 99% rename from components/modals/auth-modal/components/password-confirm-form.tsx rename to features/modals/auth-modal/password-confirm-form.tsx index a825739a..86aa9241 100644 --- a/components/modals/auth-modal/components/password-confirm-form.tsx +++ b/features/modals/auth-modal/password-confirm-form.tsx @@ -1,19 +1,18 @@ 'use client'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useMutation } from '@tanstack/react-query'; +import { useRouter, useSearchParams } from 'next/navigation'; import { useSnackbar } from 'notistack'; import React from 'react'; import { useForm } from 'react-hook-form'; -import { useRouter, useSearchParams } from 'next/navigation'; - -import { zodResolver } from '@hookform/resolvers/zod'; -import { useMutation } from '@tanstack/react-query'; - import FormInput from '@/components/form/form-input'; import H2 from '@/components/typography/h2'; import Small from '@/components/typography/small'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import confirmPasswordReset from '@/services/api/auth/confirmPasswordReset'; import { useModalContext } from '@/services/providers/modal-provider'; import { setCookie } from '@/utils/cookies'; diff --git a/components/modals/auth-modal/components/signup-form.tsx b/features/modals/auth-modal/signup-form.tsx similarity index 97% rename from components/modals/auth-modal/components/signup-form.tsx rename to features/modals/auth-modal/signup-form.tsx index 471bd2dd..3663918c 100644 --- a/components/modals/auth-modal/components/signup-form.tsx +++ b/features/modals/auth-modal/signup-form.tsx @@ -1,21 +1,21 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import React, { useRef } from 'react'; -import { useForm } from 'react-hook-form'; - -import { useRouter } from 'next/navigation'; - import { zodResolver } from '@hookform/resolvers/zod'; import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'; import { useMutation } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useSnackbar } from 'notistack'; +import { useRef } from 'react'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; -import AuthModal from '@/components/modals/auth-modal/auth-modal'; import H2 from '@/components/typography/h2'; import Small from '@/components/typography/small'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + +import AuthModal from '@/features/modals/auth-modal/auth-modal'; + import signup from '@/services/api/auth/signup'; import { useModalContext } from '@/services/providers/modal-provider'; import { setCookie } from '@/utils/cookies'; @@ -50,7 +50,7 @@ const Component = () => { }: z.infer) => signup({ params: { - ...data + ...data, }, captcha: String(captchaRef.current?.getResponse()), }), diff --git a/components/modals/crop-editor-modal.tsx b/features/modals/crop-editor-modal.tsx similarity index 99% rename from components/modals/crop-editor-modal.tsx rename to features/modals/crop-editor-modal.tsx index 07960fe3..18b5b944 100644 --- a/components/modals/crop-editor-modal.tsx +++ b/features/modals/crop-editor-modal.tsx @@ -1,6 +1,8 @@ 'use client'; +import { useQueryClient } from '@tanstack/react-query'; import clsx from 'clsx'; +import { useParams, useRouter } from 'next/navigation'; import { useSnackbar } from 'notistack'; import * as React from 'react'; import { useRef, useState } from 'react'; @@ -8,12 +10,9 @@ import AvatarEditor from 'react-avatar-editor'; import MaterialSymbolsZoomInRounded from '~icons/material-symbols/zoom-in-rounded'; import MaterialSymbolsZoomOut from '~icons/material-symbols/zoom-out'; -import { useParams, useRouter } from 'next/navigation'; - -import { useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; import { Slider } from '@/components/ui/slider'; + import uploadImage from '@/services/api/upload/uploadImage'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/components/modals/edit-filters-modal.tsx b/features/modals/edit-filters-modal.tsx similarity index 92% rename from components/modals/edit-filters-modal.tsx rename to features/modals/edit-filters-modal.tsx index df934aec..20896433 100644 --- a/components/modals/edit-filters-modal.tsx +++ b/features/modals/edit-filters-modal.tsx @@ -1,8 +1,6 @@ -import * as React from 'react'; import { ReactNode } from 'react'; import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; -import Filters from '@/components/filters/edit-filters'; import { Button } from '@/components/ui/button'; import { Drawer, @@ -13,6 +11,8 @@ import { } from '@/components/ui/drawer'; import { Separator } from '@/components/ui/separator'; +import Filters from '@/features/filters/edit-filters'; + interface Props { children?: ReactNode; } diff --git a/components/modals/edit-top-stats-modal/components/ui/edit-top-item.tsx b/features/modals/edit-top-stats-modal/edit-top-item.tsx similarity index 100% rename from components/modals/edit-top-stats-modal/components/ui/edit-top-item.tsx rename to features/modals/edit-top-stats-modal/edit-top-item.tsx index bfd33137..22dc938e 100644 --- a/components/modals/edit-top-stats-modal/components/ui/edit-top-item.tsx +++ b/features/modals/edit-top-stats-modal/edit-top-item.tsx @@ -1,11 +1,11 @@ +import Link from 'next/link'; import * as React from 'react'; import MaterialSymbolsKidStar from '~icons/material-symbols/kid-star'; -import Link from 'next/link'; - import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; + import { cn } from '@/utils/utils'; interface Props { diff --git a/components/modals/edit-top-stats-modal/edit-top-stats-modal.tsx b/features/modals/edit-top-stats-modal/edit-top-stats-modal.tsx similarity index 93% rename from components/modals/edit-top-stats-modal/edit-top-stats-modal.tsx rename to features/modals/edit-top-stats-modal/edit-top-stats-modal.tsx index 7d5125d3..cf846f71 100644 --- a/components/modals/edit-top-stats-modal/edit-top-stats-modal.tsx +++ b/features/modals/edit-top-stats-modal/edit-top-stats-modal.tsx @@ -1,11 +1,10 @@ 'use client'; -import * as React from 'react'; - import LoadMoreButton from '@/components/load-more-button'; + import useEditTop from '@/services/hooks/stats/edit/useEditTop'; -import EditTopItem from './components/ui/edit-top-item'; +import EditTopItem from './edit-top-item'; const Component = () => { const { list, fetchNextPage, isFetchingNextPage, hasNextPage, ref } = diff --git a/components/modals/editlist-modal/components/ui/edit-card.tsx b/features/modals/editlist-modal/edit-card.tsx similarity index 95% rename from components/modals/editlist-modal/components/ui/edit-card.tsx rename to features/modals/editlist-modal/edit-card.tsx index 38c2b105..ca28f7f8 100644 --- a/components/modals/editlist-modal/components/ui/edit-card.tsx +++ b/features/modals/editlist-modal/edit-card.tsx @@ -2,17 +2,20 @@ import clsx from 'clsx'; import { format } from 'date-fns'; -import * as React from 'react'; -import MaterialSymbolsShieldRounded from '~icons/material-symbols/shield-rounded'; - import Link, { LinkProps } from 'next/link'; +import MaterialSymbolsShieldRounded from '~icons/material-symbols/shield-rounded'; import H5 from '@/components/typography/h5'; import P from '@/components/typography/p'; import Small from '@/components/typography/small'; + import { EDIT_STATUS } from '@/utils/constants'; -import { Avatar, AvatarFallback, AvatarImage } from '../../../../ui/avatar'; +import { + Avatar, + AvatarFallback, + AvatarImage, +} from '../../../components/ui/avatar'; interface Props extends LinkProps { edit: API.Edit; diff --git a/components/modals/editlist-modal/editlist-modal.tsx b/features/modals/editlist-modal/editlist-modal.tsx similarity index 95% rename from components/modals/editlist-modal/editlist-modal.tsx rename to features/modals/editlist-modal/editlist-modal.tsx index 366638d2..5d51ef18 100644 --- a/components/modals/editlist-modal/editlist-modal.tsx +++ b/features/modals/editlist-modal/editlist-modal.tsx @@ -1,15 +1,15 @@ 'use client'; import clsx from 'clsx'; -import * as React from 'react'; +import Link from 'next/link'; import { useEffect } from 'react'; import { useInView } from 'react-intersection-observer'; -import Link from 'next/link'; - import LoadMoreButton from '@/components/load-more-button'; -import EditCard from '@/components/modals/editlist-modal/components/ui/edit-card'; import { Button } from '@/components/ui/button'; + +import EditCard from '@/features/modals/editlist-modal/edit-card'; + import getEditList from '@/services/api/edit/getEditList'; import useInfiniteList from '@/services/hooks/useInfiniteList'; diff --git a/components/modals/followlist-modal.tsx b/features/modals/followlist-modal.tsx similarity index 92% rename from components/modals/followlist-modal.tsx rename to features/modals/followlist-modal.tsx index 37db2a88..00ae2e04 100644 --- a/components/modals/followlist-modal.tsx +++ b/features/modals/followlist-modal.tsx @@ -1,11 +1,11 @@ 'use client'; -import * as React from 'react'; - import { useParams } from 'next/navigation'; -import FollowUserItem from '@/app/(pages)/(user)/u/[username]/components/ui/follow-user-item'; import LoadMoreButton from '@/components/load-more-button'; + +import FollowUserItem from '@/features/users/user-profile/follow-user-item'; + import getFollowers from '@/services/api/follow/getFollowers'; import getFollowings from '@/services/api/follow/getFollowings'; import useInfiniteList from '@/services/hooks/useInfiniteList'; diff --git a/components/modals/schedule-filters-modal.tsx b/features/modals/schedule-filters-modal.tsx similarity index 92% rename from components/modals/schedule-filters-modal.tsx rename to features/modals/schedule-filters-modal.tsx index ce4f69e7..569cad1e 100644 --- a/components/modals/schedule-filters-modal.tsx +++ b/features/modals/schedule-filters-modal.tsx @@ -1,8 +1,6 @@ -import * as React from 'react'; import { ReactNode } from 'react'; import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; -import Filters from '@/components/filters/schedule-filters'; import { Button } from '@/components/ui/button'; import { Drawer, @@ -13,6 +11,8 @@ import { } from '@/components/ui/drawer'; import { Separator } from '@/components/ui/separator'; +import Filters from '@/features/filters/schedule-filters'; + interface Props { children?: ReactNode; } diff --git a/components/modals/search-modal/components/ui/anime-card.tsx b/features/modals/search-modal/anime-card.tsx similarity index 98% rename from components/modals/search-modal/components/ui/anime-card.tsx rename to features/modals/search-modal/anime-card.tsx index 03386c52..366230fc 100644 --- a/components/modals/search-modal/components/ui/anime-card.tsx +++ b/features/modals/search-modal/anime-card.tsx @@ -1,16 +1,16 @@ 'use client'; +import Link from 'next/link'; import * as React from 'react'; import MaterialSymbolsStarRounded from '~icons/material-symbols/star-rounded'; -import Link from 'next/link'; - import ContentCard from '@/components/content-card/content-card'; import P from '@/components/typography/p'; import { Badge } from '@/components/ui/badge'; + import { MEDIA_TYPE, RELEASE_STATUS } from '@/utils/constants'; -import { Label } from '../../../../ui/label'; +import { Label } from '../../../components/ui/label'; interface Props { anime: API.Anime; diff --git a/components/modals/search-modal/components/anime-search-list.tsx b/features/modals/search-modal/anime-search-list.tsx similarity index 88% rename from components/modals/search-modal/components/anime-search-list.tsx rename to features/modals/search-modal/anime-search-list.tsx index 073fb784..f38ed063 100644 --- a/components/modals/search-modal/components/anime-search-list.tsx +++ b/features/modals/search-modal/anime-search-list.tsx @@ -1,16 +1,16 @@ 'use client'; -import * as React from 'react'; import { ReactNode } from 'react'; -import SearchPlaceholders from '@/components/modals/search-modal/components/ui/search-placeholders'; import { CommandGroup, CommandItem, CommandList, } from '@/components/ui/command'; -import AnimeCard from './ui/anime-card'; +import SearchPlaceholders from '@/features/modals/search-modal/search-placeholders'; + +import AnimeCard from './anime-card'; import useAnimeSearchList from './useAnimeSearchList'; interface Props { diff --git a/components/modals/search-modal/components/ui/character-card.tsx b/features/modals/search-modal/character-card.tsx similarity index 99% rename from components/modals/search-modal/components/ui/character-card.tsx rename to features/modals/search-modal/character-card.tsx index 1d2de189..39f1e8fd 100644 --- a/components/modals/search-modal/components/ui/character-card.tsx +++ b/features/modals/search-modal/character-card.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import Link from 'next/link'; +import * as React from 'react'; import ContentCard from '@/components/content-card/content-card'; import { Label } from '@/components/ui/label'; diff --git a/components/modals/search-modal/components/character-search-list.tsx b/features/modals/search-modal/character-search-list.tsx similarity index 82% rename from components/modals/search-modal/components/character-search-list.tsx rename to features/modals/search-modal/character-search-list.tsx index aa10c76f..d01ac91d 100644 --- a/components/modals/search-modal/components/character-search-list.tsx +++ b/features/modals/search-modal/character-search-list.tsx @@ -1,17 +1,17 @@ 'use client'; -import * as React from 'react'; import { ReactNode } from 'react'; -import SearchPlaceholders from '@/components/modals/search-modal/components/ui/search-placeholders'; -import useCharacterSearchList from '@/components/modals/search-modal/components/useCharacterSearchList'; import { CommandGroup, CommandItem, CommandList, } from '@/components/ui/command'; -import CharacterCard from './ui/character-card'; +import SearchPlaceholders from '@/features/modals/search-modal/search-placeholders'; +import useCharacterSearchList from '@/features/modals/search-modal/useCharacterSearchList'; + +import CharacterCard from './character-card'; interface Props { onDismiss: (character: API.Character) => void; diff --git a/components/modals/search-modal/components/ui/person-card.tsx b/features/modals/search-modal/person-card.tsx similarity index 99% rename from components/modals/search-modal/components/ui/person-card.tsx rename to features/modals/search-modal/person-card.tsx index fb7a4e8b..81ab724b 100644 --- a/components/modals/search-modal/components/ui/person-card.tsx +++ b/features/modals/search-modal/person-card.tsx @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import Link from 'next/link'; +import * as React from 'react'; import ContentCard from '@/components/content-card/content-card'; import { Label } from '@/components/ui/label'; diff --git a/components/modals/search-modal/components/person-search-list.tsx b/features/modals/search-modal/person-search-list.tsx similarity index 78% rename from components/modals/search-modal/components/person-search-list.tsx rename to features/modals/search-modal/person-search-list.tsx index 3f265f8e..35dafa5c 100644 --- a/components/modals/search-modal/components/person-search-list.tsx +++ b/features/modals/search-modal/person-search-list.tsx @@ -1,18 +1,16 @@ 'use client'; -import * as React from 'react'; import { ReactNode } from 'react'; -import PersonCard from '@/components/modals/search-modal/components/ui/person-card'; -import SearchPlaceholders from '@/components/modals/search-modal/components/ui/search-placeholders'; -import useCharacterSearchList from '@/components/modals/search-modal/components/useCharacterSearchList'; import { CommandGroup, CommandItem, CommandList, } from '@/components/ui/command'; -import CharacterCard from './ui/character-card'; +import PersonCard from '@/features/modals/search-modal/person-card'; +import SearchPlaceholders from '@/features/modals/search-modal/search-placeholders'; + import usePersonSearchList from './usePersonSearchList'; interface Props { diff --git a/components/modals/search-modal/components/search-button.tsx b/features/modals/search-modal/search-button.tsx similarity index 100% rename from components/modals/search-modal/components/search-button.tsx rename to features/modals/search-modal/search-button.tsx diff --git a/components/modals/search-modal/search-modal.tsx b/features/modals/search-modal/search-modal.tsx similarity index 84% rename from components/modals/search-modal/search-modal.tsx rename to features/modals/search-modal/search-modal.tsx index b8958f44..2971330f 100644 --- a/components/modals/search-modal/search-modal.tsx +++ b/features/modals/search-modal/search-modal.tsx @@ -1,19 +1,19 @@ 'use client'; -import * as React from 'react'; import { ReactNode, useRef, useState } from 'react'; -import CharacterSearchList from '@/components/modals/search-modal/components/character-search-list'; -import PersonSearchList from '@/components/modals/search-modal/components/person-search-list'; -import UserSearchList from '@/components/modals/search-modal/components/user-search-list'; - -import SearchToggle from '@/components/modals/search-modal/components/search-toggle'; import { CommandDialog, CommandInput } from '@/components/ui/command'; + +import CharacterSearchList from '@/features/modals/search-modal/character-search-list'; +import PersonSearchList from '@/features/modals/search-modal/person-search-list'; +import SearchToggle from '@/features/modals/search-modal/search-toggle'; +import UserSearchList from '@/features/modals/search-modal/user-search-list'; + import useDebounce from '@/services/hooks/useDebounce'; -import AnimeSearchList from './components/anime-search-list'; -import SearchButton from './components/search-button'; -import useSearchModal from './components/useSearchModal'; +import AnimeSearchList from './anime-search-list'; +import SearchButton from './search-button'; +import useSearchModal from './useSearchModal'; interface Props { onClick?: (content: API.MainContent | API.User) => void; diff --git a/features/modals/search-modal/search-placeholders.tsx b/features/modals/search-modal/search-placeholders.tsx new file mode 100644 index 00000000..92544abc --- /dev/null +++ b/features/modals/search-modal/search-placeholders.tsx @@ -0,0 +1,37 @@ +'use client'; + +import * as React from 'react'; +import { memo } from 'react'; + +interface Props { + data?: API.WithPagination | Array; + isFetching: boolean; + isRefetching: boolean; +} + +const SearchPlaceholders = ({ data, isFetching, isRefetching }: Props) => { + return ( + <> + {data && + (Array.isArray(data) + ? data.length === 0 + : data.list.length === 0) && ( +

+ За Вашим запитом нічого не знайдено +

+ )} + {isFetching && !isRefetching && ( +
+ +
+ )} + {!data && !isFetching && ( +

+ Введіть назву, щоб розпочати пошук... +

+ )} + + ); +}; + +export default memo(SearchPlaceholders); diff --git a/components/modals/search-modal/components/search-toggle.tsx b/features/modals/search-modal/search-toggle.tsx similarity index 100% rename from components/modals/search-modal/components/search-toggle.tsx rename to features/modals/search-modal/search-toggle.tsx diff --git a/components/modals/search-modal/components/useAnimeSearchList.ts b/features/modals/search-modal/useAnimeSearchList.ts similarity index 100% rename from components/modals/search-modal/components/useAnimeSearchList.ts rename to features/modals/search-modal/useAnimeSearchList.ts diff --git a/components/modals/search-modal/components/useCharacterSearchList.ts b/features/modals/search-modal/useCharacterSearchList.ts similarity index 100% rename from components/modals/search-modal/components/useCharacterSearchList.ts rename to features/modals/search-modal/useCharacterSearchList.ts diff --git a/components/modals/search-modal/components/usePersonSearchList.ts b/features/modals/search-modal/usePersonSearchList.ts similarity index 100% rename from components/modals/search-modal/components/usePersonSearchList.ts rename to features/modals/search-modal/usePersonSearchList.ts diff --git a/components/modals/search-modal/components/useSearchModal.ts b/features/modals/search-modal/useSearchModal.ts similarity index 100% rename from components/modals/search-modal/components/useSearchModal.ts rename to features/modals/search-modal/useSearchModal.ts diff --git a/components/modals/search-modal/components/useUserSearchList.ts b/features/modals/search-modal/useUserSearchList.ts similarity index 100% rename from components/modals/search-modal/components/useUserSearchList.ts rename to features/modals/search-modal/useUserSearchList.ts diff --git a/components/modals/search-modal/components/ui/user-card.tsx b/features/modals/search-modal/user-card.tsx similarity index 100% rename from components/modals/search-modal/components/ui/user-card.tsx rename to features/modals/search-modal/user-card.tsx index 72d38c90..1a050e4b 100644 --- a/components/modals/search-modal/components/ui/user-card.tsx +++ b/features/modals/search-modal/user-card.tsx @@ -1,13 +1,13 @@ 'use client'; import format from 'date-fns/format'; -import * as React from 'react'; - import Link from 'next/link'; +import * as React from 'react'; import ContentCard from '@/components/content-card/content-card'; import { Badge } from '@/components/ui/badge'; import { Label } from '@/components/ui/label'; + import { USER_ROLE } from '@/utils/constants'; interface Props { diff --git a/components/modals/search-modal/components/user-search-list.tsx b/features/modals/search-modal/user-search-list.tsx similarity index 79% rename from components/modals/search-modal/components/user-search-list.tsx rename to features/modals/search-modal/user-search-list.tsx index 106753cc..01a1986e 100644 --- a/components/modals/search-modal/components/user-search-list.tsx +++ b/features/modals/search-modal/user-search-list.tsx @@ -1,17 +1,16 @@ 'use client'; -import * as React from 'react'; import { ReactNode } from 'react'; -import UserCard from '@/components/modals/search-modal/components/ui/user-card'; -import SearchPlaceholders from '@/components/modals/search-modal/components/ui/search-placeholders'; - import { CommandGroup, CommandItem, CommandList, } from '@/components/ui/command'; +import SearchPlaceholders from '@/features/modals/search-modal/search-placeholders'; +import UserCard from '@/features/modals/search-modal/user-card'; + import useUserSearchList from './useUserSearchList'; interface Props { @@ -33,7 +32,10 @@ const UserSearchList = ({ onDismiss, type, value }: Props) => { {data && data.length > 0 && ( {data.map((user) => ( - + onDismiss(user)} user={user} diff --git a/components/modals/user-settings-modal/components/customization-form.tsx b/features/modals/user-settings-modal/customization-form.tsx similarity index 99% rename from components/modals/user-settings-modal/components/customization-form.tsx rename to features/modals/user-settings-modal/customization-form.tsx index d265a271..79854ba6 100644 --- a/components/modals/user-settings-modal/components/customization-form.tsx +++ b/features/modals/user-settings-modal/customization-form.tsx @@ -15,6 +15,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select'; + import { useSettingsContext } from '@/services/providers/settings-provider'; const Component = () => { diff --git a/components/modals/user-settings-modal/components/email-form.tsx b/features/modals/user-settings-modal/email-form.tsx similarity index 100% rename from components/modals/user-settings-modal/components/email-form.tsx rename to features/modals/user-settings-modal/email-form.tsx index 6c5b5b1b..c2b0d276 100644 --- a/components/modals/user-settings-modal/components/email-form.tsx +++ b/features/modals/user-settings-modal/email-form.tsx @@ -1,14 +1,14 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import { useForm } from 'react-hook-form'; - import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useSnackbar } from 'notistack'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import changeUserEmail from '@/services/api/settings/changeUserEmail'; import { useModalContext } from '@/services/providers/modal-provider'; import { z } from '@/utils/zod'; diff --git a/components/modals/user-settings-modal/components/general-form.tsx b/features/modals/user-settings-modal/general-form.tsx similarity index 100% rename from components/modals/user-settings-modal/components/general-form.tsx rename to features/modals/user-settings-modal/general-form.tsx index 56a27a31..61fb725f 100644 --- a/components/modals/user-settings-modal/components/general-form.tsx +++ b/features/modals/user-settings-modal/general-form.tsx @@ -1,14 +1,14 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import { useForm } from 'react-hook-form'; - import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useSnackbar } from 'notistack'; +import { useForm } from 'react-hook-form'; import FormTextarea from '@/components/form/form-textarea'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import changeUserDescription from '@/services/api/settings/changeUserDescription'; import useSession from '@/services/hooks/auth/useSession'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/components/modals/user-settings-modal/components/notifications-form.tsx b/features/modals/user-settings-modal/notifications-form.tsx similarity index 100% rename from components/modals/user-settings-modal/components/notifications-form.tsx rename to features/modals/user-settings-modal/notifications-form.tsx index 02160b7e..c4164361 100644 --- a/components/modals/user-settings-modal/components/notifications-form.tsx +++ b/features/modals/user-settings-modal/notifications-form.tsx @@ -1,16 +1,16 @@ 'use client'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useQueryClient } from '@tanstack/react-query'; import { useSnackbar } from 'notistack'; import { useEffect } from 'react'; import { useForm } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; -import { useQueryClient } from '@tanstack/react-query'; - import FormSwitch from '@/components/form/form-switch'; import H5 from '@/components/typography/h5'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import useChangeIgnoredNotifications from '@/services/hooks/settings/useChangeIgnoredNotifications'; import useIgnoredNotifications from '@/services/hooks/settings/useIgnoredNotifications'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/components/modals/user-settings-modal/components/password-form.tsx b/features/modals/user-settings-modal/password-form.tsx similarity index 100% rename from components/modals/user-settings-modal/components/password-form.tsx rename to features/modals/user-settings-modal/password-form.tsx index c87b6c22..7d0097b1 100644 --- a/components/modals/user-settings-modal/components/password-form.tsx +++ b/features/modals/user-settings-modal/password-form.tsx @@ -1,14 +1,14 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import { useForm } from 'react-hook-form'; - import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useSnackbar } from 'notistack'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import changeUserPassword from '@/services/api/settings/changeUserPassword'; import { useModalContext } from '@/services/providers/modal-provider'; import { z } from '@/utils/zod'; diff --git a/components/modals/user-settings-modal/user-settings-modal.tsx b/features/modals/user-settings-modal/user-settings-modal.tsx similarity index 87% rename from components/modals/user-settings-modal/user-settings-modal.tsx rename to features/modals/user-settings-modal/user-settings-modal.tsx index d1f0f0a7..f6a2672c 100644 --- a/components/modals/user-settings-modal/user-settings-modal.tsx +++ b/features/modals/user-settings-modal/user-settings-modal.tsx @@ -1,6 +1,5 @@ 'use client'; -import * as React from 'react'; import { Dispatch, ReactNode, @@ -10,17 +9,19 @@ import { } from 'react'; import MaterialSymbolsKeyboardBackspaceRounded from '~icons/material-symbols/keyboard-backspace-rounded'; -import CustomizationForm from '@/components/modals/user-settings-modal/components/customization-form'; -import EmailForm from '@/components/modals/user-settings-modal/components/email-form'; -import GeneralForm from '@/components/modals/user-settings-modal/components/general-form'; -import NotificationsForm from '@/components/modals/user-settings-modal/components/notifications-form'; -import PasswordForm from '@/components/modals/user-settings-modal/components/password-form'; -import UsernameForm from '@/components/modals/user-settings-modal/components/username-form'; -import WatchListForm from '@/components/modals/user-settings-modal/components/watchlist-form'; import H3 from '@/components/typography/h3'; import Small from '@/components/typography/small'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; + +import CustomizationForm from '@/features/modals/user-settings-modal/customization-form'; +import EmailForm from '@/features/modals/user-settings-modal/email-form'; +import GeneralForm from '@/features/modals/user-settings-modal/general-form'; +import NotificationsForm from '@/features/modals/user-settings-modal/notifications-form'; +import PasswordForm from '@/features/modals/user-settings-modal/password-form'; +import UsernameForm from '@/features/modals/user-settings-modal/username-form'; +import WatchListForm from '@/features/modals/user-settings-modal/watchlist-form/watchlist-form'; + import { useMediaQuery } from '@/services/hooks/useMediaQuery'; import { cn } from '@/utils/utils'; diff --git a/components/modals/user-settings-modal/components/username-form.tsx b/features/modals/user-settings-modal/username-form.tsx similarity index 99% rename from components/modals/user-settings-modal/components/username-form.tsx rename to features/modals/user-settings-modal/username-form.tsx index 89cac2ea..a6926ba8 100644 --- a/components/modals/user-settings-modal/components/username-form.tsx +++ b/features/modals/user-settings-modal/username-form.tsx @@ -1,16 +1,15 @@ 'use client'; -import { useSnackbar } from 'notistack'; -import { useForm } from 'react-hook-form'; - -import { useRouter } from 'next/navigation'; - import { zodResolver } from '@hookform/resolvers/zod'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useSnackbar } from 'notistack'; +import { useForm } from 'react-hook-form'; import FormInput from '@/components/form/form-input'; import { Button } from '@/components/ui/button'; import { Form } from '@/components/ui/form'; + import changeUserUsername from '@/services/api/settings/changeUserUsername'; import { useModalContext } from '@/services/providers/modal-provider'; import { z } from '@/utils/zod'; diff --git a/components/modals/user-settings-modal/components/watchlist-form/components/anilist.tsx b/features/modals/user-settings-modal/watchlist-form/anilist.tsx similarity index 99% rename from components/modals/user-settings-modal/components/watchlist-form/components/anilist.tsx rename to features/modals/user-settings-modal/watchlist-form/anilist.tsx index d1b02139..1209ddc8 100644 --- a/components/modals/user-settings-modal/components/watchlist-form/components/anilist.tsx +++ b/features/modals/user-settings-modal/watchlist-form/anilist.tsx @@ -7,6 +7,7 @@ import MaterialSymbolsCheckSmallRounded from '~icons/material-symbols/check-smal import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; + import importAnilistWatch from '@/services/api/settings/importAnilistWatch'; import FoundList from './found-list'; diff --git a/components/modals/user-settings-modal/components/watchlist-form/components/found-list.tsx b/features/modals/user-settings-modal/watchlist-form/found-list.tsx similarity index 100% rename from components/modals/user-settings-modal/components/watchlist-form/components/found-list.tsx rename to features/modals/user-settings-modal/watchlist-form/found-list.tsx diff --git a/components/modals/user-settings-modal/components/watchlist-form/components/general.tsx b/features/modals/user-settings-modal/watchlist-form/general.tsx similarity index 97% rename from components/modals/user-settings-modal/components/watchlist-form/components/general.tsx rename to features/modals/user-settings-modal/watchlist-form/general.tsx index 9e349e20..84e2d9a8 100644 --- a/components/modals/user-settings-modal/components/watchlist-form/components/general.tsx +++ b/features/modals/user-settings-modal/watchlist-form/general.tsx @@ -1,17 +1,17 @@ 'use client'; import clsx from 'clsx'; +import Link from 'next/link'; import { Dispatch, SetStateAction, useCallback } from 'react'; import { useDropzone } from 'react-dropzone'; import { xml2json } from 'xml-js'; -import Link from 'next/link'; - -import FoundList from '@/components/modals/user-settings-modal/components/watchlist-form/components/found-list'; import P from '@/components/typography/p'; import Small from '@/components/typography/small'; import { Label } from '@/components/ui/label'; +import FoundList from '@/features/modals/user-settings-modal/watchlist-form/found-list'; + interface Props { watchList: Record[]; setWatchList: Dispatch[]>>; diff --git a/components/modals/user-settings-modal/components/watchlist-form/watchlist-form.tsx b/features/modals/user-settings-modal/watchlist-form/watchlist-form.tsx similarity index 97% rename from components/modals/user-settings-modal/components/watchlist-form/watchlist-form.tsx rename to features/modals/user-settings-modal/watchlist-form/watchlist-form.tsx index 5ec85039..1b4ca7ff 100644 --- a/components/modals/user-settings-modal/components/watchlist-form/watchlist-form.tsx +++ b/features/modals/user-settings-modal/watchlist-form/watchlist-form.tsx @@ -1,19 +1,19 @@ 'use client'; +import { useQueryClient } from '@tanstack/react-query'; import { useSnackbar } from 'notistack'; import { useEffect, useState } from 'react'; -import { useQueryClient } from '@tanstack/react-query'; - import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; + import importWatch from '@/services/api/settings/importWatch'; import { useModalContext } from '@/services/providers/modal-provider'; -import Anilist from './components/anilist'; -import General from './components/general'; +import Anilist from './anilist'; +import General from './general'; const Component = () => { const { enqueueSnackbar } = useSnackbar(); diff --git a/components/modals/watch-edit-modal.tsx b/features/modals/watch-edit-modal.tsx similarity index 100% rename from components/modals/watch-edit-modal.tsx rename to features/modals/watch-edit-modal.tsx index df0066b4..6e18dbb9 100644 --- a/components/modals/watch-edit-modal.tsx +++ b/features/modals/watch-edit-modal.tsx @@ -1,10 +1,9 @@ 'use client'; +import { zodResolver } from '@hookform/resolvers/zod'; import { createElement, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; - import FormInput from '@/components/form/form-input'; import FormTextarea from '@/components/form/form-textarea'; import { Button } from '@/components/ui/button'; @@ -19,6 +18,7 @@ import { SelectList, SelectTrigger, } from '@/components/ui/select'; + import useAddToList from '@/services/hooks/watch/useAddToList'; import useDeleteFromList from '@/services/hooks/watch/useDeleteFromList'; import useWatch from '@/services/hooks/watch/useWatch'; diff --git a/app/(pages)/(content)/people/[slug]/components/anime.tsx b/features/people/person-view/anime.tsx similarity index 94% rename from app/(pages)/(content)/people/[slug]/components/anime.tsx rename to features/people/person-view/anime.tsx index cf268709..35432cee 100644 --- a/app/(pages)/(content)/people/[slug]/components/anime.tsx +++ b/features/people/person-view/anime.tsx @@ -1,14 +1,14 @@ 'use client'; -import React, { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import AnimeCard from '@/app/(pages)/(content)/components/anime-card'; +import AnimeCard from '@/components/anime-card'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import usePersonAnime from '@/services/hooks/people/usePersonAnime'; interface Props { diff --git a/app/(pages)/(content)/people/[slug]/components/characters.tsx b/features/people/person-view/characters.tsx similarity index 98% rename from app/(pages)/(content)/people/[slug]/components/characters.tsx rename to features/people/person-view/characters.tsx index 691d9f06..5808f82d 100644 --- a/app/(pages)/(content)/people/[slug]/components/characters.tsx +++ b/features/people/person-view/characters.tsx @@ -1,14 +1,13 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import Stack from '@/components/ui/stack'; + import usePersonCharacters from '@/services/hooks/people/usePersonCharacters'; import CharacterAnimeCard from '../../../components/character-anime-card'; diff --git a/app/(pages)/(content)/people/[slug]/components/cover.tsx b/features/people/person-view/cover.tsx similarity index 99% rename from app/(pages)/(content)/people/[slug]/components/cover.tsx rename to features/people/person-view/cover.tsx index 1f66f03d..c6f672ea 100644 --- a/app/(pages)/(content)/people/[slug]/components/cover.tsx +++ b/features/people/person-view/cover.tsx @@ -3,6 +3,7 @@ import { useParams } from 'next/navigation'; import ContentCard from '@/components/content-card/content-card'; + import usePersonInfo from '@/services/hooks/people/usePersonInfo'; const Cover = () => { diff --git a/app/(pages)/(content)/people/[slug]/components/title.tsx b/features/people/person-view/title.tsx similarity index 96% rename from app/(pages)/(content)/people/[slug]/components/title.tsx rename to features/people/person-view/title.tsx index 208d7af0..b5494e5e 100644 --- a/app/(pages)/(content)/people/[slug]/components/title.tsx +++ b/features/people/person-view/title.tsx @@ -1,12 +1,12 @@ 'use client'; -import { useRef } from 'react'; - import { useParams } from 'next/navigation'; +import { useRef } from 'react'; -import EditButton from '@/app/(pages)/(content)/components/edit-button'; +import EditButton from '@/components/edit-button'; import H2 from '@/components/typography/h2'; import P from '@/components/typography/p'; + import useSession from '@/services/hooks/auth/useSession'; import usePersonInfo from '@/services/hooks/people/usePersonInfo'; diff --git a/app/(pages)/schedule/components/ui/schedule-item.tsx b/features/schedule/schedule-list/schedule-item.tsx similarity index 91% rename from app/(pages)/schedule/components/ui/schedule-item.tsx rename to features/schedule/schedule-list/schedule-item.tsx index a32b493e..6bc90831 100644 --- a/app/(pages)/schedule/components/ui/schedule-item.tsx +++ b/features/schedule/schedule-list/schedule-item.tsx @@ -1,13 +1,15 @@ 'use client'; -import React, { FC, memo } from 'react'; +import { FC, memo } from 'react'; -import ScheduleWatchButton from '@/app/(pages)/schedule/components/ui/schedule-watch-button'; -import HorizontalContentCard, { - Props as HorizontalContentCardProps, -} from '@/components/horizontal-content-card'; import H5 from '@/components/typography/h5'; import P from '@/components/typography/p'; +import HorizontalContentCard, { + Props as HorizontalContentCardProps, +} from '@/components/ui/horizontal-content-card'; + +import ScheduleWatchButton from '@/features/schedule/schedule-watch-button'; + import getScheduleDuration from '@/utils/getScheduleDuration'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/schedule/components/schedule-list.tsx b/features/schedule/schedule-list/schedule-list.tsx similarity index 92% rename from app/(pages)/schedule/components/schedule-list.tsx rename to features/schedule/schedule-list/schedule-list.tsx index acb8dd3a..02a0aba5 100644 --- a/app/(pages)/schedule/components/schedule-list.tsx +++ b/features/schedule/schedule-list/schedule-list.tsx @@ -2,16 +2,16 @@ import { getUnixTime, startOfDay } from 'date-fns'; import format from 'date-fns/format'; -import * as React from 'react'; -import FiltersNotFound from '@/components/filters/components/filters-not-found'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; -import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; + +import FiltersNotFound from '@/features/filters/filters-not-found'; + import useAnimeSchedule from '@/services/hooks/stats/useAnimeSchedule'; -import ScheduleItem from './ui/schedule-item'; +import ScheduleItem from './schedule-item'; const ScheduleList = () => { const { diff --git a/app/(pages)/schedule/components/ui/schedule-watch-button.tsx b/features/schedule/schedule-watch-button.tsx similarity index 94% rename from app/(pages)/schedule/components/ui/schedule-watch-button.tsx rename to features/schedule/schedule-watch-button.tsx index 1ba8ccfb..7907e09e 100644 --- a/app/(pages)/schedule/components/ui/schedule-watch-button.tsx +++ b/features/schedule/schedule-watch-button.tsx @@ -1,10 +1,12 @@ 'use client'; import { useSnackbar } from 'notistack'; -import React, { FC, Fragment, createElement, memo } from 'react'; +import { FC, Fragment, createElement, memo } from 'react'; -import WatchEditModal from '@/components/modals/watch-edit-modal'; import { Button } from '@/components/ui/button'; + +import WatchEditModal from '@/features/modals/watch-edit-modal'; + import useSession from '@/services/hooks/auth/useSession'; import useAddToList from '@/services/hooks/watch/useAddToList'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/app/(pages)/(user)/u/[username]/history/components/history/components/following-history.tsx b/features/users/user-history/following-history.tsx similarity index 95% rename from app/(pages)/(user)/u/[username]/history/components/history/components/following-history.tsx rename to features/users/user-history/following-history.tsx index c260592e..7980fd8e 100644 --- a/app/(pages)/(user)/u/[username]/history/components/history/components/following-history.tsx +++ b/features/users/user-history/following-history.tsx @@ -8,13 +8,14 @@ import { Badge } from '@/components/ui/badge'; import Card from '@/components/ui/card'; import NotFound from '@/components/ui/not-found'; import Stack from '@/components/ui/stack'; + import useUserHistory from '@/services/hooks/history/useFollowingHistory'; interface Props { className?: string; } -const History: FC = ({ className }) => { +const FollowingHistory: FC = ({ className }) => { const { list, fetchNextPage, isFetchingNextPage, hasNextPage, ref } = useUserHistory(); @@ -55,4 +56,4 @@ const History: FC = ({ className }) => { ); }; -export default History; +export default FollowingHistory; diff --git a/app/(pages)/(user)/u/[username]/history/components/history/components/user-history.tsx b/features/users/user-history/history.tsx similarity index 95% rename from app/(pages)/(user)/u/[username]/history/components/history/components/user-history.tsx rename to features/users/user-history/history.tsx index 29fb0d88..5fab7e27 100644 --- a/app/(pages)/(user)/u/[username]/history/components/history/components/user-history.tsx +++ b/features/users/user-history/history.tsx @@ -1,8 +1,7 @@ 'use client'; -import { FC, Fragment } from 'react'; - import { useParams } from 'next/navigation'; +import { FC, Fragment } from 'react'; import HistoryItem from '@/components/history-item'; import LoadMoreButton from '@/components/load-more-button'; @@ -10,6 +9,7 @@ import { Badge } from '@/components/ui/badge'; import Card from '@/components/ui/card'; import NotFound from '@/components/ui/not-found'; import Stack from '@/components/ui/stack'; + import useUserHistory from '@/services/hooks/user/useUserHistory'; interface Props { @@ -18,9 +18,10 @@ interface Props { const History: FC = ({ className }) => { const params = useParams(); - const { list, fetchNextPage, isFetchingNextPage, hasNextPage, ref } = useUserHistory({ - username: String(params.username), - }); + const { list, fetchNextPage, isFetchingNextPage, hasNextPage, ref } = + useUserHistory({ + username: String(params.username), + }); return ( diff --git a/app/(pages)/(user)/u/[username]/history/components/history/history.tsx b/features/users/user-history/user-history.tsx similarity index 88% rename from app/(pages)/(user)/u/[username]/history/components/history/history.tsx rename to features/users/user-history/user-history.tsx index 8ba00489..07f37de2 100644 --- a/app/(pages)/(user)/u/[username]/history/components/history/history.tsx +++ b/features/users/user-history/user-history.tsx @@ -1,28 +1,28 @@ 'use client'; -import { FC } from 'react'; - import { useParams, usePathname, useRouter, useSearchParams, } from 'next/navigation'; +import { FC } from 'react'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; + import useSession from '@/services/hooks/auth/useSession'; import { cn } from '@/utils/utils'; -import FollowingHistory from './components/following-history'; -import UserHistory from './components/user-history'; +import FollowingHistory from './following-history'; +import History from './history'; interface Props { className?: string; } -const History: FC = ({ className }) => { +const UserHistory: FC = ({ className }) => { const params = useParams(); const pathname = usePathname(); const router = useRouter(); @@ -58,10 +58,10 @@ const History: FC = ({ className }) => { )}
- {type === 'user' && } + {type === 'user' && } {type === 'following' && }
); }; -export default History; +export default UserHistory; diff --git a/app/(pages)/(user)/u/[username]/components/activation-alert.tsx b/features/users/user-profile/activation-alert.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/activation-alert.tsx rename to features/users/user-profile/activation-alert.tsx index 96f4131c..e0469b63 100644 --- a/app/(pages)/(user)/u/[username]/components/activation-alert.tsx +++ b/features/users/user-profile/activation-alert.tsx @@ -1,11 +1,11 @@ 'use client'; +import { useParams } from 'next/navigation'; import { useSnackbar } from 'notistack'; import MaterialSymbolsInfoRounded from '~icons/material-symbols/info-rounded'; -import { useParams } from 'next/navigation'; - import { Button } from '@/components/ui/button'; + import resendActivation from '@/services/api/auth/resendActivation'; import useSession from '@/services/hooks/auth/useSession'; import useUser from '@/services/hooks/user/useUser'; diff --git a/app/(pages)/(user)/u/[username]/components/favorites/_components/anime.tsx b/features/users/user-profile/favorites/anime.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/favorites/_components/anime.tsx rename to features/users/user-profile/favorites/anime.tsx index 06bf6101..e25b1306 100644 --- a/app/(pages)/(user)/u/[username]/components/favorites/_components/anime.tsx +++ b/features/users/user-profile/favorites/anime.tsx @@ -1,12 +1,12 @@ 'use client'; -import React, { FC } from 'react'; - import { useParams } from 'next/navigation'; +import React, { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import LoadMoreButton from '@/components/load-more-button'; import NotFound from '@/components/ui/not-found'; + import useFavorites from '@/services/hooks/favorite/useFavorites'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(user)/u/[username]/components/favorites/_components/characters.tsx b/features/users/user-profile/favorites/characters.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/favorites/_components/characters.tsx rename to features/users/user-profile/favorites/characters.tsx index f196d4f6..187dd63b 100644 --- a/app/(pages)/(user)/u/[username]/components/favorites/_components/characters.tsx +++ b/features/users/user-profile/favorites/characters.tsx @@ -1,13 +1,13 @@ 'use client'; -import React, { FC } from 'react'; - import { useParams } from 'next/navigation'; +import React, { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import LoadMoreButton from '@/components/load-more-button'; import NotFound from '@/components/ui/not-found'; import Stack from '@/components/ui/stack'; + import useFavorites from '@/services/hooks/favorite/useFavorites'; interface Props { diff --git a/app/(pages)/(user)/u/[username]/components/favorites/_components/collections.tsx b/features/users/user-profile/favorites/collections.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/favorites/_components/collections.tsx rename to features/users/user-profile/favorites/collections.tsx index a5c05991..b4407758 100644 --- a/app/(pages)/(user)/u/[username]/components/favorites/_components/collections.tsx +++ b/features/users/user-profile/favorites/collections.tsx @@ -1,12 +1,12 @@ 'use client'; -import React, { FC } from 'react'; - import { useParams } from 'next/navigation'; +import React, { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import LoadMoreButton from '@/components/load-more-button'; import NotFound from '@/components/ui/not-found'; + import useFavorites from '@/services/hooks/favorite/useFavorites'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(user)/u/[username]/components/favorites/favorites.tsx b/features/users/user-profile/favorites/favorites.tsx similarity index 93% rename from app/(pages)/(user)/u/[username]/components/favorites/favorites.tsx rename to features/users/user-profile/favorites/favorites.tsx index 5379062c..08d8668a 100644 --- a/app/(pages)/(user)/u/[username]/components/favorites/favorites.tsx +++ b/features/users/user-profile/favorites/favorites.tsx @@ -1,16 +1,15 @@ 'use client'; -import { FC, useState } from 'react'; - import { useParams } from 'next/navigation'; +import { FC, useState } from 'react'; import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; -import Anime from './_components/anime'; -import Character from './_components/characters'; -import Collections from './_components/collections'; +import Anime from './anime'; +import Character from './characters'; +import Collections from './collections'; interface Props { extended?: boolean; diff --git a/app/(pages)/(user)/u/[username]/components/follow-button.tsx b/features/users/user-profile/follow-button.tsx similarity index 98% rename from app/(pages)/(user)/u/[username]/components/follow-button.tsx rename to features/users/user-profile/follow-button.tsx index 29a602a6..94daddac 100644 --- a/app/(pages)/(user)/u/[username]/components/follow-button.tsx +++ b/features/users/user-profile/follow-button.tsx @@ -1,13 +1,14 @@ 'use client'; +import { useParams } from 'next/navigation'; import { FC } from 'react'; import CilUserFollow from '~icons/cil/user-follow'; import CilUserUnfollow from '~icons/cil/user-unfollow'; -import { useParams } from 'next/navigation'; - -import AuthModal from '@/components/modals/auth-modal/auth-modal'; import { Button } from '@/components/ui/button'; + +import AuthModal from '@/features/modals/auth-modal/auth-modal'; + import useSession from '@/services/hooks/auth/useSession'; import useFollow from '@/services/hooks/follow/useFollow'; import useFollowChecker from '@/services/hooks/follow/useFollowChecker'; diff --git a/app/(pages)/(user)/u/[username]/components/follow-stats.tsx b/features/users/user-profile/follow-stats.tsx similarity index 97% rename from app/(pages)/(user)/u/[username]/components/follow-stats.tsx rename to features/users/user-profile/follow-stats.tsx index 53f54559..663662a9 100644 --- a/app/(pages)/(user)/u/[username]/components/follow-stats.tsx +++ b/features/users/user-profile/follow-stats.tsx @@ -1,12 +1,13 @@ 'use client'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; -import FollowlistModal from '@/components/modals/followlist-modal'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; + +import FollowlistModal from '@/features/modals/followlist-modal'; + import useFollowStats from '@/services/hooks/follow/useFollowStats'; import { useModalContext } from '@/services/providers/modal-provider'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(user)/u/[username]/components/ui/follow-user-item.tsx b/features/users/user-profile/follow-user-item.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/components/ui/follow-user-item.tsx rename to features/users/user-profile/follow-user-item.tsx index f8e422e4..34d4c338 100644 --- a/app/(pages)/(user)/u/[username]/components/ui/follow-user-item.tsx +++ b/features/users/user-profile/follow-user-item.tsx @@ -1,16 +1,15 @@ 'use client'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; +import Link from 'next/link'; import * as React from 'react'; import { FC } from 'react'; import MaterialSymbolsShieldRounded from '~icons/material-symbols/shield-rounded'; -import Link from 'next/link'; - -import { useMutation, useQueryClient } from '@tanstack/react-query'; - import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Button } from '@/components/ui/button'; + import follow from '@/services/api/follow/follow'; import unfollow from '@/services/api/follow/unfollow'; diff --git a/app/(pages)/(user)/u/[username]/components/history/components/history-modal.tsx b/features/users/user-profile/history/history-modal.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/history/components/history-modal.tsx rename to features/users/user-profile/history/history-modal.tsx index f5a015f7..cc9f1fc5 100644 --- a/app/(pages)/(user)/u/[username]/components/history/components/history-modal.tsx +++ b/features/users/user-profile/history/history-modal.tsx @@ -1,11 +1,11 @@ 'use client'; -import * as React from 'react'; - import { useParams } from 'next/navigation'; +import * as React from 'react'; import HistoryItem from '@/components/history-item'; import LoadMoreButton from '@/components/load-more-button'; + import useUserHistory from '@/services/hooks/user/useUserHistory'; interface Props { diff --git a/app/(pages)/(user)/u/[username]/components/history/history.tsx b/features/users/user-profile/history/history.tsx similarity index 97% rename from app/(pages)/(user)/u/[username]/components/history/history.tsx rename to features/users/user-profile/history/history.tsx index a4522fc1..c92565fd 100644 --- a/app/(pages)/(user)/u/[username]/components/history/history.tsx +++ b/features/users/user-profile/history/history.tsx @@ -1,21 +1,21 @@ 'use client'; -import { FC } from 'react'; -import MaterialSymbolsGridViewRounded from '~icons/material-symbols/grid-view-rounded'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import { FC } from 'react'; +import MaterialSymbolsGridViewRounded from '~icons/material-symbols/grid-view-rounded'; import HistoryItem from '@/components/history-item'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; import NotFound from '@/components/ui/not-found'; + import useUserHistory from '@/services/hooks/user/useUserHistory'; import { useModalContext } from '@/services/providers/modal-provider'; import { cn } from '@/utils/utils'; -import ActivityModal from './components/history-modal'; +import ActivityModal from './history-modal'; interface Props { className?: string; diff --git a/app/(pages)/(user)/u/[username]/components/list-stats.tsx b/features/users/user-profile/list-stats.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/list-stats.tsx rename to features/users/user-profile/list-stats.tsx index a750e14d..ebb53c7e 100644 --- a/app/(pages)/(user)/u/[username]/components/list-stats.tsx +++ b/features/users/user-profile/list-stats.tsx @@ -1,13 +1,13 @@ 'use client'; -import MaterialSymbolsOpenInNewRounded from '~icons/material-symbols/open-in-new-rounded'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import MaterialSymbolsOpenInNewRounded from '~icons/material-symbols/open-in-new-rounded'; import { Label } from '@/components/ui/label'; import RadialProgress from '@/components/ui/radial-progress'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; + import useWatchStats from '@/services/hooks/watch/useWatchStats'; import { WATCH_STATUS } from '@/utils/constants'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(user)/u/[username]/components/collections/components/ui/collection-item.tsx b/features/users/user-profile/user-collections/collection-item.tsx similarity index 86% rename from app/(pages)/(user)/u/[username]/components/collections/components/ui/collection-item.tsx rename to features/users/user-profile/user-collections/collection-item.tsx index 3eeb0a78..17c3eb08 100644 --- a/app/(pages)/(user)/u/[username]/components/collections/components/ui/collection-item.tsx +++ b/features/users/user-profile/user-collections/collection-item.tsx @@ -1,11 +1,11 @@ -import React, { FC, Fragment, memo } from 'react'; +import { FC, Fragment, memo } from 'react'; import BxBxsUpvote from '~icons/bx/bxs-upvote'; import IconamoonCommentFill from '~icons/iconamoon/comment-fill'; import MaterialSymbolsGridViewRounded from '~icons/material-symbols/grid-view-rounded'; import Small from '@/components/typography/small'; import HorizontalCard from '@/components/ui/horizontal-card'; -import parseTextFromMarkDown from '@/utils/parseTextFromMarkDown'; + import { cn } from '@/utils/utils'; interface Props { @@ -14,7 +14,6 @@ interface Props { } const CollectionItem: FC = ({ data, className }) => { - const description = parseTextFromMarkDown(data.description); const poster = (content: API.MainContent) => content.data_type === 'anime' ? content.poster : content.image; @@ -53,8 +52,10 @@ const CollectionItem: FC = ({ data, className }) => { data.spoiler && 'blur-sm duration-500 hover:blur-none', )} image={poster(data.collection[0].content)} - imageClassName={cn(data.nsfw && 'blur-sm duration-500 hover:blur-none')} - description={description} + imageClassName={cn( + data.nsfw && 'blur-sm duration-500 hover:blur-none', + )} + description={data.description} descriptionClassName={cn( data.spoiler && 'blur-sm duration-500 hover:blur-none', )} diff --git a/app/(pages)/(user)/u/[username]/components/collections/components/collections-modal.tsx b/features/users/user-profile/user-collections/collections-modal.tsx similarity index 94% rename from app/(pages)/(user)/u/[username]/components/collections/components/collections-modal.tsx rename to features/users/user-profile/user-collections/collections-modal.tsx index 9787e66b..695d8d61 100644 --- a/app/(pages)/(user)/u/[username]/components/collections/components/collections-modal.tsx +++ b/features/users/user-profile/user-collections/collections-modal.tsx @@ -1,14 +1,13 @@ 'use client'; -import * as React from 'react'; -import { FC } from 'react'; - import { useParams } from 'next/navigation'; +import { FC } from 'react'; import LoadMoreButton from '@/components/load-more-button'; + import useUserCollections from '@/services/hooks/user/useUserCollections'; -import CollectionItem from './ui/collection-item'; +import CollectionItem from './collection-item'; interface Props { className?: string; diff --git a/app/(pages)/(user)/u/[username]/components/collections/collections.tsx b/features/users/user-profile/user-collections/user-collections.tsx similarity index 92% rename from app/(pages)/(user)/u/[username]/components/collections/collections.tsx rename to features/users/user-profile/user-collections/user-collections.tsx index 8eada06e..63a7ab83 100644 --- a/app/(pages)/(user)/u/[username]/components/collections/collections.tsx +++ b/features/users/user-profile/user-collections/user-collections.tsx @@ -1,28 +1,28 @@ 'use client'; -import { FC } from 'react'; -import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; - import Link from 'next/link'; import { useParams } from 'next/navigation'; +import { FC } from 'react'; +import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; import Block from '@/components/ui/block'; import { Button } from '@/components/ui/button'; import Header from '@/components/ui/header'; import NotFound from '@/components/ui/not-found'; + import useSession from '@/services/hooks/auth/useSession'; import useUserCollections from '@/services/hooks/user/useUserCollections'; import { useModalContext } from '@/services/providers/modal-provider'; import { cn } from '@/utils/utils'; -import CollectionsModal from './components/collections-modal'; -import CollectionItem from './components/ui/collection-item'; +import CollectionItem from './collection-item'; +import CollectionsModal from './collections-modal'; interface Props { className?: string; } -const Collections: FC = ({ className }) => { +const UserCollections: FC = ({ className }) => { const params = useParams(); const { openModal } = useModalContext(); @@ -85,4 +85,4 @@ const Collections: FC = ({ className }) => { ); }; -export default Collections; +export default UserCollections; diff --git a/app/(pages)/(user)/u/[username]/components/user-info.tsx b/features/users/user-profile/user-info.tsx similarity index 98% rename from app/(pages)/(user)/u/[username]/components/user-info.tsx rename to features/users/user-profile/user-info.tsx index 0323c8e9..cbe1b5ca 100644 --- a/app/(pages)/(user)/u/[username]/components/user-info.tsx +++ b/features/users/user-profile/user-info.tsx @@ -1,14 +1,11 @@ 'use client'; -import * as React from 'react'; +import { useParams } from 'next/navigation'; import { ChangeEvent, useRef } from 'react'; import MaterialSymbolsImageOutlineRounded from '~icons/material-symbols/image-outline-rounded'; import MaterialSymbolsPerson2OutlineRounded from '~icons/material-symbols/person-2-outline-rounded'; import MaterialSymbolsUploadRounded from '~icons/material-symbols/upload-rounded'; -import { useParams } from 'next/navigation'; - -import CropEditorModal from '@/components/modals/crop-editor-modal'; import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -18,6 +15,9 @@ import { } from '@/components/ui/dropdown-menu'; import Image from '@/components/ui/image'; import { Input } from '@/components/ui/input'; + +import CropEditorModal from '@/features/modals/crop-editor-modal'; + import useSession from '@/services/hooks/auth/useSession'; import useUser from '@/services/hooks/user/useUser'; import { useModalContext } from '@/services/providers/modal-provider'; diff --git a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/_components/ui/activity-item.tsx b/features/users/user-profile/user-statistics/activity-stats/activity-item.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/_components/ui/activity-item.tsx rename to features/users/user-profile/user-statistics/activity-stats/activity-item.tsx index 802a06ee..8be37411 100644 --- a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/_components/ui/activity-item.tsx +++ b/features/users/user-profile/user-statistics/activity-stats/activity-item.tsx @@ -9,6 +9,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import getDeclensionWord from '@/utils/getDeclensionWord'; interface Props { diff --git a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/activity-stats.tsx b/features/users/user-profile/user-statistics/activity-stats/activity-stats.tsx similarity index 94% rename from app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/activity-stats.tsx rename to features/users/user-profile/user-statistics/activity-stats/activity-stats.tsx index 63b8f119..b3ec9843 100644 --- a/app/(pages)/(user)/u/[username]/components/statistics/_components/activity-stats/activity-stats.tsx +++ b/features/users/user-profile/user-statistics/activity-stats/activity-stats.tsx @@ -1,15 +1,14 @@ 'use client'; -import React from 'react'; -import MaterialSymbolsBarChartRounded from '~icons/material-symbols/bar-chart-rounded'; - import { useParams } from 'next/navigation'; +import MaterialSymbolsBarChartRounded from '~icons/material-symbols/bar-chart-rounded'; import { Label } from '@/components/ui/label'; + import useUserActivity from '@/services/hooks/user/useUserActivity'; import { convertToDays } from '@/utils/convertActivityStats'; -import ActivityItem from './_components/ui/activity-item'; +import ActivityItem from './activity-item'; const ActivityStats = () => { const params = useParams(); diff --git a/app/(pages)/(user)/u/[username]/components/statistics/statistics.tsx b/features/users/user-profile/user-statistics/user-statistics.tsx similarity index 60% rename from app/(pages)/(user)/u/[username]/components/statistics/statistics.tsx rename to features/users/user-profile/user-statistics/user-statistics.tsx index ef05653f..67615eeb 100644 --- a/app/(pages)/(user)/u/[username]/components/statistics/statistics.tsx +++ b/features/users/user-profile/user-statistics/user-statistics.tsx @@ -1,12 +1,10 @@ -import React from 'react'; - import Block from '@/components/ui/block'; import Header from '@/components/ui/header'; -import ActivityStats from './_components/activity-stats/activity-stats'; -import WatchhourStats from './_components/watchhour-stats'; +import ActivityStats from './activity-stats/activity-stats'; +import WatchhourStats from './watchhour-stats'; -const Statistics = () => { +const UserStatistics = () => { return (
@@ -18,4 +16,4 @@ const Statistics = () => { ); }; -export default Statistics; +export default UserStatistics; diff --git a/app/(pages)/(user)/u/[username]/components/statistics/_components/watchhour-stats.tsx b/features/users/user-profile/user-statistics/watchhour-stats.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/components/statistics/_components/watchhour-stats.tsx rename to features/users/user-profile/user-statistics/watchhour-stats.tsx index 27e7067c..fcf7c41b 100644 --- a/app/(pages)/(user)/u/[username]/components/statistics/_components/watchhour-stats.tsx +++ b/features/users/user-profile/user-statistics/watchhour-stats.tsx @@ -2,11 +2,10 @@ import formatDuration from 'date-fns/formatDuration'; import intervalToDuration from 'date-fns/intervalToDuration'; +import { useParams } from 'next/navigation'; import React from 'react'; import MaterialSymbolsClockLoader10 from '~icons/material-symbols/clock-loader-10'; -import { useParams } from 'next/navigation'; - import H5 from '@/components/typography/h5'; import Small from '@/components/typography/small'; import { Label } from '@/components/ui/label'; @@ -16,6 +15,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import useWatchStats from '@/services/hooks/watch/useWatchStats'; const WatchhourStats = () => { diff --git a/app/(pages)/(user)/u/[username]/components/user-title.tsx b/features/users/user-profile/user-title.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/components/user-title.tsx rename to features/users/user-profile/user-title.tsx index 397fdac7..c72b94de 100644 --- a/app/(pages)/(user)/u/[username]/components/user-title.tsx +++ b/features/users/user-profile/user-title.tsx @@ -1,9 +1,8 @@ 'use client'; -import React from 'react'; -import ClarityAdministratorSolid from '~icons/clarity/administrator-solid'; - import { useParams } from 'next/navigation'; +import React from 'react'; +import ClarityAdministratorSolid from '~icons/clarity/administrator-solid'; import H3 from '@/components/typography/h3'; import P from '@/components/typography/p'; @@ -12,6 +11,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; + import useUser from '@/services/hooks/user/useUser'; interface Props {} diff --git a/app/(pages)/(user)/u/[username]/list/components/status-combobox.tsx b/features/users/user-watchlist/status-combobox.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/list/components/status-combobox.tsx rename to features/users/user-watchlist/status-combobox.tsx index 27af38a4..96f46fef 100644 --- a/app/(pages)/(user)/u/[username]/list/components/status-combobox.tsx +++ b/features/users/user-watchlist/status-combobox.tsx @@ -1,14 +1,13 @@ 'use client'; -import * as React from 'react'; -import { createElement } from 'react'; - import { useParams, usePathname, useRouter, useSearchParams, } from 'next/navigation'; +import * as React from 'react'; +import { createElement } from 'react'; import H5 from '@/components/typography/h5'; import { Label } from '@/components/ui/label'; @@ -21,6 +20,7 @@ import { SelectList, SelectTrigger, } from '@/components/ui/select'; + import useWatchList from '@/services/hooks/watch/useWatchList'; import { WATCH_STATUS } from '@/utils/constants'; import createQueryString from '@/utils/createQueryString'; diff --git a/app/(pages)/(user)/u/[username]/list/components/tools-combobox.tsx b/features/users/user-watchlist/tools-combobox.tsx similarity index 96% rename from app/(pages)/(user)/u/[username]/list/components/tools-combobox.tsx rename to features/users/user-watchlist/tools-combobox.tsx index 95925731..047b9ad3 100644 --- a/app/(pages)/(user)/u/[username]/list/components/tools-combobox.tsx +++ b/features/users/user-watchlist/tools-combobox.tsx @@ -1,14 +1,11 @@ 'use client'; +import { useMutation } from '@tanstack/react-query'; +import { useParams, useRouter, useSearchParams } from 'next/navigation'; import AntDesignFilterFilled from '~icons/ant-design/filter-filled'; import FeRandom from '~icons/fe/random'; import MaterialSymbolsMoreVert from '~icons/material-symbols/more-vert'; -import { useParams, useRouter, useSearchParams } from 'next/navigation'; - -import { useMutation } from '@tanstack/react-query'; - -import FiltersModal from '@/components/modals/anime-filters-modal'; import { Button } from '@/components/ui/button'; import { DropdownMenu, @@ -16,6 +13,9 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; + +import FiltersModal from '@/features/modals/anime-filters-modal'; + import getRandomWatch from '@/services/api/watch/getRandomWatch'; const ToolsCombobox = () => { diff --git a/app/(pages)/(user)/u/[username]/list/components/view-combobox.tsx b/features/users/user-watchlist/view-combobox.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/list/components/view-combobox.tsx rename to features/users/user-watchlist/view-combobox.tsx index 1dbe3b3a..3090a863 100644 --- a/app/(pages)/(user)/u/[username]/list/components/view-combobox.tsx +++ b/features/users/user-watchlist/view-combobox.tsx @@ -1,10 +1,9 @@ 'use client'; +import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import IcRoundGridView from '~icons/ic/round-grid-view'; import MaterialSymbolsEventList from '~icons/material-symbols/event-list'; -import { usePathname, useRouter, useSearchParams } from 'next/navigation'; - import { Button } from '@/components/ui/button'; import { Select, @@ -14,8 +13,8 @@ import { SelectList, SelectTrigger, } from '@/components/ui/select'; -import createQueryString from '@/utils/createQueryString'; +import createQueryString from '@/utils/createQueryString'; type View = 'table' | 'grid'; diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/details-cell.tsx b/features/users/user-watchlist/watchlist/details-cell.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/list/components/list/components/ui/details-cell.tsx rename to features/users/user-watchlist/watchlist/details-cell.tsx index 0c7fc91a..64fde3c0 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/details-cell.tsx +++ b/features/users/user-watchlist/watchlist/details-cell.tsx @@ -1,6 +1,5 @@ -import { FC } from 'react'; - import Link from 'next/link'; +import { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; import MDViewer from '@/components/markdown/viewer/MD-viewer'; diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/episodes-cell.tsx b/features/users/user-watchlist/watchlist/episodes-cell.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/list/components/list/components/ui/episodes-cell.tsx rename to features/users/user-watchlist/watchlist/episodes-cell.tsx diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/grid-view.tsx b/features/users/user-watchlist/watchlist/grid-view.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/list/components/list/components/grid-view.tsx rename to features/users/user-watchlist/watchlist/grid-view.tsx index cd33b4f8..4f8d6b6c 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/components/grid-view.tsx +++ b/features/users/user-watchlist/watchlist/grid-view.tsx @@ -3,6 +3,7 @@ import { FC } from 'react'; import ContentCard from '@/components/content-card/content-card'; + import { useSettingsContext } from '@/services/providers/settings-provider'; interface Props { diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/media-cell.tsx b/features/users/user-watchlist/watchlist/media-cell.tsx similarity index 99% rename from app/(pages)/(user)/u/[username]/list/components/list/components/ui/media-cell.tsx rename to features/users/user-watchlist/watchlist/media-cell.tsx index 2824962f..011b0499 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/media-cell.tsx +++ b/features/users/user-watchlist/watchlist/media-cell.tsx @@ -1,6 +1,7 @@ import { FC } from 'react'; import { TableCell } from '@/components/ui/table'; + import { MEDIA_TYPE } from '@/utils/constants'; interface Props { diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/number-cell.tsx b/features/users/user-watchlist/watchlist/number-cell.tsx similarity index 96% rename from app/(pages)/(user)/u/[username]/list/components/list/components/ui/number-cell.tsx rename to features/users/user-watchlist/watchlist/number-cell.tsx index 68b12668..2dfa84b7 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/number-cell.tsx +++ b/features/users/user-watchlist/watchlist/number-cell.tsx @@ -1,14 +1,15 @@ 'use client'; +import { useParams } from 'next/navigation'; import { FC } from 'react'; import MaterialSymbolsMoreVert from '~icons/material-symbols/more-vert'; -import { useParams } from 'next/navigation'; - -import WatchEditModal from '@/components/modals/watch-edit-modal'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { TableCell } from '@/components/ui/table'; + +import WatchEditModal from '@/features/modals/watch-edit-modal'; + import useSession from '@/services/hooks/auth/useSession'; import { useModalContext } from '@/services/providers/modal-provider'; import { cn } from '@/utils/utils'; diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/ui/score-cell.tsx b/features/users/user-watchlist/watchlist/score-cell.tsx similarity index 100% rename from app/(pages)/(user)/u/[username]/list/components/list/components/ui/score-cell.tsx rename to features/users/user-watchlist/watchlist/score-cell.tsx diff --git a/app/(pages)/(user)/u/[username]/list/components/list/components/table-view.tsx b/features/users/user-watchlist/watchlist/table-view.tsx similarity index 94% rename from app/(pages)/(user)/u/[username]/list/components/list/components/table-view.tsx rename to features/users/user-watchlist/watchlist/table-view.tsx index 8f9881ec..d4a362b0 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/components/table-view.tsx +++ b/features/users/user-watchlist/watchlist/table-view.tsx @@ -1,8 +1,7 @@ 'use client'; -import { FC } from 'react'; - import { usePathname, useRouter, useSearchParams } from 'next/navigation'; +import { FC } from 'react'; import { Table, @@ -11,14 +10,15 @@ import { TableHeader, TableRow, } from '@/components/ui/table'; + import createQueryString from '@/utils/createQueryString'; import { cn } from '@/utils/utils'; -import DetailsCell from './ui/details-cell'; -import EpisodesCell from './ui/episodes-cell'; -import MediaCell from './ui/media-cell'; -import NumberCell from './ui/number-cell'; -import ScoreCell from './ui/score-cell'; +import DetailsCell from './details-cell'; +import EpisodesCell from './episodes-cell'; +import MediaCell from './media-cell'; +import NumberCell from './number-cell'; +import ScoreCell from './score-cell'; interface Props { data: API.Watch[]; diff --git a/app/(pages)/(user)/u/[username]/list/components/list/list.tsx b/features/users/user-watchlist/watchlist/watchlist.tsx similarity index 95% rename from app/(pages)/(user)/u/[username]/list/components/list/list.tsx rename to features/users/user-watchlist/watchlist/watchlist.tsx index 4d18118b..66bf2039 100644 --- a/app/(pages)/(user)/u/[username]/list/components/list/list.tsx +++ b/features/users/user-watchlist/watchlist/watchlist.tsx @@ -5,11 +5,12 @@ import { useParams, useSearchParams } from 'next/navigation'; import LoadMoreButton from '@/components/load-more-button'; import Block from '@/components/ui/block'; import NotFound from '@/components/ui/not-found'; + import useWatchList from '@/services/hooks/watch/useWatchList'; import { WATCH_STATUS } from '@/utils/constants'; -import GridView from './components/grid-view'; -import TableView from './components/table-view'; +import GridView from './grid-view'; +import TableView from './table-view'; const List = () => { const searchParams = useSearchParams()!; diff --git a/services/hooks/anime/useAnimeCatalog.ts b/services/hooks/anime/useAnimeCatalog.ts index fb33e068..d875dc5b 100644 --- a/services/hooks/anime/useAnimeCatalog.ts +++ b/services/hooks/anime/useAnimeCatalog.ts @@ -1,10 +1,9 @@ -import { useSearchParams } from 'next/navigation'; - import { useInfiniteQuery } from '@tanstack/react-query'; +import { useSearchParams } from 'next/navigation'; import getAnimeCatalog, { - Response as AnimeCatalogResponse, Params as AnimeCatalogParams, + Response as AnimeCatalogResponse, } from '@/services/api/anime/getAnimeCatalog'; import { useSettingsContext } from '@/services/providers/settings-provider'; import { convertAnimeList } from '@/utils/animeAdapter'; diff --git a/services/hooks/collections/useCreateCollection.ts b/services/hooks/collections/useCreateCollection.ts index e864e083..fe38a303 100644 --- a/services/hooks/collections/useCreateCollection.ts +++ b/services/hooks/collections/useCreateCollection.ts @@ -1,8 +1,6 @@ -import { useSnackbar } from 'notistack'; - -import { useRouter } from 'next/navigation'; - import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useSnackbar } from 'notistack'; import createCollction, { Params as CollectionRequest, diff --git a/services/hooks/collections/useDeleteCollection.ts b/services/hooks/collections/useDeleteCollection.ts index e63cc3e2..aad22c1e 100644 --- a/services/hooks/collections/useDeleteCollection.ts +++ b/services/hooks/collections/useDeleteCollection.ts @@ -1,8 +1,6 @@ -import { useSnackbar } from 'notistack'; - -import { useRouter } from 'next/navigation'; - import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useSnackbar } from 'notistack'; import deleteCollection from '@/services/api/collections/deleteCollection'; import useSession from '@/services/hooks/auth/useSession'; diff --git a/services/hooks/collections/useUpdateCollection.ts b/services/hooks/collections/useUpdateCollection.ts index f2c5d9b6..a1ab2727 100644 --- a/services/hooks/collections/useUpdateCollection.ts +++ b/services/hooks/collections/useUpdateCollection.ts @@ -1,15 +1,15 @@ -import { useSnackbar } from 'notistack'; - -import { useRouter } from 'next/navigation'; - import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { useRouter } from 'next/navigation'; +import { useSnackbar } from 'notistack'; import { Params as CollectionRequest } from '@/services/api/collections/createCollection'; import updateCollection from '@/services/api/collections/updateCollection'; -const useUpdateCollection = (params: { - reference: string; -} & CollectionRequest) => { +const useUpdateCollection = ( + params: { + reference: string; + } & CollectionRequest, +) => { const queryClient = useQueryClient(); const router = useRouter(); const { enqueueSnackbar } = useSnackbar(); diff --git a/services/hooks/edit/useEditList.ts b/services/hooks/edit/useEditList.ts index b610418e..72ab5087 100644 --- a/services/hooks/edit/useEditList.ts +++ b/services/hooks/edit/useEditList.ts @@ -1,6 +1,5 @@ -import { useSearchParams } from 'next/navigation'; - import { useQuery } from '@tanstack/react-query'; +import { useSearchParams } from 'next/navigation'; import getEditList from '@/services/api/edit/getEditList'; import { useSettingsContext } from '@/services/providers/settings-provider'; diff --git a/services/hooks/useInfiniteList.tsx b/services/hooks/useInfiniteList.tsx index e255ae8e..7156aacd 100644 --- a/services/hooks/useInfiniteList.tsx +++ b/services/hooks/useInfiniteList.tsx @@ -1,13 +1,12 @@ 'use client'; -import { useEffect } from 'react'; -import { useInView } from 'react-intersection-observer'; - import { QueryFunction, QueryKey, useInfiniteQuery, } from '@tanstack/react-query'; +import { useEffect } from 'react'; +import { useInView } from 'react-intersection-observer'; interface Props { queryFn: QueryFunction, this['queryKey'], number>; diff --git a/services/hooks/useScrollTrigger.ts b/services/hooks/useScrollTrigger.ts index 3b195700..8a679c84 100644 --- a/services/hooks/useScrollTrigger.ts +++ b/services/hooks/useScrollTrigger.ts @@ -1,8 +1,7 @@ 'use client'; -import * as React from 'react'; - import { usePathname } from 'next/navigation'; +import * as React from 'react'; interface UseScrollTriggerOptions { disableHysteresis?: boolean; diff --git a/services/hooks/useSize.ts b/services/hooks/useSize.ts index 590376aa..cb1a3238 100644 --- a/services/hooks/useSize.ts +++ b/services/hooks/useSize.ts @@ -1,8 +1,7 @@ +import useResizeObserver from '@react-hook/resize-observer'; import * as React from 'react'; import { RefObject } from 'react'; -import useResizeObserver from '@react-hook/resize-observer'; - const useSize = (target: RefObject) => { const [size, setSize] = React.useState(); diff --git a/services/hooks/watch/useAddWatch.ts b/services/hooks/watch/useAddWatch.ts index a34152fb..c1f5be2c 100644 --- a/services/hooks/watch/useAddWatch.ts +++ b/services/hooks/watch/useAddWatch.ts @@ -9,8 +9,14 @@ const useAddWatch = () => { mutationKey: ['addToList'], mutationFn: addWatch, onSettled: async () => { - await queryClient.invalidateQueries({ queryKey: ['watch'], exact: false }); - await queryClient.invalidateQueries({ queryKey: ['watchList'], exact: false }); + await queryClient.invalidateQueries({ + queryKey: ['watch'], + exact: false, + }); + await queryClient.invalidateQueries({ + queryKey: ['watchList'], + exact: false, + }); }, }); }; diff --git a/services/providers/modal-provider.tsx b/services/providers/modal-provider.tsx index a4497eda..4f32f299 100644 --- a/services/providers/modal-provider.tsx +++ b/services/providers/modal-provider.tsx @@ -1,5 +1,6 @@ 'use client'; +import { usePathname } from 'next/navigation'; import React, { ReactNode, createContext, @@ -8,8 +9,6 @@ import React, { useState, } from 'react'; -import { usePathname } from 'next/navigation'; - import { Dialog, DialogContent, @@ -28,6 +27,7 @@ import { SheetHeader, SheetTitle, } from '@/components/ui/sheet'; + import { cn } from '@/utils/utils'; import { useMediaQuery } from '../hooks/useMediaQuery'; diff --git a/tailwind.config.js b/tailwind.config.js index 2f612e64..b7c23356 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -3,6 +3,7 @@ module.exports = { darkMode: ['class'], content: [ './pages/**/*.{ts,tsx}', + './features/**/*.{ts,tsx}', './components/**/*.{ts,tsx}', './app/**/*.{ts,tsx}', './src/**/*.{ts,tsx}', @@ -20,10 +21,10 @@ module.exports = { }, extend: { gridAutoColumns: { - 'scroll': 'minmax(var(--grid-min, 7rem), 1fr)', + scroll: 'minmax(var(--grid-min, 7rem), 1fr)', }, gridTemplateColumns: { - 'scroll': 'repeat(auto-fill, minmax(var(--grid-min, 7rem), 1fr))', + scroll: 'repeat(auto-fill, minmax(var(--grid-min, 7rem), 1fr))', }, fontFamily: { sans: ['var(--font-inter)'], @@ -97,5 +98,8 @@ module.exports = { }, }, }, - plugins: [require('tailwindcss-animate'), require("tailwind-gradient-mask-image")], + plugins: [ + require('tailwindcss-animate'), + require('tailwind-gradient-mask-image'), + ], }; diff --git a/types/index.d.ts b/types/index.d.ts index bcaadc50..36852bb2 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,5 @@ -import { ReactNode } from 'react'; - import '@tanstack/react-query'; +import { ReactNode } from 'react'; interface QueryMeta extends Record { auth: string | undefined; diff --git a/utils/constants.ts b/utils/constants.ts index f9a3adfc..49c152ab 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -1,8 +1,8 @@ import MaterialSymbolsLightGridViewRounded from '~icons/material-symbols-light/grid-view-rounded'; import MaterialSymbolsCalendarClockRounded from '~icons/material-symbols/calendar-clock-rounded'; import MaterialSymbolsEditRounded from '~icons/material-symbols/edit-rounded'; +import MaterialSymbolsHomeRounded from '~icons/material-symbols/home-rounded'; import MaterialSymbolsStack from '~icons/material-symbols/stack'; -import MaterialSymbolsHomeRounded from '~icons/material-symbols/home-rounded' import Completed from '@/components/icons/watch-status/completed'; import Dropped from '@/components/icons/watch-status/dropped'; diff --git a/utils/editParamUtils.ts b/utils/editParamUtils.ts index d57532f3..e938092e 100644 --- a/utils/editParamUtils.ts +++ b/utils/editParamUtils.ts @@ -1,6 +1,7 @@ -import InputParam from '@/app/(pages)/edit/components/ui/input-param'; -import ListParam from '@/app/(pages)/edit/components/ui/list-param'; -import MarkdownParam from '@/app/(pages)/edit/components/ui/markdown-param'; +import InputParam from '@/features/edit/edit-forms/params/input-param'; +import ListParam from '@/features/edit/edit-forms/params/list-param'; +import MarkdownParam from '@/features/edit/edit-forms/params/markdown-param'; + import { ANIME_EDIT_GROUPS, ANIME_EDIT_PARAMS, diff --git a/utils/generateMetadata.ts b/utils/generateMetadata.ts index 4ea22026..c41e9a74 100644 --- a/utils/generateMetadata.ts +++ b/utils/generateMetadata.ts @@ -1,5 +1,4 @@ import { Metadata } from 'next'; - import { TemplateString } from 'next/dist/lib/metadata/types/metadata-types'; export const DEFAULTS = { diff --git a/utils/getQueryClient.ts b/utils/getQueryClient.ts index aa1df1c8..4b38a228 100644 --- a/utils/getQueryClient.ts +++ b/utils/getQueryClient.ts @@ -1,7 +1,6 @@ -import { cache } from 'react'; - import { QueryClient } from '@tanstack/query-core'; import { QueryClientConfig } from '@tanstack/react-query'; +import { cache } from 'react'; export const createQueryClient = (config?: QueryClientConfig) => new QueryClient({