Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

fix: reactions count grammar #69

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/social-card/highlight-card/highlight-card.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export class HighlightCardService {
);

const [highlight, highlightReactions] = await Promise.all([highlightReq, reactionsReq]);

const { login, updated_at, url, highlight: body } = highlight.data;
const [owner, repoName] = url.replace("https://github.com/", "").split("/");

const repo = await this.githubService.getRepo(owner, repoName);

const reactions = highlightReactions.data.reduce<number>((acc, curr) => acc + Number(curr.reaction_count), 0);

const langList = repo.languages?.edges?.flatMap(edge => {
Expand Down Expand Up @@ -127,11 +129,11 @@ export class HighlightCardService {
if (code === "emoji") {
// if segment is an emoji
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return (`data:image/svg+xml;base64,${btoa(await loadEmoji( "twemoji", getIconCode(segment)))}`);
return `data:image/svg+xml;base64,${btoa(await loadEmoji("twemoji", getIconCode(segment)))}`;
}

// if segment is normal text
return (code);
return code;
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/social-card/templates/shared/card-footer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const cardFooter = (langs: string, repos: string, reactions?: number) => `
reactions
? ` <img tw="w-32px h-32px" width="1" height="1" src="${heartIconData}"/>
<span tw="font-medium text-32px text-black">
${reactions} Reactions
${reactions} ${reactions > 1 ? "Reactions" : "Reaction"}
</span>`
: ""
}
Expand Down