Files
supabase/apps/studio/components/layouts/AppLayout/NoticeBanner.tsx
Charis 47dc3d8478 chore: remove NoticeBanner2 (#46074)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Chore / cleanup.

## What is the current behavior?

`NoticeBanner2` displayed a maintenance notice for `ap-southeast-1` and
`sa-east-1` on May 13-14. The window has passed and the banner is no
longer needed.

## What is the new behavior?

`NoticeBanner2`, its `showNoticeBanner2` flag wiring in
`AppBannerWrapper`, and its now-unused imports (`useQueries`,
`useOrganizationsQuery`, `projectKeys`, `getOrganizationProjects`,
`OrgProject`, `MAINTENANCE_REGIONS`) are removed. Shared utilities still
used elsewhere (`projectKeys.bannerProjectsByOrg`,
`getOrganizationProjects`/`OrgProject`,
`LOCAL_STORAGE_KEYS.MAINTENANCE_BANNER_DISMISSED`) are kept.

## Additional context

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added Terms of Service update notification banner that expires on July
4, 2026, with options to view details or dismiss.

* **Chores**
  * Removed deprecated maintenance banner notification.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46074?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-18 15:46:02 -04:00

111 lines
3.5 KiB
TypeScript

import { LOCAL_STORAGE_KEYS } from 'common'
import { useRouter } from 'next/router'
import {
Button,
cn,
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogSection,
DialogSectionSeparator,
DialogTitle,
DialogTrigger,
} from 'ui'
import { HeaderBanner } from '@/components/interfaces/Organization/HeaderBanner'
import { InlineLink, InlineLinkClassName } from '@/components/ui/InlineLink'
import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage'
// Update this whenever the banner content below changes so old client bundles
// stop displaying outdated notices after the relevant date passes.
const BANNER_EXPIRES_AT = new Date('2026-07-04T00:00:00Z')
/**
* Used to display urgent notices that apply for all users, such as maintenance windows.
*/
export const NoticeBanner = () => {
const router = useRouter()
const [bannerAcknowledged, setBannerAcknowledged, { isSuccess }] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.TERMS_OF_SERVICE_UPDATE,
false
)
if (
Date.now() >= BANNER_EXPIRES_AT.getTime() ||
router.pathname.includes('sign-in') ||
!isSuccess ||
bannerAcknowledged
) {
return null
}
return (
<HeaderBanner
variant="note"
title="We've updated our Terms of Service"
description={<UpdatedTermsOfServiceDialog onDismiss={() => setBannerAcknowledged(true)} />}
onDismiss={() => setBannerAcknowledged(true)}
/>
)
}
const UpdatedTermsOfServiceDialog = ({ onDismiss }: { onDismiss: () => void }) => {
return (
<Dialog>
<DialogTrigger className={cn(InlineLinkClassName, 'cursor-pointer')}>
Learn more
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Terms of Service update</DialogTitle>
<DialogDescription>
We've updated our Terms of Service to better define the responsibilities of both you and
Supabase in the use of AI.
</DialogDescription>
</DialogHeader>
<DialogSectionSeparator />
<DialogSection className="text-sm flex flex-col gap-y-2">
<p>
We've clarified how we use AI in our customer support tooling, introduced guidelines for
the responsible use of AI by our users, and updated our indemnification terms to clarify
the allocation of responsibility for claims arising from AI-generated inputs and
outputs.
</p>
<p>
Additionally, we've made an explicit commitment that Supabase will never use the data
you submit to the Supabase services to train or improve any AI without your prior
written consent.
</p>
<p>
The updated Terms (Version 2) will take effect on June 6, 2026. By continuing to use the
Services after that date, you agree to the updated Terms. You can review the changes{' '}
<InlineLink href="https://supabase.com/terms">here</InlineLink>.
</p>
<p>
This notice applies to users on Supabase's standard Terms of Service only. If you are on
an Enterprise plan or with a separately negotiated agreement, your existing terms
continue to govern your use of the Services.
</p>
</DialogSection>
<DialogFooter>
<DialogClose asChild>
<Button type="default" className="opacity-100" onClick={onDismiss}>
Understood
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
)
}