Skip to content

Commit

Permalink
allow dismissing preview
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Feb 8, 2025
1 parent 2dbb28f commit 6cff0ab
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/client/src/components/PrereleaseWarning.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Icon } from '@a-type/ui';
import { useAppInfo } from '../react.js';
import { useAppInfo, useLocalStorage } from '../react.js';

export interface PrereleaseWarningProps {}

export function PrereleaseWarning({}: PrereleaseWarningProps) {
const app = useAppInfo();
const [dismissed, setDismissed] = useLocalStorage(
'dismissedPrereleaseWarning',
false,
);

if (!app.prerelease) {
if (!app.prerelease || dismissed || !import.meta.env.DEV) {
return null;
}

if (import.meta.env.DEV) return null;

return (
<div className="bg-attention-light text-black row p-1 text-xxs items-center justify-center">
<Icon name="warning" />
Expand All @@ -27,6 +29,12 @@ export function PrereleaseWarning({}: PrereleaseWarningProps) {
</a>{' '}
app. It may be unstable or incomplete, and your data may be lost.
</span>
<Icon
name="x"
role="button"
tabIndex={0}
onClick={() => setDismissed(true)}
/>
</div>
);
}

0 comments on commit 6cff0ab

Please sign in to comment.