forked from baron/baron-sso
i18n 누락 키 보완 및 biome 포맷 정리
This commit is contained in:
@@ -111,7 +111,7 @@ function AppLayout() {
|
||||
const currentRole = resolveProfileRole(
|
||||
auth.user?.profile as Record<string, unknown> | undefined,
|
||||
);
|
||||
|
||||
|
||||
// Use profile.role from API if available, otherwise fallback to local role
|
||||
const displayRoleKey = profile?.role || currentRole;
|
||||
|
||||
@@ -331,12 +331,18 @@ function AppLayout() {
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center pt-1">
|
||||
<Badge variant="outline" className="text-[10px] px-2 py-0">
|
||||
{t(`ui.common.role.${displayRoleKey}`, displayRoleKey.toUpperCase())}
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-[10px] px-2 py-0"
|
||||
>
|
||||
{t(
|
||||
`ui.common.role.${displayRoleKey}`,
|
||||
displayRoleKey.toUpperCase(),
|
||||
)}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
@@ -349,7 +355,7 @@ function AppLayout() {
|
||||
<UserIcon size={16} className="text-muted-foreground" />
|
||||
<span>{t("ui.dev.profile.title", "내 정보")}</span>
|
||||
</button>
|
||||
|
||||
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { User, Shield, Briefcase, Mail, Fingerprint, Building2 } from "lucide-react";
|
||||
import {
|
||||
User,
|
||||
Shield,
|
||||
Briefcase,
|
||||
Mail,
|
||||
Fingerprint,
|
||||
Building2,
|
||||
} from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { useAuth } from "react-oidc-context";
|
||||
import {
|
||||
@@ -16,7 +23,11 @@ function ProfilePage() {
|
||||
const auth = useAuth();
|
||||
const hasAccessToken = Boolean(auth.user?.access_token);
|
||||
|
||||
const { data: profile, isLoading, error } = useQuery({
|
||||
const {
|
||||
data: profile,
|
||||
isLoading,
|
||||
error,
|
||||
} = useQuery({
|
||||
queryKey: ["userMe"],
|
||||
queryFn: fetchMe,
|
||||
enabled: hasAccessToken,
|
||||
@@ -41,8 +52,13 @@ function ProfilePage() {
|
||||
}
|
||||
|
||||
// Fallback to token information if API data is incomplete
|
||||
const displayTenant = profile.tenant?.name || profile.tenantId || auth.user?.profile?.tenant_id?.toString() || "-";
|
||||
const displayCompanyCode = profile.companyCode || auth.user?.profile?.companyCode?.toString() || "-";
|
||||
const displayTenant =
|
||||
profile.tenant?.name ||
|
||||
profile.tenantId ||
|
||||
auth.user?.profile?.tenant_id?.toString() ||
|
||||
"-";
|
||||
const displayCompanyCode =
|
||||
profile.companyCode || auth.user?.profile?.companyCode?.toString() || "-";
|
||||
|
||||
return (
|
||||
<div className="space-y-6 max-w-4xl mx-auto">
|
||||
@@ -139,9 +155,7 @@ function ProfilePage() {
|
||||
<p className="text-sm font-medium text-muted-foreground">
|
||||
{t("ui.dev.profile.org.tenant", "테넌트")}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
{displayTenant}
|
||||
</p>
|
||||
<p className="text-sm">{displayTenant}</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<p className="text-sm font-medium text-muted-foreground">
|
||||
@@ -178,7 +192,10 @@ function ProfilePage() {
|
||||
{t("ui.dev.profile.role.current", "Current Role")}
|
||||
</p>
|
||||
<p className="text-xl font-bold mt-1">
|
||||
{t(`ui.common.role.${profile.role}`, profile.role.toUpperCase())}
|
||||
{t(
|
||||
`ui.common.role.${profile.role}`,
|
||||
profile.role.toUpperCase(),
|
||||
)}
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
{t(
|
||||
|
||||
@@ -9,7 +9,9 @@ export function normalizeRole(rawRole: unknown): string {
|
||||
return role;
|
||||
}
|
||||
|
||||
export function resolveProfileRole(profile: Record<string, unknown> | undefined) {
|
||||
export function resolveProfileRole(
|
||||
profile: Record<string, unknown> | undefined,
|
||||
) {
|
||||
if (!profile) return "";
|
||||
const candidates = [
|
||||
profile.role,
|
||||
|
||||
@@ -93,8 +93,12 @@ test.describe("DevFront role report", () => {
|
||||
await page
|
||||
.getByPlaceholder("My Awesome Application")
|
||||
.fill("Tenant A CRM Updated");
|
||||
|
||||
const updatePromise = page.waitForResponse(r => r.url().includes('/api/v1/dev/clients') && r.request().method() === 'PUT');
|
||||
|
||||
const updatePromise = page.waitForResponse(
|
||||
(r) =>
|
||||
r.url().includes("/api/v1/dev/clients") &&
|
||||
r.request().method() === "PUT",
|
||||
);
|
||||
await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
|
||||
await updatePromise;
|
||||
|
||||
@@ -133,8 +137,12 @@ test.describe("DevFront role report", () => {
|
||||
await page
|
||||
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
|
||||
.fill("https://super-admin.example.com/callback");
|
||||
|
||||
const createPromise = page.waitForResponse(r => r.url().includes('/api/v1/dev/clients') && r.request().method() === 'POST');
|
||||
|
||||
const createPromise = page.waitForResponse(
|
||||
(r) =>
|
||||
r.url().includes("/api/v1/dev/clients") &&
|
||||
r.request().method() === "POST",
|
||||
);
|
||||
await page.getByRole("button", { name: /앱 생성|Create/i }).click();
|
||||
await createPromise;
|
||||
|
||||
|
||||
@@ -1160,6 +1160,31 @@ menu_aria = "Open account menu"
|
||||
menu_title = "Account"
|
||||
unknown_email = "unknown@example.com"
|
||||
unknown_name = "Unknown User"
|
||||
title = "My Profile"
|
||||
subtitle = "View user details and assigned roles."
|
||||
loading = "Loading profile..."
|
||||
error = "Failed to load profile."
|
||||
|
||||
[ui.dev.profile.tab]
|
||||
basic = "Basic Info"
|
||||
role = "Roles & Permissions"
|
||||
|
||||
[ui.dev.profile.basic]
|
||||
title = "User Info"
|
||||
id = "User ID"
|
||||
name = "Name"
|
||||
email = "Email"
|
||||
phone = "Phone Number"
|
||||
|
||||
[ui.dev.profile.org]
|
||||
title = "Organization Info"
|
||||
tenant = "Tenant"
|
||||
company_code = "Company Code"
|
||||
|
||||
[ui.dev.profile.role]
|
||||
title = "System Role"
|
||||
description = "The permission level granted to this account."
|
||||
current = "Current Role"
|
||||
|
||||
[ui.dev.clients]
|
||||
copy_client_id = "Copy client id"
|
||||
|
||||
@@ -1160,6 +1160,31 @@ menu_aria = "계정 메뉴 열기"
|
||||
menu_title = "계정"
|
||||
unknown_email = "unknown@example.com"
|
||||
unknown_name = "Unknown User"
|
||||
title = "내 정보"
|
||||
subtitle = "사용자 상세 정보 및 할당된 역할(Role)을 확인합니다."
|
||||
loading = "프로필 정보를 불러오는 중..."
|
||||
error = "프로필 정보를 불러오지 못했습니다."
|
||||
|
||||
[ui.dev.profile.tab]
|
||||
basic = "기본 정보"
|
||||
role = "권한 및 역할"
|
||||
|
||||
[ui.dev.profile.basic]
|
||||
title = "사용자 정보"
|
||||
id = "사용자 ID"
|
||||
name = "이름"
|
||||
email = "이메일"
|
||||
phone = "전화번호"
|
||||
|
||||
[ui.dev.profile.org]
|
||||
title = "조직 정보"
|
||||
tenant = "테넌트"
|
||||
company_code = "회사 코드"
|
||||
|
||||
[ui.dev.profile.role]
|
||||
title = "시스템 역할"
|
||||
description = "현재 계정에 부여된 권한 등급입니다."
|
||||
current = "현재 역할"
|
||||
|
||||
[ui.dev.clients]
|
||||
copy_client_id = "Copy client id"
|
||||
|
||||
@@ -1025,6 +1025,31 @@ menu_aria = ""
|
||||
menu_title = ""
|
||||
unknown_email = ""
|
||||
unknown_name = ""
|
||||
title = ""
|
||||
subtitle = ""
|
||||
loading = ""
|
||||
error = ""
|
||||
|
||||
[ui.dev.profile.tab]
|
||||
basic = ""
|
||||
role = ""
|
||||
|
||||
[ui.dev.profile.basic]
|
||||
title = ""
|
||||
id = ""
|
||||
name = ""
|
||||
email = ""
|
||||
phone = ""
|
||||
|
||||
[ui.dev.profile.org]
|
||||
title = ""
|
||||
tenant = ""
|
||||
company_code = ""
|
||||
|
||||
[ui.dev.profile.role]
|
||||
title = ""
|
||||
description = ""
|
||||
current = ""
|
||||
|
||||
[ui.dev.clients]
|
||||
new = ""
|
||||
|
||||
Reference in New Issue
Block a user