* fix: make all fields required on the Terms & Conditions page if Show on screen is enabled fix: enable/disable the Terms & Conditions form based on the Show on screen toggle fix: replaced deactivated field with plain text when not editing fix: make de non editable text content field scrollable style: make it follow the same style as the other screens, with the edit button and links to save and cancel feat: created Prompt component to avoid leaving pages without saving feat: applied component to the editable table feat: applied component to the Cashout, Commissions, Locales, Cashboxes, Notifications, CryptoBalanceOverrides and Wallet pages feat: applied component to the ContactInfo and ReceiptPrinting pages refactor: export the default prompt message to be used in other contexts fix: applied prompt component to the Operator Info pages fix: create routes for the operator info components feat: applied the Prompt component to the Contact Info and Receipt pages feat: applied the Prompt component to the Terms & Conditions page * refactor: move prompt to components * feat: use formik on the boolean properties table * chore: removed console.logs chore: removed comments refactor: moved BooleanCell to the BooleanPropertiesTable file and make it not a formik field
16 lines
453 B
JavaScript
16 lines
453 B
JavaScript
import { useFormikContext } from 'formik'
|
|
import React from 'react'
|
|
import { Prompt } from 'react-router-dom'
|
|
|
|
const PROMPT_DEFAULT_MESSAGE =
|
|
'You have unsaved changes on this page. Are you sure you want to leave?'
|
|
|
|
const PromptWhenDirty = ({ message = PROMPT_DEFAULT_MESSAGE }) => {
|
|
const formik = useFormikContext()
|
|
|
|
return (
|
|
<Prompt when={formik.dirty && formik.submitCount === 0} message={message} />
|
|
)
|
|
}
|
|
|
|
export default PromptWhenDirty
|