From a628fe948a177a7803aa7555c0c22d10ec6fcb0b Mon Sep 17 00:00:00 2001 From: olexh Date: Thu, 7 Mar 2024 00:33:03 +0200 Subject: [PATCH] add typography, add diff to edit --- .../anime/[slug]/_components/about.tsx | 9 +- .../actions/_components/watchlist-stats.tsx | 9 +- .../anime/[slug]/_components/links.tsx | 11 +- .../anime/[slug]/_components/title.tsx | 18 +- .../anime/[slug]/_components/watch-stats.tsx | 13 +- .../characters/[slug]/_components/title.tsx | 8 +- .../_components/ui/collection-item.tsx | 15 +- .../_components/collection-info.tsx | 8 +- .../collection-settings.tsx | 39 +- app/(pages)/collections/new/page.tsx | 7 +- .../edit/[editId]/_components/author.tsx | 8 +- .../edit/[editId]/_components/moderator.tsx | 18 +- .../content/_components/details.tsx | 13 +- .../_components/tags-modal.tsx | 7 +- .../edit-description/edit-description.tsx | 22 +- app/(pages)/edit/_components/edit-form.tsx | 106 ++--- app/(pages)/edit/_components/edit-group.tsx | 7 +- app/(pages)/edit/_components/edit-view.tsx | 105 ++--- app/(pages)/edit/_components/editlist.tsx | 10 +- .../edit/_components/ui/edit-status.tsx | 3 +- .../edit/_components/ui/input-param.tsx | 39 +- .../edit/_components/ui/list-param.tsx | 12 +- .../edit/_components/ui/markdown-param.tsx | 38 +- app/(pages)/edit/content/_components/list.tsx | 7 +- app/(pages)/layout.tsx | 4 +- .../_components/activation-alert.tsx | 38 +- .../components/ui/collection-item.tsx | 11 +- .../history/components/ui/history-item.tsx | 13 +- .../_components/ui/activity-item.tsx | 5 +- .../_components/watchhour-stats.tsx | 20 +- .../_components/ui/follow-user-item.tsx | 18 +- .../u/[username]/_components/user-title.tsx | 14 +- app/(pages)/u/[username]/layout.tsx | 2 + .../list/_components/status-combobox.tsx | 3 +- app/(pages)/u/[username]/page.tsx | 2 - app/globals.css | 20 - app/not-found.tsx | 8 +- components/anime-tooltip.tsx | 19 +- components/comments/ui/comment.tsx | 11 +- .../filters/_components/ui/badge-filter.tsx | 5 +- .../markdown/editor/toolbar/bold-button.tsx | 3 +- .../markdown/editor/toolbar/italic-button.tsx | 3 +- .../markdown/editor/toolbar/link-button.tsx | 3 +- .../editor/toolbar/spoiler-button.tsx | 3 +- .../markdown/viewer/_components/link.tsx | 3 +- .../_components/forgot-password-form.tsx | 24 +- .../auth-modal/_components/login-form.tsx | 8 +- .../_components/password-confirm-form.tsx | 8 +- .../auth-modal/_components/signup-form.tsx | 8 +- .../_components/ui/edit-card.tsx | 17 +- .../_components/ui/search-card.tsx | 16 +- .../_components/customization-form.tsx | 3 +- .../_components/email-form.tsx | 5 +- .../_components/general-form.tsx | 5 +- .../_components/password-form.tsx | 3 +- .../_components/username-form.tsx | 5 +- .../_components/watchlist-form.tsx | 36 +- .../user-settings-modal.tsx | 14 +- components/nav-menu.tsx | 5 +- .../_components/not-found-notifications.tsx | 5 +- .../_components/ui/notification-item.tsx | 10 +- .../_components/profile-menu.tsx | 3 +- components/sub-header.tsx | 16 +- components/typography/blockquote.tsx | 16 + components/typography/h1.tsx | 21 + components/typography/h2.tsx | 21 + components/typography/h3.tsx | 21 + components/typography/h4.tsx | 21 + components/typography/h5.tsx | 21 + components/typography/inline-code.tsx | 21 + components/typography/large.tsx | 14 + components/typography/lead.tsx | 16 + components/typography/muted.tsx | 16 + components/typography/p.tsx | 16 + components/typography/small.tsx | 16 + components/ui/base-card.tsx | 30 +- components/ui/not-found.tsx | 6 +- .../api/integrations/mal/getAnimeFromMAL.ts | 15 + services/hooks/edit/useEdit.ts | 7 +- types/api.d.ts | 376 +++++++++++++++ types/hikka.d.ts | 71 +++ types/index.d.ts | 438 +----------------- 82 files changed, 1246 insertions(+), 848 deletions(-) create mode 100644 components/typography/blockquote.tsx create mode 100644 components/typography/h1.tsx create mode 100644 components/typography/h2.tsx create mode 100644 components/typography/h3.tsx create mode 100644 components/typography/h4.tsx create mode 100644 components/typography/h5.tsx create mode 100644 components/typography/inline-code.tsx create mode 100644 components/typography/large.tsx create mode 100644 components/typography/lead.tsx create mode 100644 components/typography/muted.tsx create mode 100644 components/typography/p.tsx create mode 100644 components/typography/small.tsx create mode 100644 services/api/integrations/mal/getAnimeFromMAL.ts create mode 100644 types/api.d.ts create mode 100644 types/hikka.d.ts diff --git a/app/(pages)/anime/[slug]/_components/about.tsx b/app/(pages)/anime/[slug]/_components/about.tsx index e797da1b..ca3d268e 100644 --- a/app/(pages)/anime/[slug]/_components/about.tsx +++ b/app/(pages)/anime/[slug]/_components/about.tsx @@ -15,6 +15,7 @@ import { } from '@/components/ui/tooltip'; import { AGE_RATING, MEDIA_TYPE, RELEASE_STATUS } from '@/utils/constants'; import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; +import P from '@/components/typography/p'; const Component = () => { @@ -58,9 +59,9 @@ const Component = () => { RELEASE_STATUS[data.status].color, }} > -

+

{RELEASE_STATUS[data.status].title_ua} -

+

@@ -134,9 +135,9 @@ const Component = () => { /> -

+

{studio.company.name} -

+

) : ( diff --git a/app/(pages)/anime/[slug]/_components/actions/_components/watchlist-stats.tsx b/app/(pages)/anime/[slug]/_components/actions/_components/watchlist-stats.tsx index c85b3753..8158b0e8 100644 --- a/app/(pages)/anime/[slug]/_components/actions/_components/watchlist-stats.tsx +++ b/app/(pages)/anime/[slug]/_components/actions/_components/watchlist-stats.tsx @@ -3,9 +3,14 @@ import { createElement, useRef } from 'react'; import { NumericFormat } from 'react-number-format'; + + import { useParams } from 'next/navigation'; + + import SubHeader from '@/components/sub-header'; +import Small from '@/components/typography/small'; import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useSize from '@/services/hooks/useSize'; import { WATCH_STATUS } from '@/utils/constants'; @@ -61,14 +66,14 @@ const Component = () => {
{createElement(status.icon!)}
-

+ -

+
{ target="_blank" className="flex h-auto flex-col items-center justify-center text-center gap-2 overflow-hidden rounded-lg" > -

+

{link.text} -

-

+ +

{link.url} -

+

); diff --git a/app/(pages)/anime/[slug]/_components/title.tsx b/app/(pages)/anime/[slug]/_components/title.tsx index 96c49dac..4c46bfc1 100644 --- a/app/(pages)/anime/[slug]/_components/title.tsx +++ b/app/(pages)/anime/[slug]/_components/title.tsx @@ -5,17 +5,23 @@ import { useEffect, useRef } from 'react'; import MaterialSymbolsEditRounded from '~icons/material-symbols/edit-rounded'; import MaterialSymbolsStarRounded from '~icons/material-symbols/star-rounded'; + + import Link from 'next/link'; import { useParams, usePathname } from 'next/navigation'; + + import EditListModal from '@/components/modals/editlist-modal'; +import H2 from '@/components/typography/h2'; import { Button } from '@/components/ui/button'; +import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; import useIsMobile from '@/services/hooks/useIsMobile'; import { useAuthContext } from '@/services/providers/auth-provider'; import { useModalContext } from '@/services/providers/modal-provider'; import { useSettingsContext } from '@/services/providers/settings-provider'; import { ANIME_NAV_ROUTES } from '@/utils/constants'; -import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; +import P from '@/components/typography/p'; const EditButton = ({ className }: { className?: string }) => { @@ -77,7 +83,7 @@ const Component = () => {
-

+

{data[titleLanguage!] || data.title_ua || data.title_en || @@ -92,17 +98,17 @@ const Component = () => { ) )} -

+ {secret && }
-

{data.title_ja}

+

{data.title_ja}

{data.score > 0 && (
-

+

{data.score} -

+
diff --git a/app/(pages)/anime/[slug]/_components/watch-stats.tsx b/app/(pages)/anime/[slug]/_components/watch-stats.tsx index 6b28b390..449ac65f 100644 --- a/app/(pages)/anime/[slug]/_components/watch-stats.tsx +++ b/app/(pages)/anime/[slug]/_components/watch-stats.tsx @@ -2,14 +2,15 @@ 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 { useAuthContext } from '@/services/providers/auth-provider'; import useAnimeInfo from '@/services/hooks/anime/useAnimeInfo'; -import useWatch from '@/services/hooks/watch/useWatch'; import useAddWatch from '@/services/hooks/watch/useAddWatch'; +import useWatch from '@/services/hooks/watch/useWatch'; +import { useAuthContext } from '@/services/providers/auth-provider'; const Component = () => { const params = useParams(); @@ -80,12 +81,12 @@ const Component = () => { precision={0.5} value={watch.score ? watch.score / 2 : 0} /> -

+

{watch.score} -

+
@@ -111,12 +112,12 @@ const Component = () => {
-

+

{watch.episodes} -

+ { @@ -73,15 +75,15 @@ const Component = () => {
-

+

{character.name_ua || character.name_en || character.name_ja || ''}{' '} -

+ {secret && }
-

{character.name_ja}

+

{character.name_ja}

{secret && } diff --git a/app/(pages)/collections/(collections)/_components/ui/collection-item.tsx b/app/(pages)/collections/(collections)/_components/ui/collection-item.tsx index 86ba1846..b7b2ffeb 100644 --- a/app/(pages)/collections/(collections)/_components/ui/collection-item.tsx +++ b/app/(pages)/collections/(collections)/_components/ui/collection-item.tsx @@ -9,6 +9,7 @@ import Link from 'next/link'; import { useRouter } from 'next/navigation'; import AnimeCard from '@/components/anime-card'; +import Small from '@/components/typography/small'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Badge } from '@/components/ui/badge'; import BaseCard from '@/components/ui/base-card'; @@ -54,7 +55,9 @@ const Component = ({ collection }: Props) => { ); }} > -
@@ -97,7 +96,7 @@ const Component = ({ collection }: Props) => {
)}
- {[...collection.collection].reverse().map((item, index) => ( + {collection.collection.map((item, index) => ( { const params = useParams(); @@ -73,7 +75,7 @@ const Component = () => {
-
{collection?.author.username}
+
{collection?.author.username}
@@ -119,13 +121,13 @@ const Component = () => { колекцію? -

+

Колекція{' '} {collection?.title} {' '} буде видалена назавжди. -

+

diff --git a/app/(pages)/collections/new/_components/collection-settings/collection-settings.tsx b/app/(pages)/collections/new/_components/collection-settings/collection-settings.tsx index 59b5eeb7..165f8521 100644 --- a/app/(pages)/collections/new/_components/collection-settings/collection-settings.tsx +++ b/app/(pages)/collections/new/_components/collection-settings/collection-settings.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { useParams } from 'next/navigation'; -import GroupInputs from '@/app/(pages)/collections/new/_components/collection-settings/_components/group-inputs'; +import GroupInputs from './_components/group-inputs'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { InputTags } from '@/components/ui/input-tags'; @@ -19,6 +19,8 @@ import { import useCreateCollection from '@/services/hooks/collections/useCreateCollection'; import useUpdateCollection from '@/services/hooks/collections/useUpdateCollection'; +import SimpleIconsAnilist from '~icons/simple-icons/anilist' + interface Props { mode?: 'create' | 'edit'; } @@ -152,6 +154,7 @@ const Component = ({ mode = 'create' }: Props) => { Теги @@ -191,20 +194,26 @@ const Component = ({ mode = 'create' }: Props) => { )} {mode === 'create' && ( - +
+ + +
)}
diff --git a/app/(pages)/collections/new/page.tsx b/app/(pages)/collections/new/page.tsx index 15666cd4..d889030a 100644 --- a/app/(pages)/collections/new/page.tsx +++ b/app/(pages)/collections/new/page.tsx @@ -7,6 +7,8 @@ import CollectionSettings from './_components/collection-settings'; import CollectionTitle from './_components/collection-title'; import Breadcrumbs from '@/components/breadcrumbs'; import Link from 'next/link'; +import P from '@/components/typography/p'; +import { Label } from '@/components/ui/label'; const Component = () => { @@ -15,11 +17,10 @@ const Component = () => { <>
-

Нова колекція -

+
diff --git a/app/(pages)/edit/[editId]/_components/author.tsx b/app/(pages)/edit/[editId]/_components/author.tsx index de7bb94e..eb673f41 100644 --- a/app/(pages)/edit/[editId]/_components/author.tsx +++ b/app/(pages)/edit/[editId]/_components/author.tsx @@ -13,6 +13,8 @@ import { } from '@/components/ui/avatar'; import { Label } from '@/components/ui/label'; import useEdit from '@/services/hooks/edit/useEdit'; +import H5 from '@/components/typography/h5'; +import Small from '@/components/typography/small'; const Component = () => { @@ -42,13 +44,13 @@ const Component = () => {
-
{edit.author!.username}
+
{edit.author!.username}
-

+ {format(edit.created * 1000, 'd MMM yyyy H:mm')} -

+
diff --git a/app/(pages)/edit/[editId]/_components/moderator.tsx b/app/(pages)/edit/[editId]/_components/moderator.tsx index 50302e03..8fa3c755 100644 --- a/app/(pages)/edit/[editId]/_components/moderator.tsx +++ b/app/(pages)/edit/[editId]/_components/moderator.tsx @@ -3,14 +3,16 @@ import { format } from 'date-fns'; import * as React from 'react'; + + import Link from 'next/link'; import { useParams } from 'next/navigation'; -import { - Avatar, - AvatarFallback, - AvatarImage, -} from '@/components/ui/avatar'; + + +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'; @@ -44,16 +46,16 @@ const Component = () => {
-
{edit.moderator.username}
+
{edit.moderator.username}
-

+ {format( edit.updated * 1000, 'd MMM yyyy H:mm', )} -

+
diff --git a/app/(pages)/edit/_components/content/_components/details.tsx b/app/(pages)/edit/_components/content/_components/details.tsx index 3e5b85ab..23c01c19 100644 --- a/app/(pages)/edit/_components/content/_components/details.tsx +++ b/app/(pages)/edit/_components/content/_components/details.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { Label } from '@/components/ui/label'; +import P from '@/components/typography/p'; interface Props { content: API.AnimeInfo | API.Character; @@ -13,21 +14,21 @@ const Component = ({ content }: Props) => { return (
-
+
-

{title_ua || '-'}

+

{title_ua || '-'}

-
+
-

{title_en || '-'}

+

{title_en || '-'}

-
+
-

{title_ja || '-'}

+

{title_ja || '-'}

); diff --git a/app/(pages)/edit/_components/edit-description/_components/tags-modal.tsx b/app/(pages)/edit/_components/edit-description/_components/tags-modal.tsx index b6e6c056..e3333e3d 100644 --- a/app/(pages)/edit/_components/edit-description/_components/tags-modal.tsx +++ b/app/(pages)/edit/_components/edit-description/_components/tags-modal.tsx @@ -12,6 +12,7 @@ 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'; +import P from '@/components/typography/p'; interface Props { @@ -71,7 +72,7 @@ const Component = ({ setValue }: Props) => { key={tag + index} className="flex gap-2 items-center justify-between px-6 py-2" > -

{tag}

+

{tag}

diff --git a/app/(pages)/edit/_components/edit-description/edit-description.tsx b/app/(pages)/edit/_components/edit-description/edit-description.tsx index 260f8ce9..0533c6eb 100644 --- a/app/(pages)/edit/_components/edit-description/edit-description.tsx +++ b/app/(pages)/edit/_components/edit-description/edit-description.tsx @@ -1,26 +1,23 @@ 'use client'; import * as React from 'react'; -import { Controller } from 'react-hook-form'; -import { Control, UseFormSetValue } from 'react-hook-form/dist/types/form'; +import { Controller, useFormContext } from 'react-hook-form'; 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 './_components/tags-modal'; -import { useSettingsContext } from '@/services/providers/settings-provider'; interface Props { - setValue?: UseFormSetValue; - control: Control; - disabled?: boolean; + mode: 'edit' | 'view'; } - -const Component = ({ setValue, control, disabled }: Props) => { +const Component = ({ mode }: Props) => { + const { control, setValue } = useFormContext(); const { openModal } = useModalContext(); const { editTags } = useSettingsContext(); @@ -30,7 +27,7 @@ const Component = ({ setValue, control, disabled }: Props) => { Опис правки Необов’язково - {setValue && ( + {mode === 'edit' && (
{editTags?.slice(0, 3).map((tag) => ( @@ -40,7 +37,10 @@ const Component = ({ setValue, control, disabled }: Props) => { key={tag} onClick={() => setValue('description', tag)} > - {tag.slice(0, 20).trim().concat(tag.length > 20 ? '...' : '')} + {tag + .slice(0, 20) + .trim() + .concat(tag.length > 20 ? '...' : '')} ))} - + e.preventDefault()} + className="flex flex-col gap-6" + > +
+ {Object.keys(params).map((group) => ( + -
+ ))} + +
- )} - + {mode === 'edit' && ( +
+ +
+ + +
+
+ )} + + ); }; diff --git a/app/(pages)/edit/_components/edit-group.tsx b/app/(pages)/edit/_components/edit-group.tsx index 35f25c67..d8cbf22b 100644 --- a/app/(pages)/edit/_components/edit-group.tsx +++ b/app/(pages)/edit/_components/edit-group.tsx @@ -10,15 +10,15 @@ import { CollapsibleTrigger, } from '@/components/ui/collapsible'; import { getEditParamComponent } from '@/utils/editParamUtils'; +import H5 from '@/components/typography/h5'; interface Props { title: string; params: Hikka.EditParam[]; - control: any; mode: 'view' | 'edit'; } -const Component = ({ title, params, control, mode }: Props) => { +const Component = ({ title, params, mode }: Props) => { const [selected, setSelected] = React.useState([]); const switchParam = (param: string) => { @@ -33,7 +33,7 @@ const Component = ({ title, params, control, mode }: Props) => {
-
{title}
+
{title}
- + e.preventDefault()} + className="flex flex-col gap-6" + > +
+ {Object.keys(params).map((group) => ( + -
+ ))} + +
- )} - + {mode === 'edit' && ( +
+ +
+ + +
+
+ )} + + ); }; diff --git a/app/(pages)/edit/_components/editlist.tsx b/app/(pages)/edit/_components/editlist.tsx index b567244c..c592239d 100644 --- a/app/(pages)/edit/_components/editlist.tsx +++ b/app/(pages)/edit/_components/editlist.tsx @@ -28,6 +28,8 @@ import { useSettingsContext } from '@/services/providers/settings-provider'; import EditStatus from './ui/edit-status'; import useEditList from '@/services/hooks/edit/useEditList'; +import P from '@/components/typography/p'; +import Small from '@/components/typography/small'; const Component = () => { @@ -105,12 +107,12 @@ const Component = () => { > {edit.author!.username} - +
@@ -148,7 +150,7 @@ const Component = () => { className="hidden lg:table-cell" align="left" > -

{ {edit.description ? edit.description : 'Немає опису правки'} -

+

diff --git a/app/(pages)/edit/_components/ui/edit-status.tsx b/app/(pages)/edit/_components/ui/edit-status.tsx index e422f75d..a1865d32 100644 --- a/app/(pages)/edit/_components/ui/edit-status.tsx +++ b/app/(pages)/edit/_components/ui/edit-status.tsx @@ -6,6 +6,7 @@ import { useParams } from 'next/navigation'; import { EDIT_STATUS } from '@/utils/constants'; import useEdit from '@/services/hooks/edit/useEdit'; +import P from '@/components/typography/p'; interface Props { status?: API.EditStatus; @@ -28,7 +29,7 @@ const Component = ({ status }: Props) => { backgroundColor: EDIT_STATUS[currentStatus].color, }} > -

{EDIT_STATUS[currentStatus].title_ua}

+

{EDIT_STATUS[currentStatus].title_ua}

); }; diff --git a/app/(pages)/edit/_components/ui/input-param.tsx b/app/(pages)/edit/_components/ui/input-param.tsx index 3544bc69..306afce3 100644 --- a/app/(pages)/edit/_components/ui/input-param.tsx +++ b/app/(pages)/edit/_components/ui/input-param.tsx @@ -1,10 +1,15 @@ 'use client'; import * as React from 'react'; -import { Controller } from 'react-hook-form'; +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'; + type EditParamGroup = { title: string; @@ -23,14 +28,29 @@ type EditParam = { interface Props { param: EditParam; - control: any; mode: 'view' | 'edit'; } -const Component = ({ mode, control, param }: Props) => { +const Component = ({ mode, param }: Props) => { + const { control } = useFormContext(); + const params = useParams(); + const [showDiff, setShowDiff] = React.useState(false); + const { data: edit } = useEdit(String(params.editId), mode === 'view'); + return (
- +
+ + {mode === 'view' && edit && edit.before![param.slug] && ( + + )} +
{ /> )} /> + + {mode === 'view' && + edit && + edit.before![param.slug] && + showDiff && ( + + )}
); }; diff --git a/app/(pages)/edit/_components/ui/list-param.tsx b/app/(pages)/edit/_components/ui/list-param.tsx index 501f3ec1..ff29f719 100644 --- a/app/(pages)/edit/_components/ui/list-param.tsx +++ b/app/(pages)/edit/_components/ui/list-param.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useState } from 'react'; -import { useFieldArray } from 'react-hook-form'; +import { useFieldArray, useFormContext } from 'react-hook-form'; import MaterialSymbolsAddRounded from '~icons/material-symbols/add-rounded'; import MaterialSymbolsCloseSmallRounded from '~icons/material-symbols/close-small-rounded'; @@ -27,11 +27,11 @@ type EditParam = { interface Props { param: EditParam; - control: any; mode: 'edit' | 'view'; } -const Component = ({ param, mode, control }: Props) => { +const Component = ({ param, mode }: Props) => { + const { control } = useFormContext(); const { fields, append, remove } = useFieldArray({ control, name: param.slug, @@ -73,7 +73,11 @@ const Component = ({ param, mode, control }: Props) => { className="flex-1" /> + )} +
{ )} /> + {mode === 'view' && + edit && + edit.before![param.slug] && + showDiff && ( + + {edit.before![param.slug]} + + )}
); } @@ -56,7 +84,7 @@ const Component = ({ mode, control, param }: Props) => { diff --git a/app/(pages)/edit/content/_components/list.tsx b/app/(pages)/edit/content/_components/list.tsx index 8330ba50..dbd98f84 100644 --- a/app/(pages)/edit/content/_components/list.tsx +++ b/app/(pages)/edit/content/_components/list.tsx @@ -7,12 +7,13 @@ import { range } from '@antfu/utils'; import AnimeCard from '@/components/anime-card'; import SkeletonCard from '@/components/skeletons/entry-card'; +import H3 from '@/components/typography/h3'; import { Button } from '@/components/ui/button'; import { Combobox } from '@/components/ui/combobox'; import { Label } from '@/components/ui/label'; +import useTodoAnime from '@/services/hooks/edit/todo/useTodoAnime'; import { useAuthContext } from '@/services/providers/auth-provider'; import { useSettingsContext } from '@/services/providers/settings-provider'; -import useTodoAnime from '@/services/hooks/edit/todo/useTodoAnime'; interface Props { extended?: boolean; @@ -65,7 +66,7 @@ const Component = ({ extended }: Props) => { !Array.isArray(option) && option && (
-

{option.label}

+

{option.label}

{data && (
); diff --git a/app/(pages)/u/[username]/_components/statistics/_components/activity-stats/_components/ui/activity-item.tsx b/app/(pages)/u/[username]/_components/statistics/_components/activity-stats/_components/ui/activity-item.tsx index 040ce481..ba8bda3d 100644 --- a/app/(pages)/u/[username]/_components/statistics/_components/activity-stats/_components/ui/activity-item.tsx +++ b/app/(pages)/u/[username]/_components/statistics/_components/activity-stats/_components/ui/activity-item.tsx @@ -9,6 +9,7 @@ import { TooltipTrigger, } from '@/components/ui/tooltip'; import getDeclensionWord from '@/utils/getDeclensionWord'; +import P from '@/components/typography/p'; interface Props { item: API.Activity; @@ -37,9 +38,9 @@ const Component = ({ item, max }: Props) => { {item.actions}{' '} {getDeclensionWord(item.actions, ACTION_DECLENSION)} -

+

{format(toDate(item.timestamp * 1000), 'd.MM.yyyy')} -

+

)} diff --git a/app/(pages)/u/[username]/_components/statistics/_components/watchhour-stats.tsx b/app/(pages)/u/[username]/_components/statistics/_components/watchhour-stats.tsx index 6f2bb3e8..848f0000 100644 --- a/app/(pages)/u/[username]/_components/statistics/_components/watchhour-stats.tsx +++ b/app/(pages)/u/[username]/_components/statistics/_components/watchhour-stats.tsx @@ -5,15 +5,17 @@ import intervalToDuration from 'date-fns/intervalToDuration'; 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'; import { Progress } from '@/components/ui/progress'; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from '@/components/ui/tooltip'; +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import useWatchStats from '@/services/hooks/watch/useWatchStats'; @@ -29,7 +31,7 @@ const Component = () => {
-
+
{(stats?.duration && formatDuration( intervalToDuration({ @@ -39,15 +41,15 @@ const Component = () => { { format: ['years', 'months', 'days'] }, )) || '0 днів'} -
-

+ + {(stats?.duration && formatDuration( { hours: Math.round(stats?.duration / 60) }, { format: ['hours'] }, )) || '0 годин'} -

+
diff --git a/app/(pages)/u/[username]/_components/ui/follow-user-item.tsx b/app/(pages)/u/[username]/_components/ui/follow-user-item.tsx index 14f2fa57..542e71b7 100644 --- a/app/(pages)/u/[username]/_components/ui/follow-user-item.tsx +++ b/app/(pages)/u/[username]/_components/ui/follow-user-item.tsx @@ -3,20 +3,24 @@ import * as React from 'react'; import MaterialSymbolsShieldRounded from '~icons/material-symbols/shield-rounded'; + + import Link from 'next/link'; + + import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { - Avatar, - AvatarFallback, - AvatarImage, -} from '@/components/ui/avatar'; + + +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'; import { useAuthContext } from '@/services/providers/auth-provider'; + interface Props { user: API.User; } @@ -82,9 +86,9 @@ const Component = ({ user }: Props) => { > {user.username} -

+ {user.description} -

+
{secret && diff --git a/app/(pages)/u/[username]/_components/user-title.tsx b/app/(pages)/u/[username]/_components/user-title.tsx index 35e06298..11269560 100644 --- a/app/(pages)/u/[username]/_components/user-title.tsx +++ b/app/(pages)/u/[username]/_components/user-title.tsx @@ -5,12 +5,14 @@ import ClarityAdministratorSolid from '~icons/clarity/administrator-solid'; import { useParams } from 'next/navigation'; +import H3 from '@/components/typography/h3'; import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; import useUser from '@/services/hooks/user/useUser'; +import P from '@/components/typography/p'; interface Props {} @@ -25,9 +27,9 @@ const Component = ({}: Props) => { return (
-

+

{user.username} -

+ {(user.role === 'admin' || user.role === 'moderator') && ( @@ -36,19 +38,19 @@ const Component = ({}: Props) => {
-

+

{user.role === 'admin' ? 'Адміністратор' : 'Модератор'} -

+

)}
{user.description && ( -

+

{user.description} -

+

)} ); diff --git a/app/(pages)/u/[username]/layout.tsx b/app/(pages)/u/[username]/layout.tsx index 34497cc3..5d1d115a 100644 --- a/app/(pages)/u/[username]/layout.tsx +++ b/app/(pages)/u/[username]/layout.tsx @@ -28,6 +28,7 @@ import getQueryClient from '@/utils/getQueryClient'; import FollowButton from './_components/follow-button'; import FollowStats from './_components/follow-stats'; import UserInfo from './_components/user-info'; +import ActivationAlert from '@/app/(pages)/u/[username]/_components/activation-alert'; interface Props extends PropsWithChildren { @@ -115,6 +116,7 @@ const Component = async ({ params: { username }, children }: Props) => { return (
+ {user.cover && (
{ @@ -56,7 +57,7 @@ const Component = () => { )}
-

{option.label}

+

{option.label}

{pagination && (