Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: force dark mode in intro #251

Merged
merged 1 commit into from
Jul 11, 2024
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
13 changes: 10 additions & 3 deletions frontend/src/screens/Intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ export function Intro() {
const navigate = useNavigate();
const [api, setApi] = React.useState<CarouselApi>();
const [progress, setProgress] = React.useState<number>(0);
const { theme } = useTheme();
const { setDarkMode } = useTheme();

React.useEffect(() => {
// Force dark mode on intro screen
setDarkMode("dark");
return () => {
// Revert to default after exiting intro
setDarkMode("system");
};
}, [setDarkMode]);

React.useEffect(() => {
if (!info?.setupCompleted) {
Expand All @@ -49,7 +58,6 @@ export function Intro() {
style={{
backgroundImage: `url(${Cloud})`,
backgroundPositionX: `${-Math.max(progress, 0) * 40}%`,
filter: theme === "light" ? "invert(0.3)" : undefined,
}}
/>
<div
Expand All @@ -58,7 +66,6 @@ export function Intro() {
backgroundImage: `url(${Cloud2})`,
backgroundPositionX: `${150 - Math.max(progress, 0) * 60}%`,
backgroundPositionY: "100%",
filter: theme === "light" ? "invert(0.3)" : undefined,
}}
/>
<CarouselContent className="select-none bg-transparent">
Expand Down
Loading