Disable actions in leaderboard entries table

This commit is contained in:
AlexandreSi
2022-03-17 14:05:43 +01:00
parent 14b8e530d9
commit 81080acb28
2 changed files with 11 additions and 2 deletions

View File

@@ -21,9 +21,14 @@ import { type LeaderboardDisplayData } from '../../Utils/GDevelopServices/Play';
type Props = {|
entries: ?Array<LeaderboardDisplayData>,
onDeleteEntry: (entryId: string) => Promise<void>,
disableActions: boolean,
|};
const LeaderboardEntriesTable = ({ entries, onDeleteEntry }: Props) => {
const LeaderboardEntriesTable = ({
entries,
onDeleteEntry,
disableActions,
}: Props) => {
if (!entries) return <PlaceholderLoader />;
return (
@@ -73,7 +78,10 @@ const LeaderboardEntriesTable = ({ entries, onDeleteEntry }: Props) => {
</TableCell>
<TableCell>
<Tooltip title={'Remove entry'}>
<IconButton onClick={() => onDeleteEntry(entry.id)}>
<IconButton
onClick={() => onDeleteEntry(entry.id)}
disabled={disableActions}
>
<DeleteOutline size={20} />
</IconButton>
</Tooltip>

View File

@@ -500,6 +500,7 @@ const LeaderboardAdmin = ({ onLoading }: Props) => {
<LeaderboardEntriesTable
entries={entries}
onDeleteEntry={entryId => _deleteEntry(i18n, entryId)}
disableActions={isRequestPending || isEditingName}
/>
</div>
</ResponsiveLineStackLayout>