feat(ui): unknown writer label fallback + i18n (en/vi/zh)

This commit is contained in:
viettranx committed 2026-04-18 21:35:54 +07:00
1 parent f1c1a466f0
commit 78e2882335
4 files changed
+9 -1

No files matched your search

+1
View File
@@ -1002,6 +1002,7 @@
"noRules": "No permission rules. Owner has implicit full access.",
"userIdPlaceholder": "Search contacts or type ID...",
"scopePlaceholder": "Select or type scope...",
"unknownWriterLabel": "User {{id}}",
"types": {
"file_writer": "File Writer",
"file_writer_desc": "Controls who can edit files and manage cron in group chats. First user auto-added.",
+1
View File
@@ -987,6 +987,7 @@
"noRules": "Chưa có quy tắc. Chủ sở hữu mặc định có đầy đủ quyền.",
"userIdPlaceholder": "Tìm liên hệ hoặc nhập ID...",
"scopePlaceholder": "Chọn hoặc nhập phạm vi...",
"unknownWriterLabel": "Người dùng {{id}}",
"types": {
"file_writer": "Quyền viết file",
"file_writer_desc": "Ai được chỉnh sửa file và quản lý cron trong nhóm chat. Người đầu tiên tự động được thêm.",
+1
View File
@@ -987,6 +987,7 @@
"noRules": "暂无权限规则。所有者默认拥有完全访问权限。",
"userIdPlaceholder": "搜索联系人或输入ID...",
"scopePlaceholder": "选择或输入范围...",
"unknownWriterLabel": "用户 {{id}}",
"types": {
"file_writer": "文件编辑",
"file_writer_desc": "控制谁可以在群聊中编辑文件和管理定时任务。首位用户自动添加。",
@@ -237,7 +237,12 @@ export function AgentPermissionsTab({ agentId }: AgentPermissionsTabProps) {
<span className="text-xs font-medium text-muted-foreground">{scopeLabels.get(scopeKey) ?? scopeKey}</span>
</div>
{writers.map((p) => {
const label = p.metadata?.displayName || formatUserLabel(p.userId, resolve);
// Label preference: displayName → contact resolver → "User <id>" fallback.
// Username is rendered separately next to the label when present.
const resolved = formatUserLabel(p.userId, resolve);
const isNumericFallback = /^#?-?\d+$/.test(resolved);
const label = p.metadata?.displayName
|| (isNumericFallback ? t("permissions.unknownWriterLabel", { id: p.userId }) : resolved);
const username = p.metadata?.username ? ` @${p.metadata.username}` : "";
return (
<div key={p.id} className="flex items-center justify-between gap-2 px-3 py-2 pl-7">