Skip to content

Commit

Permalink
Add verified badge
Browse files Browse the repository at this point in the history
  • Loading branch information
karniv00l committed Nov 15, 2022
1 parent 07c42ec commit 8dd443b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/@types/pocketbase-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type UsersRecord = {
username: string
email: string
verified: boolean
verifiedAuthor?: boolean
}

export type UsersResponse = UsersRecord & BaseRecord
Expand Down
4 changes: 4 additions & 0 deletions src/css/overrides.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ reach-portal>div {
.ant-tag {
background-color: transparent;
}

.ant-table-tbody>tr.ant-table-row:hover>td {
background: @main-dark;
}
38 changes: 33 additions & 5 deletions src/pages/Hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Space,
Table,
Tag,
Tooltip,
Typography,
} from 'antd';
import { ColumnsType } from 'antd/lib/table';
Expand All @@ -16,6 +17,7 @@ import {
StarOutlined,
ArrowRightOutlined,
EditOutlined,
CheckCircleFilled,
} from '@ant-design/icons';
import {
useCallback,
Expand Down Expand Up @@ -131,7 +133,12 @@ const Hub = () => {
<Space direction="vertical">
<Text type="secondary">
<Link to={generatePath(Routes.USER_ROOT, { userId: tune.author })}>
{(tune as any).authorUsername}
<Space>
{(tune.expand?.author as unknown as UsersResponse).verifiedAuthor === true && (
<Tooltip title="Verified author"><CheckCircleFilled /></Tooltip>
)}
{(tune as any).authorUsername}
</Space>
</Link>, {tune.updated}, {tune.stars} <StarOutlined />
</Text>
<Text>{tune.engineMake}, {tune.engineCode}, {tune.displacement}, {tune.cylindersCount} cylinders, {tune.aspiration}</Text>
Expand Down Expand Up @@ -190,7 +197,12 @@ const Hub = () => {
responsive: ['sm'],
render: (userName: string, record: TunesResponse) => (
<Link to={generatePath(Routes.USER_ROOT, { userId: record.author })}>
{userName}
<Space>
{(record.expand?.author as unknown as UsersResponse).verifiedAuthor === true && (
<Tooltip title="Verified author"><CheckCircleFilled /></Tooltip>
)}
{userName}
</Space>
</Link>
),
},
Expand Down Expand Up @@ -224,9 +236,25 @@ const Hub = () => {

return (
<Space>
{isOwner && <Button size={size} icon={<EditOutlined />} onClick={() => goToEdit(tuneId)} />}
{isClipboardSupported && <Button size={size} icon={<CopyOutlined />} onClick={() => copyToClipboard(buildFullUrl([tunePath(tuneId)]))} />}
<Button size={size} type="primary" icon={<ArrowRightOutlined />} onClick={() => navigate(tunePath(tuneId))} />
{isOwner && (
<Button
size={size}
icon={<EditOutlined />}
onClick={() => goToEdit(tuneId)}
/>
)}
{isClipboardSupported && (
<Button
size={size}
icon={<CopyOutlined />}
onClick={() => copyToClipboard(buildFullUrl([tunePath(tuneId)]))}
/>
)}
<Button
size={size}
type="primary"
icon={<ArrowRightOutlined />} onClick={() => navigate(tunePath(tuneId))}
/>
</Space>
);
},
Expand Down

0 comments on commit 8dd443b

Please sign in to comment.