Skip to content

Commit

Permalink
Fix more buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau committed Dec 4, 2024
1 parent c6fa819 commit b1c9279
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions newIDE/app/src/GameDashboard/ProjectCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const ProjectCard = ({
showAlert,
} = useAlertDialog();
const fileMetadata = projectFileMetadataAndStorageProviderName.fileMetadata;
const projectName = fileMetadata.name || 'Unknown project';
const projectName = fileMetadata.name;
const storageProvider = getStorageProviderByInternalName(
storageProviders,
projectFileMetadataAndStorageProviderName.storageProviderName
Expand Down Expand Up @@ -250,12 +250,14 @@ const ProjectCard = ({
): Array<MenuItemTemplate> => {
if (!file) return [];

const actions = [
{
const actions = [];

if (authenticatedUser.profile) {
actions.push({
label: i18n._(t`Register the game online`),
click: () => onRegisterProject(),
},
];
});
}

if (file.storageProviderName === 'Cloud') {
actions.push({
Expand All @@ -272,30 +274,30 @@ const ProjectCard = ({

// Don't allow removing project if opened, as it would not result in any change in the list.
if (!isCurrentProjectOpened) {
actions.push(
{
if (actions.length > 0) {
actions.push({
type: 'separator',
},
{
label: i18n._(t`Remove from list`),
click: () => onRemoveRecentProjectFile(file),
}
);
});
}
actions.push({
label: i18n._(t`Remove from list`),
click: () => onRemoveRecentProjectFile(file),
});
}
}

if (isCurrentProjectOpened) {
actions.push(
{
if (actions.length > 0) {
actions.push({
type: 'separator',
});
}
actions.push({
label: i18n._(t`Close project`),
click: async () => {
await askToCloseProject();
},
{
label: i18n._(t`Close project`),
click: async () => {
await askToCloseProject();
},
}
);
});
}

return actions;
Expand Down

0 comments on commit b1c9279

Please sign in to comment.