From 6de185821989c8f2d91ab8339041eec3524b05b0 Mon Sep 17 00:00:00 2001 From: Dennis Keil Date: Tue, 5 Nov 2024 02:27:18 +0100 Subject: [PATCH] fix empty leaderboard text --- app/src/app/statistics/leaderboard.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/app/statistics/leaderboard.tsx b/app/src/app/statistics/leaderboard.tsx index da1a1644..3dfe6025 100644 --- a/app/src/app/statistics/leaderboard.tsx +++ b/app/src/app/statistics/leaderboard.tsx @@ -510,6 +510,16 @@ function Leaderboard({ leaderboardId }: any) { inactivityTimeout.current = setTimeout(() => setHandleVisible(true), 1000); }; + const getEmptyListStr = () => { + if (!leaderboard.touched) { + return ''; + } + if (leaderboard.error) { + return getTranslation('leaderboard.error'); + } + return getTranslation('leaderboard.noplayerfound'); + }; + return ( {/**/} @@ -534,7 +544,7 @@ function Leaderboard({ leaderboardId }: any) { showsVerticalScrollIndicator={!handleVisible} ListEmptyComponent={ - {leaderboard.error ? getTranslation('leaderboard.error') : getTranslation('leaderboard.noplayerfound')} + {getEmptyListStr()} } />