🐛 fix(node): Locale and form

This commit is contained in:
web@ppanel 2024-12-13 20:43:46 +07:00
parent 11ea821f52
commit 38be4d53b0
5 changed files with 18 additions and 14 deletions

View File

@ -13,7 +13,7 @@ const securityConfigSchema = z
reality_public_key: nullableString,
reality_short_id: nullableString,
reality_server_addr: nullableString,
reality_server_port: portSchema,
reality_server_port: portSchema.nullish(),
})
.nullish();

View File

@ -278,7 +278,7 @@ export default function NodeForm<T extends { [x: string]: any }>({
>
<TabsList className='h-full w-full flex-wrap md:flex-nowrap'>
{protocols.map((proto) => (
<TabsTrigger value={proto}>
<TabsTrigger value={proto} key={proto}>
{proto.charAt(0).toUpperCase() + proto.slice(1)}
</TabsTrigger>
))}

View File

@ -31,7 +31,7 @@ export function NodeStatusCell({ status }: { status: API.NodeStatus }) {
const isOnline = last_at > 0;
const badgeVariant = isOnline ? 'default' : 'destructive';
const badgeText = isOnline ? t('normal') : t('abnormal');
const onlineCount = Array.isArray(online_users) ? online_users.length : 0;
const onlineCount = Array.isArray(online_users) ? online_users?.length : 0;
return (
<TooltipProvider>
@ -73,7 +73,7 @@ export function NodeStatusCell({ status }: { status: API.NodeStatus }) {
<div className='text-xs'>
{t('lastUpdated')}: {formatDate(serverStatus?.updated_at ?? 0)}
</div>
{isOnline && online_users.length > 0 && (
{isOnline && onlineCount > 0 && (
<div className='space-y-2'>
<h4 className='text-sm font-semibold'>{t('onlineUsers')}</h4>
<ScrollArea className='h-[400px] rounded-md border p-2'>

View File

@ -37,6 +37,7 @@
"delete": "Delete",
"deleteSuccess": "Deleted successfully",
"deleteWarning": "Data will not be recoverable after deletion. Please proceed with caution.",
"disk": "Disk",
"edit": "Edit",
"editNode": "Edit Node",
"enable": "Enable",
@ -85,7 +86,7 @@
"selectEncryptionMethod": "Select Encryption Method",
"selectNodeGroup": "Select Node Group",
"selectProtocol": "Select Protocol",
"serverAddr": "Server IP",
"serverAddr": "Server Address",
"serverName": "Service Name",
"speedLimit": "Speed Limit",
"speedLimitPlaceholder": "Unlimited",
@ -96,14 +97,17 @@
"transportPath": "Transport Path",
"transportServerName": "Transport Server Name"
},
"lastUpdated": "Last Updated",
"memory": "Memory",
"name": "Name",
"node": "Node",
"nodeGroup": "Node Group",
"normal": "Normal",
"onlineCount": "Online users",
"onlineUsers": "Online Users",
"rate": "Rate",
"relay": "Relay",
"serverAddr": "Server IP",
"serverAddr": "Server Address",
"speedLimit": "Speed Limit",
"status": "Status",
"trafficRatio": "Traffic Rate",

View File

@ -37,13 +37,10 @@
"delete": "删除",
"deleteSuccess": "删除成功",
"deleteWarning": "删除后,数据将无法恢复。请谨慎操作。",
"disk": "磁盘",
"edit": "编辑",
"editNode": "编辑节点",
"enable": "启用",
"memory": "内存",
"disk": "磁盘",
"lastUpdated": "最后更新",
"onlineUsers": "在线用户",
"form": {
"allowInsecure": "允许不安全",
"cancel": "取消",
@ -54,8 +51,8 @@
"enableTLS": "启用TLS",
"encryptionMethod": "加密方法",
"flow": "流控算法",
"hopInterval": "中继间隔",
"hopPorts": "中继端口",
"hopInterval": "跳跃间隔",
"hopPorts": "跳跃端口",
"hopPortsPlaceholder": "多个端口用逗号分隔",
"name": "名称",
"nodeGroupId": "节点组ID",
@ -89,7 +86,7 @@
"selectEncryptionMethod": "选择加密方法",
"selectNodeGroup": "选择节点组",
"selectProtocol": "选择协议",
"serverAddr": "服务器IP",
"serverAddr": "服务器地址",
"serverName": "服务名称",
"speedLimit": "速度限制",
"speedLimitPlaceholder": "无限制",
@ -100,14 +97,17 @@
"transportPath": "传输路径",
"transportServerName": "传输服务名称"
},
"lastUpdated": "最后更新",
"memory": "内存",
"name": "名称",
"node": "节点",
"nodeGroup": "节点组",
"normal": "正常",
"onlineCount": "在线人数",
"onlineUsers": "在线用户",
"rate": "速率",
"relay": "中继",
"serverAddr": "服务器IP",
"serverAddr": "服务器地址",
"speedLimit": "速度限制",
"status": "状态",
"trafficRatio": "流量速率",