Skip to content

Commit

Permalink
show pingpad community on posts
Browse files Browse the repository at this point in the history
  • Loading branch information
kualta committed Jul 4, 2024
1 parent 38b426b commit 0fcf5f1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/post/PostInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ export const PostInfo = ({ post }: { post: Post }) => {
const handle = author.handle;
const tags = post.metadata.tags || [];

let communityText = null;
let communityName = null;
let community = "";
tags.map((tag) => {
if (tag.includes("orbcommunities")) {
communityText = `orb/${tag.replace("orbcommunities", "")}`;
communityName = `orb/${tag.replace("orbcommunities", "")}`;
community = tag;
}
if (tag.includes("channel")) {
communityText = `channel/${tag.split("-")[1]}`;
communityName = `channel/${tag.split("-")[1]}`;
community = tag;
}
if (tag.includes("pingpad")) {
communityName = "ping";
community = tag;
}
});
Expand All @@ -30,10 +34,10 @@ export const PostInfo = ({ post }: { post: Post }) => {
<span className="w-fit truncate font-bold">{author.name}</span>
<span className="">{`${isLensHandle ? "@" : "#"}${handle}`}</span>
</Link>
{communityText && (
{communityName && (
<>
<span>{"·"}</span>
<Link href={`/c/${community}`}>{communityText}</Link>
<Link href={`/c/${community}`}>{communityName}</Link>
</>
)}
<span>{"·"}</span>
Expand Down

0 comments on commit 0fcf5f1

Please sign in to comment.