diff --git a/src/App.tsx b/src/App.tsx index f55d4c9..1dc7f02 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -122,15 +122,18 @@ function App() { .catch(error => console.error('Error fetching top players:', error)) }, []) - // Format playtime from seconds to hours + // Format playtime from seconds to hours and minutes const formatPlayTime = (seconds: number) => { const hours = Math.floor(seconds / 3600) - if (hours >= 1000000) { - return `${(hours / 1000000).toFixed(1)}M` - } else if (hours >= 1000) { - return `${(hours / 1000).toFixed(1)}K` + const minutes = Math.floor((seconds % 3600) / 60) + + if (hours > 0) { + if (minutes > 0) { + return `${hours}${t('time.hours')} ${minutes}${t('time.minutes')}` + } + return `${hours}${t('time.hours')}` } - return hours.toLocaleString() + return `${minutes}${t('time.minutes')}` } // Format time ago from timestamp diff --git a/src/locales/en.json b/src/locales/en.json index dfe4249..911823d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -51,13 +51,9 @@ "joinForum": "Join Forum", "viewFriends": "View Friends" }, - "activity": { - "title": "Recent Activity", - "topPlayers": "Top Players by Playtime", - "serverInfo": "Server Info", - "serverStatus": "Status: Online ✓", - "currentMap": "Map: de_dust2", - "nextRestart": "Restart: 6h 30m" + "time": { + "hours": "h", + "minutes": "m" }, "footer": { "community": "🎯 CS Community", diff --git a/src/locales/zh.json b/src/locales/zh.json index 2976190..77c8a53 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -50,13 +50,9 @@ "joinForum": "加入论坛", "viewFriends": "查看友链" }, - "activity": { - "title": "最近活动", - "topPlayers": "游戏时长排行榜", - "serverInfo": "服务器信息", - "serverStatus": "状态:在线 ✓", - "currentMap": "地图:de_dust2", - "nextRestart": "重启:6小时30分钟" + "time": { + "hours": "小时", + "minutes": "分钟" }, "footer": { "community": "🎯 CS 社区",