Skip to content

Commit

Permalink
add prerelease warning
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed May 31, 2024
1 parent da84e2a commit 7a5d822
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/marginalia/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IconSpritesheet } from '@a-type/ui/components/icon';
import { ErrorBoundary } from '@a-type/ui/components/errorBoundary';
import { TooltipProvider } from '@a-type/ui/components/tooltip';
import { ParticleLayer } from '@a-type/ui/components/particles';
import { ReloadButton } from '@biscuits/client';
import { PrereleaseWarning, ReloadButton } from '@biscuits/client';
import { H1, P } from '@a-type/ui/components/typography';
import {
useCanSync,
Expand Down Expand Up @@ -50,6 +50,7 @@ export function App({}: AppProps) {
<QueryClientProvider client={queryClient}>
<ParticleLayer>
<AppPreviewNotice />
<PrereleaseWarning />
<Pages />
<Toaster
position="bottom-center"
Expand Down
3 changes: 2 additions & 1 deletion apps/shopping/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IconSpritesheet } from '@a-type/ui/components/icon';
import { ErrorBoundary } from '@a-type/ui/components/errorBoundary';
import { TooltipProvider } from '@a-type/ui/components/tooltip';
import { ParticleLayer } from '@a-type/ui/components/particles';
import { ReloadButton } from '@biscuits/client';
import { PrereleaseWarning, ReloadButton } from '@biscuits/client';
import { H1, P } from '@a-type/ui/components/typography';

export interface AppProps {}
Expand All @@ -21,6 +21,7 @@ export function App({}: AppProps) {
<Suspense>
<VerdantProvider>
<ParticleLayer>
<PrereleaseWarning />
<Pages />
<Toaster
position="bottom-center"
Expand Down
3 changes: 2 additions & 1 deletion apps/star-chart/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IconSpritesheet } from '@a-type/ui/components/icon';
import { ErrorBoundary } from '@a-type/ui/components/errorBoundary';
import { TooltipProvider } from '@a-type/ui/components/tooltip';
import { ParticleLayer } from '@a-type/ui/components/particles';
import { ReloadButton } from '@biscuits/client';
import { PrereleaseWarning, ReloadButton } from '@biscuits/client';
import { H1, P } from '@a-type/ui/components/typography';
import {
useCanSync,
Expand Down Expand Up @@ -41,6 +41,7 @@ export function App({}: AppProps) {
<VerdantProvider>
<ParticleLayer>
<AppPreviewNotice />
<PrereleaseWarning />
<Pages />
<Toaster
position="bottom-center"
Expand Down
32 changes: 32 additions & 0 deletions packages/client/src/components/PrereleaseWarning.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useAppInfo } from '../react.js';
import { Icon } from '@a-type/ui/components/icon';

export interface PrereleaseWarningProps {}

export function PrereleaseWarning({}: PrereleaseWarningProps) {
const app = useAppInfo();

if (!app.prerelease) {
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" />
<span>
{app.name} is an unreleased{' '}
<a
target="_blank"
rel="noreferrer"
href="https://biscuits.club"
className="underline"
>
Biscuits
</a>{' '}
app. It may be unstable or incomplete, and your data might be lost.
</span>
</div>
);
}
1 change: 1 addition & 0 deletions packages/client/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export * from './TosPrompt.js';
export * from './Essentials.js';
export * from './ReloadButton.js';
export * from './Explainer.js';
export * from './PrereleaseWarning.js';
2 changes: 2 additions & 0 deletions scripts/create-app/template/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Provider,
createGraphQLClient,
AppPreviewNotice,
PrereleaseWarning,
} from '@biscuits/client';

export interface AppProps {}
Expand Down Expand Up @@ -41,6 +42,7 @@ export function App({}: AppProps) {
<VerdantProvider>
<ParticleLayer>
<AppPreviewNotice />
<PrereleaseWarning />
<Pages />
<Toaster
position="bottom-center"
Expand Down

0 comments on commit 7a5d822

Please sign in to comment.