TorbatYar/frontend/modules/workspace/components/IdentityUserSelect.tsx
Mortezakoohjani a483b47369 feat(workspace): complete production workspace and content operations
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:54:17 +03:30

45 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import { Select } from "@/components/ds";
import { useTenantMembers } from "@/modules/workspace/hooks/useTenantMembers";
export function IdentityUserSelect({
value,
onChange,
allowEmpty = true,
emptyLabel = "تعیین نشده",
"aria-label": ariaLabel = "انتخاب عضو سازمان",
}: {
value?: string;
onChange: (userId: string) => void;
allowEmpty?: boolean;
emptyLabel?: string;
"aria-label"?: string;
}) {
const members = useTenantMembers();
if (members.isError) {
return (
<p className="rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-900 dark:bg-amber-950/30 dark:text-amber-200">
فهرست اعضای سازمان از سرویس هویت در دسترس نیست. عضو فعلی را می‌توانید بعداً اضافه کنید.
</p>
);
}
return (
<Select
aria-label={ariaLabel}
value={value || ""}
disabled={members.isLoading}
onChange={(event) => onChange(event.target.value)}
>
{allowEmpty ? <option value="">{emptyLabel}</option> : null}
{(members.data ?? []).map((person) => (
<option key={person.id} value={person.id}>
{person.label}
</option>
))}
</Select>
);
}