Skip to content

feat(templates): add referral bonus job template - #296

Merged
anurag629 merged 1 commit into
codercops:devfrom
Saifjafri212213:feat/job-referral-template
Oct 28, 2026
Merged

anurag629 merged 1 commit into
codercops:devfrom
Saifjafri212213:feat/job-referral-template

Conversation

@Saifjafri212213

Copy link
Copy Markdown
Contributor

Description

Adds the job-referral template (Referral Bonus) for posts asking people to refer a friend for an open role. From the top: a "Know someone?" label in the accent colour, the role large with the company under it ("at Acme"), the referral bonus large with its label beside it, one line on how to refer, and the site name at the bottom.

Closes #294

  • src/templates/job/referral.ts, id job-referral, with fields title, company, bonus, bonusLabel, note, siteName, bgColor, accentColor, textColor
  • Re-exported in src/templates/job/index.ts and appended to the Job block in src/templates/registry.ts
  • A long role shrinks with autoFontSize() and then truncates at 60 characters; the company, bonus, label and note truncate too
  • An omitted field falls back to its default, but a blank one (or one of only spaces) hides: the company, the bonus, the note and the site name. The bonus label is drawn inside the bonus row, so it goes with the bonus
  • On a light background the label and the bonus are drawn in the accent darkened with mixColors(), so they stay readable

How I Tested This

  • tests/templates/job-referral.test.ts (13 tests): registration and re-export, the field list and defaults, a 1200 by 630 root with only flex divs, the render order, each blank optional field hiding, the bonus label hiding with the bonus, defaults for omitted fields, role font sizes and truncation, truncation of the other fields, bonus sizing, and colours on a light background
  • Changed the template in six ways (omitted vs blank handling, role size, role truncation, bonus truncation, accent darkening, and removed the redundant label guard) and checked the tests fail for each of the first five; the sixth was equivalent and I removed the dead guard
  • npx tsc --noEmit is clean and the full suite passes (75 files, 1503 tests)
  • Rendered the template to PNG with the same satori and @resvg/resvg-wasm engine and the bundled fonts in public/fonts for six cases: defaults, a light background, long text, all optional fields blank, a blank bonus, and a light blue accent. I looked at each image; nothing overflows and blank fields hide cleanly
  • Not run: npm run dev, the editor's live preview and the Download PNG button, and astro check. The local @cloudflare/workerd-darwin-arm64 package in my node_modules has an empty bin folder, so Astro cannot load its config here

AI Assistance

An AI coding assistant helped write the template and its tests. I read the template and ran the checks above.

Type of Change

  • New template

Screenshots

Rendered with the same satori and resvg engine and the bundled fonts.

Default, dark:

default dark

Light background (white, dark text, pale yellow accent):

light background

Light background with a blue accent:

light blue

Long role, company, bonus, label and note (shrunk, then truncated):

long text

Blank bonus and site name (the bonus label goes with the bonus):

no bonus

All optional fields blank:

empty optionals

Checklist

  • This PR targets dev
  • I was assigned the linked issue
  • npm run check passes (tsc passes; astro check could not run locally, see above)
  • npm run test passes
  • Tested locally with npm run dev (not possible locally, see above)
  • Screenshots included for visual changes
  • New templates follow the Template Guidelines

Adds job-referral for posts asking people to refer a friend for an open role: a Know someone? label, the role and company, a large referral bonus with its label, how to refer, and the site name. Long text shrinks and truncates, blank optional fields hide, and the accent text is darkened on a light background. Closes codercops#294

@anurag629 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Saifjafri212213, this works. Check, all 1503 tests and the build pass on top of dev, and the renders look right: default, a white background with a pale accent, long caps text in every field (the bonus label drops under a wide bonus), and blank fields, with the label going away along with the bonus.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 28, 2026
@anurag629
anurag629 merged commit 2b27ad7 into codercops:dev Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the Referral Bonus job template (job-referral)

2 participants