Skip to content

Commit

Permalink
fix: update reactions count grammar (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
takanome-dev committed Aug 16, 2023
1 parent ce80b21 commit 765696a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 765696a

Please sign in to comment.