PronounsPage/components/CalendarExtra.vue
Adaline Simonian 23a3862ca0
test: introduce snapshot-based smoke tests
- Adds a new test suite with Docker-based smoke tests for all locales.
  Can be run using the ./smoketest.sh script.
- Replaces all calls to Math.random() with a new helper that returns 0.5
  in snapshot testing mode, ensuring deterministic snapshots.
- Similarly replaces all calls to new Date() and Date.now() with new
  helpers that return a fixed date in snapshot testing mode.
- Replaces checks against NODE_ENV with APP_ENV, to ensure that the
  bundles can be built with Nuxt for testing without losing code that
  would otherwise be stripped out by production optimizations.
- Adds a database init script that can be used to initialize the
  database with a single admin user and a long-lived JWT token for use
  in automation tests.
- Adds a JWT decoding/encoding CLI tool for debugging JWTs.

Note: Snapshots are not checked in, and must be generated manually. See
test/__snapshots__/.gitignore for more information.
2025-02-02 23:11:19 -08:00

100 lines
3.4 KiB
Vue

<template>
<section>
<div class="alert alert-info d-flex flex-column flex-md-row justify-content-around">
<div v-if="day" class="px-1">
<p class="h5">
<T>calendar.full</T><T>quotation.colon</T>
</p>
<nuxt-link :to="{ name: 'calendar', params: { year: day.year } }" class="btn btn-outline-primary m-1">
<Icon v="calendar-star" />
{{ day.year }}
</nuxt-link>
</div>
<div class="px-1">
<p class="h5">
Bots:
</p>
<p class="mb-0">
<a v-for="bot in bots" :href="bot.url" target="_blank" rel="noopener" class="btn btn-outline-primary m-1">
<Icon :v="bot.icon" :set="bot.iconSet || 'b'" />
{{ bot.headline }}
</a>
</p>
</div>
<div v-if="!day" class="px-1">
<p class="h5">
iCalendar:
</p>
<CalendarIcs :url="icsLink" />
</div>
<div class="px-1">
<p class="h5">
<T>calendar.image.header</T><T>quotation.colon</T>
</p>
<p v-if="day" class="mb-0">
<a :href="`/calendar/${day}.png`" target="_blank" rel="noopener" class="btn btn-outline-primary m-1">
<Icon v="image" />
<T>calendar.image.header</T>
</a>
</p>
<p v-else class="mb-0">
<a :href="`/calendar/${year.year}-overview.png`" target="_blank" rel="noopener" class="btn btn-outline-primary m-1">
<Icon v="table" />
<T>calendar.view.grid</T>
</a>
<a :href="`/calendar/${year.year}-labels.png`" target="_blank" rel="noopener" class="btn btn-outline-primary m-1">
<Icon v="list" />
<T>calendar.view.list</T>
</a>
</p>
</div>
</div>
<section v-if="(config.calendar.sources || []).length">
<h3>
<Icon v="link" />
<T>profile.links</T>
</h3>
<ul>
<li v-for="source in config.calendar.sources">
<a :href="source" target="_blank" rel="noopener">
{{ clearUrl(source) }}
</a>
</li>
</ul>
</section>
</section>
</template>
<script>
import useConfig from '../composables/useConfig.ts';
import { socialLinks } from '../src/contact.ts';
import { clearUrl, newDate } from '../src/helpers.ts';
export default {
props: {
day: {},
year: {},
},
setup() {
return {
config: useConfig(),
};
},
data() {
return {
bots: [
socialLinks.calendar.mastodon,
socialLinks.calendar.bluesky,
],
clearUrl,
};
},
computed: {
icsLink() {
const yearSuffix = this.year.year === newDate().getFullYear() ? '' : `-${this.year.year}`;
return `${this.$config.public.baseUrl}/api/queer-calendar-${this.config.locale}${yearSuffix}.ics`;
},
},
};
</script>