Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

COR-501 Sanity debug toggle on staging #4301

Merged
merged 3 commits into from
Jun 27, 2022
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
5 changes: 4 additions & 1 deletion packages/app/src/locale/use-lokalize-text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ export function useLokalizeText(initialLocale: LanguageKey) {
const [text, setText] = useState<SiteText>(languages[locale]);
const lokalizeTextsRef = useRef<SanityDocument<LokalizeText>[]>([]);

const isStagingEnv = typeof window !== 'undefined' && window.location.host === 'staging.coronadashboard.rijksoverheid.nl';
const showSanityDebugToggle = enableHotReload || isStagingEnv;

const [dataset, setDataset] = useState<Dataset>(
(process.env.NEXT_PUBLIC_SANITY_DATASET as Dataset | undefined) ??
'development'
);

const toggleButton = enableHotReload ? (
const toggleButton = showSanityDebugToggle ? (
<ToggleButton isActive={isActive} onClick={() => setIsActive((x) => !x)}>
<Toggle values={[...datasets]} onToggle={setDataset} value={dataset} />
<Toggle
Expand Down