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
9 changes: 8 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,11 @@ NEXT_PUBLIC_DEPLOY_DATE=
# Get a token from https://p3.theseed.org/user/authenticate
#
# Optional. Not required for application functionality.
PATRIC_TOKEN=
PATRIC_TOKEN=

# Maintenance mode banner
# Set to 'true' and rebuild to display a yellow outage banner on every page.
# Optional. Defaults to disabled.
NEXT_PUBLIC_MAINTENANCE_MODE=false
# Optional custom message shown in the banner when maintenance mode is enabled.
NEXT_PUBLIC_MAINTENANCE_MESSAGE=
10 changes: 5 additions & 5 deletions app/(reference-data)/biochem/reactions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ export default function ReactionsPage() {
}, [handleFilterModelChange]);

// Modal state
const [commentModalOpen, setCommentModalOpen] = useState(false);
const [commentReactionId, setCommentReactionId] = useState<string | null>(null);
/* const [commentModalOpen, setCommentModalOpen] = useState(false); */
/* const [commentReactionId, setCommentReactionId] = useState<string | null>(null); */
const [exportModalOpen, setExportModalOpen] = useState(false);
const [pathwaysModalOpen, setPathwaysModalOpen] = useState(false);
const [pathwaysModalReactionId, setPathwaysModalReactionId] = useState<string | null>(null);
Expand Down Expand Up @@ -250,10 +250,10 @@ export default function ReactionsPage() {
}));
}, [filterModel]);

const handleOpenComment = useCallback((id: string) => {
/* const handleOpenComment = useCallback((id: string) => {
setCommentReactionId(id);
setCommentModalOpen(true);
}, []);
}, []); */

const handleOpenPathwaysModal = useCallback((reaction: Reaction) => {
setPathwaysModalReactionId(reaction.id);
Expand Down Expand Up @@ -375,7 +375,7 @@ export default function ReactionsPage() {
return row.ontology;
},
},
], [handleOpenComment, handleOpenPathwaysModal]);
], [handleOpenPathwaysModal]);

const queryOpts = useMemo<SolrQueryOpts>(() => ({
limit: paginationModel.pageSize,
Expand Down
57 changes: 0 additions & 57 deletions app/api/maintenance/route.ts

This file was deleted.

23 changes: 4 additions & 19 deletions components/ui/OutageBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
'use client';

import { useEffect, useState } from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Alert from '@mui/material/Alert';

interface MaintenanceStatus {
enabled: boolean;
message: string;
}
const MAINTENANCE_ENABLED = process.env.NEXT_PUBLIC_MAINTENANCE_MODE === 'true';
const MAINTENANCE_MESSAGE = process.env.NEXT_PUBLIC_MAINTENANCE_MESSAGE || 'Site is undergoing maintenance. Please check back shortly.';

export default function OutageBanner() {
const [status, setStatus] = useState<MaintenanceStatus | null>(null);

useEffect(() => {
fetch('/api/maintenance', { cache: 'no-store' })
.then((res) => {
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return res.json();
})
.then((data: MaintenanceStatus) => setStatus(data))
.catch(() => setStatus({ enabled: false, message: '' }));
}, []);

if (!status || !status.enabled) return null;
if (!MAINTENANCE_ENABLED) return null;

return (
<Box sx={{ width: '100%' }}>
Expand All @@ -37,7 +22,7 @@ export default function OutageBanner() {
}}
>
<Typography variant="body1" fontWeight={600}>
{status.message || 'Site is undergoing maintenance. Please check back shortly.'}
{MAINTENANCE_MESSAGE}
</Typography>
</Alert>
</Box>
Expand Down
Loading