General Guidelines
This needs expanding on, but some key points!
types.tscontains all the type information for modalsmodals.tsxcontains all the component mounting codemodals/*.tsxare all the individual modals- All modals should use the
Dialogcomponent except in special circumstance - If you take user input, use Form2 (ex. EditUsername)
- If you are performing an action, use Tanstack Mutations (ex. ChannelToggleMature)
NB. take care to usemutateAsyncinstead ofmutateto keep dialog open while pending
NB. bindonErrortoshowErrorfromuseModals() - Do not mix Tanstack and Form2, you're either using one or the other
They both provide the necessary UX flows, e.g. 'pending' actions
Your action onClick handlers can return one of the following:
- A
Promise<any>which on resolution will close the dialog, otherwise will do nothing. - A non-
falsevalue which will close the dialog. - The value
falsewhich will prevent the dialog from closing.