From ec2c3b7de21d45256fc48e62d73a632b53b4ac8c Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Fri, 24 Feb 2023 22:52:53 +0100 Subject: [PATCH] feat: default view mode depends on location --- src/App.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index 3e3f3d3..77d4597 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,8 +13,12 @@ import "./style/thumbs.css"; import "./style/row.css"; import "./photos"; +const defaultViewMode: ViewMode = location.href.includes("resistants") + ? "photos" + : "map"; + export const App = () => { - const [viewMode, setViewMode] = React.useState("map"); + const [viewMode, setViewMode] = React.useState(defaultViewMode); return (