diff --git a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/en.json b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/en.json index a9e949862..280866ad4 100644 --- a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/en.json +++ b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/en.json @@ -1,4 +1,7 @@ { "title": "Taskany — Explore — Projects - Starred", - "Starred": "Starred Projects" + "Starred": "Starred Projects", + "You haven't starred any projects": "You haven't starred any projects.", + "Go to any project page and mark it with a star": "Go to any project page and mark it with a star", + "All projects": "All projects page" } diff --git a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/ru.json b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/ru.json index 08e05d9d9..7504ff1af 100644 --- a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/ru.json +++ b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/ru.json @@ -1,4 +1,7 @@ { "title": "Taskany — Обзор — Проекты — Избранное", - "Starred": "Избранные Проекты" + "Starred": "Избранные проекты", + "You haven't starred any projects": "Нет отмеченных звездочкой проектов.", + "Go to any project page and mark it with a star": "Перейди на страницу любого проекта и отметь его звездочкой", + "All projects": "Все проекты" } diff --git a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.module.css b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.module.css new file mode 100644 index 000000000..409445646 --- /dev/null +++ b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.module.css @@ -0,0 +1,3 @@ +.EmptyStarredProjectsCard { + width: 50%; +} \ No newline at end of file diff --git a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.tsx b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.tsx index 491708d91..5f6ad401a 100644 --- a/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.tsx +++ b/src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.tsx @@ -1,5 +1,5 @@ import { nullable } from '@taskany/bricks'; -import { Table, Link } from '@taskany/bricks/harmony'; +import { Table, Link, Text, Card, CardContent } from '@taskany/bricks/harmony'; import NextLink from 'next/link'; import { ExternalPageProps } from '../../utils/declareSsrProps'; @@ -12,34 +12,56 @@ import { CommonHeader } from '../CommonHeader'; import { ActivityByIdReturnType } from '../../../trpc/inferredTypes'; import { tr } from './ExploreProjectsStarredPage.i18n'; +import classes from './ExploreProjectsStarredPage.module.css'; export const ExploreProjectsStarredPage = ({ user, ssrTime }: ExternalPageProps) => { const { data } = trpc.v2.project.starred.useQuery(); - if (!data) return null; return ( }> - - {data.map((project) => - nullable(project, (p) => ( - - - {p.title}}> - - - - - )), - )} -
+ {nullable(data, (projects) => + nullable( + projects.length, + () => ( + + {projects.map((project) => + nullable(project, (p) => ( + + + {p.title}} + > + + + + + )), + )} +
+ ), + + + + {tr("You haven't starred any projects")}{' '} + {tr('Go to any project page and mark it with a star')} + + + + {tr('All projects')} + + + + , + ), + )}
); }; diff --git a/trpc/router/projectV2.ts b/trpc/router/projectV2.ts index 2767b5ff3..93ec02345 100644 --- a/trpc/router/projectV2.ts +++ b/trpc/router/projectV2.ts @@ -82,6 +82,10 @@ export const project = router({ try { const projectIds = await getStarredProjectsIds(activityId).execute(); + if (!projectIds?.length) { + return []; + } + return getProjectsByIds({ activityId, in: projectIds, role }) .select([ jsonBuildObject({