Skip to content

Commit

Permalink
fix empty leaderboard text
Browse files Browse the repository at this point in the history
  • Loading branch information
denniske committed Nov 5, 2024
1 parent 4240992 commit 6de1858
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/app/statistics/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<View style={styles.container2}>
{/*<Button onPress={onRefresh}>REFRESH</Button>*/}
Expand All @@ -534,7 +544,7 @@ function Leaderboard({ leaderboardId }: any) {
showsVerticalScrollIndicator={!handleVisible}
ListEmptyComponent={
<View style={styles.centered}>
<MyText>{leaderboard.error ? getTranslation('leaderboard.error') : getTranslation('leaderboard.noplayerfound')}</MyText>
<MyText>{getEmptyListStr()}</MyText>
</View>
}
/>
Expand Down

0 comments on commit 6de1858

Please sign in to comment.