From 47bc6653460132ba2b51662336c0e9fd9f6dcd05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Benedek?= Date: Sat, 13 Jun 2026 11:30:01 +0200 Subject: [PATCH] =?UTF-8?q?Removed=20hardcoded=20instances=20of=20"tank?= =?UTF-8?q?=C3=B6r"=20to=20use=20the=20value=20of=20groupTitle=20where=20u?= =?UTF-8?q?seful?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/profile.groupChange.page.tsx | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/profile/profile.groupChange.page.tsx b/frontend/src/pages/profile/profile.groupChange.page.tsx index d503ec66..59050156 100644 --- a/frontend/src/pages/profile/profile.groupChange.page.tsx +++ b/frontend/src/pages/profile/profile.groupChange.page.tsx @@ -1,6 +1,9 @@ +import { useConfigContext } from '@/api/contexts/config/ConfigContext.tsx' +import type { Profile } from '@/api/contexts/config/types.ts' import { useServiceContext } from '@/api/contexts/service/ServiceContext' import { useGroupChangeMutation } from '@/api/hooks/group-change/useGroupChangeMutation' import { useProfileQuery } from '@/api/hooks/profile/useProfileQuery.ts' +import { ComponentUnavailable } from '@/common-components/ComponentUnavailable.tsx' import { CmschPage } from '@/common-components/layout/CmschPage' import { LinkButton } from '@/common-components/LinkButton' import { PageStatus } from '@/common-components/PageStatus.tsx' @@ -16,13 +19,25 @@ import { Navigate, useNavigate } from 'react-router' export function ProfileGroupChangePage() { const { isLoading, isError, data: profile, refetch } = useProfileQuery() + const config = useConfigContext()?.components + const component = config?.profile + + if (!component) return if (isError || isLoading || !profile) return if (!profile || !profile.groupSelectionAllowed) return - return + return } -function ProfileGroupChangeBody({ profile, refetch }: { profile: ProfileView; refetch: () => void }) { +function ProfileGroupChangeBody({ + profile, + profileComponent, + refetch +}: { + profile: ProfileView + profileComponent: Profile + refetch: () => void +}) { const availableGroups = profile.availableGroups ? Object.entries(profile.availableGroups).toSorted((a, b) => a[1].localeCompare(b[1])) : [] @@ -40,7 +55,7 @@ function ProfileGroupChangeBody({ profile, refetch }: { profile: ProfileView; re navigate(AbsolutePaths.PROFILE) break case GroupChangeStatus.INVALID_GROUP: - setError('Érvénytelen tankör!') + setError(`Érvénytelen ${profileComponent.groupTitle}!`) break case GroupChangeStatus.LEAVE_DENIED: setError('Nem engedélyezett a módosítás!') @@ -60,14 +75,16 @@ function ProfileGroupChangeBody({ profile, refetch }: { profile: ProfileView; re const onSubmit = () => { if (value) mutate(value) - else setError('Válassz tankört!') + else setError(`Válassz ${profileComponent.groupTitle}-t!`) } return ( - -

Tankör beállítása

-

Állítsd be a tankörödet, hogy részt vehess a feladatokban!

-

Csak helyesen beállított tankörrel fog érvényesülni a tanköri jelenlét!

+ +

{`${profileComponent.groupTitle} beállítása`}

+

Állíts be saját {profileComponent.groupTitle}-t, hogy részt vehess a feladatokban!

+ {profileComponent.showMinimumTokenMessage && ( +

Csak helyesen beállított tankör esetén fog érvényesülni a tanköri jelenlét!

+ )} {availableGroups.length ? (
{ @@ -77,10 +94,10 @@ function ProfileGroupChangeBody({ profile, refetch }: { profile: ProfileView; re >
- +