diff --git a/.agents/skills/add-a-custom-badge/SKILL.md b/.agents/skills/add-a-custom-badge/SKILL.md
index 4107dff..24b1cca 100644
--- a/.agents/skills/add-a-custom-badge/SKILL.md
+++ b/.agents/skills/add-a-custom-badge/SKILL.md
@@ -13,7 +13,7 @@ Ask for anything missing; never guess it. The "Badge request" issue form asks fo
| What | Why |
| --- | --- |
-| Each person's GitHub username and role (`creator`, `co-creator`, `maintainer` or `organizer`) | who wears it |
+| Each person's GitHub username and role (`creator`, `co-creator`, `founder`, `co-founder`, `maintainer`, `organizer` or `lead organizer`) | who wears it |
| Project name | the tooltip |
| Website, its main page | where the badge links |
| GitHub repository (required for a library or a tool) | to check the project and the role |
@@ -39,8 +39,8 @@ Done when every row not marked optional has an answer (the repository only for a
] },
```
- - **`badge`.** Two or three words, playful, about what the project does ("Analog alchemist", "Icon smith", "Slide master"). Use a word other badges don't already use. Don't use the plain role ("Creator"): the one exception is the badge of Angularians' own creator.
- - **`tone`.** The project's name in kebab case. Add its colours to `app/src/app/profile/badge-pill.css`, after the other projects, built from the brand colour `C` like theirs: `--pill-bg: color-mix(in oklab, C 10%, transparent)`, `--pill-text: L`, `--pill-ring: color-mix(in oklab, C 30%, transparent)` in `.tone-`, then `--pill-text: D` and `--pill-ring: color-mix(in oklab, C 40%, transparent)` in `:host-context(.dark) .tone-`. `L` is `C` darkened until it has 4.5:1 contrast on white. `D` is `C` lightened until it has 4.5:1 on `#0a0a0a`.
+ - **`badge`.** Two or three words, playful, about what the project does ("Analog alchemist", "Icon smith", "Slide master"). Use a word other badges don't already use. Don't use the plain role ("Creator"): the one exception is the badge of Angularians' own creator. A conference or a community is different: its badge is its real name and the role ("NG Poland organizer"), never a joke, with `badgeIsOfficial: true`.
+ - **`tone`.** The project's name in kebab case. Add its colours to `app/src/app/profile/badge-pill.css`, after the other projects, built from the brand colour `C` like theirs: `--pill-bg: color-mix(in oklab, C 10%, transparent)`, `--pill-text: L`, `--pill-ring: color-mix(in oklab, C 30%, transparent)` in `.tone-`, then `--pill-text: D` and `--pill-ring: color-mix(in oklab, C 40%, transparent)` in `:host-context(.dark) .tone-`. `L` is `C` darkened until it has 4.5:1 contrast on white. `D` is `C` lightened until it has 4.5:1 on `#0a0a0a`. Add the same `C` and `D` to `TAG_COLORS` in `app/src/server/card/tag-colors.ts`: the card has no theme.
- **`builtOn`.** Leave it out. It is only for the tools Angularians itself runs on.
4. **Notices.** Add the logo's credit to `THIRD_PARTY_NOTICES.md`, under "Credited logos".
5. **Data.** Leave `data/` as the collector wrote it.
@@ -59,7 +59,7 @@ pnpm dev
With `pnpm dev` running, open:
- `/`: the badge shows with the logo and title, its tooltip reads " of ", and clicking it opens the website.
- Both themes, and phone width.
-- `//card.png`: the logo shows in the card's footer.
+- `//card.png`: the badge shows under the stats, with its logo, title and colour.
Done when the test, typecheck and build pass and each page above shows the badge as described.
diff --git a/.agents/skills/add-a-translator/SKILL.md b/.agents/skills/add-a-translator/SKILL.md
index 68f1e09..2897dc7 100644
--- a/.agents/skills/add-a-translator/SKILL.md
+++ b/.agents/skills/add-a-translator/SKILL.md
@@ -17,7 +17,7 @@ Done when you hold the footer link, the date of the angular/angular commit that
## 2. Add it
1. Get each id: `gh api users/ -q .id`.
-2. A new translation: an entry in `TRANSLATIONS`, in the footer's order, with `language` in that language, its `code` and `flag` (a country in `COUNTRIES` of `shared/src/countries.ts`), `site`, `repository` and `joinedAt` (the day the footer commit landed: its committer date), and its `.tone-lang-` in `badge-pill.css`, built from the flag's main colour as the other languages' are, added to the dark `:is()` list above them too. A new translator: `{ githubId: , username: '' }` in its `translators`, with `helper: true` unless they lead it (their badge then says contributor, and they score 10).
+2. A new translation: an entry in `TRANSLATIONS`, in the footer's order, with `language` in that language, its `code` and `flag` (a country in `COUNTRIES` of `shared/src/countries.ts`), `site`, `repository` and `joinedAt` (the day the footer commit landed: its committer date), and its `.tone-lang-` in `badge-pill.css`, built from the flag's main colour as the other languages' are, added to the dark `:is()` list above them too, and to `TAG_COLORS` in `app/src/server/card/tag-colors.ts` for the card. If its name uses letters the card cannot draw yet, the card says only "Translator": `DRAWABLE` and `TAG_FONTS` in `app/src/server/card/tag-fonts.ts` need it (for Korean, Japanese or Chinese, a font from Google Fonts with `text=` set to the name, kept in `app/src/server/card/fonts`). A new translator: `{ githubId: , username: '' }` in its `translators`, with `helper: true` unless they lead it (their badge then says contributor, and they score 10).
3. Update the list's "as of " line.
Done when the ids are in, `pnpm test` passes, and `/` with `pnpm dev` shows " translator" (or " contributor" for a helper).
diff --git a/.github/ISSUE_TEMPLATE/badge-request.yml b/.github/ISSUE_TEMPLATE/badge-request.yml
index 7775ac4..02536dd 100644
--- a/.github/ISSUE_TEMPLATE/badge-request.yml
+++ b/.github/ISSUE_TEMPLATE/badge-request.yml
@@ -68,8 +68,11 @@ body:
options:
- Creator
- Co-creator
+ - Founder
+ - Co-founder
- Maintainer
- Organizer
+ - Lead organizer
validations:
required: true
- type: textarea
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 15736a2..1e21b03 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -108,6 +108,7 @@ MIT, Copyright (c) 2026 HatScripts. The full licence ships with the package.
- [Manrope](https://github.com/sharanda/manrope), the site's font: SIL Open Font License 1.1, Copyright 2019 The Manrope
Project Authors, through `@fontsource-variable/manrope` (and, for the cards, `app/src/server/card/fonts`).
+- [Noto Sans KR, JP, SC and TC](https://fonts.google.com/noto), for the language names on the cards: SIL Open Font License 1.1, Copyright 2014-2021 Adobe, reduced by Google Fonts to the letters used, in `app/src/server/card/fonts`.
- [cobe](https://github.com/shuding/cobe), the globe: MIT, Copyright (c) 2021 Shu Ding.
- [satori](https://github.com/vercel/satori) and [resvg-js](https://github.com/yisibl/resvg-js), which draw the cards:
MPL 2.0, unmodified.
@@ -127,7 +128,9 @@ The special badges also show, unchanged, the marks of Pangular Inspector (https:
The badges of Ashley Hunter's Angular Native (https://ng-native.com) and Angular Primitives
(https://angularprimitives.com) show their marks, unchanged, in `app/public/credits/`. Santosh Yadav's ngx-builders
-(https://github.com/ngx-builders) shows its GitHub organization avatar, unchanged.
+(https://github.com/ngx-builders) shows its GitHub organization avatar, unchanged. The badges of NG Baguette (https://ngbaguette.angulardevs.fr) and Angular
+Devs France (https://angulardevs.fr) show their logos, reduced to 256 pixels (NG Baguette's white logo on a dark tile, so it shows in both themes), and OpenNG (https://www.openng.org) its GitHub
+organization avatar. NG Poland (https://ng-poland.pl) and NG Asia (https://ng-asia.org) show the mark their own sites use, and NG Tunisia (https://ng-tunisia.org) its logo, reduced to 256 pixels. Angular Space (https://www.angularspace.com) shows its site icon, unchanged, and Angular Wrocław (https://www.meetup.com/angularwroclaw/) the shield from its Meetup banner.
## Data
diff --git a/app/public/credits/angular-devs-france.png b/app/public/credits/angular-devs-france.png
new file mode 100644
index 0000000..3feedb3
Binary files /dev/null and b/app/public/credits/angular-devs-france.png differ
diff --git a/app/public/credits/angular-space.png b/app/public/credits/angular-space.png
new file mode 100644
index 0000000..11fd64e
Binary files /dev/null and b/app/public/credits/angular-space.png differ
diff --git a/app/public/credits/angular-wroclaw.png b/app/public/credits/angular-wroclaw.png
new file mode 100644
index 0000000..b816e81
Binary files /dev/null and b/app/public/credits/angular-wroclaw.png differ
diff --git a/app/public/credits/ng-asia.png b/app/public/credits/ng-asia.png
new file mode 100644
index 0000000..ed01e6e
Binary files /dev/null and b/app/public/credits/ng-asia.png differ
diff --git a/app/public/credits/ng-baguette.png b/app/public/credits/ng-baguette.png
new file mode 100644
index 0000000..0ae2b04
Binary files /dev/null and b/app/public/credits/ng-baguette.png differ
diff --git a/app/public/credits/ng-poland.png b/app/public/credits/ng-poland.png
new file mode 100644
index 0000000..7595514
Binary files /dev/null and b/app/public/credits/ng-poland.png differ
diff --git a/app/public/credits/ng-tunisia.png b/app/public/credits/ng-tunisia.png
new file mode 100644
index 0000000..516129c
Binary files /dev/null and b/app/public/credits/ng-tunisia.png differ
diff --git a/app/public/credits/openng.png b/app/public/credits/openng.png
new file mode 100644
index 0000000..5b26bcb
Binary files /dev/null and b/app/public/credits/openng.png differ
diff --git a/app/src/app/app.html b/app/src/app/app.html
index ddf4007..7a2dba0 100644
--- a/app/src/app/app.html
+++ b/app/src/app/app.html
@@ -5,3 +5,4 @@
+
diff --git a/app/src/app/app.ts b/app/src/app/app.ts
index 9272706..42f976c 100644
--- a/app/src/app/app.ts
+++ b/app/src/app/app.ts
@@ -1,6 +1,7 @@
import { isPlatformBrowser, Location } from '@angular/common';
import { afterNextRender, Component, DestroyRef, inject, Injector, PLATFORM_ID, signal } from '@angular/core';
import { NavigationEnd, NavigationStart, Router, RouterOutlet } from '@angular/router';
+import { AngieIntro } from './layout/angie-intro';
import { HammerStrike } from './layout/hammer-strike';
import { SiteFooter } from './layout/site-footer';
import { SiteHeader } from './layout/site-header';
@@ -8,7 +9,7 @@ import { ThemeService } from './theme.service';
@Component({
selector: 'app-root',
- imports: [HammerStrike, RouterOutlet, SiteFooter, SiteHeader],
+ imports: [AngieIntro, HammerStrike, RouterOutlet, SiteFooter, SiteHeader],
templateUrl: './app.html',
styleUrl: './app.css',
})
diff --git a/app/src/app/layout/angie-intro.css b/app/src/app/layout/angie-intro.css
new file mode 100644
index 0000000..2d1ba9b
--- /dev/null
+++ b/app/src/app/layout/angie-intro.css
@@ -0,0 +1,26 @@
+.sponsor {
+ border: 1px solid var(--github-red);
+ color: var(--github-red);
+ background-color: color-mix(in oklab, var(--github-red) 12%, transparent);
+}
+
+.sponsor:hover {
+ background-color: color-mix(in oklab, var(--github-red) 22%, transparent);
+}
+
+.quiet {
+ justify-self: center;
+ font-size: var(--text-xs);
+ color: var(--muted-foreground);
+ text-decoration: underline;
+ text-underline-offset: 2px;
+}
+
+.quiet:hover {
+ color: var(--foreground);
+}
+
+.quiet:focus-visible {
+ outline: 2px solid var(--ring);
+ outline-offset: 2px;
+}
diff --git a/app/src/app/layout/angie-intro.html b/app/src/app/layout/angie-intro.html
new file mode 100644
index 0000000..596a2d7
--- /dev/null
+++ b/app/src/app/layout/angie-intro.html
@@ -0,0 +1,21 @@
+
+
+
+
+ That was Angie
+ She is Angular’s official mascot . Here she guards ng-halla , the hall of every Angularian . Click that word or a logo and she comes back.
+
+
+ @if (starred()) {
+ If you can, a sponsor helps pay for the hosting and keeps the hall open.
+ } @else {
+ It is free, has no ads and is run by one maintainer . A star helps other Angular developers find it, and a sponsor helps pay for the hosting.
+ }
+
+
+ Too loud? Turn off Angie’s lightning
+
+
diff --git a/app/src/app/layout/angie-intro.spec.ts b/app/src/app/layout/angie-intro.spec.ts
new file mode 100644
index 0000000..7d5ed10
--- /dev/null
+++ b/app/src/app/layout/angie-intro.spec.ts
@@ -0,0 +1,31 @@
+import { TestBed } from '@angular/core/testing'
+import { vi } from 'vitest'
+import { AngieIntro } from './angie-intro'
+import { AngieService } from './angie.service'
+
+describe('AngieIntro', () => {
+ beforeEach(() => {
+ localStorage.clear()
+ vi.useFakeTimers()
+ })
+
+ afterEach(() => vi.useRealTimers())
+
+ it('offers the close button five seconds after it opens', () => {
+ const fixture = TestBed.createComponent(AngieIntro)
+ const canClose = () => (fixture.componentInstance as unknown as { canClose(): boolean }).canClose()
+ TestBed.inject(AngieService).stormEnded()
+ TestBed.tick()
+ vi.advanceTimersByTime(4999)
+ expect(canClose()).toBe(false)
+ vi.advanceTimersByTime(1)
+ expect(canClose()).toBe(true)
+ })
+
+ it('thanks for the star', () => {
+ const intro = TestBed.createComponent(AngieIntro).componentInstance as unknown as { markStarred(): void, starLabel(): string }
+ expect(intro.starLabel()).toBe('Star on GitHub')
+ intro.markStarred()
+ expect(intro.starLabel()).toBe('Thanks for the star')
+ })
+})
diff --git a/app/src/app/layout/angie-intro.ts b/app/src/app/layout/angie-intro.ts
new file mode 100644
index 0000000..e29c963
--- /dev/null
+++ b/app/src/app/layout/angie-intro.ts
@@ -0,0 +1,55 @@
+import { Component, computed, effect, inject, linkedSignal, signal } from '@angular/core'
+import { NgIcon, provideIcons } from '@ng-icons/core'
+import { remixCheckLine, remixHeartLine, remixStarLine } from '@ng-icons/remixicon'
+import { HlmButton } from '@spartan-ng/helm/button'
+import { HlmDialogImports } from '@spartan-ng/helm/dialog'
+import { REPO_URL, SITE_AUTHOR, SPONSOR_URL } from '../site'
+import { AngieService } from './angie.service'
+import { AngularLogo } from './angular-logo'
+
+const CLOSE_BUTTON_DELAY = 5000
+const PRESS_KIT_URL = 'https://angular.dev/press-kit'
+
+@Component({
+ selector: 'app-angie-intro',
+ imports: [AngularLogo, HlmButton, HlmDialogImports, NgIcon],
+ providers: [provideIcons({ remixCheckLine, remixHeartLine, remixStarLine })],
+ templateUrl: './angie-intro.html',
+ styleUrl: './angie-intro.css',
+})
+export class AngieIntro {
+ private readonly angie = inject(AngieService)
+ protected readonly state = computed(() => (this.angie.introOpen() ? 'open' : 'closed'))
+ protected readonly canClose = linkedSignal({ source: this.angie.introOpen, computation: () => false })
+ protected readonly starred = signal(false)
+ protected readonly starLabel = computed(() => (this.starred() ? 'Thanks for the star' : 'Star on GitHub'))
+ protected readonly starIcon = computed(() => (this.starred() ? 'remixCheckLine' : 'remixStarLine'))
+ protected readonly authorUrl = SITE_AUTHOR.url
+ protected readonly pressKitUrl = PRESS_KIT_URL
+ protected readonly repoUrl = REPO_URL
+ protected readonly sponsorUrl = SPONSOR_URL
+
+ constructor() {
+ this.revealCloseButtonLater()
+ }
+
+ protected closeWhenDismissed(state: string): void {
+ if (state === 'closed') this.angie.closeIntro()
+ }
+
+ protected markStarred(): void {
+ this.starred.set(true)
+ }
+
+ protected turnOff(): void {
+ this.angie.turnOff()
+ }
+
+ private revealCloseButtonLater(): void {
+ effect((onCleanup) => {
+ if (!this.angie.introOpen()) return
+ const timer = setTimeout(() => this.canClose.set(true), CLOSE_BUTTON_DELAY)
+ onCleanup(() => clearTimeout(timer))
+ })
+ }
+}
diff --git a/app/src/app/layout/angie.service.spec.ts b/app/src/app/layout/angie.service.spec.ts
new file mode 100644
index 0000000..dd4719b
--- /dev/null
+++ b/app/src/app/layout/angie.service.spec.ts
@@ -0,0 +1,53 @@
+import { TestBed } from '@angular/core/testing'
+import { ANGIE_MET_KEY, ANGIE_OFF_KEY, AngieService } from './angie.service'
+
+describe('AngieService', () => {
+ beforeEach(() => {
+ localStorage.clear()
+ TestBed.resetTestingModule()
+ })
+
+ it('is on by default', () => {
+ expect(TestBed.inject(AngieService).on()).toBe(true)
+ })
+
+ it('turns off and on, remembering only off', () => {
+ const angie = TestBed.inject(AngieService)
+ angie.toggle()
+ expect(angie.on()).toBe(false)
+ expect(localStorage.getItem(ANGIE_OFF_KEY)).toBe('1')
+ angie.toggle()
+ expect(angie.on()).toBe(true)
+ expect(localStorage.getItem(ANGIE_OFF_KEY)).toBeNull()
+ })
+
+ it('stays off on the next visit', () => {
+ localStorage.setItem(ANGIE_OFF_KEY, '1')
+ expect(TestBed.inject(AngieService).on()).toBe(false)
+ })
+
+ it('introduces her once, after the first storm', () => {
+ const angie = TestBed.inject(AngieService)
+ expect(angie.introOpen()).toBe(false)
+ angie.stormEnded()
+ expect(angie.introOpen()).toBe(true)
+ expect(localStorage.getItem(ANGIE_MET_KEY)).toBe('1')
+ angie.closeIntro()
+ angie.stormEnded()
+ expect(angie.introOpen()).toBe(false)
+ })
+
+ it('does not introduce her on a later visit', () => {
+ localStorage.setItem(ANGIE_MET_KEY, '1')
+ const angie = TestBed.inject(AngieService)
+ angie.stormEnded()
+ expect(angie.introOpen()).toBe(false)
+ })
+
+ it('does not introduce her once she is off', () => {
+ const angie = TestBed.inject(AngieService)
+ angie.toggle()
+ angie.stormEnded()
+ expect(angie.introOpen()).toBe(false)
+ })
+})
diff --git a/app/src/app/layout/angie.service.ts b/app/src/app/layout/angie.service.ts
new file mode 100644
index 0000000..fd6202a
--- /dev/null
+++ b/app/src/app/layout/angie.service.ts
@@ -0,0 +1,68 @@
+import { DOCUMENT, isPlatformBrowser } from '@angular/common'
+import { effect, inject, PLATFORM_ID, Service, signal } from '@angular/core'
+
+export const ANGIE_OFF_KEY = 'angularians-angie-off'
+export const ANGIE_MET_KEY = 'angularians-angie-met'
+
+@Service()
+export class AngieService {
+ private readonly document = inject(DOCUMENT)
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID))
+
+ private met = false
+
+ readonly on = signal(true)
+ readonly introOpen = signal(false)
+
+ constructor() {
+ if (!this.browser) return
+ this.restoreChoice()
+ this.markPage()
+ }
+
+ toggle(): void {
+ this.on.update(on => !on)
+ try {
+ if (this.on()) localStorage.removeItem(ANGIE_OFF_KEY)
+ else localStorage.setItem(ANGIE_OFF_KEY, '1')
+ }
+ catch {
+ // Not remembered, still applied.
+ }
+ }
+
+ stormEnded(): void {
+ if (!this.on() || this.met) return
+ this.met = true
+ this.introOpen.set(true)
+ try {
+ localStorage.setItem(ANGIE_MET_KEY, '1')
+ }
+ catch {
+ // Not remembered: she introduces herself again next visit.
+ }
+ }
+
+ turnOff(): void {
+ if (this.on()) this.toggle()
+ this.closeIntro()
+ }
+
+ closeIntro(): void {
+ this.introOpen.set(false)
+ }
+
+ private restoreChoice(): void {
+ try {
+ this.met = localStorage.getItem(ANGIE_MET_KEY) === '1'
+ if (localStorage.getItem(ANGIE_OFF_KEY) === '1') this.on.set(false)
+ }
+ catch {
+ // Storage can be blocked: on, the default.
+ }
+ }
+
+ private markPage(): void {
+ effect(() => this.document.documentElement.classList.toggle('angie-off', !this.on()))
+ }
+}
diff --git a/app/src/app/layout/github-stars.css b/app/src/app/layout/github-stars.css
new file mode 100644
index 0000000..c3b4c79
--- /dev/null
+++ b/app/src/app/layout/github-stars.css
@@ -0,0 +1,46 @@
+.repo {
+ width: calc(var(--spacing) * 9);
+ padding-inline: 0;
+ justify-content: center;
+}
+
+.divider,
+.stars {
+ display: none;
+}
+
+.stars {
+ align-items: center;
+ gap: calc(var(--spacing) * 1);
+ font-size: var(--text-sm);
+ font-weight: 500;
+ font-variant-numeric: tabular-nums;
+ color: var(--muted-foreground);
+}
+
+.stars ng-icon {
+ color: var(--primary);
+}
+
+@media (width >= 40rem) {
+ .repo {
+ width: auto;
+ min-width: calc(var(--spacing) * 27);
+ gap: calc(var(--spacing) * 2);
+ border: 1px solid var(--border);
+ border-radius: 9999px;
+ padding-inline: calc(var(--spacing) * 3);
+ justify-content: center;
+ }
+
+ .divider {
+ display: block;
+ width: 1px;
+ height: calc(var(--spacing) * 4);
+ background-color: var(--border);
+ }
+
+ .stars {
+ display: inline-flex;
+ }
+}
diff --git a/app/src/app/layout/github-stars.html b/app/src/app/layout/github-stars.html
new file mode 100644
index 0000000..b234dbd
--- /dev/null
+++ b/app/src/app/layout/github-stars.html
@@ -0,0 +1,7 @@
+
+
+ @if (stars(); as stars) {
+
+ {{ stars }}
+ }
+
diff --git a/app/src/app/layout/github-stars.spec.ts b/app/src/app/layout/github-stars.spec.ts
new file mode 100644
index 0000000..8c34ec4
--- /dev/null
+++ b/app/src/app/layout/github-stars.spec.ts
@@ -0,0 +1,44 @@
+import { TestBed } from '@angular/core/testing'
+import { vi } from 'vitest'
+import { GithubStars, STARS_KEY } from './github-stars'
+
+const settle = async (fixture: ReturnType>) => {
+ await fixture.whenStable()
+ await new Promise(resolve => setTimeout(resolve))
+ fixture.detectChanges()
+}
+
+describe('GithubStars', () => {
+ beforeEach(() => sessionStorage.clear())
+ afterEach(() => vi.unstubAllGlobals())
+
+ it('shows the count from GitHub and remembers it for the visit', async () => {
+ const request = vi.fn(async () => ({ ok: true, json: async () => ({ stargazers_count: 1234 }) }))
+ vi.stubGlobal('fetch', request)
+ const fixture = TestBed.createComponent(GithubStars)
+ await settle(fixture)
+ const link: HTMLElement = fixture.nativeElement.querySelector('a')
+ expect(link.textContent).toContain('1,234')
+ expect(link.getAttribute('aria-label')).toBe('Angularians on GitHub, 1,234 stars')
+ expect(sessionStorage.getItem(STARS_KEY)).toBe('1234')
+ })
+
+ it('uses the remembered count without asking GitHub', async () => {
+ sessionStorage.setItem(STARS_KEY, '17')
+ const request = vi.fn()
+ vi.stubGlobal('fetch', request)
+ const fixture = TestBed.createComponent(GithubStars)
+ await settle(fixture)
+ expect(fixture.nativeElement.textContent).toContain('17')
+ expect(request).not.toHaveBeenCalled()
+ })
+
+ it('stays a plain GitHub link when the count cannot load', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => ({ ok: false, json: async () => ({}) })))
+ const fixture = TestBed.createComponent(GithubStars)
+ await settle(fixture)
+ const link: HTMLElement = fixture.nativeElement.querySelector('a')
+ expect(link.getAttribute('aria-label')).toBe('Angularians on GitHub')
+ expect(link.querySelector('.stars')).toBeNull()
+ })
+})
diff --git a/app/src/app/layout/github-stars.ts b/app/src/app/layout/github-stars.ts
new file mode 100644
index 0000000..775f439
--- /dev/null
+++ b/app/src/app/layout/github-stars.ts
@@ -0,0 +1,64 @@
+import { afterNextRender, Component, computed, signal } from '@angular/core'
+import { NgIcon, provideIcons } from '@ng-icons/core'
+import { remixStarFill } from '@ng-icons/remixicon'
+import { simpleGithub } from '@ng-icons/simple-icons'
+import { HlmButton } from '@spartan-ng/helm/button'
+import { REPO_URL } from '../site'
+import { formatNumber } from '../text/number-format'
+import { plural } from '../text/plural'
+
+export const STARS_KEY = 'angularians-repo-stars'
+const API_URL = REPO_URL.replace('https://github.com/', 'https://api.github.com/repos/')
+
+@Component({
+ selector: 'app-github-stars',
+ imports: [HlmButton, NgIcon],
+ providers: [provideIcons({ remixStarFill, simpleGithub })],
+ templateUrl: './github-stars.html',
+ styleUrl: './github-stars.css',
+})
+export class GithubStars {
+ private readonly count = signal(null)
+ protected readonly repoUrl = REPO_URL
+ protected readonly stars = computed(() => {
+ const count = this.count()
+ return count === null ? null : formatNumber(count)
+ })
+ protected readonly label = computed(() => {
+ const count = this.count()
+ return count === null ? 'Angularians on GitHub' : `Angularians on GitHub, ${plural(count, 'star', 'stars')}`
+ })
+
+ constructor() {
+ afterNextRender(() => void this.loadCount())
+ }
+
+ private async loadCount(): Promise {
+ const remembered = this.rememberedCount()
+ if (remembered !== null) {
+ this.count.set(remembered)
+ return
+ }
+ try {
+ const response = await fetch(API_URL)
+ if (!response.ok) return
+ const { stargazers_count: count } = await response.json() as { stargazers_count?: unknown }
+ if (typeof count !== 'number') return
+ this.count.set(count)
+ sessionStorage.setItem(STARS_KEY, String(count))
+ }
+ catch {
+ // No count: the link still works.
+ }
+ }
+
+ private rememberedCount(): number | null {
+ try {
+ const saved = sessionStorage.getItem(STARS_KEY)
+ return saved && Number.isFinite(Number(saved)) ? Number(saved) : null
+ }
+ catch {
+ return null
+ }
+ }
+}
diff --git a/app/src/app/layout/hammer-strike.ts b/app/src/app/layout/hammer-strike.ts
index cceb0e4..d215154 100644
--- a/app/src/app/layout/hammer-strike.ts
+++ b/app/src/app/layout/hammer-strike.ts
@@ -1,5 +1,6 @@
import { isPlatformBrowser } from '@angular/common'
-import { afterNextRender, Component, DestroyRef, inject, PLATFORM_ID, signal } from '@angular/core'
+import { afterNextRender, Component, DestroyRef, effect, inject, PLATFORM_ID, signal } from '@angular/core'
+import { AngieService } from './angie.service'
import { lightning, type Strike } from './lightning'
/** The thunder follows the flash (`--strike` in the CSS), a quarter of a second later: the light arrives first. */
@@ -13,7 +14,8 @@ const ANGIE = '/angie/angie-hammer.png'
* The word "Angularian(s)" or "ng-halla", or a logo, calls Angie: she comes in with her hammer and calls down lightning
* somewhere on the page, with thunder. A click on the word calls her any time, a click on a logo once a visit (the tab's
* session); the mouse coming onto the word does once a visit too, and only after a first click or key on the page, so
- * the browser lets the thunder play. Never on touch screens, a link or button that holds the word, or with reduced motion.
+ * the browser lets the thunder play. Never on touch screens, a link, button or dialog that holds the word (a link
+ * can opt in with `data-calls-angie`), with reduced motion, or once the visitor has turned her off in the account menu.
*/
@Component({
selector: 'app-hammer-strike',
@@ -22,33 +24,38 @@ const ANGIE = '/angie/angie-hammer.png'
styleUrl: './hammer-strike.css',
})
export class HammerStrike {
+ private readonly angie = inject(AngieService)
protected readonly strike = signal(null)
+ private thunder: HTMLAudioElement | undefined
/** Angie has gone: the storm is over. */
protected end(): void {
+ if (!this.strike()) return
this.strike.set(null)
+ this.angie.stormEnded()
}
constructor() {
const destroyRef = inject(DestroyRef)
if (!isPlatformBrowser(inject(PLATFORM_ID))) return
+ this.stopWhenTurnedOff()
afterNextRender(() => {
if (matchMedia('(prefers-reduced-motion: reduce), (hover: none)').matches) return
let current: Element | null = null
let thunderTimer: ReturnType | undefined
let endTimer: ReturnType | undefined
- let thunder: HTMLAudioElement | undefined
let strikes = 0
- let angie: HTMLImageElement | undefined
+ let portrait: HTMLImageElement | undefined
let calling = false
const call = (started?: () => void) => {
- if (calling || this.strike()) return
+ if (!this.angie.on() || calling || this.strike()) return
calling = true
- angie ??= Object.assign(new Image(), { src: ANGIE })
- angie.decode().then(() => {
+ portrait ??= Object.assign(new Image(), { src: ANGIE })
+ portrait.decode().then(() => {
+ if (!this.angie.on()) return
storm()
started?.()
- }, () => (angie = undefined)).finally(() => (calling = false))
+ }, () => (portrait = undefined)).finally(() => (calling = false))
}
const storm = () => {
const x = innerWidth * (0.2 + Math.random() * 0.5)
@@ -58,19 +65,19 @@ export class HammerStrike {
endTimer = setTimeout(() => this.end(), STORM)
remember(HOVERED)
thunderTimer = setTimeout(() => {
- if (!thunder) return
- thunder.currentTime = 0
- thunder.play().catch(() => {
+ if (!this.thunder || !this.angie.on()) return
+ this.thunder.currentTime = 0
+ this.thunder.play().catch(() => {
// Not allowed yet: no click or key on the page so far.
})
}, THUNDER)
}
// The first click or key wakes the hover up, and loads the thunder ahead of the first storm.
const wake = () => {
- if (thunder) return
- thunder = new Audio('/sounds/thunder.mp3')
- thunder.preload = 'auto'
- thunder.volume = 0.6
+ if (this.thunder) return
+ this.thunder = new Audio('/sounds/thunder.mp3')
+ this.thunder.preload = 'auto'
+ this.thunder.volume = 0.6
}
const onOver = (event: PointerEvent) => {
if (event.pointerType !== 'mouse') return
@@ -78,11 +85,11 @@ export class HammerStrike {
// Once per entry into a word: moving inside it, or over its letters, does not call her again.
if (word === current) return
current = word
- if (word && thunder && !usedThisVisit(HOVERED)) call()
+ if (word && this.thunder && !usedThisVisit(HOVERED)) call()
}
const onClick = (event: MouseEvent) => {
if ((event as PointerEvent).pointerType === 'touch' || this.strike()) return
- if (angularian(event.target)) call()
+ if (angularian(event.target) || (event.target as Element | null)?.closest?.('[data-calls-angie]')) call()
else if (headerLogo(event.target) && !usedThisVisit(LOGO)) call(() => remember(LOGO))
}
document.addEventListener('pointerover', onOver)
@@ -99,13 +106,21 @@ export class HammerStrike {
})
})
}
+
+ private stopWhenTurnedOff(): void {
+ effect(() => {
+ if (this.angie.on()) return
+ this.end()
+ this.thunder?.pause()
+ })
+ }
}
-/** The word "Angularian(s)" or "ng-halla" under the pointer, not in a link or a button, or `null`. Ranks and headings share its font. */
+/** The word "Angularian(s)" or "ng-halla" under the pointer, not in a link, a button or a dialog, or `null`. Ranks and headings share its font. */
function angularian(target: EventTarget | null): Element | null {
const element = target as Element | null
const word = element?.closest?.('.brand')
- if (!word || word.closest('a, button')) return null
+ if (!word || word.closest('a, button, hlm-dialog-content')) return null
return [element!, word].find(candidate => /^(angularians?|ng-halla)$/i.test(candidate.textContent?.trim() ?? '')) ?? null
}
diff --git a/app/src/app/layout/site-footer.html b/app/src/app/layout/site-footer.html
index d4bf590..5b7a891 100644
--- a/app/src/app/layout/site-footer.html
+++ b/app/src/app/layout/site-footer.html
@@ -36,6 +36,9 @@
MIT licence ·
Inspired by Nuxters ·
Credits
+ @if (!angie.on()) {
+ · Turn on Angie’s lightning
+ }
Community project, not affiliated with Google or the Angular team. Angular is a trademark of Google LLC.
diff --git a/app/src/app/layout/site-footer.ts b/app/src/app/layout/site-footer.ts
index e6f1dd0..582547d 100644
--- a/app/src/app/layout/site-footer.ts
+++ b/app/src/app/layout/site-footer.ts
@@ -3,11 +3,12 @@ import { Router, RouterLink } from '@angular/router';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { simpleGithub } from '@ng-icons/simple-icons';
import { HlmButton } from '@spartan-ng/helm/button';
+import { AngieService } from './angie.service';
import { AngularLogo } from './angular-logo';
import { Container } from './container';
import { scrollHomeToTop } from './home-top';
import { LogoMark } from './logo-mark';
-import { REPO_URL } from '../site';
+import { REPO_URL, SPONSOR_URL } from '../site';
/** The footer: the brand and its pitch, then the small print. */
@Component({
@@ -20,6 +21,7 @@ import { REPO_URL } from '../site';
})
export class SiteFooter {
private readonly router = inject(Router);
+ protected readonly angie = inject(AngieService);
protected readonly repo = REPO_URL;
/** The footer's links: the board, how to take part, and the people behind it. */
protected readonly groups: ReadonlyArray<{ title: string, links: ReadonlyArray<{ label: string, route?: string, fragment?: string, href?: string }> }> = [
@@ -35,7 +37,7 @@ export class SiteFooter {
{ label: 'Report a bug', href: `${REPO_URL}/issues/new?template=bug_report.yml` },
] },
{ title: 'People', links: [
- { label: 'Sponsor', href: 'https://github.com/sponsors/erkamyaman' },
+ { label: 'Sponsor', href: SPONSOR_URL },
{ label: 'Send a raven (ping me)', href: 'https://erkamyaman.dev/links/' },
] },
];
diff --git a/app/src/app/layout/site-header.html b/app/src/app/layout/site-header.html
index 6322b8a..32be1e0 100644
--- a/app/src/app/layout/site-header.html
+++ b/app/src/app/layout/site-header.html
@@ -6,14 +6,12 @@
+ [href]="sponsorUrl" target="_blank" rel="noopener" aria-label="Sponsor Angularians" title="Sponsor Angularians">
Sponsor
-
-
-
+
@if (avatarSlot()) {
My Angularian profile
@@ -20,6 +20,7 @@
No contributions on record yet.
}
+
diff --git a/app/src/app/layout/user-menu.ts b/app/src/app/layout/user-menu.ts
index 68df68e..8e24825 100644
--- a/app/src/app/layout/user-menu.ts
+++ b/app/src/app/layout/user-menu.ts
@@ -6,6 +6,7 @@ import { NgIcon, provideIcons } from '@ng-icons/core'
import { remixLogoutBoxRLine } from '@ng-icons/remixicon'
import { HlmPopoverImports } from '@spartan-ng/helm/popover'
import { AuthService } from '../auth/auth.service'
+import { AngieService } from './angie.service'
import { LogoMark } from './logo-mark'
import { avatarUrl } from '../contributors/avatar-url'
@@ -18,7 +19,9 @@ import { avatarUrl } from '../contributors/avatar-url'
})
export class UserMenu {
private readonly auth = inject(AuthService)
+ protected readonly angie = inject(AngieService)
protected readonly user = computed(() => this.auth.state()?.user ?? null)
+ protected readonly angieLabel = computed(() => (this.angie.on() ? 'Turn off Angie’s lightning' : 'Turn on Angie’s lightning'))
protected readonly avatar = (githubId: number) => avatarUrl(githubId, 28)
/** Following the profile link closes the menu, which would stay open over the new page. */
diff --git a/app/src/app/leaderboard/me-card.html b/app/src/app/leaderboard/me-card.html
index 1d3d1de..845cf47 100644
--- a/app/src/app/leaderboard/me-card.html
+++ b/app/src/app/leaderboard/me-card.html
@@ -95,7 +95,7 @@
}
diff --git a/app/src/app/leaderboard/me-card.ts b/app/src/app/leaderboard/me-card.ts
index 7427d35..3695ab6 100644
--- a/app/src/app/leaderboard/me-card.ts
+++ b/app/src/app/leaderboard/me-card.ts
@@ -15,6 +15,7 @@ import { AuthService } from '../auth/auth.service'
import { AngularLogo } from '../layout/angular-logo'
import { AngularianPill } from '../layout/angularian-pill'
import { ContributorSince } from '../profile/contributor-since'
+import { earnedBadges } from '../profile/earned-badges'
import { ScoreDialog } from '../profile/score-dialog'
import { JoinLinks } from './join-links'
import { Share, SHARE_BUTTONS } from '../profile/share'
@@ -47,6 +48,10 @@ export class MeCard {
protected readonly loginUrl = this.auth.loginUrl('/')
protected readonly lastYear = computed(() => this.me()?.angularian?.periods.find(row => row.period === '12m') ?? null)
protected readonly periods = computed(() => this.me()?.angularian?.periods.map(row => row.period) ?? [])
+ protected readonly earned = computed(() => {
+ const person = this.me()?.angularian
+ return person ? earnedBadges(person) : []
+ })
protected readonly unlocks = computed(() => {
const person = this.me()?.angularian
return [
diff --git a/app/src/app/pages/[username].page.html b/app/src/app/pages/[username].page.html
index 7dd6efb..b324217 100644
--- a/app/src/app/pages/[username].page.html
+++ b/app/src/app/pages/[username].page.html
@@ -13,7 +13,7 @@
@if (ownProfile(); as person) {
-
+
}
diff --git a/app/src/app/pages/[username].page.ts b/app/src/app/pages/[username].page.ts
index efed1b2..d513df0 100644
--- a/app/src/app/pages/[username].page.ts
+++ b/app/src/app/pages/[username].page.ts
@@ -15,6 +15,7 @@ import {
simpleBluesky, simpleFacebook, simpleGithub, simpleInstagram, simpleMastodon, simpleNpm, simpleReddit, simpleThreads, simpleTwitch, simpleX,
simpleYoutube,
} from '@ng-icons/simple-icons';
+import { badgeQuery, parseBadgeOptions } from '../profile/card-badges';
import { BADGE_ICONS, earnedBadges } from '../profile/earned-badges';
import { BadgePill } from '../profile/badge-pill';
import { injectParams } from 'ngxtension/inject-params';
@@ -83,6 +84,7 @@ export default class Profile {
private readonly fromCountry = injectQueryParams(params => countryCode(params['country']));
/** The country the owner picked for the shared card, for this link's preview image. */
private readonly cardFlag = injectQueryParams(params => countryCode(params['flag']));
+ private readonly cardBadges = injectQueryParams(params => parseBadgeOptions(params['hide'], params['names']));
/** Every period is in the profile: switching period needs no request. */
protected readonly profile = injectSeededServerFn(getContributor, () => ({ username: this.username() }));
@@ -235,11 +237,12 @@ export default class Profile {
const { title, description } = profileHead(person, this.current(), this.period());
this.title.setTitle(`${title} · Angularians`);
this.meta.removeTag('name="robots"');
+ const cardQuery = shareQuery(this.period(), this.cardFlag(), badgeQuery(this.cardBadges()));
setShareMeta(this.meta, this.document, {
title,
description,
- url: `${SITE_URL}/${person.username}${shareQuery(this.period())}`,
- image: `${SITE_URL}/${person.username}/card.png${shareQuery(this.period(), this.cardFlag())}`,
+ url: `${SITE_URL}/${person.username}${cardQuery}`,
+ image: `${SITE_URL}/${person.username}/card.png${cardQuery}`,
canonical: `/${person.username}`,
});
setJsonLd(this.document, profileJsonLd(person, { title, description }));
diff --git a/app/src/app/profile/badge-pill.css b/app/src/app/profile/badge-pill.css
index ecd10ad..969ddca 100644
--- a/app/src/app/profile/badge-pill.css
+++ b/app/src/app/profile/badge-pill.css
@@ -101,7 +101,7 @@
}
/* The projects: on dark, a lighter text and a stronger ring (ngx-builders sets its own) */
-:host-context(.dark) :is(.tone-analog, .tone-ng-icons, .tone-ngxtension, .tone-pangular, .tone-slide-ng, .tone-ng-native, .tone-ng-primitives) {
+:host-context(.dark) :is(.tone-analog, .tone-ng-icons, .tone-ngxtension, .tone-pangular, .tone-slide-ng, .tone-ng-native, .tone-ng-primitives, .tone-ng-baguette, .tone-angular-devs-france, .tone-openng, .tone-ng-poland, .tone-ng-asia, .tone-ng-tunisia, .tone-angular-space, .tone-angular-wroclaw) {
--pill-ring: color-mix(in oklab, var(--pill) 40%, transparent);
}
@@ -170,6 +170,70 @@
--pill-ring: color-mix(in oklab, #90A4AE 40%, transparent);
}
+.tone-ng-baguette {
+ --pill: #D6336C;
+ --pill-text: #B0245A;
+}
+:host-context(.dark) .tone-ng-baguette {
+ --pill-text: #FF7BA5;
+}
+
+.tone-angular-devs-france {
+ --pill: #1E4FB0;
+ --pill-text: #1E4FB0;
+}
+:host-context(.dark) .tone-angular-devs-france {
+ --pill-text: #7FA6F5;
+}
+
+.tone-openng {
+ --pill: #D6249F;
+ --pill-text: #A81B7E;
+}
+:host-context(.dark) .tone-openng {
+ --pill-text: #FF6FD0;
+}
+
+.tone-ng-poland {
+ --pill: #DC143C;
+ --pill-text: #B8102F;
+}
+:host-context(.dark) .tone-ng-poland {
+ --pill-text: #F2627D;
+}
+
+.tone-ng-asia {
+ --pill: #8B2FE0;
+ --pill-text: #7A22CC;
+}
+:host-context(.dark) .tone-ng-asia {
+ --pill-text: #C58BFF;
+}
+
+.tone-ng-tunisia {
+ --pill: #E70013;
+ --pill-text: #C00010;
+}
+:host-context(.dark) .tone-ng-tunisia {
+ --pill-text: #F2555F;
+}
+
+.tone-angular-space {
+ --pill: #6D3BBF;
+ --pill-text: #5B2FA8;
+}
+:host-context(.dark) .tone-angular-space {
+ --pill-text: #B79CF0;
+}
+
+.tone-angular-wroclaw {
+ --pill: #C2258E;
+ --pill-text: #A81E7A;
+}
+:host-context(.dark) .tone-angular-wroclaw {
+ --pill-text: #FF77C8;
+}
+
/* The translations: each in its flag's colour, its text 4.5:1 on the tint in both themes */
:host-context(.dark) :is(.tone-lang-az, .tone-lang-es, .tone-lang-uz, .tone-lang-tr, .tone-lang-ru, .tone-lang-ko, .tone-lang-ja, .tone-lang-zh-cn, .tone-lang-zh-tw, .tone-lang-fr) {
--pill-ring: color-mix(in oklab, var(--pill) 40%, transparent);
diff --git a/app/src/app/profile/badge-pill.ts b/app/src/app/profile/badge-pill.ts
index 40389c0..e4f7c51 100644
--- a/app/src/app/profile/badge-pill.ts
+++ b/app/src/app/profile/badge-pill.ts
@@ -9,7 +9,7 @@ import type { EarnedBadge } from './earned-badges'
export type BadgeTone =
| 'team' | 'gde' | 'star' | 'nx' | 'shieldwall' | 'primary' | 'gold' | 'green' | 'purple' | 'foreground'
| `lang-${string}`
- | 'analog' | 'ng-icons' | 'ngxtension' | 'pangular' | 'slide-ng' | 'ng-native' | 'ng-primitives' | 'ngx-builders'
+ | 'analog' | 'ng-icons' | 'ngxtension' | 'pangular' | 'slide-ng' | 'ng-native' | 'ng-primitives' | 'ngx-builders' | 'ng-baguette' | 'angular-devs-france' | 'openng' | 'ng-poland' | 'ng-asia' | 'ng-tunisia' | 'angular-space' | 'angular-wroclaw'
/** One badge: a link to its project, or a button that shows its tooltip. Its icons come from the page's `provideIcons`. */
@Component({
diff --git a/app/src/app/profile/card-badge-options.html b/app/src/app/profile/card-badge-options.html
new file mode 100644
index 0000000..c0bf5fb
--- /dev/null
+++ b/app/src/app/profile/card-badge-options.html
@@ -0,0 +1,23 @@
+@if (choices().length) {
+
+
+ {{ summary() }}
+
+ @for (choice of choices(); track choice.key) {
+ {{ choice.label }}
+ }
+
+
+ {{ toggleLabel() }}
+ @if (!noneShown()) {
+
+
+
+ @for (choice of nameChoices(); track choice.value) {
+ {{ choice.label }}
+ }
+
+
+ }
+
+}
diff --git a/app/src/app/profile/card-badge-options.ts b/app/src/app/profile/card-badge-options.ts
new file mode 100644
index 0000000..be1df87
--- /dev/null
+++ b/app/src/app/profile/card-badge-options.ts
@@ -0,0 +1,49 @@
+import { Component, computed, input, model, output } from '@angular/core'
+import { HlmButton } from '@spartan-ng/helm/button'
+import { HlmSelectImports } from '@spartan-ng/helm/select'
+import { badgeKey, cardBadgeLabel, shownBadges, type BadgeNameStyle } from './card-badges'
+import type { EarnedBadge } from './earned-badges'
+
+@Component({
+ selector: 'app-card-badge-options',
+ imports: [HlmButton, HlmSelectImports],
+ templateUrl: './card-badge-options.html',
+})
+export class CardBadgeOptions {
+ readonly badges = input.required()
+ readonly hidden = model([])
+ readonly names = model('fun')
+ readonly changed = output()
+
+ protected readonly choices = computed(() => this.badges().map(badge => ({ key: badgeKey(badge.label), label: cardBadgeLabel(badge, this.names()) })))
+ private readonly keys = computed(() => this.choices().map(choice => choice.key))
+ protected readonly shownKeys = computed(() => this.keys().filter(key => !this.hidden().includes(key)))
+ protected readonly noneShown = computed(() => !this.shownKeys().length)
+ protected readonly summary = computed(() => {
+ if (this.noneShown()) return 'No badges'
+ return this.shownKeys().length === this.keys().length ? 'All badges' : `${this.shownKeys().length} of ${this.keys().length} badges`
+ })
+ protected readonly toggleLabel = computed(() => (this.noneShown() ? 'Show all badges' : 'No badges'))
+ protected readonly nameChoices = computed((): ReadonlyArray<{ value: BadgeNameStyle, label: string }> => shownBadges(this.badges(), this.hidden()).some(badge => badge.officialLabel)
+ ? [{ value: 'fun', label: 'Fun names' }, { value: 'official', label: 'Official names' }, { value: 'none', label: 'No names' }]
+ : [{ value: 'fun', label: 'Names' }, { value: 'none', label: 'No names' }])
+ protected readonly choiceLabel = (key: string) => this.choices().find(choice => choice.key === key)?.label ?? key
+ protected readonly nameLabel = (value: BadgeNameStyle) => this.nameChoices().find(choice => choice.value === value)?.label ?? ''
+
+ protected pickBadges(keys: readonly string[] | null | undefined): void {
+ const shown = keys ?? []
+ this.hidden.set(this.keys().filter(key => !shown.includes(key)))
+ if (!this.nameChoices().some(choice => choice.value === this.names())) this.names.set('fun')
+ this.changed.emit()
+ }
+
+ protected toggleNoBadges(): void {
+ this.pickBadges(this.noneShown() ? this.keys() : [])
+ }
+
+ protected pickNames(value: BadgeNameStyle | null | undefined): void {
+ if (!value || value === this.names()) return
+ this.names.set(value)
+ this.changed.emit()
+ }
+}
diff --git a/app/src/app/profile/card-badges.spec.ts b/app/src/app/profile/card-badges.spec.ts
new file mode 100644
index 0000000..7a91714
--- /dev/null
+++ b/app/src/app/profile/card-badges.spec.ts
@@ -0,0 +1,72 @@
+import { badgeKey, badgeQuery, cardBadgeLabel, hiddenBadgeKeys, parseBadgeNames, parseBadgeOptions, shownBadges } from './card-badges'
+
+describe('badgeKey', () => {
+ it('makes a label safe for a URL, keeping its letters', () => {
+ expect(badgeKey('NG Baguette organizer')).toBe('ng-baguette-organizer')
+ expect(badgeKey('Top 10 all time')).toBe('top-10-all-time')
+ expect(badgeKey('Русский translator')).toBe('русский-translator')
+ expect(badgeKey('Français translator')).toBe('français-translator')
+ })
+
+ it('keeps one key for the #1 badge as its years grow', () => {
+ expect(badgeKey('#1 in 2024')).toBe(badgeKey('#1 in 2024–2025'))
+ })
+})
+
+describe('hiddenBadgeKeys', () => {
+ it('reads a comma list, sorted and without repeats', () => {
+ expect(hiddenBadgeKeys('reviewer,creator,reviewer')).toEqual(['creator', 'reviewer'])
+ })
+
+ it('ignores anything that is not a usable list', () => {
+ expect(hiddenBadgeKeys(undefined)).toEqual([])
+ expect(hiddenBadgeKeys('')).toEqual([])
+ expect(hiddenBadgeKeys(['a', 'b'])).toEqual([])
+ expect(hiddenBadgeKeys(`${'x'.repeat(61)},ok`)).toEqual(['ok'])
+ })
+
+ it('reads at most 30 keys', () => {
+ expect(hiddenBadgeKeys(Array.from({ length: 40 }, (_, index) => `k${index}`).join(',')).length).toBe(30)
+ })
+})
+
+describe('shownBadges', () => {
+ const badges = [{ label: 'Creator' }, { label: 'Reviewer' }]
+
+ it('leaves out the hidden ones and keeps the order', () => {
+ expect(shownBadges(badges, ['creator'])).toEqual([{ label: 'Reviewer' }])
+ expect(shownBadges(badges, [])).toEqual(badges)
+ })
+})
+
+describe('badge names', () => {
+ it('reads official and none, and anything else is fun', () => {
+ expect(parseBadgeNames('official')).toBe('official')
+ expect(parseBadgeNames('none')).toBe('none')
+ expect(parseBadgeNames('x')).toBe('fun')
+ expect(parseBadgeNames(undefined)).toBe('fun')
+ })
+
+ it('uses the official label when asked and there is one', () => {
+ const fun = { label: 'Analog alchemist', officialLabel: 'AnalogJS creator' }
+ expect(cardBadgeLabel(fun, 'fun')).toBe('Analog alchemist')
+ expect(cardBadgeLabel(fun, 'official')).toBe('AnalogJS creator')
+ expect(cardBadgeLabel({ label: 'NG Poland organizer' }, 'official')).toBe('NG Poland organizer')
+ })
+})
+
+describe('badgeQuery', () => {
+ it('leaves out the defaults', () => {
+ expect(badgeQuery({ hidden: [], names: 'fun' })).toEqual({})
+ })
+
+ it('sorts what is hidden and names the choice', () => {
+ expect(badgeQuery({ hidden: ['reviewer', 'creator'], names: 'none' })).toEqual({ hide: 'creator,reviewer', names: 'none' })
+ })
+})
+
+describe('parseBadgeOptions', () => {
+ it('reads both card choices', () => {
+ expect(parseBadgeOptions('reviewer', 'none')).toEqual({ hidden: ['reviewer'], names: 'none' })
+ })
+})
diff --git a/app/src/app/profile/card-badges.ts b/app/src/app/profile/card-badges.ts
new file mode 100644
index 0000000..6a3b0fb
--- /dev/null
+++ b/app/src/app/profile/card-badges.ts
@@ -0,0 +1,36 @@
+const MAX_KEYS = 30
+const MAX_KEY_LENGTH = 60
+
+export const badgeKey = (label: string): string =>
+ label.startsWith('#1 in ') ? 'number-one' : label.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, '-').replace(/^-|-$/g, '')
+
+export function hiddenBadgeKeys(value: unknown): string[] {
+ if (typeof value !== 'string') return []
+ const keys = value.split(',').filter(key => key && key.length <= MAX_KEY_LENGTH)
+ return [...new Set(keys)].sort().slice(0, MAX_KEYS)
+}
+
+export function shownBadges(badges: readonly T[], hidden: readonly string[]): T[] {
+ return badges.filter(badge => !hidden.includes(badgeKey(badge.label)))
+}
+
+export type BadgeNameStyle = 'fun' | 'official' | 'none'
+
+export const parseBadgeNames = (value: unknown): BadgeNameStyle => (value === 'official' || value === 'none' ? value : 'fun')
+
+export const cardBadgeLabel = (badge: { label: string, officialLabel?: string }, names: BadgeNameStyle): string =>
+ (names === 'official' && badge.officialLabel) || badge.label
+
+export interface BadgeOptions {
+ hidden: readonly string[]
+ names: BadgeNameStyle
+}
+
+export const parseBadgeOptions = (hide: unknown, names: unknown): BadgeOptions => ({ hidden: hiddenBadgeKeys(hide), names: parseBadgeNames(names) })
+
+export function badgeQuery({ hidden, names }: BadgeOptions): Record {
+ return {
+ ...(hidden.length ? { hide: [...hidden].sort().join(',') } : {}),
+ ...(names !== 'fun' ? { names } : {}),
+ }
+}
diff --git a/app/src/app/profile/card-design.ts b/app/src/app/profile/card-design.ts
index 4a9aaf0..016dd9a 100644
--- a/app/src/app/profile/card-design.ts
+++ b/app/src/app/profile/card-design.ts
@@ -1,2 +1,2 @@
/** Raise it when the card's design changes, so the preview does not show a copy the browser kept. */
-export const CARD_DESIGN = 15
+export const CARD_DESIGN = 18
diff --git a/app/src/app/profile/earned-badges.ts b/app/src/app/profile/earned-badges.ts
index c891bdb..de6e90e 100644
--- a/app/src/app/profile/earned-badges.ts
+++ b/app/src/app/profile/earned-badges.ts
@@ -20,6 +20,7 @@ export const BADGE_ICONS = { octShield, remixStarFill, simpleNx, vikingAnvil, vi
*/
export interface EarnedBadge {
label: string
+ officialLabel?: string
title: string
icon: 'angular' | 'gde' | 'logo' | keyof typeof BADGE_ICONS
tone: BadgeTone
@@ -29,7 +30,7 @@ export interface EarnedBadge {
/** A project's badge for one of its people: its title, logo and colour, linked to the project. */
export function projectBadge(project: ProjectBadge, role: ProjectRole): EarnedBadge {
- return { label: project.badge, title: `${role[0]!.toUpperCase()}${role.slice(1)} of ${project.name}`, icon: 'logo', logo: project.logo, href: project.href, tone: project.tone }
+ return { label: project.badge, ...(project.badgeIsOfficial ? {} : { officialLabel: `${project.name} ${role}` }), title: `${role[0]!.toUpperCase()}${role.slice(1)} of ${project.name}`, icon: 'logo', logo: project.logo, href: project.href, tone: project.tone }
}
/** Every badge a contributor has, in the order the profile and the card show them. */
diff --git a/app/src/app/profile/project-badges.ts b/app/src/app/profile/project-badges.ts
index c28511c..daf2cc9 100644
--- a/app/src/app/profile/project-badges.ts
+++ b/app/src/app/profile/project-badges.ts
@@ -1,6 +1,6 @@
import type { BadgeTone } from './badge-pill'
-export type ProjectRole = 'creator' | 'co-creator' | 'maintainer' | 'organizer'
+export type ProjectRole = 'creator' | 'co-creator' | 'founder' | 'co-founder' | 'maintainer' | 'organizer' | 'lead organizer'
export interface ProjectPerson {
githubId: number
@@ -16,6 +16,7 @@ export interface ProjectBadge {
logo: string
does: string
builtOn?: true
+ badgeIsOfficial?: true
/** Its colours: a `tone-*` class of `badge-pill.css`. */
tone: BadgeTone
people: readonly ProjectPerson[]
@@ -35,7 +36,7 @@ export const PROJECT_BADGES: readonly ProjectBadge[] = [
{ githubId: 25516557, username: 'nartc', name: 'Chau Tran', role: 'creator' },
{ githubId: 25394362, username: 'eneajaho', name: 'Enea Jahollari', role: 'creator' },
] },
- { name: 'Angularians', badge: 'Creator', tone: 'primary', href: 'https://angularians.dev', logo: '/logo.svg', does: 'Everyone who has contributed to Angular, ranked', people: [
+ { name: 'Angularians', badgeIsOfficial: true, badge: 'Creator', tone: 'primary', href: 'https://angularians.dev', logo: '/logo.svg', does: 'Everyone who has contributed to Angular, ranked', people: [
{ githubId: 88717125, username: 'erkamyaman', name: 'Erkam Yaman', role: 'creator' },
] },
{ name: 'Pangular Inspector', badge: 'Chief inspector', tone: 'pangular', href: 'https://pangular-inspector.dev', logo: '/credits/pangular.svg', does: 'Angular DevTools: components, signals, DI and routes', people: [
@@ -54,6 +55,30 @@ export const PROJECT_BADGES: readonly ProjectBadge[] = [
{ name: 'ngx-builders', badge: 'Builder baron', tone: 'ngx-builders', href: 'https://github.com/ngx-builders', logo: '/credits/ngx-builders.png', does: 'Angular CLI builders: Netlify deploys, bundle analysis', people: [
{ githubId: 11923975, username: 'santoshyadavdev', name: 'Santosh Yadav', role: 'creator' },
] },
+ { name: 'NG Baguette', badgeIsOfficial: true, badge: 'NG Baguette organizer', tone: 'ng-baguette', href: 'https://ngbaguette.angulardevs.fr', logo: '/credits/ng-baguette.png', does: 'The French Angular conference', people: [
+ { githubId: 32737308, username: 'geromegrignon', name: 'Gérôme Grignon', role: 'organizer' },
+ ] },
+ { name: 'Angular Devs France', badgeIsOfficial: true, badge: 'Angular Devs France co-founder', tone: 'angular-devs-france', href: 'https://angulardevs.fr', logo: '/credits/angular-devs-france.png', does: 'The French-speaking Angular community', people: [
+ { githubId: 32737308, username: 'geromegrignon', name: 'Gérôme Grignon', role: 'co-founder' },
+ ] },
+ { name: 'OpenNG', badge: 'OpenNG sorcerer', tone: 'openng', href: 'https://www.openng.org', logo: '/credits/openng.png', does: 'Keeps abandoned Angular libraries maintained', people: [
+ { githubId: 32737308, username: 'geromegrignon', name: 'Gérôme Grignon', role: 'maintainer' },
+ ] },
+ { name: 'NG Poland', badgeIsOfficial: true, badge: 'NG Poland organizer', tone: 'ng-poland', href: 'https://ng-poland.pl', logo: '/credits/ng-poland.png', does: 'The Angular conference in Poland', people: [
+ { githubId: 6573939, username: 'kalbarczyk', name: 'Dariusz Kalbarczyk', role: 'organizer' },
+ ] },
+ { name: 'NG Asia', badgeIsOfficial: true, badge: 'NG Asia founder', tone: 'ng-asia', href: 'https://ng-asia.org', logo: '/credits/ng-asia.png', does: 'The Angular conference and community across Asia', people: [
+ { githubId: 30035451, username: 'Ilyoskhuja', name: 'Ilyoskhuja Ikromkhujaev', role: 'founder' },
+ ] },
+ { name: 'NG Tunisia', badgeIsOfficial: true, badge: 'NG Tunisia lead organizer', tone: 'ng-tunisia', href: 'https://ng-tunisia.org', logo: '/credits/ng-tunisia.png', does: 'The Angular community of Tunisia', people: [
+ { githubId: 192744266, username: 'azizaydi23', name: 'Mohamed Aziz Aydi', role: 'lead organizer' },
+ ] },
+ { name: 'Angular Space', badgeIsOfficial: true, badge: 'Angular Space founder', tone: 'angular-space', href: 'https://www.angularspace.com', logo: '/credits/angular-space.png', does: 'Articles and podcasts for Angular developers', people: [
+ { githubId: 69144223, username: 'danielglejzner', name: 'Daniel Glejzner', role: 'founder' },
+ ] },
+ { name: 'Angular Wrocław', badgeIsOfficial: true, badge: 'Angular Wrocław organizer', tone: 'angular-wroclaw', href: 'https://www.meetup.com/angularwroclaw/', logo: '/credits/angular-wroclaw.png', does: 'The Angular meetup in Wrocław', people: [
+ { githubId: 69144223, username: 'danielglejzner', name: 'Daniel Glejzner', role: 'organizer' },
+ ] },
]
export const BUILT_ON = PROJECT_BADGES.filter(project => project.builtOn)
diff --git a/app/src/app/profile/share.html b/app/src/app/profile/share.html
index 73cac84..1a86cad 100644
--- a/app/src/app/profile/share.html
+++ b/app/src/app/profile/share.html
@@ -22,6 +22,7 @@
@if (country(); as code) { says {{ name(code) }}. From elsewhere? Pick yours. } @else { is empty. Pick a country for a flag. }
+
diff --git a/app/src/app/profile/share.ts b/app/src/app/profile/share.ts
index 1da54e6..c11170d 100644
--- a/app/src/app/profile/share.ts
+++ b/app/src/app/profile/share.ts
@@ -12,7 +12,10 @@ import { PeriodTabs } from '../leaderboard/period-tabs'
import { HlmSkeleton } from '@spartan-ng/helm/skeleton'
import { SITE_URL } from '../site'
import { shareQuery } from './share-query'
+import { CardBadgeOptions } from './card-badge-options'
+import { badgeQuery, type BadgeNameStyle } from './card-badges'
import { CARD_DESIGN } from './card-design'
+import type { EarnedBadge } from './earned-badges'
/** The skeleton shows at least this long, so a fast card does not flicker it. */
const MIN_LOADING_MS = 500
@@ -26,7 +29,7 @@ export const SHARE_BUTTONS = { link: 'Copy profile link', card: 'Share card', re
/** Copy the profile link, or the Markdown of the Angularian card for a GitHub profile README. */
@Component({
selector: 'app-share',
- imports: [CountrySelect, HlmButton, HlmDialogImports, HlmSkeleton, NgIcon, NgTemplateOutlet, PeriodTabs],
+ imports: [CardBadgeOptions, CountrySelect, HlmButton, HlmDialogImports, HlmSkeleton, NgIcon, NgTemplateOutlet, PeriodTabs],
providers: [provideIcons({ remixCheckLine, remixDownloadLine, remixFileCopyLine, remixImageLine, remixLinkedinBoxFill, remixShareLine, simpleBluesky, simpleX, remixLinkM, remixMarkdownLine })],
templateUrl: './share.html',
styleUrl: './share.css',
@@ -39,6 +42,7 @@ export class Share {
readonly periods = input([])
/** The country of the GitHub location, when it has one. */
readonly country = input(null)
+ readonly badges = input([])
protected readonly buttons = SHARE_BUTTONS
protected readonly copied = signal<'link' | 'markdown' | null>(null)
@@ -56,6 +60,8 @@ export class Share {
protected readonly cardPeriod = linkedSignal(() => this.period())
/** A country picked for this card only. `null`: the GitHub location. */
protected readonly flag = signal(null)
+ protected readonly hiddenBadges = signal([])
+ protected readonly names = signal('fun')
protected readonly allCountries = Object.keys(COUNTRIES).map(code => ({ code, count: 0, top: [] }))
protected readonly name = countryName
protected readonly flagLabel = computed(() => {
@@ -64,12 +70,13 @@ export class Share {
})
protected readonly cardPeriods = computed(() => sortPeriods(['all', ...this.periods()]))
+ private readonly badgeOptions = computed(() => badgeQuery({ hidden: this.hiddenBadges(), names: this.names() }))
private readonly profileUrl = computed(() => `${SITE_URL}/${this.username()}${shareQuery(this.period())}`)
/** The profile with the card's period and flag: what a post links to, and the README card's link. */
- private readonly cardProfileUrl = computed(() => `${SITE_URL}/${this.username()}${shareQuery(this.cardPeriod(), this.flag())}`)
- private readonly cardUrl = computed(() => `${SITE_URL}/${this.username()}/card.png${shareQuery(this.cardPeriod(), this.flag())}`)
+ private readonly cardProfileUrl = computed(() => `${SITE_URL}/${this.username()}${shareQuery(this.cardPeriod(), this.flag(), this.badgeOptions())}`)
+ private readonly cardUrl = computed(() => `${SITE_URL}/${this.username()}/card.png${shareQuery(this.cardPeriod(), this.flag(), this.badgeOptions())}`)
/** The same card from this site: right on a preview deploy or locally too. The Markdown keeps the public address. */
- protected readonly previewUrl = computed(() => `/${this.username()}/card.png${shareQuery(this.cardPeriod(), this.flag(), { v: String(CARD_DESIGN) })}`)
+ protected readonly previewUrl = computed(() => `/${this.username()}/card.png${shareQuery(this.cardPeriod(), this.flag(), { v: String(CARD_DESIGN), ...this.badgeOptions() })}`)
protected readonly fileName = computed(() => `${this.username()}-angularian${this.cardPeriod() === 'all' ? '' : `-${this.cardPeriod()}`}.png`)
/** The profile's link preview is this card, so a post only needs the link. */
protected readonly shareLinks = computed(() => {
@@ -95,6 +102,8 @@ export class Share {
if (state !== 'open') return
this.cardPeriod.set(this.period())
this.flag.set(null)
+ this.hiddenBadges.set([])
+ this.names.set('fun')
this.shownUrl.set(null)
this.startLoading()
}
@@ -137,7 +146,7 @@ export class Share {
void this.copy(this.markdown(), 'markdown')
}
- private startLoading(): void {
+ protected startLoading(): void {
clearTimeout(this.loadedTimer)
this.loadingSince = Date.now()
this.cardState.set('loading')
diff --git a/app/src/app/site.ts b/app/src/app/site.ts
index 8737ced..74704cb 100644
--- a/app/src/app/site.ts
+++ b/app/src/app/site.ts
@@ -4,6 +4,8 @@ export const SITE_URL = 'https://angularians.dev'
/** The site's repository on GitHub. */
export const REPO_URL = 'https://github.com/erkamyaman/angularians'
+export const SPONSOR_URL = 'https://github.com/sponsors/erkamyaman'
+
/** Who made the site, for search engines (schema.org `Person`): the author of every page. */
export const SITE_AUTHOR = {
'@type': 'Person',
diff --git a/app/src/server/card/assets.ts b/app/src/server/card/assets.ts
index 170a5a1..6e06cb9 100644
--- a/app/src/server/card/assets.ts
+++ b/app/src/server/card/assets.ts
@@ -1,5 +1,6 @@
import { useStorage } from 'nitropack/runtime'
import type { CardFonts } from './card'
+import { TAG_FONTS } from './tag-fonts'
import { avatarUrl } from '../../app/contributors/avatar-url'
import { flagUrl } from '../../app/contributors/flag-url'
@@ -16,7 +17,8 @@ export function cardFonts(): Promise {
if (!regular || !semibold) throw new Error('The card fonts are missing from the server assets')
// Optional: only there when the build could download it.
const brand = await useStorage('assets:brand-font').getItemRaw('Norse-Bold.otf').catch(() => null)
- return { regular, semibold, brand: brand ?? null }
+ const tags = await Promise.all(TAG_FONTS.map(async ({ name, file }) => ({ name, data: await storage.getItemRaw(file) })))
+ return { regular, semibold, brand: brand ?? null, tags: tags.flatMap(({ name, data }) => data ? [{ name, data }] : []) }
})().catch((error: unknown) => {
fonts = undefined
throw error
diff --git a/app/src/server/card/badges.ts b/app/src/server/card/badges.ts
index 3479323..6c6df74 100644
--- a/app/src/server/card/badges.ts
+++ b/app/src/server/card/badges.ts
@@ -1,7 +1,11 @@
import type { ContributorProfile } from '@angularians/shared'
+import { cardBadgeLabel, shownBadges, type BadgeOptions } from '../../app/profile/card-badges'
import { BADGE_ICONS, earnedBadges } from '../../app/profile/earned-badges'
import { siteImage } from './assets'
import { ANGULAR_LOGO } from './card'
+import { fitTags, TAG_ROW_WIDTH, TAG_ROWS, type CardTag } from './card-tags'
+import { drawableLabel } from './tag-fonts'
+import { tagColors } from './tag-colors'
/** The badge icons' colours on the card, which has no theme: the dark theme's. */
const COLORS: Record = {
@@ -14,17 +18,17 @@ const COLORS: Record = {
vikingAxes: '#A371F7',
}
-/** The card shows this many badges at most, so the row stays clear of the footer's left corner. */
-const MAX_BADGES = 10
-
const isIcon = (icon: string): icon is keyof typeof BADGE_ICONS => icon in BADGE_ICONS
-/** The profile's badges as images for the card, in the profile's order; one whose image is missing is left out. */
-export async function cardBadgeImages(profile: ContributorProfile): Promise {
- const images = await Promise.all(earnedBadges(profile).slice(0, MAX_BADGES).map(({ icon, logo }) =>
- icon === 'angular' ? ANGULAR_LOGO
+/** The profile's badges as tags for the card, in the profile's order; one whose image is missing is left out. */
+export async function cardBadgeTags(profile: ContributorProfile, { hidden, names }: BadgeOptions): Promise {
+ const iconsOnly = names === 'none'
+ const candidates = await Promise.all(shownBadges(earnedBadges(profile), hidden).map(async (badge) => {
+ const { icon, logo, tone } = badge
+ const src = icon === 'angular' ? ANGULAR_LOGO
: isIcon(icon) ? `data:image/svg+xml,${encodeURIComponent(BADGE_ICONS[icon].replaceAll('currentColor', COLORS[icon]))}`
- : logo ? siteImage(logo) : null,
- ))
- return images.filter((src): src is string => !!src)
+ : logo ? await siteImage(logo) : null
+ return src ? { src, label: drawableLabel(cardBadgeLabel(badge, names)), colors: tagColors(tone) } : null
+ }))
+ return fitTags(candidates.filter(badge => badge !== null), iconsOnly ? 1 : TAG_ROWS, TAG_ROW_WIDTH, iconsOnly)
}
diff --git a/app/src/server/card/card-tags.spec.ts b/app/src/server/card/card-tags.spec.ts
new file mode 100644
index 0000000..589cb13
--- /dev/null
+++ b/app/src/server/card/card-tags.spec.ts
@@ -0,0 +1,53 @@
+import { describe, expect, it } from 'vitest'
+import { fitTags, TAG_ICON_WIDTH, TAG_LARGE_SIZE } from './card-tags'
+
+const badge = (label: string) => ({ src: `data:${label}`, label })
+
+describe('fitTags', () => {
+ it('labels every tag that fits, in order', () => {
+ expect(fitTags([badge('Français translator'), badge('Reviewer')], 2, 628).map(tag => tag.label)).toEqual(['Français translator', 'Reviewer'])
+ })
+
+ it('moves a tag that does not fit to the next row', () => {
+ const tags = fitTags([badge('a'.repeat(30)), badge('b'.repeat(30))], 2, 410)
+ expect(tags.map(tag => tag.label)).toEqual(['a'.repeat(30), 'b'.repeat(30)])
+ })
+
+ it('keeps the icon alone when the rows are full of labels', () => {
+ const tags = fitTags([badge('a'.repeat(30)), badge('b'.repeat(30))], 1, 460)
+ expect(tags).toEqual([{ ...badge('a'.repeat(30)), row: 1, large: false }, { src: `data:${'b'.repeat(30)}`, label: null, row: 1, large: false }])
+ })
+
+ it('draws only icons when asked', () => {
+ expect(fitTags([badge('Reviewer'), badge('Creator')], 3, 628, true).map(tag => tag.label)).toEqual([null, null])
+ })
+
+ it('gives icons alone the large size', () => {
+ const icons = [badge('a'), badge('b'), badge('c')]
+ expect(fitTags(icons, 1, TAG_LARGE_SIZE * 2 + 8, true).length).toBe(2)
+ })
+
+ it('says which row each tag is in', () => {
+ const tags = fitTags([badge('a'.repeat(30)), badge('b'.repeat(30)), badge('c'.repeat(30))], 3, 410)
+ expect(tags.map(tag => tag.row)).toEqual([1, 2, 3])
+ })
+
+ it('leaves out what does not fit even as an icon', () => {
+ const icons = Array.from({ length: 20 }, (_, index) => badge(`badge number ${index}`))
+ expect(fitTags(icons, 1, TAG_ICON_WIDTH).length).toBe(1)
+ })
+
+ it('puts a short tag in an earlier row that still has room', () => {
+ const tags = fitTags([badge('a'.repeat(10)), badge('b'.repeat(40)), badge('c'.repeat(5))], 2, 520)
+ expect(tags.map(tag => tag.label)).toEqual(['a'.repeat(10), 'c'.repeat(5), 'b'.repeat(40)])
+ })
+
+ it('counts Korean, Japanese and Chinese letters as full width', () => {
+ expect(fitTags([badge('简体中文简体中文简体中文 translator')], 1, 400).map(tag => tag.label)).toEqual([null])
+ })
+
+ it('still draws an icon after a label too long for any row', () => {
+ const tags = fitTags([badge('a'.repeat(200)), badge('Reviewer')], 1, 300)
+ expect(tags.map(tag => tag.label)).toEqual([null, 'Reviewer'])
+ })
+})
diff --git a/app/src/server/card/card-tags.ts b/app/src/server/card/card-tags.ts
new file mode 100644
index 0000000..404ed9b
--- /dev/null
+++ b/app/src/server/card/card-tags.ts
@@ -0,0 +1,45 @@
+import type { TagColors } from './tag-colors'
+
+export interface CardTag {
+ src: string
+ label: string | null
+ colors: TagColors
+ row: number
+ large: boolean
+}
+
+export const TAG_ROWS = 3
+export const TAG_ROW_WIDTH = 628
+export const TAG_HEIGHT = 36
+export const TAG_GAP = 8
+export const TAG_FONT_SIZE = 19
+export const TAG_ICON_SIZE = 28
+export const TAG_PADDING = 12
+export const TAG_ICON_WIDTH = 40
+export const TAG_LARGE_SIZE = 60
+export const TAG_LARGE_ICON = 44
+
+const AVERAGE_LETTER = 0.55
+const TAG_CHROME = TAG_PADDING * 2 + TAG_ICON_SIZE + TAG_GAP + 2
+const FULL_WIDTH = /[\u3000-\u9fff\uac00-\ud7af]/g
+
+function labelledWidth(label: string): number {
+ const full = label.match(FULL_WIDTH)?.length ?? 0
+ return Math.ceil((full + (label.length - full) * AVERAGE_LETTER) * TAG_FONT_SIZE) + TAG_CHROME
+}
+
+export function fitTags(badges: readonly T[], rows: number, width: number, iconsOnly = false): Array & { label: string | null, row: number, large: boolean }> {
+ type Tag = Omit & { label: string | null }
+ const lines = Array.from({ length: rows }, () => ({ used: 0, tags: [] as Tag[] }))
+ const place = (tag: Tag, size: number): boolean => {
+ const line = lines.find(({ used }) => used + (used ? TAG_GAP : 0) + size <= width)
+ if (!line) return false
+ line.used += (line.used ? TAG_GAP : 0) + size
+ line.tags.push(tag)
+ return true
+ }
+ for (const badge of badges) {
+ if (iconsOnly || !place(badge, labelledWidth(badge.label))) place({ ...badge, label: null }, iconsOnly ? TAG_LARGE_SIZE : TAG_ICON_WIDTH)
+ }
+ return lines.flatMap((line, index) => line.tags.map(tag => ({ ...tag, row: index + 1, large: iconsOnly })))
+}
diff --git a/app/src/server/card/card.ts b/app/src/server/card/card.ts
index 0851bd0..5477e29 100644
--- a/app/src/server/card/card.ts
+++ b/app/src/server/card/card.ts
@@ -7,6 +7,9 @@ import satori from 'satori'
import { formatMonth } from '../../app/text/date-format'
import { formatNumber, formatPoints, formatRank } from '../../app/text/number-format'
import { statWord } from '../../app/text/stat-names'
+import { TAG_FONT_SIZE, TAG_GAP, TAG_HEIGHT, TAG_ICON_SIZE, TAG_ICON_WIDTH, TAG_LARGE_ICON, TAG_LARGE_SIZE, TAG_PADDING, type CardTag } from './card-tags'
+import type { TagColors } from './tag-colors'
+import { TAG_FONTS } from './tag-fonts'
export const CARD_WIDTH = 1200
export const CARD_HEIGHT = 630
@@ -45,12 +48,31 @@ const ICONS = {
comments: ['M1 2.75C1 1.784 1.784 1 2.75 1h10.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 13.25 12H9.06l-2.573 2.573A1.458 1.458 0 0 1 4 13.543V12H2.75A1.75 1.75 0 0 1 1 10.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h4.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z'],
reactions: ['M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm3.82 1.636a.75.75 0 0 1 1.038.175l.007.009c.103.118.22.222.35.31.264.178.683.37 1.285.37.602 0 1.02-.192 1.285-.371.13-.088.247-.192.35-.31l.007-.008a.75.75 0 0 1 1.222.87l-.022-.015c.02.013.021.015.021.015v.001l-.001.002-.002.003-.005.007-.014.019a2.066 2.066 0 0 1-.184.213c-.16.166-.338.316-.53.445-.63.418-1.37.638-2.127.629-.946 0-1.652-.308-2.126-.63a3.331 3.331 0 0 1-.715-.657l-.014-.02-.005-.006-.002-.003v-.002h-.001l.613-.432-.614.43a.75.75 0 0 1 .183-1.044ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM5 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm5.25 2.25.592.416a97.71 97.71 0 0 0-.592-.416Z'],
}
-const STAT_ICON_SIZE = 40
-const statIcon = (paths: string[], color: string): Node =>
- h('svg', { width: STAT_ICON_SIZE, height: STAT_ICON_SIZE }, paths.map(d => h('path', {}, undefined, { d })), {
- viewBox: '0 0 16 16', width: STAT_ICON_SIZE, height: STAT_ICON_SIZE, fill: color,
+const TILES = { gap: 24, height: 196, padding: 24, icon: 40, value: 58, label: 26 }
+const TILES_WITH_TAGS = { gap: 20, height: 164, padding: 18, icon: 32, value: 50, label: 24 }
+const TILES_WITH_THREE_ROWS = { gap: 16, height: 140, padding: 14, icon: 26, value: 40, label: 20 }
+const statIcon = (paths: string[], color: string, size: number): Node =>
+ h('svg', { width: size, height: size }, paths.map(d => h('path', {}, undefined, { d })), {
+ viewBox: '0 0 16 16', width: size, height: size, fill: color,
})
+const tagSurface = (colors: TagColors) => ({ backgroundColor: `${colors.pill}1a`, border: `1px solid ${colors.pill}66` })
+
+const largeIcon = ({ src, colors }: CardTag): Node =>
+ h('div', { width: TAG_LARGE_SIZE, height: TAG_LARGE_SIZE, alignItems: 'center', justifyContent: 'center', borderRadius: 14, ...tagSurface(colors) }, [
+ h('img', { width: TAG_LARGE_ICON, height: TAG_LARGE_ICON }, undefined, { src, width: TAG_LARGE_ICON, height: TAG_LARGE_ICON }),
+ ])
+
+const badgeTag = ({ src, label, colors }: CardTag): Node =>
+ h('div', { height: TAG_HEIGHT, ...(label ? { paddingLeft: TAG_PADDING, paddingRight: TAG_PADDING, gap: TAG_GAP } : { width: TAG_ICON_WIDTH, justifyContent: 'center' }), alignItems: 'center', borderRadius: 10, ...tagSurface(colors), fontFamily: ['Manrope', ...TAG_FONTS.map(font => font.name)].join(', '), fontSize: TAG_FONT_SIZE, fontWeight: 600, color: colors.text, whiteSpace: 'nowrap' }, [
+ h('img', { width: TAG_ICON_SIZE, height: TAG_ICON_SIZE }, undefined, { src, width: TAG_ICON_SIZE, height: TAG_ICON_SIZE }),
+ ...(label ? [h('div', {}, label)] : []),
+ ])
+
+
+const tagRows = (tags: readonly CardTag[]): Node[] =>
+ [...new Set(tags.map(tag => tag.row))].map(row =>
+ h('div', { flexDirection: 'row', gap: TAG_GAP }, tags.filter(tag => tag.row === row).map(tag => (tag.large ? largeIcon(tag) : badgeTag(tag)))))
/**
* Text with the word "Angularian(s)" set in the brand font (its capitals are about as tall as Manrope's):
@@ -83,7 +105,8 @@ export function cardPeriod(profile: ContributorProfile, requested: unknown): Per
}
/** `avatar`: a data URL, or `null` when GitHub did not send it (a grey circle instead). */
-export function cardTree(profile: ContributorProfile, period: Period, avatar: string | null, flag: { src: string, name: string } | null = null, badges: readonly string[] = []): Node {
+export function cardTree(profile: ContributorProfile, period: Period, avatar: string | null, flag: { src: string, name: string } | null = null, tags: readonly CardTag[] = []): Node {
+ const tiles = !tags.length ? TILES : tags.some(tag => tag.row === 3) ? TILES_WITH_THREE_ROWS : TILES_WITH_TAGS
const stats = period === 'all' ? profile : profile.periods.find(row => row.period === period)!
const since = profile.firstContributionAt ? formatMonth(profile.firstContributionAt) : null
const rows = [
@@ -119,23 +142,22 @@ export function cardTree(profile: ContributorProfile, period: Period, avatar: st
]),
]),
]),
- h('div', { flexDirection: 'column', flex: 1, gap: 24 }, rows.map(row =>
- h('div', { flexDirection: 'row', gap: 24 }, row.map(stat =>
- h('div', { flexDirection: 'column', justifyContent: 'space-between', flex: 1, height: 196, borderRadius: 24, padding: 24, border: `2px solid ${stat.color}`, backgroundColor: `${stat.color}12` }, [
- statIcon(stat.icon, stat.color),
- h('div', { flexDirection: 'column' }, [
- h('div', { fontSize: 58, fontWeight: 600, lineHeight: 1.1 }, formatNumber(stat.value)),
- h('div', { fontSize: 26, marginTop: 2, color: stat.color }, stat.label),
- ]),
- ])),
- ))),
+ h('div', { flexDirection: 'column', flex: 1, gap: tiles.gap }, [
+ ...rows.map(row =>
+ h('div', { flexDirection: 'row', gap: tiles.gap }, row.map(stat =>
+ h('div', { flexDirection: 'column', justifyContent: 'space-between', flex: 1, height: tiles.height, borderRadius: 24, padding: tiles.padding, border: `2px solid ${stat.color}`, backgroundColor: `${stat.color}12` }, [
+ statIcon(stat.icon, stat.color, tiles.icon),
+ h('div', { flexDirection: 'column' }, [
+ h('div', { fontSize: tiles.value, fontWeight: 600, lineHeight: 1.1 }, formatNumber(stat.value)),
+ h('div', { fontSize: tiles.label, marginTop: 2, color: stat.color }, stat.label),
+ ]),
+ ])),
+ )),
+ ...(tags.length ? [h('div', { flexDirection: 'column', gap: TAG_GAP }, tagRows(tags))] : []),
+ ]),
]),
// The footer's left stays empty: X lays the page's title over a card's bottom-left corner.
h('div', { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-end', gap: 40, borderTop: '1px solid #262626', paddingTop: 18 }, [
- ...(badges.length ? [h('div', { flexDirection: 'row', gap: 10 }, badges.map(src =>
- h('div', { width: 48, height: 48, borderRadius: 12, backgroundColor: '#171717', border: '1px solid #262626', alignItems: 'center', justifyContent: 'center' }, [
- h('img', { width: 28, height: 28 }, undefined, { src, width: 28, height: 28 }),
- ])))] : []),
h('div', { flexDirection: 'row', alignItems: 'center', gap: 12 }, [
markSvg(68),
h('div', { flexDirection: 'column' }, [
@@ -173,7 +195,7 @@ export function homeTree(input: { title: string, description: string, avatars: A
])
}
-export interface CardFonts { regular: ArrayBuffer | Buffer, semibold: ArrayBuffer | Buffer, brand?: ArrayBuffer | Buffer | null }
+export interface CardFonts { regular: ArrayBuffer | Buffer, semibold: ArrayBuffer | Buffer, brand?: ArrayBuffer | Buffer | null, tags?: ReadonlyArray<{ name: string, data: ArrayBuffer | Buffer }> }
export async function renderCard(tree: Node, fonts: CardFonts): Promise {
const svg = await satori(tree as never, {
@@ -183,6 +205,7 @@ export async function renderCard(tree: Node, fonts: CardFonts): Promise
{ name: 'Manrope', data: fonts.regular, weight: 400, style: 'normal' },
{ name: 'Manrope', data: fonts.semibold, weight: 600, style: 'normal' },
...(fonts.brand ? [{ name: 'Norse', data: fonts.brand, weight: 700 as const, style: 'normal' as const }] : []),
+ ...(fonts.tags ?? []).map(({ name, data }) => ({ name, data, weight: 600 as const, style: 'normal' as const })),
],
})
return new Resvg(svg, { fitTo: { mode: 'width', value: CARD_WIDTH * PIXEL_RATIO } }).render().asPng()
diff --git a/app/src/server/card/fonts/LICENSE b/app/src/server/card/fonts/LICENSE
index 462280f..e8d189e 100644
--- a/app/src/server/card/fonts/LICENSE
+++ b/app/src/server/card/fonts/LICENSE
@@ -1,4 +1,5 @@
Copyright 2019 The Manrope Project Authors (https://github.com/sharanda/manrope)
+The noto-sans-*-subset files: Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. Noto Sans KR, JP, SC and TC, reduced by Google Fonts to the letters of the language names.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
diff --git a/app/src/server/card/fonts/manrope-cyrillic-600-normal.woff b/app/src/server/card/fonts/manrope-cyrillic-600-normal.woff
new file mode 100644
index 0000000..10ebb9f
Binary files /dev/null and b/app/src/server/card/fonts/manrope-cyrillic-600-normal.woff differ
diff --git a/app/src/server/card/fonts/manrope-latin-ext-600-normal.woff b/app/src/server/card/fonts/manrope-latin-ext-600-normal.woff
new file mode 100644
index 0000000..4ba5d43
Binary files /dev/null and b/app/src/server/card/fonts/manrope-latin-ext-600-normal.woff differ
diff --git a/app/src/server/card/fonts/noto-sans-jp-subset-600.ttf b/app/src/server/card/fonts/noto-sans-jp-subset-600.ttf
new file mode 100644
index 0000000..87efda1
Binary files /dev/null and b/app/src/server/card/fonts/noto-sans-jp-subset-600.ttf differ
diff --git a/app/src/server/card/fonts/noto-sans-kr-subset-600.ttf b/app/src/server/card/fonts/noto-sans-kr-subset-600.ttf
new file mode 100644
index 0000000..cdae78b
Binary files /dev/null and b/app/src/server/card/fonts/noto-sans-kr-subset-600.ttf differ
diff --git a/app/src/server/card/fonts/noto-sans-sc-subset-600.ttf b/app/src/server/card/fonts/noto-sans-sc-subset-600.ttf
new file mode 100644
index 0000000..c986b5e
Binary files /dev/null and b/app/src/server/card/fonts/noto-sans-sc-subset-600.ttf differ
diff --git a/app/src/server/card/fonts/noto-sans-tc-subset-600.ttf b/app/src/server/card/fonts/noto-sans-tc-subset-600.ttf
new file mode 100644
index 0000000..40b02c0
Binary files /dev/null and b/app/src/server/card/fonts/noto-sans-tc-subset-600.ttf differ
diff --git a/app/src/server/card/tag-colors.spec.ts b/app/src/server/card/tag-colors.spec.ts
new file mode 100644
index 0000000..018cbc8
--- /dev/null
+++ b/app/src/server/card/tag-colors.spec.ts
@@ -0,0 +1,25 @@
+import { readFileSync } from 'node:fs'
+import { TRANSLATIONS } from '@angularians/shared'
+import { describe, expect, it } from 'vitest'
+import type { BadgeTone } from '../../app/profile/badge-pill'
+import { PROJECT_BADGES } from '../../app/profile/project-badges'
+import { TAG_COLORS, tagColors } from './tag-colors'
+
+const css = readFileSync('src/app/profile/badge-pill.css', 'utf8')
+const darkRules = [...css.matchAll(/:host-context\(\.dark\) \.tone-([\w-]+) \{\s*--pill-text: (#[0-9A-Fa-f]{6});/g)]
+
+describe('TAG_COLORS', () => {
+ it('has the dark text of every badge tone that sets one', () => {
+ expect(darkRules.length).toBeGreaterThan(10)
+ for (const [, tone, text] of darkRules) expect(TAG_COLORS[tone as BadgeTone]?.text, tone).toBe(text)
+ })
+
+ it('covers every translation and project', () => {
+ for (const { code } of TRANSLATIONS) expect(TAG_COLORS[`lang-${code}`], code).toBeDefined()
+ for (const { tone } of PROJECT_BADGES) expect(TAG_COLORS[tone], tone).toBeDefined()
+ })
+
+ it('falls back to a neutral colour for a new language', () => {
+ expect(tagColors('lang-xx').pill).toBe('#A3A3A3')
+ })
+})
diff --git a/app/src/server/card/tag-colors.ts b/app/src/server/card/tag-colors.ts
new file mode 100644
index 0000000..b573fba
--- /dev/null
+++ b/app/src/server/card/tag-colors.ts
@@ -0,0 +1,51 @@
+import type { BadgeTone } from '../../app/profile/badge-pill'
+
+export interface TagColors {
+ pill: string
+ text: string
+}
+
+const NEUTRAL: TagColors = { pill: '#A3A3A3', text: '#E5E5E5' }
+
+const same = (color: string): TagColors => ({ pill: color, text: color })
+
+export const TAG_COLORS: Record = {
+ 'team': { pill: '#DC087D', text: '#FAFAFA' },
+ 'gde': same('#8AB4F8'),
+ 'star': same('#E3B341'),
+ 'nx': same('#96D7E8'),
+ 'shieldwall': same('#FF7B72'),
+ 'primary': same('#D29922'),
+ 'gold': same('#D29922'),
+ 'green': same('#3FB950'),
+ 'purple': same('#A371F7'),
+ 'foreground': same('#FAFAFA'),
+ 'analog': { pill: '#DD0330', text: '#F47088' },
+ 'ng-icons': { pill: '#E53935', text: '#FF8A80' },
+ 'ngxtension': { pill: '#F20755', text: '#FF5BE1' },
+ 'pangular': { pill: '#D97706', text: '#FBBF24' },
+ 'slide-ng': { pill: '#CC4209', text: '#F0883E' },
+ 'ng-native': { pill: '#F0224F', text: '#FF6B88' },
+ 'ng-primitives': { pill: '#E90364', text: '#FF5C9A' },
+ 'ngx-builders': { pill: '#90A4AE', text: '#B0BEC5' },
+ 'ng-baguette': { pill: '#D6336C', text: '#FF7BA5' },
+ 'angular-devs-france': { pill: '#1E4FB0', text: '#7FA6F5' },
+ 'openng': { pill: '#D6249F', text: '#FF6FD0' },
+ 'ng-poland': { pill: '#DC143C', text: '#F2627D' },
+ 'ng-asia': { pill: '#8B2FE0', text: '#C58BFF' },
+ 'ng-tunisia': { pill: '#E70013', text: '#F2555F' },
+ 'angular-space': { pill: '#6D3BBF', text: '#B79CF0' },
+ 'angular-wroclaw': { pill: '#C2258E', text: '#FF77C8' },
+ 'lang-az': same('#00B5E2'),
+ 'lang-es': { pill: '#C60B1E', text: '#D64F5D' },
+ 'lang-uz': same('#0099B5'),
+ 'lang-tr': { pill: '#E30A17', text: '#E93B45' },
+ 'lang-ru': { pill: '#0039A6', text: '#577CC4' },
+ 'lang-ko': { pill: '#CD2E3A', text: '#D6525B' },
+ 'lang-ja': { pill: '#BC002D', text: '#D14F6E' },
+ 'lang-zh-cn': { pill: '#DE2910', text: '#E34731' },
+ 'lang-zh-tw': { pill: '#000095', text: '#7373C5' },
+ 'lang-fr': { pill: '#0055A4', text: '#4281BC' },
+}
+
+export const tagColors = (tone: BadgeTone): TagColors => TAG_COLORS[tone] ?? NEUTRAL
diff --git a/app/src/server/card/tag-fonts.spec.ts b/app/src/server/card/tag-fonts.spec.ts
new file mode 100644
index 0000000..b7a587a
--- /dev/null
+++ b/app/src/server/card/tag-fonts.spec.ts
@@ -0,0 +1,24 @@
+import { TRANSLATIONS } from '@angularians/shared'
+import { describe, expect, it } from 'vitest'
+import { drawableLabel } from './tag-fonts'
+
+describe('drawableLabel', () => {
+ it('keeps a label the card font can draw', () => {
+ expect(drawableLabel('Français translator')).toBe('Français translator')
+ expect(drawableLabel('Türkçe translator')).toBe('Türkçe translator')
+ expect(drawableLabel('#1 in 2019–2021')).toBe('#1 in 2019–2021')
+ })
+
+ it('keeps every language on the list', () => {
+ for (const { language } of TRANSLATIONS) expect(drawableLabel(`${language} translator`)).not.toBe('Translator')
+ })
+
+ it('draws the Uzbek letter mark with a quote the font has', () => {
+ expect(drawableLabel('Oʻzbekcha translator')).toBe('O‘zbekcha translator')
+ })
+
+ it('drops the words it cannot draw and capitalises what is left', () => {
+ expect(drawableLabel('ไทย translator')).toBe('Translator')
+ expect(drawableLabel('العربية contributor')).toBe('Contributor')
+ })
+})
diff --git a/app/src/server/card/tag-fonts.ts b/app/src/server/card/tag-fonts.ts
new file mode 100644
index 0000000..8188d2c
--- /dev/null
+++ b/app/src/server/card/tag-fonts.ts
@@ -0,0 +1,18 @@
+export const TAG_FONTS = [
+ { name: 'Manrope Latin Ext', file: 'manrope-latin-ext-600-normal.woff' },
+ { name: 'Manrope Cyrillic', file: 'manrope-cyrillic-600-normal.woff' },
+ { name: 'Noto Sans KR', file: 'noto-sans-kr-subset-600.ttf' },
+ { name: 'Noto Sans JP', file: 'noto-sans-jp-subset-600.ttf' },
+ { name: 'Noto Sans SC', file: 'noto-sans-sc-subset-600.ttf' },
+ { name: 'Noto Sans TC', file: 'noto-sans-tc-subset-600.ttf' },
+] as const
+
+const DRAWABLE = /^[\u0000-\u024f\u0259\u0400-\u04ff\u2000-\u206f한국어日本語简体中文正體]+$/
+
+export function drawableLabel(label: string): string {
+ const text = label.replaceAll('\u02bb', '\u2018')
+ const words = text.split(' ').filter(word => DRAWABLE.test(word))
+ if (words.length === text.split(' ').length) return text
+ const kept = words.join(' ')
+ return `${kept.charAt(0).toUpperCase()}${kept.slice(1)}`
+}
diff --git a/app/src/server/routes/[username]/card.png.get.ts b/app/src/server/routes/[username]/card.png.get.ts
index 0abf85e..9824787 100644
--- a/app/src/server/routes/[username]/card.png.get.ts
+++ b/app/src/server/routes/[username]/card.png.get.ts
@@ -2,8 +2,9 @@ import { sendPng } from '../../data/http'
import { createError, defineEventHandler, getQuery, getRouterParam } from 'h3'
import * as v from 'valibot'
import { countryCode, countryName } from '@angularians/shared'
+import { parseBadgeOptions } from '../../../app/profile/card-badges'
import { avatarData, cardFonts, flagData } from '../../card/assets'
-import { cardBadgeImages } from '../../card/badges'
+import { cardBadgeTags } from '../../card/badges'
import { cardPeriod, cardTree, renderCard } from '../../card/card'
import { UsernameSchema } from '../../data/schemas'
import { contributorsData } from '../../data/store'
@@ -21,8 +22,8 @@ export default defineEventHandler(async (event) => {
const period = cardPeriod(profile, getQuery(event)['period'])
// `?flag=TR`: the country the owner picked for this card. Otherwise their GitHub location.
const code = countryCode(getQuery(event)['flag']) ?? profile.country ?? null
- const [avatar, flagSrc, fonts, badges] = await Promise.all([avatarData(profile.githubId), code ? flagData(code) : null, cardFonts(), cardBadgeImages(profile)])
- const png = await renderCard(cardTree(profile, period, avatar, code && flagSrc ? { src: flagSrc, name: countryName(code) } : null, badges), fonts)
+ const [avatar, flagSrc, fonts, tags] = await Promise.all([avatarData(profile.githubId), code ? flagData(code) : null, cardFonts(), cardBadgeTags(profile, parseBadgeOptions(getQuery(event)['hide'], getQuery(event)['names']))])
+ const png = await renderCard(cardTree(profile, period, avatar, code && flagSrc ? { src: flagSrc, name: countryName(code) } : null, tags), fonts)
// A day in shared caches (GitHub's image proxy too): each night's deploy clears the CDN.
return sendPng(event, png)
})
diff --git a/app/src/styles.css b/app/src/styles.css
index c5d9853..a7d2259 100644
--- a/app/src/styles.css
+++ b/app/src/styles.css
@@ -231,6 +231,11 @@
cursor: url(/cursors/hammer.png) 3 3, auto;
}
+hlm-dialog-content .brand,
+html.angie-off .brand {
+ cursor: inherit;
+}
+
@layer base {
* {
@apply border-border outline-ring/50;
diff --git a/app/vite.config.ts b/app/vite.config.ts
index 5fd371e..cfe25b6 100644
--- a/app/vite.config.ts
+++ b/app/vite.config.ts
@@ -66,7 +66,7 @@ export default defineConfig(() => ({
{ route: `${DEV_IMAGES}/:username/card.png`, env: 'dev', handler: './src/server/routes/[username]/card.png.get.ts' },
{ route: `${DEV_IMAGES}/og.png`, env: 'dev', handler: './src/server/routes/og.png.get.ts' },
],
- // The two fonts of the Angularian card (src/server/card), inlined in the server: about 60 KB.
+ // The fonts of the Angularian card (src/server/card), inlined in the server: about 100 KB.
// And the brand font, Norse Bold, for the word "Angularian" (public/fonts), about 30 KB.
serverAssets: [
{ baseName: 'client-manifest', dir: dirname(CLIENT_MANIFEST) },
@@ -82,7 +82,7 @@ export default defineConfig(() => ({
// country). Any other one (`?utm_source=`) shares the page's copy. A route reading a new parameter must add it here.
// and per value of the signed-in hint cookie (app/src/app/auth/hint.ts), whose pages start with the signed-in
// card's skeleton. Every other cookie is ignored by the cache.
- '/**': { headers: { 'cache-control': 'public, max-age=0, s-maxage=86400, stale-while-revalidate=86400', 'netlify-cdn-cache-control': 'public, durable, s-maxage=86400, stale-while-revalidate=86400', 'netlify-vary': 'query=period|country|page|q|flag|v,cookie=angularians-signed-in' } },
+ '/**': { headers: { 'cache-control': 'public, max-age=0, s-maxage=86400, stale-while-revalidate=86400', 'netlify-cdn-cache-control': 'public, durable, s-maxage=86400, stale-while-revalidate=86400', 'netlify-vary': 'query=period|country|page|q|flag|hide|names|v,cookie=angularians-signed-in' } },
// Sign-in: per person, with cookies. Never in a shared cache.
'/api/auth/**': { headers: { 'cache-control': 'private, no-store', 'netlify-cdn-cache-control': 'no-store' } },
// Server functions are POSTs whose input is in the body, which no cache key sees: never cached.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index cbf886f..08b4665 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -113,7 +113,9 @@ To add a colour: give it a name for what it is, not how it looks (`--medal-gold`
`styles.css` with its dark value next to it if it changes, add a `--color-*` line to `@theme inline` only when a template
needs it as a utility, and remove any token nothing uses any more.
-An easter egg: the word "Angularian(s)" or "ng-halla", or a click on the header's or footer's logo, calls Angie (`app/public/angie/`) to bring down a storm with thunder (`app/public/sounds/`), on a click on the word, once a visit on a click on a logo, or once a visit on hover after a first click; `app/src/app/layout/hammer-strike.ts`, the bolt's shape in `lightning.ts`.
+An easter egg, which the account menu turns off for good (`layout/angie.service.ts`), and which its "My Angularian profile" link also calls; after the first storm a dialog (`layout/angie-intro.ts`) introduces her once, with the off switch and the star and sponsor links: the word "Angularian(s)" or "ng-halla", or a click on the header's or footer's logo, calls Angie (`app/public/angie/`) to bring down a storm with thunder (`app/public/sounds/`), on a click on the word, once a visit on a click on a logo, or once a visit on hover after a first click; `app/src/app/layout/hammer-strike.ts`, the bolt's shape in `lightning.ts`.
+
+The header shows the repository's star count, read from GitHub's API in the visitor's browser and kept for the visit (`layout/github-stars.ts`), so it costs no function call.
## Search engines
@@ -164,5 +166,5 @@ Signing in from the home page ends on your profile, or back on the home page if
| `GET /api/contributors/:username` | A profile: all-time stats, rank in each period, links |
| `GET /api/search/contributors?q=cris&country=TR` | Up to 8 contributors, of that country if given |
| `GET /api/map/contributors?period=all` | Contributors by country |
-| `GET /:username/card.png?period=2025&flag=TR` | The Angularian card, 2400×1260: the README card and the profile's link preview. Its flag is the GitHub location's country, or `flag` when the owner picked another; its footer shows the profile's badges as icons (`earnedBadges` in `app/src/app/profile/earned-badges.ts`, shared with the profile page; images from the `site-images` server asset) |
+| `GET /:username/card.png?period=2025&flag=TR&hide=reviewer&names=official` | The Angularian card, 2400×1260: the README card and the profile's link preview. `names=official` swaps fun project titles for the project and role, `names=none` shows the badges as icons alone; `hide` is the badges the owner left out in the share dialog (`app/src/app/profile/card-badges.ts`), and the profile's own `?hide=` carries them to its link preview. Its flag is the GitHub location's country, or `flag` when the owner picked another; under its stats, the profile's badges as tags with their names, as many as fit in up to three rows (the stats shrink for a third) and the rest as icons alone, a language's own name in Manrope's Cyrillic and extended Latin or a small Noto font holding just its letters (`TAG_FONTS` in `app/src/server/card/tag-fonts.ts`) (`earnedBadges` in `app/src/app/profile/earned-badges.ts`, shared with the profile page; images from the `site-images` server asset) |
| `GET /og.png?period=2025` | The home page's link preview, 2400×1260: all time, or the top of a period |