Skip to content

Commit

Permalink
chore: Better syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
firejune committed Nov 7, 2023
1 parent 1077182 commit 540cd56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a simple project that lets you embed a GitHub user's contribution chart
### How to use this?

1. Create a new Embed block in your Notion doc.
2. Set the Embed URL to `https://jandee.vercel.app/%USERNAME%` replacing %USERNAME% with your GitHub username.
2. Set the Embed URL to `https://jandee.vercel.app/%USERNAME%` replacing `%USERNAME%` with your GitHub username.
3. Adjust the size of the embed accordingly.
4. Bask in its glory!

Expand Down
23 changes: 11 additions & 12 deletions src/app/[username]/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const Canvas = ({
return (
<>
<img useMap="#info" width={width} height={height} src={url} alt="" ref={imageRef} />

<map name="info">
{data.map((week, x) => (
<Fragment key={x}>
Expand Down Expand Up @@ -152,6 +151,17 @@ function drawGraph(
}
}

if (showWeekDays) {
for (let y = 0; y < data[0].length; y += 1) {
if (y % 2)
ctx.fillText(
format(parseISO(data[0][y].date), 'EEE'),
canvasMargin,
canvasMargin + textHeight * 2 + (boxSize + boxMargin) * y - 4
)
}
}

for (let x = 0; x < data.length; x += 1) {
for (let y = 0; y < data[x].length; y += 1) {
const day = data[x][y]
Expand Down Expand Up @@ -187,17 +197,6 @@ function drawGraph(
lastCountedMonth = month
}
}

if (showWeekDays) {
for (let y = 0; y < data[0].length; y += 1) {
if (y % 2)
ctx.fillText(
format(parseISO(data[0][y].date), 'EEE'),
canvasMargin,
canvasMargin + textHeight * 2 + (boxSize + boxMargin) * y - 4
)
}
}
}

export default Canvas

0 comments on commit 540cd56

Please sign in to comment.