Skip to content

Commit

Permalink
Fixes to maintenance stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad committed Mar 11, 2024
1 parent 35a7227 commit 88a1a3b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@
"brand_image_deleted": "The brand image has been deleted.",
"privacy_policy_updated": "The privacy policy has been updated.",
"helpcenter_updated": "The help center link has been updated.",
"terms_of_service_updated": "The terms of service have been updated."
"terms_of_service_updated": "The terms of service have been updated.",
"maintenance_updated": "The maintenance banner has been updated."
},
"recording": {
"recording_visibility_updated": "The recording visibility has been updated.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default function App() {
progress: undefined,
theme: 'light',
className: 'text-center',
onClose: () => localStorage.setItem('maintenanceClosedAt', new Date().toISOString()),
});
localStorage.setItem('maintenanceBannerId', toastId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function LinksForm({ id, value, mutation: useUpdateSiteSettingsAP
const updateSiteSettingsAPI = useUpdateSiteSettingsAPI();
const { t } = useTranslation();

const { methods, fields } = useLinksForm({ defaultValues: { value } });
const { methods, fields } = useLinksForm({ defaultValues: { value: value } });

return (
<Form id={id} methods={methods} onSubmit={updateSiteSettingsAPI.mutate}>
Expand All @@ -48,5 +48,5 @@ export default function LinksForm({ id, value, mutation: useUpdateSiteSettingsAP
LinksForm.propTypes = {
id: PropTypes.string.isRequired,
mutation: PropTypes.func.isRequired,
value: PropTypes.string.isRequired,
value: PropTypes.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ export default function TextForm({ id, value, mutation: useUpdateSiteSettingsAPI
const { t } = useTranslation();
const maintenanceBannerId = localStorage.getItem('maintenanceBannerId');

const { methods, fields } = useTextForm({ defaultValues: { value } });
const { methods, fields } = useTextForm({ defaultValues: { value: value } });

// Function to clear the form
const clearForm = () => {
methods.reset({ value: '' });
toast.dismiss(maintenanceBannerId);
methods.reset({ value: '' });
toast.dismiss(maintenanceBannerId);
updateSiteSettingsAPI.mutate('')
};

return (
Expand All @@ -60,5 +61,5 @@ export default function TextForm({ id, value, mutation: useUpdateSiteSettingsAPI
TextForm.propTypes = {
id: PropTypes.string.isRequired,
mutation: PropTypes.func.isRequired,
value: PropTypes.string.isRequired,
value: PropTypes.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export default function useUpdateSiteSetting(name) {
case 'TermsOfService':
toast.success(t('toast.success.site_settings.terms_of_service_updated'));
break;
case 'Maintenance':
toast.success(t('toast.success.site_settings.maintenance_updated'));
break;
default:
toast.success(t('toast.success.site_settings.site_setting_updated'));
}
Expand Down

0 comments on commit 88a1a3b

Please sign in to comment.