Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 105x 2x 2x 2x 2x 2x 2x 1x | import { useLDClient } from "launchdarkly-react-client-sdk";
import { featureFlags } from "shared-utils";
import { Alert } from "@/components";
export const MaintenanceBanner = () => {
const banners = {
UNSCHEDULED: <h1 className="text-xl font-medium">Unschedule Maintenance Flag</h1>,
SCHEDULED: <h1 className="text-xl font-medium">Scheduled Maintenance Flag</h1>,
};
function getMaintenanceBanner(flag: string) {
return banners[flag as keyof typeof banners] || undefined;
}
const ldClient = useLDClient();
const siteUnderMaintenanceBannerFlag = ldClient?.variation(
featureFlags.SITE_UNDER_MAINTENANCE_BANNER.flag,
featureFlags.SITE_UNDER_MAINTENANCE_BANNER.defaultValue,
);
const possibleMaintenanceBanner = getMaintenanceBanner(siteUnderMaintenanceBannerFlag);
if (possibleMaintenanceBanner) {
return (
<Alert className="mb-6 w-5/6" variant="destructive">
{possibleMaintenanceBanner}
</Alert>
);
}
return null;
};
|