mkscho63 / sta

This is an unofficial system for Foundry VTT using Modiphius's Star Trek Adventures 2d20 RPG. This system attempts to replicate the feeling of playing through an episode of the epic SciFi that is Star Trek. I am in no way associated with Modiphius.
MIT License
32 stars 33 forks source link

Delete confirm dialog switched to Foundry UI Dialog instead of confirm() call. #94

Closed WesWedding closed 1 year ago

WesWedding commented 1 year ago

This was primarily done to address a known cause of #60, which was the call to confirm() when a user attempts to delete an item from a character sheet. The secondary benefit is that we get a dialog that more visually integrates into Foundry's UI.

I moved the Dialog creation code into actor.js for lack of a better home for a shared utility function. I noticed one was there for handling other character sheet behavior. I kept the comment about Simple Worldbuilding System Code because that's where I ultimately looked for inspiration, myself.

I removed the li.slideUp(200, () => this.render(false)); line because, as far as I can tell, it wasn't working. Perhaps in older supported versions it did, but in V11 the sheet immediately removes the item and doesn't give it a chance to animate.

Minimal work was done about formatting, this is perhaps something worth spending time on in the future.

I also took the extra step to clean up older Dialogs before creating new ones. Even though Foundry doesn't seem to even do this (you can create a million sheet configuration popups), I went this direction because it keeps things tidy and also prevents potential headaches caused by remnant confirm dialogs sitting around and getting clicked long after the related items were removed.