Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app/components/EditorInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ interface IEditorInterface {
token: string
font: string
customLabels?: CustomLabels
pauseUpdates?: boolean
}

const EditorInterface = ({
settings,
token,
font,
customLabels,
pauseUpdates,
}: IEditorInterface) => {
const appState = useAppState()

Expand Down Expand Up @@ -341,6 +343,7 @@ const EditorInterface = ({
appState?.setToken(token)
appState?.setFont(font)
appState?.setCustomLabels(customLabels)
appState?.setPauseUpdates(!!pauseUpdates)
}
appState?.setLoading(false)
})()
Expand Down
20 changes: 20 additions & 0 deletions src/app/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,26 @@ export const Footer = () => {
return () => clearTimeout(t)
}, [])

if (appState?.appState.pauseUpdates && appState?.appState.changesCreated) {
return (
<div
className='w-full flex flex-col items-center gap-1 py-4 px-6 fixed bottom-0 bg-white border-t border-slate-300'
style={{
fontFamily: getFont(appState),
}}
>
<p className='text-[13px] text-new-dark font-semibold'>
Client Home is currently under maintenance - you will not be able to
make any changes to your content or settings in the meanwhile.
</p>
<p className='text-[13px] text-new-dark'>
Clients will be able to view the Client Home content as usual without
any interruptions during this time.
</p>
</div>
)
}

return (
<When
condition={
Expand Down
3 changes: 2 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EditorInterface from '@/app/components/EditorInterface'
import InvalidToken from '@/app/components/InvalidToken'
import SideBarInterface from '@/app/components/SideBarInterface'
import NotificationsModal from '@/components/NotificationsModal'
import { apiUrl } from '@/config'
import { apiUrl, pauseUpdates } from '@/config'
import {
ClientsResponseSchema,
CompanyResponse,
Expand Down Expand Up @@ -102,6 +102,7 @@ export default async function Page({
token={token}
font={workspace.font}
customLabels={labels}
pauseUpdates={pauseUpdates}
/>
</div>
<div
Expand Down
2 changes: 2 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const apiUrl = `${
process.env.VERCEL_ENV === 'development' ? 'http://' : 'https://'
}${process.env.VERCEL_URL}`

export const pauseUpdates = !!process.env.FLG_PAUSE_UPDATES

export const SentryConfig = {
DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN,
Expand Down
8 changes: 8 additions & 0 deletions src/context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface IAppState {
tasks?: number
customLabels?: CustomLabels
brandName?: string
pauseUpdates?: boolean
}

export interface IAppContext {
Expand Down Expand Up @@ -66,6 +67,7 @@ export interface IAppContext {
setTasks: (tasks: number) => void
setCustomLabels: (customLabels?: CustomLabels) => void
setBrandName: (brandName?: string | null) => void
setPauseUpdates: (v: boolean) => void
/* eslint-enable no-unused-vars */
}

Expand Down Expand Up @@ -103,6 +105,7 @@ export const AppContextProvider: FC<IAppCoreProvider> = ({ children }) => {
tasks: undefined,
customLabels: undefined,
brandName: '',
pauseUpdates: false,
})

useEffect(() => {
Expand Down Expand Up @@ -210,6 +213,10 @@ export const AppContextProvider: FC<IAppCoreProvider> = ({ children }) => {
setState((prev) => ({ ...prev, brandName: brandName || '' }))
}

const setPauseUpdates = (v: boolean) => {
setState((prev) => ({ ...prev, pauseUpdates: v }))
}

return (
<AppContext.Provider
value={{
Expand Down Expand Up @@ -238,6 +245,7 @@ export const AppContextProvider: FC<IAppCoreProvider> = ({ children }) => {
setTasks,
setCustomLabels,
setBrandName,
setPauseUpdates,
}}
>
<AppDataProvider>{children}</AppDataProvider>
Expand Down
Loading