Skip to content

refactor(dialogs): Improved dialog system in the launcher#88

Merged
Purdze merged 4 commits intoPommeMC:masterfrom
arse09:refactor/dialogs
Mar 27, 2026
Merged

refactor(dialogs): Improved dialog system in the launcher#88
Purdze merged 4 commits intoPommeMC:masterfrom
arse09:refactor/dialogs

Conversation

@arse09
Copy link
Copy Markdown
Contributor

@arse09 arse09 commented Mar 26, 2026

Summary

  • Improved the current dialog system
  • The new/edit dialog was renamed to InstallationsDialog
  • Created a new dialog called ConfirmDialog which needs be provided with a title, a message, an optional onConfirm event and an optional onCancel event. You can see it in action when deleting an installation.
  • Made InstallationDialog's states (editingInstall, versionDialogOpen and showSnapshots) not global.
  • Installations are still client-side, they are being implemented in feat: Implement installations #62.

Dialogs are opened via setOpenedDialog({name: ""}) if the dialog requires additional data, you need to provide it with setOpenedDialog({name: "", props: "data"})

For example, opening a InstallationDialog to edit a installation:

setOpenedDialog({
  name: "installation",
  props: {
    editing: true,
    installation: {...}
  }
});

To create a new dialog, create a tsx file inside components/dialogs/.
Write a export type with your props if needed. Then, add your dialog name and type inside lib/types.ts in the DialogMap type:

// dialog_name: typeof props
type DialogMap = {
  installation: InstallationDialogProps;
  confirm_dialog: ConfirmDialogProps;
};

If you don't have prompts, put undefined as the type and don't forget to add the dialog to App.tsx

@Purdze
Copy link
Copy Markdown
Collaborator

Purdze commented Mar 26, 2026

Good work,a few issues tho

ConfirmDialog closes before action completes - setOpenedDialog(null) is called before await dialogProps.onConfirm?.(), If the confirm action fails, the dialog is already gone and the user gets no feedback

Installations still only client-side - setInstallations((prev) => prev.filter(...)) on delete doesn't call any backend, PR doesn't persist installations (#62 does that), but worth noting they should be coordinated

lastPlayed: "Today" in createEmptyInstallation - hardcoded string for a new installation that hasn't been played. Should be null or "Never".

linear-gradient(135deg, var(--accent-dark), var(--accent-dark)) - gradient with the same color twice is just a solid color. Use background: var(--accent-dark) instead

Default version fallback "26.1" - hardcoded in createEmptyInstallation. Should just use versions[0]?.id || "" and validate before save

@Purdze
Copy link
Copy Markdown
Collaborator

Purdze commented Mar 27, 2026

lastPlayed: "Never" still hardcoded

linear-gradient(135deg, var(--accent-dark), var(--accent-dark)) - gradient with the same color twice is just a solid color. Use background: var(--accent-dark) instead

@Purdze Purdze merged commit a4895ea into PommeMC:master Mar 27, 2026
7 checks passed
@arse09 arse09 deleted the refactor/dialogs branch March 27, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants