1
0
forked from baron/baron-sso

dev 병합 code-check 오류 수정

This commit is contained in:
2026-05-08 15:04:40 +09:00
parent 59cb482219
commit e78b2bea50
8 changed files with 144 additions and 28 deletions

View File

@@ -123,6 +123,7 @@ function createEmptyAppointment(): AppointmentDraft {
tenantId: "",
tenantName: "",
tenantSlug: "",
isPrimary: false,
isOwner: false,
jobTitle: "",
position: "",
@@ -554,6 +555,15 @@ function UserDetailPage() {
);
};
const setPrimaryAppointment = (targetIndex: number) => {
setAdditionalAppointments((current) =>
current.map((appointment, index) => ({
...appointment,
isPrimary: index === targetIndex,
})),
);
};
const handleUserTypeChange = (value: string) => {
const nextType = value as UserType;
setUserType(nextType);
@@ -645,6 +655,9 @@ function UserDetailPage() {
Array.isArray(rawAppointments)
? (rawAppointments as UserAppointment[]).map((appointment) => ({
...appointment,
isPrimary:
appointment.isPrimary === true ||
appointment.tenantId === primaryFromMetadata?.id,
draftId: createDraftId(),
}))
: isUserHanmacFamily
@@ -654,6 +667,7 @@ function UserDetailPage() {
tenantId: tenant.id,
tenantName: tenant.name,
tenantSlug: tenant.slug,
isPrimary: tenant.id === fallbackAppointment?.id,
isOwner:
metadata.primaryTenantIsOwner === true &&
tenant.id === fallbackAppointment?.id,
@@ -667,6 +681,7 @@ function UserDetailPage() {
tenantId: fallbackAppointment.id,
tenantName: fallbackAppointment.name,
tenantSlug: fallbackAppointment.slug,
isPrimary: true,
isOwner: metadata.primaryTenantIsOwner === true,
jobTitle: user.jobTitle,
position: user.position,
@@ -781,7 +796,15 @@ function UserDetailPage() {
payload.metadata = {
...metadata,
additionalAppointments: appointments,
primaryTenantId: primaryAppointment?.tenantId,
primaryTenantName: primaryAppointment?.tenantName,
primaryTenantSlug: primaryAppointment?.tenantSlug,
primaryTenantIsOwner: primaryAppointment?.isOwner ?? false,
};
payload.tenantSlug = primaryAppointment?.tenantSlug;
payload.primaryTenantId = primaryAppointment?.tenantId;
payload.primaryTenantName = primaryAppointment?.tenantName;
payload.primaryTenantIsOwner = primaryAppointment?.isOwner ?? false;
}
mutation.mutate(payload);

View File

@@ -33,7 +33,13 @@ import {
DialogTrigger,
} from "../../components/ui/dialog";
import { Input } from "../../components/ui/input";
import { Switch } from "../../components/ui/switch";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "../../components/ui/select";
import {
Table,
TableBody,
@@ -547,7 +553,7 @@ function UserListPage() {
/>
</TableHead>
<TableHead
className="min-w-[220px] cursor-pointer hover:bg-muted/50 transition-colors"
className="min-w-[220px] whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort("id")}
>
<div className="flex items-center">
@@ -556,7 +562,7 @@ function UserListPage() {
</div>
</TableHead>
<TableHead
className="min-w-[200px] cursor-pointer hover:bg-muted/50 transition-colors"
className="min-w-[200px] whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort("name_email")}
>
<div className="flex items-center">
@@ -568,7 +574,7 @@ function UserListPage() {
</div>
</TableHead>
<TableHead
className="cursor-pointer hover:bg-muted/50 transition-colors"
className="whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort("status")}
>
<div className="flex items-center">
@@ -577,7 +583,7 @@ function UserListPage() {
</div>
</TableHead>
<TableHead
className="cursor-pointer hover:bg-muted/50 transition-colors"
className="whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort("tenant_dept")}
>
<div className="flex items-center">
@@ -594,7 +600,7 @@ function UserListPage() {
visibleColumns[field.key] !== false && (
<TableHead
key={field.key}
className="uppercase cursor-pointer hover:bg-muted/50 transition-colors"
className="whitespace-nowrap uppercase cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort(field.key)}
>
<div className="flex items-center">
@@ -605,7 +611,7 @@ function UserListPage() {
),
)}
<TableHead
className="cursor-pointer hover:bg-muted/50 transition-colors"
className="whitespace-nowrap cursor-pointer hover:bg-muted/50 transition-colors"
onClick={() => requestSort("createdAt")}
>
<div className="flex items-center">
@@ -693,28 +699,42 @@ function UserListPage() {
)}
</div>
</div>
</TableCell>{" "}
</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<Switch
checked={user.status === "active"}
onCheckedChange={(checked) =>
<Select
value={user.status}
onValueChange={(value: "active" | "inactive") =>
statusMutation.mutate({
userId: user.id,
status: checked ? "active" : "inactive",
status: value,
})
}
disabled={
statusMutation.isPending ||
user.id === profile?.id
}
aria-label={t(
"ui.admin.users.list.toggle_status",
"{{name}} 활성 상태",
{ name: user.name },
)}
data-testid={`user-status-toggle-${user.id}`}
/>
>
<SelectTrigger
className="h-8 w-[112px]"
aria-label={t(
"ui.admin.users.list.toggle_status",
"{{name}} 활성 상태",
{ name: user.name },
)}
data-testid={`user-status-select-${user.id}`}
>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="active">
{t("ui.common.status.active", "활성")}
</SelectItem>
<SelectItem value="inactive">
{t("ui.common.status.inactive", "비활성")}
</SelectItem>
</SelectContent>
</Select>
<span className="text-sm text-muted-foreground">
{t(`ui.common.status.${user.status}`, user.status)}
</span>