Skip to content
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

team translations #320

Merged
merged 2 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function Account() {
const params = useParams();
const slug = Array.isArray(params.team) ? params.team[0] : params.team;
const { isPending, data, refetch } = useData(slug);
const t = useTranslations('pages.console.organisation.members');
const t = useTranslations('pages.console.team.members');

if (!data?.team) return <NotFoundScreen text={t('not_found')} />;
const team = data.team;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import { Team } from '@/schema/resources/team';
import { User } from '@/schema/resources/user';
import { useQuery } from '@tanstack/react-query';
import { ArrowRight } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';
import React from 'react';
import { z } from 'zod';
import { PageTitle } from '../../components/PageTitle';

export default function Account() {
const t = useTranslations('pages.console.team.overview');
const params = useParams();
const slug = Array.isArray(params.team) ? params.team[0] : params.team;

Expand All @@ -33,13 +35,13 @@ export default function Account() {

return (
<div className="flex flex-grow flex-col gap-6 pt-6">
<PageTitle team={team} title="Overview" />
<PageTitle team={team} title={t('title')} />
<div className="grid grid-cols-1 gap-16 xl:grid-cols-3">
<div className="space-y-12 xl:col-span-2">
<div className="space-y-6">
<div className="flex justify-between gap-8">
<h2 className="text-xl font-semibold">
Registrations
{t('registrations')}
</h2>
<Link
href={`/team/${slug}/registrations`}
Expand All @@ -48,8 +50,10 @@ export default function Account() {
})}
>
{registration_count >= 6
? `View all ${registration_count} registrations`
: 'View all registrations'}
? t('registration-count.multiple', {
registration_count,
})
: t('registration-count.single')}
<ArrowRight className="ml-2 h-4 w-4" />
</Link>
</div>
Expand All @@ -66,16 +70,18 @@ export default function Account() {
<div className="space-y-12">
<div className="space-y-6">
<div className="flex items-center justify-between gap-8">
<h2 className="text-xl font-semibold">Members</h2>
<h2 className="text-xl font-semibold">
{t('members')}
</h2>
<Link
href={`/team/${slug}/members`}
className={buttonVariants({
variant: 'outline',
})}
>
{player_count >= 6
? `View all ${player_count} members`
: 'View all members'}
? t('member-count.multiple')
: t('member-count.single')}
<ArrowRight className="ml-2 h-4 w-4" />
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useTeam, useUpdateTeam } from '@/lib/Queries/Team';
import { useSurreal } from '@/lib/Surreal';
import { brand_name } from '@/lib/branding';
import { useRouter } from '@/locales/navigation';
import { Team } from '@/schema/resources/team';
import { zodResolver } from '@hookform/resolvers/zod';
Expand All @@ -24,6 +23,7 @@ import { z } from 'zod';
import { PageTitle } from '../../components/PageTitle';

export default function Account() {
const t = useTranslations('pages.console.team.settings');
const params = useParams();
const slug = Array.isArray(params.team) ? params.team[0] : params.team;
const { isPending, data: team, refetch } = useTeam<Team>({ slug });
Expand All @@ -34,39 +34,36 @@ export default function Account() {
<LoaderOverlay />
) : team ? (
<div className="flex max-w-2xl flex-grow flex-col gap-6 pt-6">
<PageTitle team={team} title="Settings" />
<PageTitle team={team} title={t('title')} />
<div className="flex w-full items-center justify-between gap-16 rounded-lg border p-6">
<div className="flex flex-col gap-6">
<div className="space-y-2">
<h2 className="text-xl font-bold">Team Logo</h2>
<p>
This is the public logo of your team, shown all
throughout {brand_name}.
</p>
<h2 className="text-xl font-bold">{t('logo.title')}</h2>
<p>{t('logo.description')}</p>
</div>
<UploadImage
intent="logo"
actor={team}
triggerRefresh={refetch}
title={'change logo'}
description={'cjamge'}
title={t('logo.change')}
description={t('logo.description')}
/>
</div>
<Avatar profile={team} renderBadge={false} size="huge" />
</div>
<EditorBox
title="Team name"
description={`This is the public name of your team, shown all throughout ${brand_name}.`}
submit="Save name"
title={t('name.title')}
description={t('name.description')}
submit={t('name.submit')}
defaultValue={team.name}
mutate={mutate}
Schema={Team.pick({ name: true })}
field="name"
/>
<EditorBox
title="Team description"
description={`This is the public description of your team, shown all throughout ${brand_name}.`}
submit="Save description"
title={t('description.title')}
description={t('description.description')}
submit={t('description.submit')}
defaultValue={team.description}
mutate={mutate}
Schema={Team.pick({ description: true })}
Expand All @@ -76,7 +73,7 @@ export default function Account() {
<DangerZone team={team} />
</div>
) : (
<NotFoundScreen text="Team not found" />
<NotFoundScreen text={t('not_found')} />
);
}

Expand Down
16 changes: 12 additions & 4 deletions src/app/[locale]/(console)/team/[team]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import { useAuth } from '@/lib/auth';
import { useRouter } from '@/locales/navigation';
import { User } from '@/schema/resources/user';
import { ArrowLeft } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { useParams } from 'next/navigation';
import React, { ReactNode, useEffect } from 'react';

export default function TeamLayout({ children }: { children: ReactNode }) {
const t = useTranslations('pages.console.team');
const router = useRouter();
const params = useParams();
const slug = Array.isArray(params.team) ? params.team[0] : params.team;
Expand All @@ -41,12 +43,18 @@ export default function TeamLayout({ children }: { children: ReactNode }) {
<NavbarSubLink>
<ArrowLeft />
</NavbarSubLink>
<NavbarSubLink link="overview">Overview</NavbarSubLink>
<NavbarSubLink link="overview">
{t('overview.title')}
</NavbarSubLink>
<NavbarSubLink link="registrations">
Registrations
{t('registration.title')}
</NavbarSubLink>
<NavbarSubLink link="members">
{t('members.title')}
</NavbarSubLink>
<NavbarSubLink link="settings">
{t('settings.title')}
</NavbarSubLink>
<NavbarSubLink link="members">Members</NavbarSubLink>
<NavbarSubLink link="settings">Settings</NavbarSubLink>
</NavbarSubLinks>
</Navbar>
<div className="flex flex-grow flex-col pb-24 pt-8">
Expand Down
41 changes: 41 additions & 0 deletions src/locales/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,47 @@
"confirmed": "Registration confirmed!"
}
}
},
"team": {
"overview": {
"title": "Overview",
"registrations": "Registrations",
"members": "Members",
"registration-count": {
"single": "View registrations",
"multiple": "View all {registration_count} registrations"
},
"member-count": {
"single": "View members",
"multiple": "View all {player_count} members"
}
},
"registration": {
"title": "Registrations"
},
"members": {
"title": "Members",
"not_found": "Team not found"
},
"settings": {
"title": "Settings",
"not_found": "Team not found",
"logo": {
"title": "Team Logo",
"description": "This is the public logo of your team, shown all throughout {brand_name}.",
"change": "change logo"
},
"name": {
"title": "Team name",
"description": "This is the public name of your team, shown all throughout {brand_name}.",
"submit": "Save name"
},
"description": {
"title": "Team description",
"description": "This is the public description of your team, shown all throughout {brand_name}.",
"submit": "Save description"
}
}
}
},
"account": {
Expand Down
41 changes: 41 additions & 0 deletions src/locales/nl/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,47 @@
},
"user-not-found": "Gebruiker niet gevonden"
}
},
"team": {
"overview": {
"member-count": {
"multiple": "Bekijk alle {player_count} leden",
"single": "Bekijk leden"
},
"members": "Leden",
"registration-count": {
"multiple": "Bekijk alle {registration_count} registraties",
"single": "Bekijk registraties"
},
"registrations": "Registraties",
"title": "Overzicht"
},
"members": {
"not_found": "Team niet gevonden",
"title": "Leden"
},
"registration": {
"title": "Registraties"
},
"settings": {
"description": {
"description": "Dit is de openbare beschrijving van je team, die overal in {brand_name} wordt weergegeven.",
"submit": "Beschrijving opslaan",
"title": "Teambeschrijving"
},
"logo": {
"change": "logo wijzigen",
"description": "Dit is het openbare logo van je team, dat overal in {brand_name} wordt weergegeven.",
"title": "Teamlogo"
},
"name": {
"description": "Dit is de openbare naam van je team, die overal in {brand_name} wordt weergegeven.",
"submit": "Naam opslaan",
"title": "Teamnaam"
},
"not_found": "Team niet gevonden",
"title": "Instellingen"
}
}
},
"account": {
Expand Down
Loading