From 0a4d1a6f3a5c5a7624810602ba6fbcc4e468d35d Mon Sep 17 00:00:00 2001 From: rooki Date: Thu, 28 Dec 2023 13:32:24 +0100 Subject: [PATCH 01/12] init --- src/app/user/[username]/page.tsx | 9 ++- src/components/button/index.tsx | 7 ++- src/components/comment-actions/index.tsx | 43 ++++++++++++++ src/components/comment-feed/index.tsx | 25 ++++++++ src/components/comment-header/index.tsx | 56 ++++++++++++++++++ src/components/comment-votes/index.tsx | 39 +++++++++++++ src/components/comment/index.tsx | 58 +++++++++++++++++++ src/components/icon/index.tsx | 2 + .../person-comments-posts/index.tsx | 14 ++--- src/components/text/index.tsx | 5 +- test-person-data.json | 1 + 11 files changed, 244 insertions(+), 15 deletions(-) create mode 100644 src/components/comment-actions/index.tsx create mode 100644 src/components/comment-feed/index.tsx create mode 100644 src/components/comment-header/index.tsx create mode 100644 src/components/comment-votes/index.tsx create mode 100644 src/components/comment/index.tsx diff --git a/src/app/user/[username]/page.tsx b/src/app/user/[username]/page.tsx index 5fb152f..4c18ccb 100644 --- a/src/app/user/[username]/page.tsx +++ b/src/app/user/[username]/page.tsx @@ -7,6 +7,7 @@ import { ModeratesList, ModeratesProps } from '@/components/moderates-list'; import { PersonDetailSelection } from '@/components/person-comments-posts'; import sublinksClient from '@/utils/client'; +import { CommentView, PostView } from 'sublinks-js-client'; import * as testData from '../../../../test-person-data.json'; interface UserViewProps { @@ -27,8 +28,7 @@ const User = async ({ params: { username } }: UserViewProps) => { avatar, banner, bio, display_name: displayName, name }, is_admin: isAdmin } = userData.person_view; - const { posts, moderates } = userData; - + const { posts, comments, moderates } = userData; return (
@@ -52,7 +52,10 @@ const User = async ({ params: { username } }: UserViewProps) => {
- +
); diff --git a/src/components/button/index.tsx b/src/components/button/index.tsx index 8db0e71..0a2250e 100644 --- a/src/components/button/index.tsx +++ b/src/components/button/index.tsx @@ -4,17 +4,18 @@ import cx from 'classnames'; interface ButtonProps { children: React.ReactNode; type: 'button' | 'submit' | 'reset'; - id: string; + id?: string; ariaLabel?: string; className?: string; + onClick?: (e: React.MouseEvent) => void; } const Button = ({ - ariaLabel, children, className, id, type + ariaLabel, children, className, id, type, onClick }: ButtonProps) => ( // Rule doesn't like type being a variable even though types force it to be a valid option // eslint-disable-next-line react/button-has-type - + ); export default Button; diff --git a/src/components/comment-actions/index.tsx b/src/components/comment-actions/index.tsx new file mode 100644 index 0000000..a5fad61 --- /dev/null +++ b/src/components/comment-actions/index.tsx @@ -0,0 +1,43 @@ +'use client'; + +import React from 'react'; + +import { CommentAggregates } from 'sublinks-js-client'; +import CommentVotes from '../comment-votes'; +import Button from '../button'; +import Icon, { ICON_SIZE } from '../icon'; +import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; + +interface CommentActionProps { + votes: CommentAggregates; +} + +export const CommentAction = ({ + votes +}: CommentActionProps) => ( +
+ + + +
+); diff --git a/src/components/comment-feed/index.tsx b/src/components/comment-feed/index.tsx new file mode 100644 index 0000000..d1d5dc1 --- /dev/null +++ b/src/components/comment-feed/index.tsx @@ -0,0 +1,25 @@ +import React from 'react'; + +import { CommentView } from 'sublinks-js-client'; +import { H1 } from '../text'; +import { CommentCard } from '../comment'; + +interface CommentFeedProps { + data: CommentView[]; +} + +const CommentFeed = ({ data: comments }: CommentFeedProps) => ( +
+ {comments && comments.length > 0 ? comments.map(commentData => ( +
+ +
+ )) : (

No comments available!

)} +
+); + +export default CommentFeed; diff --git a/src/components/comment-header/index.tsx b/src/components/comment-header/index.tsx new file mode 100644 index 0000000..6fac11e --- /dev/null +++ b/src/components/comment-header/index.tsx @@ -0,0 +1,56 @@ +import React from 'react'; + +import { + Person +} from 'sublinks-js-client'; +import Image from 'next/image'; +import Link from 'next/link'; +import { HomeIcon, LinkIcon, PencilIcon } from '@heroicons/react/24/outline'; +import { + H2, SmallerBodyText +} from '../text'; +import Icon, { ICON_SIZE } from '../icon'; + +interface CommentHeaderProps { + creator: Person; + href: string; + ap_id: string; + createdAt: string; + updatedAt: string | undefined; +} + +export const CommentHeader = ({ + creator, + href, + ap_id, + createdAt, + updatedAt +}: CommentHeaderProps) => { + const { display_name: authorDisplayName, name: authorName } = creator; + + const showName = authorDisplayName || authorName; + + const updated = updatedAt !== undefined; + + return ( +
+ + {`Avatar +

{showName}

+ + + + + + {new Date(updated ? updatedAt : createdAt).toLocaleString()} + {updated && } +
+ + ); +}; diff --git a/src/components/comment-votes/index.tsx b/src/components/comment-votes/index.tsx new file mode 100644 index 0000000..210a5d3 --- /dev/null +++ b/src/components/comment-votes/index.tsx @@ -0,0 +1,39 @@ +'use client'; + +import React from 'react'; +import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/20/solid'; + +import Icon, { ICON_SIZE } from '../icon'; +import { PaleBodyText } from '../text'; + +interface VoteButtonProps { + children: React.ReactNode, + label: string; +} + +const VoteButton = ({ children, label }: VoteButtonProps) => ( + +); + +const CommentVotes = ({ points }: { points: number; }) => ( +
+ + + + {points} + + + +
+); + +export default CommentVotes; diff --git a/src/components/comment/index.tsx b/src/components/comment/index.tsx new file mode 100644 index 0000000..a1f2cc3 --- /dev/null +++ b/src/components/comment/index.tsx @@ -0,0 +1,58 @@ +import React from 'react'; + +import { + Person, Comment, CommentAggregates +} from 'sublinks-js-client'; +import Markdown from 'react-markdown'; +import CommentVotes from '../comment-votes'; +import { CommentHeader } from '../comment-header'; +import { BodyText } from '../text'; +import { CommentAction } from '../comment-actions'; + +interface CommentCardProps { + comment: Comment; + creator: Person; + counts: CommentAggregates; +} + +export const CommentCard = ({ + comment, + creator, + counts +}: CommentCardProps) => { + const { + id, content, ap_id, published, updated + } = comment; + const { display_name: authorDisplayName, name: authorName } = creator; + + // @todo: Make our own URLs until Sublinks API connects URLs to all entities + const commentHref = `/comment/${id}`; + const authorUrl = `/user/${authorName}`; + + return ( +
+
+
+
+ +
+
+ + {content} + +
+
+
+ +
+
+
+
+ ); +}; diff --git a/src/components/icon/index.tsx b/src/components/icon/index.tsx index 5dcdfe8..dda5a58 100644 --- a/src/components/icon/index.tsx +++ b/src/components/icon/index.tsx @@ -2,11 +2,13 @@ import React from 'react'; import cx from 'classnames'; export const ICON_SIZE = { + VERYSMALL: 0, SMALL: 1, MEDIUM: 2 }; const wrapperSizeClassMap = { + [ICON_SIZE.VERYSMALL]: 'h-20 w-20', [ICON_SIZE.SMALL]: 'h-24 w-24', [ICON_SIZE.MEDIUM]: 'h-32 w-32' }; diff --git a/src/components/person-comments-posts/index.tsx b/src/components/person-comments-posts/index.tsx index 5402f0c..3a19b44 100644 --- a/src/components/person-comments-posts/index.tsx +++ b/src/components/person-comments-posts/index.tsx @@ -6,26 +6,24 @@ import { Tab, TabPanel } from '@/components/TailwindMaterial'; -import { Community, Post, PostAggregates } from 'sublinks-js-client'; +import { CommentView, PostView } from 'sublinks-js-client'; import PostFeed from '../post-feed'; +import CommentFeed from '../comment-feed'; interface PersonDetailSelectionProps { - postViews: { - post: Post; - counts: PostAggregates; - community: Community; - }[] + postViews: PostView[], + commentViews: CommentView[] } // @todo: implement posts and comments -export const PersonDetailSelection = ({ postViews }: PersonDetailSelectionProps) => { +export const PersonDetailSelection = ({ postViews, commentViews }: PersonDetailSelectionProps) => { const tabs: { label: string; value: string; content?: React.JSX.Element; }[] = [ { label: 'Posts', value: 'posts', content: }, - { label: 'Comments', value: 'comments' } + { label: 'Comments', value: 'comments', content: } ]; return ( diff --git a/src/components/text/index.tsx b/src/components/text/index.tsx index 3003427..7c406d4 100644 --- a/src/components/text/index.tsx +++ b/src/components/text/index.tsx @@ -15,6 +15,8 @@ const BodyTitle = ({ children, className, title }: TextProps) => {children}; +const SmallerBodyText = ({ children, className, title }: TextProps) => {children}; + const PaleBodyText = ({ children, className, title }: TextProps) => {children}; const LinkText = ({ children, className, title }: TextProps) => {children}; @@ -28,5 +30,6 @@ export { BodyText, PaleBodyText, LinkText, - PaleLinkText + PaleLinkText, + SmallerBodyText }; diff --git a/test-person-data.json b/test-person-data.json index 6e3c8ac..4ec983e 100644 --- a/test-person-data.json +++ b/test-person-data.json @@ -33,6 +33,7 @@ "content": "Me getting ideas from this thread \n![](https://lemmy.ml/pictrs/image/43d092c2-ecaa-4a95-833f-e6885151c086.jpeg)", "removed": false, "published": "2023-12-09T14:30:00.372258Z", + "updated": "2023-12-10T14:30:00.372258Z", "deleted": false, "ap_id": "https://lemmy.ml/comment/6509377", "local": true, From 4530bb772fd3022850ef91fd0e1d038ea94b7c16 Mon Sep 17 00:00:00 2001 From: rooki Date: Fri, 29 Dec 2023 22:50:56 +0100 Subject: [PATCH 02/12] Implemented comments --- src/components/comment-actions/index.tsx | 72 ++++++++++++++---------- src/components/comment-votes/index.tsx | 22 ++++++-- src/components/comment/index.tsx | 15 +++-- src/components/icon/index.tsx | 5 +- src/components/linkbutton/index.tsx | 21 +++++++ 5 files changed, 90 insertions(+), 45 deletions(-) create mode 100644 src/components/linkbutton/index.tsx diff --git a/src/components/comment-actions/index.tsx b/src/components/comment-actions/index.tsx index a5fad61..8a7230a 100644 --- a/src/components/comment-actions/index.tsx +++ b/src/components/comment-actions/index.tsx @@ -3,41 +3,53 @@ import React from 'react'; import { CommentAggregates } from 'sublinks-js-client'; +import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; +import sublinksClient from '@/utils/client'; import CommentVotes from '../comment-votes'; -import Button from '../button'; import Icon, { ICON_SIZE } from '../icon'; -import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; +import LinkButton from '../linkbutton'; interface CommentActionProps { votes: CommentAggregates; + myVote?: number; } export const CommentAction = ({ - votes -}: CommentActionProps) => ( -
- - - -
-); + votes, + myVote +}: CommentActionProps) => { + const handleVote = async (vote: number) => { + if (!process.env.SUBLINKS_API_BASE_URL) return; + + await sublinksClient().likeComment({ + comment_id: votes.comment_id, + score: vote + }); + }; + + return ( +
+ + { + e.preventDefault(); + }} + > + Reply + + { + e.preventDefault(); + }} + > + + +
+ ); +}; diff --git a/src/components/comment-votes/index.tsx b/src/components/comment-votes/index.tsx index 210a5d3..c0d7edb 100644 --- a/src/components/comment-votes/index.tsx +++ b/src/components/comment-votes/index.tsx @@ -9,13 +9,17 @@ import { PaleBodyText } from '../text'; interface VoteButtonProps { children: React.ReactNode, label: string; + onClick?: (e: React.MouseEvent) => void } -const VoteButton = ({ children, label }: VoteButtonProps) => ( +const VoteButton = ({ children, label, onClick }: VoteButtonProps) => ( ); -const CommentVotes = ({ points }: { points: number; }) => ( +interface CommentVotesProps { + points: number; + onVote: (score: number) => void; + myVote?: number; +} + +const CommentVotes = ({ points, onVote, myVote }: CommentVotesProps) => (
- - + onVote(myVote === 1 ? 0 : 1)}> + {points} - - + onVote(myVote === -1 ? 0 : -1)}> +
); diff --git a/src/components/comment/index.tsx b/src/components/comment/index.tsx index a1f2cc3..516b06e 100644 --- a/src/components/comment/index.tsx +++ b/src/components/comment/index.tsx @@ -4,35 +4,34 @@ import { Person, Comment, CommentAggregates } from 'sublinks-js-client'; import Markdown from 'react-markdown'; -import CommentVotes from '../comment-votes'; import { CommentHeader } from '../comment-header'; -import { BodyText } from '../text'; import { CommentAction } from '../comment-actions'; interface CommentCardProps { comment: Comment; creator: Person; counts: CommentAggregates; + myVote?: number; } export const CommentCard = ({ comment, creator, - counts + counts, + myVote }: CommentCardProps) => { const { + // eslint-disable-next-line @typescript-eslint/naming-convention id, content, ap_id, published, updated } = comment; - const { display_name: authorDisplayName, name: authorName } = creator; // @todo: Make our own URLs until Sublinks API connects URLs to all entities const commentHref = `/comment/${id}`; - const authorUrl = `/user/${authorName}`; return (
-
+
-
+
{content}
- +
diff --git a/src/components/icon/index.tsx b/src/components/icon/index.tsx index dda5a58..8b79a7e 100644 --- a/src/components/icon/index.tsx +++ b/src/components/icon/index.tsx @@ -23,22 +23,25 @@ interface IconProps { titleId?: string; height?: string | number; width?: string | number; + className?: string; }>; size: typeof ICON_SIZE[keyof typeof ICON_SIZE]; title?: string; titleId?: string; className?: string; + SvgClassName?: string; isInteractable?: boolean; } const Icon = ({ - IconType, size, title, titleId, className, isInteractable + IconType, size, title, titleId, className, SvgClassName, isInteractable }: IconProps) => (
) => void; +} + +const LinkButton = ({ + ariaLabel, children, className, id, type, onClick +}: LinkButtonProps) => ( + // Rule doesn't like type being a variable even though types force it to be a valid option + // eslint-disable-next-line react/button-has-type + +); + +export default LinkButton; From a4db8e8f951674fb9f5fb4447b06a8311b9e7300 Mon Sep 17 00:00:00 2001 From: rooki Date: Sun, 31 Dec 2023 16:37:40 +0100 Subject: [PATCH 03/12] For review --- .../{linkbutton => button-link}/index.tsx | 0 src/components/comment-actions/index.tsx | 6 +++--- src/components/comment-header/index.tsx | 15 ++++++++------- src/components/comment/index.tsx | 5 ++--- src/components/person-comments-posts/index.tsx | 5 ++--- src/components/text/index.tsx | 5 +---- 6 files changed, 16 insertions(+), 20 deletions(-) rename src/components/{linkbutton => button-link}/index.tsx (100%) diff --git a/src/components/linkbutton/index.tsx b/src/components/button-link/index.tsx similarity index 100% rename from src/components/linkbutton/index.tsx rename to src/components/button-link/index.tsx diff --git a/src/components/comment-actions/index.tsx b/src/components/comment-actions/index.tsx index 8a7230a..89a86f1 100644 --- a/src/components/comment-actions/index.tsx +++ b/src/components/comment-actions/index.tsx @@ -7,7 +7,7 @@ import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; import sublinksClient from '@/utils/client'; import CommentVotes from '../comment-votes'; import Icon, { ICON_SIZE } from '../icon'; -import LinkButton from '../linkbutton'; +import LinkButton from '../button-link'; interface CommentActionProps { votes: CommentAggregates; @@ -32,7 +32,7 @@ export const CommentAction = ({ { e.preventDefault(); @@ -42,7 +42,7 @@ export const CommentAction = ({ { e.preventDefault(); diff --git a/src/components/comment-header/index.tsx b/src/components/comment-header/index.tsx index 6fac11e..075444d 100644 --- a/src/components/comment-header/index.tsx +++ b/src/components/comment-header/index.tsx @@ -5,16 +5,17 @@ import { } from 'sublinks-js-client'; import Image from 'next/image'; import Link from 'next/link'; -import { HomeIcon, LinkIcon, PencilIcon } from '@heroicons/react/24/outline'; +import { HomeIcon, LinkIcon } from '@heroicons/react/24/outline'; import { - H2, SmallerBodyText + BodyText, + H2 } from '../text'; import Icon, { ICON_SIZE } from '../icon'; interface CommentHeaderProps { creator: Person; href: string; - ap_id: string; + apId: string; createdAt: string; updatedAt: string | undefined; } @@ -22,7 +23,7 @@ interface CommentHeaderProps { export const CommentHeader = ({ creator, href, - ap_id, + apId, createdAt, updatedAt }: CommentHeaderProps) => { @@ -45,11 +46,11 @@ export const CommentHeader = ({

{showName}

- + - {new Date(updated ? updatedAt : createdAt).toLocaleString()} - {updated && } + {new Date(updated ? updatedAt : createdAt).toLocaleString()} + {updated && Edited}
); diff --git a/src/components/comment/index.tsx b/src/components/comment/index.tsx index 516b06e..b5270ac 100644 --- a/src/components/comment/index.tsx +++ b/src/components/comment/index.tsx @@ -21,8 +21,7 @@ export const CommentCard = ({ myVote }: CommentCardProps) => { const { - // eslint-disable-next-line @typescript-eslint/naming-convention - id, content, ap_id, published, updated + id, content, ap_id: apId, published, updated } = comment; // @todo: Make our own URLs until Sublinks API connects URLs to all entities @@ -35,7 +34,7 @@ export const CommentCard = ({
{ const tabs: { label: string; @@ -31,9 +30,9 @@ export const PersonDetailSelection = ({ postViews, commentViews }: PersonDetailS {tabs.map(({ label, value }) => ( diff --git a/src/components/text/index.tsx b/src/components/text/index.tsx index 7c406d4..3003427 100644 --- a/src/components/text/index.tsx +++ b/src/components/text/index.tsx @@ -15,8 +15,6 @@ const BodyTitle = ({ children, className, title }: TextProps) => {children}; -const SmallerBodyText = ({ children, className, title }: TextProps) => {children}; - const PaleBodyText = ({ children, className, title }: TextProps) => {children}; const LinkText = ({ children, className, title }: TextProps) => {children}; @@ -30,6 +28,5 @@ export { BodyText, PaleBodyText, LinkText, - PaleLinkText, - SmallerBodyText + PaleLinkText }; From bb4b72f36670fcaa9e70e039b1000bf77be36aca Mon Sep 17 00:00:00 2001 From: rooki Date: Sun, 31 Dec 2023 16:39:33 +0100 Subject: [PATCH 04/12] Fixed a class issue --- src/components/comment/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/comment/index.tsx b/src/components/comment/index.tsx index b5270ac..9ffffee 100644 --- a/src/components/comment/index.tsx +++ b/src/components/comment/index.tsx @@ -41,7 +41,7 @@ export const CommentCard = ({ />
- + {content}
From 2c8895de757409d0e89ca90464a3fa56676d3d96 Mon Sep 17 00:00:00 2001 From: rooki Date: Tue, 2 Jan 2024 20:41:04 +0100 Subject: [PATCH 05/12] For review --- .../{comment-votes => button-votes}/index.tsx | 14 +++++-- src/components/comment-actions/index.tsx | 4 +- src/components/post-votes/index.tsx | 39 ------------------- src/components/post/index.tsx | 6 ++- 4 files changed, 17 insertions(+), 46 deletions(-) rename src/components/{comment-votes => button-votes}/index.tsx (82%) delete mode 100644 src/components/post-votes/index.tsx diff --git a/src/components/comment-votes/index.tsx b/src/components/button-votes/index.tsx similarity index 82% rename from src/components/comment-votes/index.tsx rename to src/components/button-votes/index.tsx index c0d7edb..409909e 100644 --- a/src/components/comment-votes/index.tsx +++ b/src/components/button-votes/index.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { ArrowDownIcon, ArrowUpIcon } from '@heroicons/react/20/solid'; +import cx from 'classnames'; import Icon, { ICON_SIZE } from '../icon'; import { PaleBodyText } from '../text'; @@ -32,10 +33,17 @@ interface CommentVotesProps { points: number; onVote: (score: number) => void; myVote?: number; + vertical?: boolean; } -const CommentVotes = ({ points, onVote, myVote }: CommentVotesProps) => ( -
+const VoteButtons = ({ + points, onVote, myVote, vertical +}: CommentVotesProps) => ( +
onVote(myVote === 1 ? 0 : 1)}> @@ -46,4 +54,4 @@ const CommentVotes = ({ points, onVote, myVote }: CommentVotesProps) => (
); -export default CommentVotes; +export default VoteButtons; diff --git a/src/components/comment-actions/index.tsx b/src/components/comment-actions/index.tsx index 89a86f1..e16c7a6 100644 --- a/src/components/comment-actions/index.tsx +++ b/src/components/comment-actions/index.tsx @@ -5,9 +5,9 @@ import React from 'react'; import { CommentAggregates } from 'sublinks-js-client'; import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; import sublinksClient from '@/utils/client'; -import CommentVotes from '../comment-votes'; import Icon, { ICON_SIZE } from '../icon'; import LinkButton from '../button-link'; +import VoteButtons from '../button-votes'; interface CommentActionProps { votes: CommentAggregates; @@ -29,7 +29,7 @@ export const CommentAction = ({ return (
- + ( - -); - -const PostVotes = ({ points }: { points: number; }) => ( -
- - - - {points} - - - -
-); - -export default PostVotes; diff --git a/src/components/post/index.tsx b/src/components/post/index.tsx index 81086ea..314206f 100644 --- a/src/components/post/index.tsx +++ b/src/components/post/index.tsx @@ -1,3 +1,5 @@ +'use client'; + import React from 'react'; import Link from 'next/link'; @@ -7,9 +9,9 @@ import { } from 'sublinks-js-client'; import { getPostThumbnailUrl } from '@/utils/links'; import { BodyText, BodyTitle } from '../text'; -import PostVotes from '../post-votes'; import PostThumbnail from '../post-thumbnail'; import LinkedPostSubTitle from '../post-subtitle'; +import VoteButtons from '../button-votes'; interface PostCardProps { post: Post; @@ -42,7 +44,7 @@ export const PostCard = ({
- + {}} />
From 3ad8d374df3405a171f9b98af48983cc679dfafb Mon Sep 17 00:00:00 2001 From: rooki Date: Tue, 2 Jan 2024 20:58:29 +0100 Subject: [PATCH 06/12] eslint --- src/components/post-header/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/post-header/index.tsx b/src/components/post-header/index.tsx index 1b7549a..c6711fe 100644 --- a/src/components/post-header/index.tsx +++ b/src/components/post-header/index.tsx @@ -5,9 +5,9 @@ import Image from 'next/image'; import Link from 'next/link'; import cx from 'classnames'; -import PostVotes from '../post-votes'; import { H1 } from '../text'; import PostThumbnail from '../post-thumbnail'; +import VoteButtons from '../button-votes'; interface PostHeaderProps { points: number; @@ -33,7 +33,7 @@ const PostHeader = ({
- + {}} />
); diff --git a/src/components/icon/index.tsx b/src/components/icon/index.tsx index 8b79a7e..d4650ac 100644 --- a/src/components/icon/index.tsx +++ b/src/components/icon/index.tsx @@ -29,19 +29,19 @@ interface IconProps { title?: string; titleId?: string; className?: string; - SvgClassName?: string; + textClassName?: string; isInteractable?: boolean; } const Icon = ({ - IconType, size, title, titleId, className, SvgClassName, isInteractable + IconType, size, title, titleId, className, isInteractable, textClassName }: IconProps) => ( -
- {}} /> + {}} myVote={1} />
From 4aeee1d1e7a92a44e1415ddc3b13633310e85c3e Mon Sep 17 00:00:00 2001 From: rooki Date: Tue, 2 Jan 2024 21:52:57 +0100 Subject: [PATCH 08/12] Lint --- src/components/button-votes/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button-votes/index.tsx b/src/components/button-votes/index.tsx index 8d296ba..9f8b59e 100644 --- a/src/components/button-votes/index.tsx +++ b/src/components/button-votes/index.tsx @@ -45,7 +45,7 @@ const VoteButtons = ({ })} > onVote(myVote === 1 ? 0 : 1)}> - + {points} onVote(myVote === -1 ? 0 : -1)}> From b9c5b5a9038a0d294de2b24da05a0f815fd60dc5 Mon Sep 17 00:00:00 2001 From: rooki Date: Tue, 2 Jan 2024 21:54:23 +0100 Subject: [PATCH 09/12] added comments --- src/components/post/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/post/index.tsx b/src/components/post/index.tsx index 3e88623..94b41ab 100644 --- a/src/components/post/index.tsx +++ b/src/components/post/index.tsx @@ -39,12 +39,13 @@ export const PostCard = ({ const postHref = `/c/${communitySlug}/${id}`; const authorUrl = `/user/${authorName}`; const communityUrl = `/c/${communitySlug}`; - + + // @todo: Add real "myVote" return (
- {}} myVote={1} /> + {}} myVote={0} />
From ab9924609910bc7eed808c336e28c32ef0e6d2f3 Mon Sep 17 00:00:00 2001 From: rooki Date: Wed, 3 Jan 2024 14:22:17 +0100 Subject: [PATCH 10/12] eslint --- src/components/post/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/post/index.tsx b/src/components/post/index.tsx index 94b41ab..5225010 100644 --- a/src/components/post/index.tsx +++ b/src/components/post/index.tsx @@ -39,7 +39,6 @@ export const PostCard = ({ const postHref = `/c/${communitySlug}/${id}`; const authorUrl = `/user/${authorName}`; const communityUrl = `/c/${communitySlug}`; - // @todo: Add real "myVote" return (
From 453bba425cd24a8488442b9dca96df147a8f5f28 Mon Sep 17 00:00:00 2001 From: rooki Date: Wed, 3 Jan 2024 14:51:07 +0100 Subject: [PATCH 11/12] removed default flex-row --- src/components/button-votes/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button-votes/index.tsx b/src/components/button-votes/index.tsx index 9f8b59e..89fcda8 100644 --- a/src/components/button-votes/index.tsx +++ b/src/components/button-votes/index.tsx @@ -39,7 +39,7 @@ interface CommentVotesProps { const VoteButtons = ({ points, onVote, myVote, vertical }: CommentVotesProps) => ( -
Date: Wed, 3 Jan 2024 17:14:10 +0100 Subject: [PATCH 12/12] Adjusted the title --- src/components/button-votes/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button-votes/index.tsx b/src/components/button-votes/index.tsx index 89fcda8..1b7e389 100644 --- a/src/components/button-votes/index.tsx +++ b/src/components/button-votes/index.tsx @@ -47,7 +47,7 @@ const VoteButtons = ({ onVote(myVote === 1 ? 0 : 1)}> - {points} + {points} onVote(myVote === -1 ? 0 : -1)}>