Skip to content

Commit

Permalink
Fix bugs with repost title
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Jan 4, 2025
1 parent 03d6c30 commit 79e29e5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/components/PostsArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ export function PostsArea(props: {
<PostItem
bgColor={props.bgColor}
post={post}
showRepostsAsSelf={props.userId}
primaryColor={props.primaryColor}
/>
)}
Expand Down
41 changes: 24 additions & 17 deletions src/components/post-area/PostItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function PostItem(props: {
onClick?: (id: Post) => void;
post: Post;
pinned?: boolean;
showRepostsAsSelf?: boolean | any;
}) {
const { posts } = useStore();

Expand Down Expand Up @@ -132,7 +133,10 @@ export function PostItem(props: {
<Pinned />
</Show>
<Show when={props.reposted}>
<Reposted post={props.post} />
<Reposted
post={props.post}
showRepostsAsSelf={props.showRepostsAsSelf}
/>
</Show>
<Show when={replyingTo()}>
<ReplyTo user={replyingTo()!.createdBy} />
Expand Down Expand Up @@ -562,29 +566,32 @@ const Pinned = () => {
</div>
);
};
const Reposted = (props: { post: Post }) => {
const Reposted = (props: { post: Post; showRepostsAsSelf: boolean | any }) => {
const repostUsers = createMemo(() =>
props.post.reposts.map((r) => r.createdBy)
);
return (
<div class={style.pinnedContainer}>
<Icon name="repeat" color="var(--success-color)" size={16} />
<Text size={14} style={{ "margin-right": "5px" }}>
Reposted by{" "}
<For each={repostUsers()}>
{(user, i) => (
<>
{i() ? ", " : null}
<CustomLink
style={{ "line-height": "1" }}
decoration
href={RouterEndpoints.PROFILE(user?.id!)}
>
{user?.username}
</CustomLink>
</>
)}
</For>
<Show when={props.showRepostsAsSelf}>Reposted</Show>
<Show when={!props.showRepostsAsSelf}>
Reposted by{" "}
<For each={repostUsers()}>
{(user, i) => (
<>
{i() ? ", " : null}
<CustomLink
style={{ "line-height": "1" }}
decoration
href={RouterEndpoints.PROFILE(user?.id!)}
>
{user?.username}
</CustomLink>
</>
)}
</For>
</Show>
</Text>
</div>
);
Expand Down

0 comments on commit 79e29e5

Please sign in to comment.