Skip to content

Commit

Permalink
add notification settings, fix minor bugs, format code by prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed Apr 9, 2024
1 parent b7e3c6e commit 2db04ef
Show file tree
Hide file tree
Showing 319 changed files with 1,750 additions and 1,437 deletions.
3 changes: 2 additions & 1 deletion app/(api)/auth/activate/[token]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export async function GET(
}

return redirect(
'/anime?page=1&iPage=1&activation=error&error=' + (e as API.Error).code,
'/anime?page=1&iPage=1&activation=error&error=' +
(e as API.Error).code,
);
}

Expand Down
4 changes: 3 additions & 1 deletion app/(api)/auth/google/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export async function GET(request: Request) {
);
}

return redirect('/anime?page=1&iPage=1&auth=error&provider=google&error=' + e);
return redirect(
'/anime?page=1&iPage=1&auth=error&provider=google&error=' + e,
);
}

return redirect('/anime?page=1&iPage=1&auth=success&provider=google');
Expand Down
4 changes: 3 additions & 1 deletion app/(api)/auth/reset/[token]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export async function GET(
request: Request,
{ params: { token } }: { params: { token: string } },
) {
return redirect('/anime?page=1&iPage=1&modal=passwordConfirm&token=' + token);
return redirect(
'/anime?page=1&iPage=1&modal=passwordConfirm&token=' + token,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react';

import { ReadonlyURLSearchParams } from 'next/navigation';

import AnimeListSkeleton from '@/app/(pages)/anime/(animeList)/components/anime-list/components/anime-list-skeleton';
import EntryCard from '@/components/entry-card/entry-card';
import FiltersNotFound from '@/components/filters/components/filters-not-found';
import { Button } from '@/components/ui/button';
Expand All @@ -13,7 +14,6 @@ import useAuth from '@/services/hooks/auth/useAuth';
import { useSettingsContext } from '@/services/providers/settings-provider';
import { MEDIA_TYPE } from '@/utils/constants';

import AnimeListSkeleton from '@/app/(pages)/anime/(animeList)/components/anime-list/components/anime-list-skeleton';
import { useNextPage, useUpdatePage } from './anime-list.hooks';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { range } from '@antfu/utils';

import SkeletonCard from '@/components/skeletons/entry-card';


const AnimeListSkeleton = () => {
return (
<div className="grid grid-cols-2 gap-4 md:grid-cols-5 lg:gap-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import AnimeList from './anime-list';

export default AnimeList;
export default AnimeList;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { usePathname, useRouter, useSearchParams } from 'next/navigation';
import { Input } from '@/components/ui/input';
import createQueryString from '@/utils/createQueryString';


const Search = () => {
const router = useRouter();
const pathname = usePathname();
Expand Down Expand Up @@ -38,4 +37,4 @@ const Search = () => {
);
};

export default Search;
export default Search;
2 changes: 1 addition & 1 deletion app/(pages)/anime/(animeList)/components/navbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Navbar from './navbar';

export default Navbar;
export default Navbar;
1 change: 0 additions & 1 deletion app/(pages)/anime/(animeList)/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { cn } from '@/utils/utils';

import Search from './_components/search';


const Navbar = () => {
return (
<div
Expand Down
3 changes: 2 additions & 1 deletion app/(pages)/anime/(animeList)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ReactNode } from 'react';

import Filters from '../../../../components/filters/anime-filters';
import NavBar from '@/app/(pages)/anime/(animeList)/components/navbar';

import Filters from '../../../../components/filters/anime-filters';

interface Props {
children: ReactNode;
}
Expand Down
2 changes: 1 addition & 1 deletion app/(pages)/anime/[slug]/(animeDetails)/comments/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Metadata, ResolvingMetadata } from 'next';

import { getCookie } from '@/utils/actions';
import Comments from '@/components/comments/comments';
import { getCookie } from '@/utils/actions';
import _generateMetadata from '@/utils/generateMetadata';

export async function generateMetadata(
Expand Down
6 changes: 4 additions & 2 deletions app/(pages)/anime/[slug]/anime.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const jsonSchema = ({ anime }: { anime: API.AnimeInfo }) => ({
name: anime.title_ua || anime.title_en || anime.title_ja,
alternateName: anime.synonyms,
image: anime.poster,
description: parseTextFromMarkDown(anime.synopsis_ua || anime.synopsis_en),
description: parseTextFromMarkDown(
anime.synopsis_ua || anime.synopsis_en,
),
startDate: anime.start_date,
endDate: anime.end_date,
genre: anime.genres.map((genre) => genre.name_ua),
Expand All @@ -51,4 +53,4 @@ const jsonSchema = ({ anime }: { anime: API.AnimeInfo }) => ({
},
});

export default jsonSchema;
export default jsonSchema;
8 changes: 3 additions & 5 deletions app/(pages)/anime/[slug]/components/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo';
import { AGE_RATING, MEDIA_TYPE, RELEASE_STATUS } from '@/utils/constants';


const About = () => {
const params = useParams();

Expand Down Expand Up @@ -70,8 +69,7 @@ const About = () => {
</div>
</div>
{data.media_type !== 'movie' &&
(data.episodes_total ||
data.episodes_released) ? (
(data.episodes_total || data.episodes_released) ? (
<div className="flex flex-wrap">
<div className="w-24">
<Label className="text-muted-foreground">
Expand All @@ -81,8 +79,8 @@ const About = () => {
<div className="flex-1">
<Label>
{data.status === 'finished'
? data.episodes_total || "?"
: `${data.episodes_released || "?"} / ${data.episodes_total || "?"}`}
? data.episodes_total || '?'
: `${data.episodes_released || '?'} / ${data.episodes_total || '?'}`}
</Label>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions app/(pages)/anime/[slug]/components/actions/actions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getCookie } from '@/utils/actions';
import WatchListButton from '@/components/watchlist-button';

import WatchStats from '@/app/(pages)/anime/[slug]/components/actions/components/watch-stats';
import WatchListButton from '@/components/watchlist-button';
import { getCookie } from '@/utils/actions';

interface Props {
anime?: API.AnimeInfo;
Expand Down
2 changes: 1 addition & 1 deletion app/(pages)/anime/[slug]/components/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Actions from './actions';

export default Actions;
export default Actions;
6 changes: 3 additions & 3 deletions app/(pages)/anime/[slug]/components/characters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import clsx from 'clsx';

import { useParams } from 'next/navigation';

import SubHeader from '@/components/sub-header';
import EntryCard from '@/components/entry-card/entry-card';
import SubHeader from '@/components/sub-header';
import { Button } from '@/components/ui/button';
import useCharacters from '@/services/hooks/anime/useCharacters';

Expand Down Expand Up @@ -36,7 +36,8 @@ const Characters = ({ extended }: Props) => {
className={clsx(
'grid grid-cols-3 gap-4 md:grid-cols-5 lg:gap-8',
extended && 'md:grid-cols-6',
!extended && 'grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto no-scrollbar -mx-4 px-4'
!extended &&
'grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto no-scrollbar -mx-4 px-4',
)}
>
{(extended ? main : main.slice(0, 5)).map((ch) => (
Expand Down Expand Up @@ -84,7 +85,6 @@ const Characters = ({ extended }: Props) => {
))}
</div>
</div>

)}
{extended && hasNextPage && (
<Button
Expand Down
2 changes: 1 addition & 1 deletion app/(pages)/anime/[slug]/components/cover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Cover = ({ anime }: Props) => {
<div className="absolute bottom-2 right-2 z-[1]">
<FavoriteButton slug={anime.slug} content_type="anime" />
</div>

<div className="absolute bottom-0 left-0 h-24 w-full bg-gradient-to-t from-black to-transparent" />
</EntryCard>
</div>
Expand Down
5 changes: 0 additions & 5 deletions app/(pages)/anime/[slug]/components/description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

import { useState } from 'react';



import { useParams } from 'next/navigation';



import MDViewer from '@/components/markdown/viewer/MD-viewer';
import SubHeader from '@/components/sub-header';
import TextExpand from '@/components/text-expand';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo';


const Description = () => {
const [active, setActive] = useState<'synopsis_ua' | 'synopsis_en'>(
'synopsis_ua',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const FollowingItem = ({ data, className }: Props) => {
</div>
{data.watch[0].score > 0 && (
<div className="inline-flex gap-1">
<Label className="leading-normal">{data.watch[0].score}</Label>
<Label className="leading-normal">
{data.watch[0].score}
</Label>
<MaterialSymbolsStarRounded />
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useModalContext } from '@/services/providers/modal-provider';
import FollowingsModal from './components/followings-modal';
import FollowingItem from './components/ui/following-item';


const Followings = () => {
const params = useParams();
const { openModal } = useModalContext();
Expand Down
5 changes: 3 additions & 2 deletions app/(pages)/anime/[slug]/components/franchise.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ const Franchise = ({ extended }: Props) => {
className={cn(
'grid grid-cols-2 gap-4 md:grid-cols-4 lg:gap-8',
extended && 'md:grid-cols-5',
!extended && 'no-scrollbar grid-min-10 -mx-4 grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto px-4',
)}/*repeat(2, minmax(0, 1fr))*/
!extended &&
'no-scrollbar grid-min-10 -mx-4 auto-cols-scroll grid-flow-col grid-cols-scroll overflow-x-auto px-4',
)} /*repeat(2, minmax(0, 1fr))*/
>
{filteredData.map((anime) => (
<EntryCard
Expand Down
2 changes: 1 addition & 1 deletion app/(pages)/anime/[slug]/components/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const Links = ({ extended }: Props) => {
className={cn(
'grid gap-4 md:grid-cols-3 lg:gap-8',
!extended &&
'no-scrollbar grid-min-14 -mx-4 grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto px-4',
'no-scrollbar grid-min-14 -mx-4 auto-cols-scroll grid-flow-col grid-cols-scroll overflow-x-auto px-4',
)}
>
{active === 'general' &&
Expand Down
6 changes: 3 additions & 3 deletions app/(pages)/anime/[slug]/components/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import EntryCard from '@/components/entry-card/entry-card';
import SubHeader from '@/components/sub-header';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo';
import { cn } from '@/utils/utils';
import { OST, VIDEO } from '@/utils/constants';
import { cn } from '@/utils/utils';

interface Props {
extended?: boolean;
Expand Down Expand Up @@ -81,13 +81,13 @@ const Media = ({ extended }: Props) => {
'grid-cols-3 md:grid-cols-6',
active === 'music' &&
!extended &&
'grid-cols-scroll auto-cols-scroll md:grid-cols-4',
'auto-cols-scroll grid-cols-scroll md:grid-cols-4',
active === 'video' &&
extended &&
'grid-cols-2 md:grid-cols-4',
active === 'video' &&
!extended &&
'grid-min-10 grid-cols-scroll auto-cols-scroll md:grid-cols-3',
'grid-min-10 auto-cols-scroll grid-cols-scroll md:grid-cols-3',
)}
>
{active === 'music' &&
Expand Down
5 changes: 3 additions & 2 deletions app/(pages)/anime/[slug]/components/staff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import clsx from 'clsx';

import { useParams } from 'next/navigation';

import SubHeader from '@/components/sub-header';
import EntryCard from '@/components/entry-card/entry-card';
import SubHeader from '@/components/sub-header';
import { Button } from '@/components/ui/button';
import useStaff from '@/services/hooks/anime/useStaff';

Expand Down Expand Up @@ -44,7 +44,8 @@ const Staff = ({ extended }: Props) => {
className={clsx(
'grid grid-cols-3 gap-4 md:grid-cols-4 lg:gap-8',
extended && 'md:grid-cols-6',
!extended && 'grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto no-scrollbar -mx-4 px-4'
!extended &&
'grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto no-scrollbar -mx-4 px-4',
)}
>
{filteredData.map((staff) => (
Expand Down
4 changes: 1 addition & 3 deletions app/(pages)/anime/[slug]/components/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ 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 useAuth from '@/services/hooks/auth/useAuth';
import useIsMobile from '@/services/hooks/useIsMobile';

import { useSettingsContext } from '@/services/providers/settings-provider';
import { ANIME_NAV_ROUTES } from '@/utils/constants';
import useAuth from '@/services/hooks/auth/useAuth';


const Title = () => {
const { titleLanguage } = useSettingsContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo';

import Stats from './ui/stats';


const Score = () => {
const params = useParams();
const { data } = useAnimeInfo({ slug: String(params.slug) });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { WATCH_STATUS } from '@/utils/constants';

import Stats from './ui/stats';


const Watchlist = () => {
const params = useParams();
const { data } = useAnimeInfo({ slug: String(params.slug) });
Expand Down
3 changes: 1 addition & 2 deletions app/(pages)/anime/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';

import jsonSchema from './anime.schema';
import getAnimeInfo, {
Response as AnimeResponse,
} from '@/services/api/anime/getAnimeInfo';

import jsonSchema from './anime.schema';
import About from './components/about';
import Characters from './components/characters';
import Description from './components/description';
Expand All @@ -15,7 +15,6 @@ import Media from './components/media';
import Staff from './components/staff';
import WatchStats from './components/watch-stats/watch-stats';


const AnimePage = async ({
params,
}: {
Expand Down
3 changes: 2 additions & 1 deletion app/(pages)/characters/[slug]/components/anime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const Anime = ({ extended }: Props) => {
<div
className={cn(
'grid grid-cols-2 gap-4 md:grid-cols-5 lg:gap-8',
!extended && 'grid-min-10 no-scrollbar -mx-4 grid-flow-col grid-cols-scroll auto-cols-scroll overflow-x-auto px-4'
!extended &&
'grid-min-10 no-scrollbar -mx-4 auto-cols-scroll grid-flow-col grid-cols-scroll overflow-x-auto px-4',
)}
>
{(extended ? list : list.slice(0, 5)).map((ch) => (
Expand Down
5 changes: 0 additions & 5 deletions app/(pages)/characters/[slug]/components/description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

import { useState } from 'react';



import { useParams } from 'next/navigation';



import MDViewer from '@/components/markdown/viewer/MD-viewer';
import SubHeader from '@/components/sub-header';
import TextExpand from '@/components/text-expand';
import { Button } from '@/components/ui/button';
import useCharacterInfo from '@/services/hooks/characters/useCharacterInfo';


const Description = () => {
const [active, setActive] = useState<'description_ua'>('description_ua');
const params = useParams();
Expand Down
Loading

0 comments on commit 2db04ef

Please sign in to comment.