-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8291533
commit c066096
Showing
9 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/en.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title": "Taskany — Explore — Projects — Starred" | ||
} |
17 changes: 17 additions & 0 deletions
17
src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable */ | ||
// Do not edit, use generator to update | ||
import { i18n, fmt, I18nLangSet } from 'easy-typed-intl'; | ||
import getLang from '../../../utils/getLang'; | ||
|
||
import ru from './ru.json'; | ||
import en from './en.json'; | ||
|
||
export type I18nKey = keyof typeof ru & keyof typeof en; | ||
type I18nLang = 'ru' | 'en'; | ||
|
||
const keyset: I18nLangSet<I18nKey> = {}; | ||
|
||
keyset['ru'] = ru; | ||
keyset['en'] = en; | ||
|
||
export const tr = i18n<I18nLang, I18nKey>(keyset, fmt, getLang); |
3 changes: 3 additions & 0 deletions
3
src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.i18n/ru.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"title": "Taskany — Обзор — Проекты — Избранное" | ||
} |
45 changes: 45 additions & 0 deletions
45
src/components/ExploreProjectsStarredPage/ExploreProjectsStarredPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { nullable } from '@taskany/bricks'; | ||
import { Table, Link } from '@taskany/bricks/harmony'; | ||
import NextLink from 'next/link'; | ||
|
||
import { ExternalPageProps } from '../../utils/declareSsrProps'; | ||
import { routes } from '../../hooks/router'; | ||
import { Page } from '../Page/Page'; | ||
import { ExplorePageHeader } from '../ExplorePageHeader/ExplorePageHeader'; | ||
import { ProjectListItem } from '../ProjectListItem/ProjectListItem'; | ||
import { TableRowItem, TableRowItemTitle } from '../TableRowItem/TableRowItem'; | ||
import { trpc } from '../../utils/trpcClient'; | ||
|
||
import { tr } from './ExploreProjectsStarredPage.i18n'; | ||
|
||
export const ExploreProjectsStarredPage = ({ user, ssrTime }: ExternalPageProps) => { | ||
const { data } = trpc.project.getStarred.useQuery(); | ||
|
||
if (!data) return null; | ||
|
||
return ( | ||
<Page user={user} ssrTime={ssrTime} title={tr('title')} header={<ExplorePageHeader />}> | ||
<Table> | ||
{data.map((project) => | ||
nullable(project, (p) => ( | ||
<NextLink key={p.id} href={routes.project(p.id)} passHref legacyBehavior> | ||
<Link> | ||
<TableRowItem title={<TableRowItemTitle size="l">{p.title}</TableRowItemTitle>}> | ||
<ProjectListItem | ||
id={p.id} | ||
stargizers={p._count.stargizers} | ||
owner={p.activity} | ||
starred={p._isStarred} | ||
watching={p._isWatching} | ||
participants={p.participants} | ||
averageScore={p.averageScore} | ||
/> | ||
</TableRowItem> | ||
</Link> | ||
</NextLink> | ||
)), | ||
)} | ||
</Table> | ||
</Page> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/pages/explore/projects.tsx → src/pages/explore/projects/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ExploreProjectsStarredPage } from '../../../components/ExploreProjectsStarredPage/ExploreProjectsStarredPage'; | ||
import { declareSsrProps } from '../../../utils/declareSsrProps'; | ||
|
||
export const getServerSideProps = declareSsrProps( | ||
async ({ ssrHelpers }) => { | ||
await ssrHelpers.project.getStarred.fetch(); | ||
}, | ||
{ | ||
private: true, | ||
}, | ||
); | ||
|
||
export default ExploreProjectsStarredPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters