Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/org-admin/MaintenanceNotificationBanner.tsx
2499 views
1
/**
2
* Copyright (c) 2025 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { FC } from "react";
8
import Alert from "../components/Alert";
9
import { useMaintenanceNotification } from "../data/maintenance-mode/maintenance-notification-query";
10
import { useMaintenanceMode } from "../data/maintenance-mode/maintenance-mode-query";
11
import { DEFAULT_MESSAGE } from "./MaintenanceNotificationCard";
12
13
export const MaintenanceNotificationBanner: FC = () => {
14
const { isNotificationEnabled, notificationMessage } = useMaintenanceNotification();
15
const { isMaintenanceMode } = useMaintenanceMode();
16
17
// if both maintenance mode and scheduled notification are enabled,
18
// only show the maintenance mode notification
19
if (isMaintenanceMode || !isNotificationEnabled) {
20
return null;
21
}
22
23
const displayMessage = notificationMessage || DEFAULT_MESSAGE;
24
25
return (
26
<Alert type="warning" className="mb-2">
27
<div className="flex items-center">
28
<span className="font-semibold">Scheduled Maintenance:</span>
29
<span className="ml-2">{displayMessage}</span>
30
</div>
31
</Alert>
32
);
33
};
34
35