Compare commits

...

3 commits

7 changed files with 23 additions and 5 deletions

View file

@ -1,4 +1,5 @@
NEXT_PUBLIC_API_URL="https://api.a10y.techwork.zone" NEXT_PUBLIC_API_URL="https://api.a10y.techwork.zone"
NEXT_PUBLIC_HOSTNAME=availability.techwork.zone
# Google auth for calendar syncing, feature will be disabled if these aren't set # Google auth for calendar syncing, feature will be disabled if these aren't set
# NEXT_PUBLIC_GOOGLE_CLIENT_ID="" # NEXT_PUBLIC_GOOGLE_CLIENT_ID=""

View file

@ -46,5 +46,10 @@
"sass": "^1.63.4", "sass": "^1.63.4",
"typescript": "^5.1.3", "typescript": "^5.1.3",
"typescript-plugin-css-modules": "^5.0.1" "typescript-plugin-css-modules": "^5.0.1"
},
"prettier": {
"semi": false,
"arrowParens": "avoid",
"singleQuote": true
} }
} }

View file

@ -12,6 +12,7 @@ import { makeClass, relativeTimeFormat } from '/src/utils'
import EventAvailabilities from './EventAvailabilities' import EventAvailabilities from './EventAvailabilities'
import styles from './page.module.scss' import styles from './page.module.scss'
import appLink from '/src/utils/appLink'
interface PageProps { interface PageProps {
params: { id: string } params: { id: string }
@ -49,10 +50,10 @@ const Page = async ({ params }: PageProps) => {
>{t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })}</span> >{t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })}</span>
<Copyable className={styles.info}> <Copyable className={styles.info}>
{`https://crab.fit/${event.id}`} {appLink(event.id)}
</Copyable> </Copyable>
<p className={makeClass(styles.info, styles.noPrint)}> <p className={makeClass(styles.info, styles.noPrint)}>
<Trans i18nKey="event:nav.shareinfo" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('event:nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('event:nav.email_body')} https://crab.fit/${event.id}`)}`}>_</a>_</Trans> <Trans i18nKey="event:nav.shareinfo" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('event:nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('event:nav.email_body')} ${appLink(event.id)}`)}`}>_</a>_</Trans>
</p> </p>
</Content> </Content>
</Suspense> </Suspense>

View file

@ -8,11 +8,12 @@ import { fallbackLng } from '/src/i18n/options'
import { useTranslation } from '/src/i18n/server' import { useTranslation } from '/src/i18n/server'
import './global.css' import './global.css'
import appLink from '../utils/appLink'
const karla = Karla({ subsets: ['latin'] }) const karla = Karla({ subsets: ['latin'] })
export const metadata: Metadata = { export const metadata: Metadata = {
metadataBase: new URL('https://crab.fit'), metadataBase: new URL(appLink('')),
title: { title: {
absolute: 'Crab Fit', absolute: 'Crab Fit',
template: '%s - Crab Fit', template: '%s - Crab Fit',

View file

@ -5,6 +5,7 @@ import { EventResponse } from '/src/config/api'
import { useTranslation } from '/src/i18n/client' import { useTranslation } from '/src/i18n/client'
import styles from './EventInfo.module.scss' import styles from './EventInfo.module.scss'
import appLink from '/src/utils/appLink'
interface EventInfoProps { interface EventInfoProps {
event: EventResponse event: EventResponse
@ -16,10 +17,10 @@ const EventInfo = ({ event }: EventInfoProps) => {
return <div className={styles.wrapper}> return <div className={styles.wrapper}>
<h2>{event.name}</h2> <h2>{event.name}</h2>
<Copyable className={styles.info}> <Copyable className={styles.info}>
{`https://crab.fit/${event.id}`} {appLink(event.id)}
</Copyable> </Copyable>
<p className={styles.info}> <p className={styles.info}>
<Trans i18nKey="event:nav.shareinfo_alt" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('nav.email_body')} https://crab.fit/${event.id}`)}`} target="_blank">_</a>_</Trans> <Trans i18nKey="event:nav.shareinfo_alt" t={t} i18n={i18n}>_<a href={`mailto:?subject=${encodeURIComponent(t('nav.email_subject', { event_name: event.name }))}&body=${encodeURIComponent(`${t('nav.email_body')} ${appLink(event.id)}`)}`} target="_blank">_</a>_</Trans>
</p> </p>
</div> </div>
} }

View file

@ -6,6 +6,7 @@ import logo from '/src/res/logo.svg'
import { makeClass } from '/src/utils' import { makeClass } from '/src/utils'
import styles from './Header.module.scss' import styles from './Header.module.scss'
import appLink from '/src/utils/appLink'
const samuraiBob = localFont({ const samuraiBob = localFont({
src: './samuraibob.woff2', src: './samuraibob.woff2',
@ -37,6 +38,7 @@ const Header = async ({ isFull, isSmall }: HeaderProps) => {
</div> </div>
<span className={styles.tagline}>{t('common:tagline')}</span> <span className={styles.tagline}>{t('common:tagline')}</span>
</Link>} </Link>}
<p>{appLink('test')}</p>
</header> </header>
} }

View file

@ -0,0 +1,7 @@
export default function appLink(path: string) {
const proto = process?.env?.NODE_ENV === 'production' ? 'https' : 'http'
const host =
process?.env?.NEXT_PUBLIC_HOSTNAME ??
(process?.env?.NODE_ENV === 'production' ? 'crab.fit' : 'localhost:3000')
return `${proto}://${host}/${path}`
}