The minimalistic document archiving platform.
feat(contact): refactor contact options (#59)
Corentin Thomasset87b812a9cfec
diff --git a/src/components/Footer.astro b/src/components/Footer.astroindex 1eb93e6d..3c5d12a3 100644--- a/src/components/Footer.astro+++ b/src/components/Footer.astro@@ -1,47 +1,12 @@---import { buildLocalizedPath, useI18n } from '../i18n/i18n';+import { getSocials } from '../socials';import { cn } from '../utils/cn';import LanguagePicker from './LanguagePicker.astro';const { t } = useI18n({ locale: Astro.currentLocale });-const socials = [- {- label: t('footer.social.bluesky'),- url: 'https://bsky.app/profile/papra.app',- icon: 'i-tabler-brand-bluesky',- },- {- label: t('footer.social.mastodon'),- url: 'https://mastodon.social/@papra',- icon: 'i-tabler-brand-mastodon',- },- {- label: t('footer.social.x'),- url: 'https://x.com/papra_app',- icon: 'i-tabler-brand-x',- },- {- label: t('footer.social.github'),- url: 'https://github.com/papra-hq/papra',- icon: 'i-tabler-brand-github',- },- {- label: t('footer.social.discord'),- url: '/discord',- icon: 'i-tabler-brand-discord',- },- {- label: t('footer.social.reddit'),- url: 'https://www.reddit.com/r/Papra',- icon: 'i-tabler-brand-reddit',- },- {- label: t('footer.social.linkedin'),- url: 'https://www.linkedin.com/company/papra-hq',- icon: 'i-tabler-brand-linkedin',- },-];+const socials = getSocials({ t });const sections: {title: string;diff --git a/src/components/Header.astro b/src/components/Header.astroindex f85bc8f1..bf74eb9f 100644--- a/src/components/Header.astro+++ b/src/components/Header.astro@@ -1,37 +1,12 @@---import { config } from '../app.config';import { buildLocalizedPath, useI18n } from '../i18n/i18n';+import { getSocials } from '../socials';import { cn } from '../utils/cn';const { t } = useI18n({ locale: Astro.currentLocale });-const socials = [- {- name: 'Bluesky',- url: 'https://bsky.app/profile/papra.app',- icon: 'i-tabler-brand-bluesky',- },- {- name: 'Mastodon',- url: 'https://mastodon.social/@papra',- icon: 'i-tabler-brand-mastodon',- },- {- name: 'X / Twitter',- url: 'https://x.com/papra_app',- icon: 'i-tabler-brand-x',- },- {- name: 'GitHub',- url: 'https://github.com/papra-hq/papra',- icon: 'i-tabler-brand-github',- },- {- name: 'Discord',- url: '/discord',- icon: 'i-tabler-brand-discord',- },-];+const socials = getSocials({ t }).filter(social => social.inHeader);const navigation = [{diff --git a/src/i18n/i18n.ts b/src/i18n/i18n.tsindex 7676a8db..0e7cf630 100644--- a/src/i18n/i18n.ts+++ b/src/i18n/i18n.ts@@ -31,7 +31,7 @@ export function getTranslations({ locale }: { locale: string }): TranslationsDicconst { parse } = createBranchlet();-export function useI18n({ locale = DEFAULT_LOCALE }: { locale?: string }) {+export function useI18n({ locale = DEFAULT_LOCALE }: { locale?: string } = {}) {return {locale,t: <K extends keyof TranslationsDictionary>(key: K, args?: Record<string, string | number>): TranslationsDictionary[K] => {@@ -47,6 +47,8 @@ export function useI18n({ locale = DEFAULT_LOCALE }: { locale?: string }) {};}+export type Translator = ReturnType<typeof useI18n>['t'];+export function getPathWithoutLocale(url: URL | string) {const pathname = typeof url === 'string' ? url : url.pathname;diff --git a/src/locales/en.ts b/src/locales/en.tsindex 8f2633e6..352c189a 100644--- a/src/locales/en.ts+++ b/src/locales/en.ts@@ -239,24 +239,35 @@ export const translations = {'pricing.discount-banner.description': 'Get 50% off for life when you upgrade your organization to any paid plan during our launch period. This offer expires on 31 December 2025!',// Contact Page- 'contact.title': 'Contact',- 'contact.subtitle': 'For any questions or support, please contact us using the following options:',- 'contact.option.email.name': 'Email',- 'contact.option.email.label': '[email protected]',- 'contact.option.discord.name': 'Discord',- 'contact.option.discord.label': 'Papra Discord community',- 'contact.option.github.name': 'Github',- 'contact.option.github.label': 'Papra Github repository',- 'contact.option.bluesky.name': 'Bluesky',- 'contact.option.bluesky.label': 'Bluesky profile',- 'contact.option.x.name': 'X / Twitter',- 'contact.option.x.label': 'Papra X profile',- 'contact.option.reddit.name': 'Reddit',- 'contact.option.reddit.label': 'r/papra community',- 'contact.option.linkedin.name': 'LinkedIn',- 'contact.option.linkedin.label': 'Papra LinkedIn profile',- 'contact.option.mastodon.name': 'Mastodon',- 'contact.option.mastodon.label': 'Papra Mastodon profile',+ 'contact.title': 'Get in Touch',+ 'contact.subtitle': 'Have questions or feedback? We\'d love to hear from you. Reach out through any of our channels below.',+ 'contact.general-inquiries.title': 'General Inquiries',+ 'contact.general-inquiries.description': 'For general questions, feedback or support, reach out to us via email.',+ 'contact.partnerships.title': 'Partnerships',+ 'contact.partnerships.description': 'Interested in partnering with Papra? Get in touch!',+ 'contact.bug.title': 'Found a Bug?',+ 'contact.bug.description': 'Report bugs or issues you encounter while using Papra.',+ 'contact.bug.button-label': 'Report on GitHub',+ 'contact.community.title': 'Join Our Community',+ 'contact.community.description': 'Connect with us and other users on Discord, share ideas, and get support.',+ 'contact.community.button-label': 'Join Discord',+ 'contact.connect.title': 'Connect with Us',+ 'contact.connect.description': 'Follow us on social media to stay updated with the latest news and updates.',++ 'socials.discord.name': 'Discord',+ 'socials.discord.label': 'Papra Discord community',+ 'socials.github.name': 'GitHub',+ 'socials.github.label': 'Papra GitHub repository',+ 'socials.bluesky.name': 'Bluesky',+ 'socials.bluesky.label': 'Bluesky profile',+ 'socials.x.name': 'X / Twitter',+ 'socials.x.label': 'Papra X profile',+ 'socials.reddit.name': 'Reddit',+ 'socials.reddit.label': 'r/papra community',+ 'socials.linkedin.name': 'LinkedIn',+ 'socials.linkedin.label': 'Papra LinkedIn profile',+ 'socials.mastodon.name': 'Mastodon',+ 'socials.mastodon.label': 'Papra Mastodon profile',// Blog Page'blog.title': 'Papra Blog',diff --git a/src/locales/fr.ts b/src/locales/fr.tsindex d1c5cf85..c74a789a 100644--- a/src/locales/fr.ts+++ b/src/locales/fr.ts@@ -240,24 +240,35 @@ export const translations: Partial<TranslationsDictionary> = {'pricing.discount-banner.description': 'Bénéficiez de 50% de réduction à vie en passant vos organisations à n\'importe quel plan payant pendant notre période de lancement. Cette offre expire le 31 décembre 2025 !',// Contact Page- 'contact.title': 'Contact',- 'contact.subtitle': 'Une question ? Besoin d\'aide ? Contactez-nous !',- 'contact.option.email.name': 'Email',- 'contact.option.email.label': '[email protected]',- 'contact.option.discord.name': 'Discord',- 'contact.option.discord.label': 'Communauté Discord Papra',- 'contact.option.github.name': 'Github',- 'contact.option.github.label': 'Dépôt Github Papra',- 'contact.option.bluesky.name': 'Bluesky',- 'contact.option.bluesky.label': 'Profil Bluesky',- 'contact.option.x.name': 'X / Twitter',- 'contact.option.x.label': 'Profil Papra sur X',- 'contact.option.reddit.name': 'Reddit',- 'contact.option.reddit.label': 'Communauté r/papra',- 'contact.option.linkedin.name': 'LinkedIn',- 'contact.option.linkedin.label': 'Profil LinkedIn Papra',- 'contact.option.mastodon.name': 'Mastodon',- 'contact.option.mastodon.label': 'Profil Mastodon Papra',+ 'contact.title': 'Nous contacter',+ 'contact.subtitle': 'Une question ou un retour à faire ? On serait ravis de vous lire. Contactez-nous via n\'importe lequel de ces canaux.',+ 'contact.general-inquiries.title': 'Questions générales',+ 'contact.general-inquiries.description': 'Pour toute question, retour ou demande d\'assistance, écrivez-nous par email.',+ 'contact.partnerships.title': 'Partenariats',+ 'contact.partnerships.description': 'Envie de collaborer avec Papra ? Prenons contact !',+ 'contact.bug.title': 'Un bug à signaler ?',+ 'contact.bug.description': 'Signalez les bugs ou problèmes que vous rencontrez en utilisant Papra.',+ 'contact.bug.button-label': 'Signaler sur GitHub',+ 'contact.community.title': 'Rejoignez la communauté',+ 'contact.community.description': 'Échangez avec nous et d\'autres utilisateurs sur Discord, partagez vos idées et obtenez de l\'aide.',+ 'contact.community.button-label': 'Rejoindre Discord',+ 'contact.connect.title': 'Suivez-nous',+ 'contact.connect.description': 'Restez au courant des dernières actus et mises à jour en nous suivant sur les réseaux sociaux.',++ 'socials.discord.name': 'Discord',+ 'socials.discord.label': 'Communauté Discord Papra',+ 'socials.github.name': 'GitHub',+ 'socials.github.label': 'Dépôt GitHub Papra',+ 'socials.bluesky.name': 'Bluesky',+ 'socials.bluesky.label': 'Profil Bluesky',+ 'socials.x.name': 'X / Twitter',+ 'socials.x.label': 'Profil Papra sur X',+ 'socials.reddit.name': 'Reddit',+ 'socials.reddit.label': 'Communauté r/papra',+ 'socials.linkedin.name': 'LinkedIn',+ 'socials.linkedin.label': 'Profil LinkedIn Papra',+ 'socials.mastodon.name': 'Mastodon',+ 'socials.mastodon.label': 'Profil Mastodon Papra',// Blog Page'blog.title': 'Blog Papra',diff --git a/src/pages/[locale]/contact.astro b/src/pages/[locale]/contact.astroindex 9d7cff42..68ff54e7 100644--- a/src/pages/[locale]/contact.astro+++ b/src/pages/[locale]/contact.astro@@ -4,96 +4,124 @@ import Header from '../../components/Header.astro';import { useI18n } from '../../i18n/i18n';import { LOCALES } from '../../i18n/i18n.constants';import Layout from '../../layouts/Layout.astro';+import { DISCORD_INVITE_URL, getSocials, GITHUB_ISSUES_URL } from '../../socials';import { cn } from '../../utils/cn';export async function getStaticPaths() {- return LOCALES.map(locale => ({ params: { locale } }));+ return LOCALES.map(locale => ({ params: { locale } }));}const { t } = useI18n({ locale: Astro.currentLocale });-const contactOptions = [+const generalCards = [{- name: t('contact.option.email.name'),- label: t('contact.option.email.label'),- href: 'mailto:[email protected]',+ title: t('contact.general-inquiries.title'),+ description: t('contact.general-inquiries.description'),icon: 'i-tabler-mail',+ email: '[email protected]',},{- name: t('contact.option.discord.name'),- label: t('contact.option.discord.label'),- href: '/discord',- icon: 'i-tabler-brand-discord',+ title: t('contact.partnerships.title'),+ description: t('contact.partnerships.description'),+ icon: 'i-tabler-heart-handshake',+ email: '[email protected]',},{- name: t('contact.option.github.name'),- label: t('contact.option.github.label'),- href: 'https://github.com/papra-hq/papra',- icon: 'i-tabler-brand-github',+ title: t('contact.bug.title'),+ description: t('contact.bug.description'),+ icon: 'i-tabler-bug',+ button: {+ icon: 'i-tabler-brand-github',+ label: t('contact.bug.button-label'),+ url: GITHUB_ISSUES_URL,+ },},{- name: t('contact.option.bluesky.name'),- label: t('contact.option.bluesky.label'),- href: 'https://bsky.app/profile/papra.app',- icon: 'i-tabler-brand-bluesky',- },- {- name: t('contact.option.mastodon.name'),- label: t('contact.option.mastodon.label'),- href: 'https://mastodon.social/@papra',- icon: 'i-tabler-brand-mastodon',- },- {- name: t('contact.option.x.name'),- label: t('contact.option.x.label'),- href: 'https://x.com/papra_app',- icon: 'i-tabler-brand-x',- },- {- name: t('contact.option.reddit.name'),- label: t('contact.option.reddit.label'),- href: 'https://www.reddit.com/r/Papra/',- icon: 'i-tabler-brand-reddit',- },- {- name: t('contact.option.linkedin.name'),- label: t('contact.option.linkedin.label'),- href: 'https://www.linkedin.com/company/papra-hq',- icon: 'i-tabler-brand-linkedin',+ title: t('contact.community.title'),+ description: t('contact.community.description'),+ icon: 'i-tabler-messages',+ button: {+ icon: 'i-tabler-brand-discord',+ label: t('contact.community.button-label'),+ url: DISCORD_INVITE_URL,+ },},];++const socials = getSocials({ t });---<Layout><div class="bg-card flex flex-col w-full min-h-screen"><Header />- <div class="w-full bg-[linear-gradient(to_right,#80808010_1px,transparent_1px),linear-gradient(to_bottom,#80808010_1px,transparent_1px)] bg-[size:48px_48px] bg-background border-b pt-32 pb-24">- <div class="max-w-700px mx-auto p-4">- <h1 class="text-3xl mb-2 font-bold">{t('contact.title')}</h1>- <p class="text-base mb-2 leading-tight">{t('contact.subtitle')}</p>+ <div class="w-full bg-[linear-gradient(to_right,#80808010_1px,transparent_1px),linear-gradient(to_bottom,#80808010_1px,transparent_1px)] bg-[size:48px_48px] bg-background border-b pt-24 md:pt-32 pb-8 md:pb-18">+ <div class="max-w-700px mx-auto p-6 md:text-center">+ <h1 class="text-3xl md:text-5xl mb-4 font-bold">{t('contact.title')}</h1>+ <p class="text-base md:text-xl leading-tight text-muted-foreground text-pretty">{t('contact.subtitle')}</p></div></div>- <div class="max-w-3xl mx-auto flex-1 w-full grid grid-cols-1 md:grid-cols-2 gap-4 px-6 py-24">+ <div class="max-w-4xl mx-auto px-6 py-8 md:py-24">+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">{- contactOptions.map(option => (- <a href={option.href} target="_blank" rel="noopener noreferrer" class="flex items-center gap-3 border rounded-lg bg-background p-4 hover:(border-primary) transition">- <div class="flex items-center justify-center bg-primary/5 rounded-lg size-10">- <div class={cn(option.icon, 'size-7 bg-primary')} />- </div>- <div class="flex-1">- <div class="font-semibold text-base lh-tight">{option.name}</div>- <div class="text-sm text-muted-foreground lh-tight">{option.label}</div>- </div>-- <div class="flex items-center">- <div class="i-tabler-external-link size-5 text-muted-foreground" />+ generalCards.map(card => (+ <div class={cn('border border-border rounded-lg p-6 bg-background/50')}>+ <div class="size-14 flex items-center justify-center bg-primary/10 rounded-xl">+ <div class={`${card.icon} size-8 text-primary`} aria-hidden="true" /></div>- </a>+ <h2 class="text-2xl font-semibold mt-4 mb-3">{card.title}</h2>+ <p class="text-base text-muted-foreground mb-4">{card.description}</p>+ {card.email+? (+ <a+ href={`mailto:${card.email}`}+ class="text-base font-semibold text-primary hover:underline"+ >+ {card.email}+ </a>+ )+: card.button+? (+ <a+ href={card.button.url}+ class="text-base font-semibold bg-primary rounded-lg py-2 px-4 text-primary-foreground transition hover:bg-primary/80 inline-flex items-center"+ target="_blank"+ rel="noopener noreferrer"+ >+ <div class={`${card.button.icon} size-6 inline-block mr-2`} aria-hidden="true" />+ {card.button.label}+ </a>+ )+: null}+ </div>))}+ </div>++ <div class="flex flex-col md:flex-row justify-between items-center gap-8 border rounded-lg mt-8 p-6 bg-background/50">+ <div>+ <h2 class="text-2xl font-semibold mb-3">{t('contact.connect.title')}</h2>+ <p class="text-base text-muted-foreground">{t('contact.connect.description')}</p>+ </div>+ <div class="flex items-center gap-4 flex-wrap md:flex-nowrap">+ {+ socials.map(social => (+ <a+ href={social.url}+ target="_blank"+ rel="noopener noreferrer"+ aria-label={social.name}+ class="size-12 text-primary bg-primary/10 rounded-lg flex items-center justify-center hover:bg-primary/20 transition"+ title={social.name}+ >+ <div class={cn('size-6', social.icon)} aria-hidden="true" />+ </a>+ ))+ }+ </div>+ </div></div><Footer class="bg-background" />diff --git a/src/socials.ts b/src/socials.tsnew file mode 100644index 00000000..3fc5209d--- /dev/null+++ b/src/socials.ts@@ -0,0 +1,71 @@+import type { Translator } from './i18n/i18n';+import { useI18n } from './i18n/i18n';++export const GITHUB_REPO_URL = 'https://github.com/papra-hq/papra';+export const GITHUB_ISSUES_URL = `${GITHUB_REPO_URL}/issues`;+export const DISCORD_INVITE_URL = 'https://papra.app/discord';++export function getSocials({+ t = useI18n().t,+}: {+ t: Translator;+}) {+ return [+ {+ id: 'github',+ name: t('socials.github.name'),+ label: t('socials.github.label'),+ url: GITHUB_REPO_URL,+ icon: 'i-tabler-brand-github',+ inHeader: true,+ },+ {+ id: 'discord',+ name: t('socials.discord.name'),+ label: t('socials.discord.label'),+ url: DISCORD_INVITE_URL,+ icon: 'i-tabler-brand-discord',+ inHeader: true,+ },+ {+ id: 'bluesky',+ name: t('socials.bluesky.name'),+ label: t('socials.bluesky.label'),+ url: 'https://bsky.app/profile/papra.app',+ icon: 'i-tabler-brand-bluesky',+ inHeader: true,+ },+ {+ id: 'mastodon',+ name: t('socials.mastodon.name'),+ label: t('socials.mastodon.label'),+ url: 'https://mastodon.social/@papra',+ icon: 'i-tabler-brand-mastodon',+ inHeader: true,+ },+ {+ id: 'x',+ name: t('socials.x.name'),+ label: t('socials.x.label'),+ url: 'https://x.com/papra_app',+ icon: 'i-tabler-brand-x',+ inHeader: true,+ },+ {+ id: 'reddit',+ name: t('socials.reddit.name'),+ label: t('socials.reddit.label'),+ url: 'https://www.reddit.com/r/Papra/',+ icon: 'i-tabler-brand-reddit',+ inHeader: false,+ },+ {+ id: 'linkedin',+ name: t('socials.linkedin.name'),+ label: t('socials.linkedin.label'),+ url: 'https://www.linkedin.com/company/papra-hq',+ icon: 'i-tabler-brand-linkedin',+ inHeader: false,+ },+ ];+}