Skip to content

Commit

Permalink
🐛 fix(node): Locale and form
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Dec 13, 2024
1 parent 11ea821 commit 38be4d5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/admin/app/dashboard/server/form-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/dashboard/server/node-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
))}
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/app/dashboard/server/node-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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'>
Expand Down
8 changes: 6 additions & 2 deletions apps/admin/locales/en-US/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions apps/admin/locales/zh-CN/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@
"delete": "删除",
"deleteSuccess": "删除成功",
"deleteWarning": "删除后,数据将无法恢复。请谨慎操作。",
"disk": "磁盘",
"edit": "编辑",
"editNode": "编辑节点",
"enable": "启用",
"memory": "内存",
"disk": "磁盘",
"lastUpdated": "最后更新",
"onlineUsers": "在线用户",
"form": {
"allowInsecure": "允许不安全",
"cancel": "取消",
Expand All @@ -54,8 +51,8 @@
"enableTLS": "启用TLS",
"encryptionMethod": "加密方法",
"flow": "流控算法",
"hopInterval": "中继间隔",
"hopPorts": "中继端口",
"hopInterval": "跳跃间隔",
"hopPorts": "跳跃端口",
"hopPortsPlaceholder": "多个端口用逗号分隔",
"name": "名称",
"nodeGroupId": "节点组ID",
Expand Down Expand Up @@ -89,7 +86,7 @@
"selectEncryptionMethod": "选择加密方法",
"selectNodeGroup": "选择节点组",
"selectProtocol": "选择协议",
"serverAddr": "服务器IP",
"serverAddr": "服务器地址",
"serverName": "服务名称",
"speedLimit": "速度限制",
"speedLimitPlaceholder": "无限制",
Expand All @@ -100,14 +97,17 @@
"transportPath": "传输路径",
"transportServerName": "传输服务名称"
},
"lastUpdated": "最后更新",
"memory": "内存",
"name": "名称",
"node": "节点",
"nodeGroup": "节点组",
"normal": "正常",
"onlineCount": "在线人数",
"onlineUsers": "在线用户",
"rate": "速率",
"relay": "中继",
"serverAddr": "服务器IP",
"serverAddr": "服务器地址",
"speedLimit": "速度限制",
"status": "状态",
"trafficRatio": "流量速率",
Expand Down

0 comments on commit 38be4d5

Please sign in to comment.