Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ui/src/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ import { Link } from 'react-router-dom'
import { useReveal } from './reveal'
import { useI18n, useT } from './i18n'
import { IS_DEMO } from './api'
import { helperConfigured } from './helper'

/** A thin, always-visible strip in demo mode (runtime `?demo=1` or the VITE_DEMO fallback) so a
* visitor never mistakes the sample data for a real vault, and can leave demo mode (`?demo=0`).
* Renders nothing outside demo mode. */
* visitor never mistakes the sample data for a real vault. Offers "Exit demo" (`?demo=0`) ONLY when
* a real mode exists to exit to (a helper is configured) — a pure demo deploy has nowhere to go, so
* the exit would land on an empty backend. Renders nothing outside demo mode. */
export function DemoBanner() {
const t = useT()
if (!IS_DEMO) return null
return (
<div className="demo-banner" role="note">
<span className="demo-banner-tag">DEMO</span>
{t('demo.bannerNote')}
<a className="demo-banner-exit" href="?demo=0">{t('demo.bannerExit')}</a>
{helperConfigured() && <a className="demo-banner-exit" href="?demo=0">{t('demo.bannerExit')}</a>}
</div>
)
}
Expand Down
Loading