Skip to content

Commit

Permalink
Add missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
kearfy committed Apr 14, 2024
1 parent 5c1437a commit 6630b06
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,19 @@ export default function Account() {
/>
</Link>
</div>
<Tab value="overview">Overview</Tab>
<Tab value="attendees">Attendees</Tab>
<Tab value="events">Events</Tab>
<Tab value="overview">
{t('page.overview.title')}
</Tab>
<Tab value="attendees">
{t('page.attendees.title')}
</Tab>
<Tab value="events">{t('page.events.title')}</Tab>
{organisation.can_manage && (
<Tab
value="settings"
className="bg-transparent"
>
Settings
{t('page.settings.title')}
</Tab>
)}
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Actor } from '@/schema/resources/actor';
import { Event } from '@/schema/resources/event';
import { zodResolver } from '@hookform/resolvers/zod';
import { AlertOctagon, Loader2 } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';
import React, { useCallback } from 'react';
import { useForm } from 'react-hook-form';
Expand All @@ -28,6 +29,9 @@ export function EventSettingsTab({
event: Event;
refetch: () => unknown;
}) {
const t = useTranslations(
'pages.console.organisation.events.page.settings'
);
const { mutateAsync } = useUpdateEvent(event.id);
const onSubmit = useCallback(
async (payload: Partial<Event>) => {
Expand Down Expand Up @@ -76,30 +80,30 @@ export function EventSettingsTab({
<UploadImage
intent="logo"
actor={event as unknown as Actor}
title="Upload Logo"
description="Upload Logo"
title={t('change-logo.title')}
description={t('change-logo.description')}
triggerRefresh={refetch}
trigger={
<Button
variant="ghost"
className="bg-white/10 backdrop-blur-lg hover:bg-white/20"
>
Change logo
{t('change-logo.trigger')}
</Button>
}
/>
<UploadImage
intent="banner"
actor={event as unknown as Actor}
title="Upload Banner"
description="Upload banner"
title={t('change-banner.title')}
description={t('change-banner.description')}
triggerRefresh={refetch}
trigger={
<Button
variant="ghost"
className="bg-white/10 backdrop-blur-lg hover:bg-white/20"
>
Change banner
{t('change-banner.trigger')}
</Button>
}
/>
Expand Down
18 changes: 17 additions & 1 deletion src/app/[locale]/(public)/account/create-profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useSurreal } from '@/lib/Surreal';
import { useAuth } from '@/lib/auth';
import { privacy_policy } from '@/lib/branding';
import { useFeatureFlags } from '@/lib/featureFlags';
import { cn } from '@/lib/utils';
import { useWebAuthnAvailable } from '@/lib/webauthn';
Expand All @@ -27,6 +28,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
import jwt from 'jsonwebtoken';
import { Info, Loader2, XCircle } from 'lucide-react';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
import React, { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
Expand Down Expand Up @@ -209,13 +211,27 @@ export default function CreateProfile() {
)}
</div>
</CardContent>
<CardFooter>
<CardFooter className="flex flex-col gap-2">
<Button
disabled={!isValid || !isBirthdateReady}
type="submit"
>
{t('button.continue')}
</Button>
{privacy_policy && (
<p>
{t.rich('privacy-policy', {
link: (children) => (
<Link
href={privacy_policy ?? '#'}
target="_blank"
>
{children}
</Link>
),
})}
</p>
)}
</CardFooter>
</Card>
</form>
Expand Down
44 changes: 28 additions & 16 deletions src/app/[locale]/(public)/e/[event]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { linkToProfile } from '@/schema/resources/profile';
import { useQuery } from '@tanstack/react-query';
import { Share } from 'lucide-react';
import { useLocale } from 'next-intl';
import { useLocale, useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';
import React, { Fragment, useMemo, useState } from 'react';
import { z } from 'zod';
Expand All @@ -41,6 +41,7 @@ export default function Page() {
const params = useParams();
const slug = Array.isArray(params.event) ? params.event[0] : params.event;
const share = useShare();
const t = useTranslations('pages.e.index');

const locale = useLocale();
const order = useState<'desc' | 'asc'>('asc');
Expand Down Expand Up @@ -71,7 +72,7 @@ export default function Page() {

if (isPending) return <LoaderOverlay />;

if (!data || !data.event) return <NotFoundScreen text="Event not found" />;
if (!data || !data.event) return <NotFoundScreen text={t('not-found')} />;

const {
event,
Expand Down Expand Up @@ -164,7 +165,7 @@ export default function Page() {
'bg-white/10 backdrop-blur hover:bg-white/20'
)}
>
Manage
{t('banner.manage')}
</Link>
)}
{!event.is_tournament && (
Expand All @@ -181,8 +182,8 @@ export default function Page() {
className={buttonVariants()}
>
{registration
? 'Manage registration'
: 'Register'}
? t('banner.registration.manage')
: t('banner.registration.register')}
</Link>
)}
</div>
Expand All @@ -192,7 +193,9 @@ export default function Page() {
{events.length > 0 && (
<div className="space-y-6 md:col-span-2 xl:col-span-3">
<div className="flex items-center justify-between pb-2">
<h2 className="text-2xl font-semibold">Events</h2>
<h2 className="text-2xl font-semibold">
{t('details.title')}
</h2>
<Pagination
count={count}
pagination={pagination}
Expand All @@ -205,8 +208,11 @@ export default function Page() {
<div className="space-y-6 md:col-span-2">
<div className="space-y-2">
<h2 className="pb-2 text-2xl font-semibold">
About the{' '}
{event.is_tournament ? 'tournament' : 'event'}
{t(
event.is_tournament
? 'details.about.title-tournament'
: 'details.about.title-event'
)}
</h2>
{event.computed.description && (
<div className="pb-2 text-foreground/75">
Expand All @@ -219,7 +225,7 @@ export default function Page() {
{event.start && (
<div className="space-y-1">
<h3 className="text-md font-semibold">
Start of event
{t('details.about.start')}
</h3>
<p className="text-sm text-foreground/75">
<DateTooltip date={event.start} forceTime />
Expand All @@ -229,7 +235,7 @@ export default function Page() {
{event.end && (
<div className="space-y-1">
<h3 className="text-md font-semibold">
End of event
{t('details.about.end')}
</h3>
<p className="text-sm text-foreground/75">
<DateTooltip date={event.end} forceTime />
Expand All @@ -239,7 +245,7 @@ export default function Page() {
{tournament && (
<div className="space-y-3">
<h3 className="text-md font-semibold">
Tournament
{t('details.about.tournament')}
</h3>
<div className="flex flex-col gap-3">
<Profile
Expand All @@ -255,7 +261,9 @@ export default function Page() {
)}
{location && (
<div className="space-y-3">
<h3 className="text-md font-semibold">Location</h3>
<h3 className="text-md font-semibold">
{t('details.about.location')}
</h3>
<div className="w-full rounded-lg border p-2">
<iframe
width="100%"
Expand All @@ -269,7 +277,7 @@ export default function Page() {
</div>
<div className="space-y-6 md:col-span-2">
<h2 className="pb-2 text-2xl font-semibold">
About the organiser
{t('details.organiser.title')}
</h2>
<Profile
profile={organiser}
Expand All @@ -285,15 +293,19 @@ export default function Page() {
</p>
)}
<div className="space-y-1">
<h3 className="text-md font-semibold">Email address</h3>
<h3 className="text-md font-semibold">
{t('details.organiser.email')}
</h3>
<p className="text-sm text-foreground/75">
{organiser.email}
</p>
</div>
{organiser.website && (
<div className="space-y-1">
<h3 className="text-md font-semibold">Website</h3>
<p className="text-sm text-foreground/75">
<h3 className="text-md font-semibold">
{t('details.organiser.website')}
</h3>
<p className="text-sm text-foreground/75 hover:underline">
<Link href={organiser.website} target="_blank">
{organiser.website}
</Link>
Expand Down
Loading

0 comments on commit 6630b06

Please sign in to comment.