-
-
Notifications
You must be signed in to change notification settings - Fork 438
feat: add /recharging page
#1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
99001ca
chore: add `vacations` page
userquin ea9e429
Merge branch 'main' into chore-add-vacations-page
userquin d12ea73
chore: merge vacations page
userquin 924c6f2
chore: respect `prefers-reduced-motion` for the bouncing hero emoji
userquin abb7b98
chore: apply coderabbitai suggestion
userquin c7e97dc
chore: 3 weeks have passed, not 4 :man_facepalming:
userquin 70d1f34
Merge branch 'main' into chore-add-vacations-page
userquin 1f4ae31
chore: move stats to i18n json files
userquin 4124562
Merge remote-tracking branch 'origin/main' into chore-add-vacations-page
danielroe 7f3c9a7
refactor: rework content and move to `/holiday`
danielroe f1fe47d
Merge remote-tracking branch 'origin/main' into chore-add-vacations-page
danielroe 8ba9784
feat: add bluesky post embed + live metrics
danielroe b12e53b
Merge remote-tracking branch 'origin/main' into chore-add-vacations-page
danielroe 91782f8
chore: rename to recharging
danielroe 54593c0
test: add a11y test for the post embed
danielroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,314 @@ | ||
| <script setup lang="ts"> | ||
| definePageMeta({ | ||
| name: 'vacations', | ||
| }) | ||
|
|
||
| useSeoMeta({ | ||
| title: () => `${$t('vacations.title')} - npmx`, | ||
| description: () => $t('vacations.meta_description'), | ||
| ogTitle: () => `${$t('vacations.title')} - npmx`, | ||
| ogDescription: () => $t('vacations.meta_description'), | ||
| twitterTitle: () => `${$t('vacations.title')} - npmx`, | ||
| twitterDescription: () => $t('vacations.meta_description'), | ||
| }) | ||
|
|
||
| defineOgImageComponent('Default', { | ||
| title: () => $t('vacations.title'), | ||
| description: () => $t('vacations.meta_description'), | ||
| }) | ||
|
|
||
| const router = useRouter() | ||
| const canGoBack = useCanGoBack() | ||
|
|
||
| // --- Cosy fireplace easter egg --- | ||
| const logClicks = ref(0) | ||
| const fireVisible = ref(false) | ||
| function pokeLog() { | ||
| logClicks.value++ | ||
| if (logClicks.value >= 3) { | ||
| fireVisible.value = true | ||
| } | ||
| } | ||
|
|
||
| // Icons that tile across the banner, repeating to fill. | ||
| // Classes must be written out statically so UnoCSS can detect them at build time. | ||
| const icons = [ | ||
| 'i-carbon:snowflake', | ||
| 'i-carbon:mountain', | ||
| 'i-carbon:tree', | ||
| 'i-carbon:cafe', | ||
| 'i-carbon:book', | ||
| 'i-carbon:music', | ||
| 'i-carbon:snowflake', | ||
| 'i-carbon:star', | ||
| 'i-carbon:moon', | ||
| ] as const | ||
|
|
||
| // --- .ics calendar reminder --- | ||
| // Pick a random daytime hour (9–17) in the user's local timezone on Feb 22 | ||
| // so reminders are staggered and people don't all flood in at once. | ||
| function downloadIcs() { | ||
| const hour = 9 + Math.floor(Math.random() * 9) // 9..17 | ||
| const start = new Date(2026, 1, 22, hour, 0, 0) // month is 0-indexed | ||
| const end = new Date(2026, 1, 22, hour + 1, 0, 0) | ||
|
|
||
| // Format as UTC for the .ics file | ||
| const fmt = (d: Date) => | ||
| d | ||
| .toISOString() | ||
| .replace(/[-:]/g, '') | ||
| .replace(/\.\d{3}/, '') | ||
|
|
||
| const uid = `npmx-vacations-${start.getTime()}@npmx.dev` | ||
|
|
||
| const ics = [ | ||
| 'BEGIN:VCALENDAR', | ||
| 'VERSION:2.0', | ||
| 'PRODID:-//npmx//vacations//EN', | ||
| 'BEGIN:VEVENT', | ||
| `DTSTART:${fmt(start)}`, | ||
| `DTEND:${fmt(end)}`, | ||
| `SUMMARY:npmx Discord is back!`, | ||
| `DESCRIPTION:The npmx team is back from vacation. Time to rejoin! https://chat.npmx.dev`, | ||
| 'STATUS:CONFIRMED', | ||
| `UID:${uid}`, | ||
| 'END:VEVENT', | ||
| 'END:VCALENDAR', | ||
| ].join('\r\n') | ||
|
|
||
| const blob = new Blob([ics], { type: 'text/calendar;charset=utf-8' }) | ||
| const url = URL.createObjectURL(blob) | ||
| const a = document.createElement('a') | ||
| a.href = url | ||
| a.download = 'npmx-discord-reminder.ics' | ||
| a.click() | ||
| URL.revokeObjectURL(url) | ||
| } | ||
|
|
||
| const stats = { | ||
| weeks: '4', | ||
| contributors: '160+', | ||
| commits: '1.1k+', | ||
| pr: '900+', | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <main class="container flex-1 py-12 sm:py-16 overflow-x-hidden max-w-full"> | ||
| <article class="max-w-2xl mx-auto"> | ||
| <header class="mb-12"> | ||
| <div class="max-w-2xl mx-auto py-8 bg-none flex justify-center"> | ||
| <!-- Icon / Illustration --> | ||
| <div class="relative inline-block"> | ||
| <div class="absolute inset-0 bg-accent/20 blur-3xl rounded-full" aria-hidden="true" /> | ||
| <span class="relative text-8xl sm:text-9xl animate-bounce-slow inline-block">🏖️</span> | ||
| </div> | ||
| </div> | ||
| <div class="flex items-baseline justify-between gap-4 mb-4"> | ||
| <h1 class="font-mono text-3xl sm:text-4xl font-medium"> | ||
| {{ $t('vacations.heading') }} | ||
| </h1> | ||
| <button | ||
| type="button" | ||
| class="cursor-pointer inline-flex items-center gap-2 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0" | ||
| @click="router.back()" | ||
| v-if="canGoBack" | ||
| > | ||
| <span class="i-carbon:arrow-left rtl-flip w-4 h-4" aria-hidden="true" /> | ||
| <span class="sr-only sm:not-sr-only">{{ $t('nav.back') }}</span> | ||
| </button> | ||
| </div> | ||
| <i18n-t | ||
| keypath="vacations.subtitle" | ||
| tag="p" | ||
| scope="global" | ||
| class="text-fg-muted text-lg sm:text-xl" | ||
| > | ||
| <template #weeks> | ||
| {{ $t('vacations.stats.subtitle.weeks', [stats.weeks]) }} | ||
| </template> | ||
| <template #contributors> | ||
| {{ $t('vacations.stats.subtitle.contributors', [stats.contributors]) }} | ||
| </template> | ||
| <template #commits> | ||
| {{ $t('vacations.stats.subtitle.commits', [stats.commits]) }} | ||
| </template> | ||
| <template #npmx> | ||
| <strong>npmx</strong> | ||
| </template> | ||
| </i18n-t> | ||
| </header> | ||
|
|
||
| <div | ||
| class="grid grid-cols-3 justify-center gap-4 sm:gap-8 mb-8 py-8 border-y border-border/50" | ||
| > | ||
| <div class="space-y-1 text-center"> | ||
| <div class="font-mono text-2xl sm:text-3xl font-bold text-fg"> | ||
| {{ stats.contributors }} | ||
| </div> | ||
| <div class="text-xs sm:text-sm text-fg-subtle uppercase tracking-wider"> | ||
| {{ $t('vacations.stats.contributors') }} | ||
| </div> | ||
| </div> | ||
| <div class="space-y-1 text-center"> | ||
| <div class="font-mono text-2xl sm:text-3xl font-bold text-fg">{{ stats.commits }}</div> | ||
| <div class="text-xs sm:text-sm text-fg-subtle uppercase tracking-wider"> | ||
| {{ $t('vacations.stats.commits') }} | ||
| </div> | ||
| </div> | ||
| <div class="space-y-1 text-center"> | ||
| <div class="font-mono text-2xl sm:text-3xl font-bold text-fg">{{ stats.pr }}</div> | ||
| <div class="text-xs sm:text-sm text-fg-subtle uppercase tracking-wider"> | ||
| {{ $t('vacations.stats.pr') }} | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Icon banner — a single row of cosy icons, clipped to fill width --> | ||
| <div | ||
| class="relative mb-12 px-4 border border-border rounded-lg bg-bg-subtle overflow-hidden select-none" | ||
| :aria-label="$t('vacations.illustration_alt')" | ||
| role="img" | ||
| > | ||
| <div class="flex items-center gap-4 sm:gap-5 py-3 sm:py-4 w-max"> | ||
| <template v-for="n in 4" :key="`set-${n}`"> | ||
| <!-- Campsite icon — click it 3x to light the fire --> | ||
| <button | ||
| type="button" | ||
| class="relative shrink-0 cursor-pointer rounded transition-transform duration-200 hover:scale-110 focus-visible:outline-accent/70 w-5 h-5 sm:w-6 sm:h-6" | ||
| :aria-label="$t('vacations.poke_log')" | ||
| @click="pokeLog" | ||
| > | ||
| <span | ||
| class="absolute inset-0 i-carbon:fire w-5 h-5 sm:w-6 sm:h-6 text-orange-400 transition-opacity duration-400" | ||
| :class="fireVisible ? 'opacity-100' : 'opacity-0'" | ||
| /> | ||
| <span | ||
| class="absolute inset-0 i-carbon:campsite w-5 h-5 sm:w-6 sm:h-6 transition-colors duration-400" | ||
| :class="fireVisible ? 'text-amber-700' : ''" | ||
| /> | ||
| </button> | ||
| <span | ||
| v-for="(icon, i) in icons" | ||
| :key="`${n}-${i}`" | ||
| class="shrink-0 w-5 h-5 sm:w-6 sm:h-6 opacity-40" | ||
| :class="icon" | ||
| /> | ||
| </template> | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| </div> | ||
| </div> | ||
|
|
||
| <section class="prose prose-invert max-w-none space-y-8"> | ||
| <div> | ||
| <p class="text-fg-muted leading-relaxed mb-4"> | ||
| <i18n-t keypath="vacations.intro.p1" tag="span" scope="global"> | ||
| <template #some> | ||
| <span class="line-through decoration-fg">{{ $t('vacations.intro.some') }}</span> | ||
| {{ ' ' }} | ||
| <strong class="text-fg">{{ $t('vacations.intro.all') }}</strong> | ||
| </template> | ||
| </i18n-t> | ||
| </p> | ||
| <p class="text-fg-muted leading-relaxed"> | ||
| {{ $t('vacations.intro.p2') }} | ||
| </p> | ||
| </div> | ||
|
|
||
| <!-- What's happening --> | ||
| <div> | ||
| <h2 class="text-lg text-fg-subtle uppercase tracking-wider mb-4"> | ||
| {{ $t('vacations.what.title') }} | ||
| </h2> | ||
| <p class="text-fg-muted leading-relaxed mb-4"> | ||
| <i18n-t keypath="vacations.what.p1" tag="span" scope="global"> | ||
| <template #dates> | ||
| <strong class="text-fg">{{ $t('vacations.what.dates') }}</strong> | ||
| </template> | ||
| </i18n-t> | ||
| </p> | ||
| <ul class="space-y-3 text-fg-muted list-none p-0"> | ||
| <li class="flex items-start gap-3"> | ||
| <span class="text-fg-subtle shrink-0 mt-1">—</span> | ||
| <span> | ||
| <i18n-t keypath="vacations.what.discord" tag="span" scope="global"> | ||
| <template #garden> | ||
| <code class="font-mono text-fg text-sm">{{ $t('vacations.what.garden') }}</code> | ||
| </template> | ||
| </i18n-t> | ||
| </span> | ||
| </li> | ||
| <li class="flex items-start gap-3"> | ||
| <span class="text-fg-subtle shrink-0 mt-1">—</span> | ||
| <span>{{ $t('vacations.what.site') }}</span> | ||
| </li> | ||
| <li class="flex items-start gap-3"> | ||
| <span class="text-fg-subtle shrink-0 mt-1">—</span> | ||
| <span>{{ $t('vacations.what.repo') }}</span> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| <!-- In the meantime --> | ||
| <div> | ||
| <h2 class="text-lg text-fg-subtle uppercase tracking-wider mb-4"> | ||
| {{ $t('vacations.meantime.title') }} | ||
| </h2> | ||
| <p class="text-fg-muted leading-relaxed mb-4"> | ||
| <i18n-t keypath="vacations.meantime.p1" tag="span" scope="global"> | ||
| <template #repo> | ||
| <LinkBase to="https://repo.npmx.dev"> | ||
| {{ $t('vacations.meantime.repo_link') }} | ||
| </LinkBase> | ||
| </template> | ||
| </i18n-t> | ||
| </p> | ||
| <p class="text-fg-muted leading-relaxed"> | ||
| {{ $t('vacations.meantime.p2') }} | ||
| </p> | ||
| </div> | ||
|
|
||
| <!-- See you soon --> | ||
| <div> | ||
| <h2 class="text-lg text-fg-subtle uppercase tracking-wider mb-4"> | ||
| {{ $t('vacations.return.title') }} | ||
| </h2> | ||
| <p class="text-fg-muted leading-relaxed mb-4"> | ||
| {{ $t('vacations.return.p1') }} | ||
| </p> | ||
| <p class="text-fg-muted leading-relaxed mb-6"> | ||
| <i18n-t keypath="vacations.return.p2" tag="span" scope="global"> | ||
| <template #social> | ||
| <LinkBase to="https://social.npmx.dev"> | ||
| {{ $t('vacations.return.social_link') }} | ||
| </LinkBase> | ||
| </template> | ||
| </i18n-t> | ||
| </p> | ||
|
|
||
| <!-- Add to calendar button --> | ||
| <ButtonBase classicon="i-carbon:calendar" @click="downloadIcs"> | ||
| {{ $t('vacations.return.add_to_calendar') }} | ||
| </ButtonBase> | ||
| </div> | ||
| </section> | ||
| </article> | ||
| </main> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .animate-bounce-slow { | ||
| animation: bounce 3s infinite; | ||
| } | ||
|
|
||
| @keyframes bounce { | ||
| 0%, | ||
| 100% { | ||
| transform: translateY(-5%); | ||
| animation-timing-function: cubic-bezier(0.8, 0, 1, 1); | ||
| } | ||
| 50% { | ||
| transform: translateY(0); | ||
| animation-timing-function: cubic-bezier(0, 0, 0.2, 1); | ||
| } | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.