Skip to content

Commit

Permalink
Add maintenance toast (#3052)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Feb 7, 2023
1 parent a9b6c3c commit 6137846
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -9,6 +9,7 @@ import {
import { useMaintenance } from 'hooks/api/getters/useMaintenance/useMaintenance';
import { useMaintenanceApi } from 'hooks/api/actions/useMaintenanceApi/useMaintenanceApi';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import useToast from 'hooks/useToast';

const StyledContainer = styled('div')(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -39,7 +40,14 @@ export const MaintenanceToggle = () => {
const { enabled, refetchMaintenance } = useMaintenance();
const { toggleMaintenance } = useMaintenanceApi();
const { trackEvent } = usePlausibleTracker();
const { setToastData } = useToast();
const updateEnabled = async () => {
setToastData({
type: 'success',
title: `Maintenance mode has been successfully ${
enabled ? 'disabled' : 'enabled'
}`,
});
trackEvent('maintenance', {
props: {
eventType: `maintenance ${enabled ? 'de' : ''}activated`,
Expand Down
2 changes: 1 addition & 1 deletion src/server-dev.ts
Expand Up @@ -39,7 +39,7 @@ process.nextTick(async () => {
anonymiseEventLog: false,
responseTimeWithAppName: true,
variantsPerEnvironment: true,
maintenance: false,
maintenance: true,
featuresExportImport: true,
newProjectOverview: true,
projectStatusApi: true,
Expand Down

0 comments on commit 6137846

Please sign in to comment.