Skip to content

Commit 5da48f7

Browse files
authored
feat: a few ui changes (#772)
### TL;DR Added torch glow effect to the authentication screen and enhanced the TorchGlow component to support an "always show" mode. ### What changed? - Added an `alwaysShow` prop to the `TorchGlow` component with a default value of `false` - Modified the visibility logic in `TorchGlow` to respect the new `alwaysShow` prop - Integrated the `TorchGlow` component into the `AuthScreen` with `alwaysShow={true}` - Added a ref to the cave background in `AuthScreen` to properly position the glow effect - Fixed the width of the auth form container to be exactly 320px instead of max-width ### How to test? 1. Open the authentication screen 2. Verify that the torch glow effect appears when moving the cursor over the cave background 3. Confirm the effect works regardless of dark/light mode or cursor glow settings 4. Check that the auth form has a fixed width of 320px ### Why make this change? The torch glow effect enhances the visual appeal of the cave-themed authentication screen, creating a more immersive and engaging user experience. The `alwaysShow` option allows the effect to be used in specific contexts regardless of user preferences, while still respecting those preferences elsewhere in the application.
1 parent 7dd14df commit 5da48f7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

apps/twig/src/renderer/components/TorchGlow.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { useEffect, useState } from "react";
44

55
interface TorchGlowProps {
66
containerRef: React.RefObject<HTMLElement | null>;
7+
alwaysShow?: boolean;
78
}
89

9-
export function TorchGlow({ containerRef }: TorchGlowProps) {
10+
export function TorchGlow({
11+
containerRef,
12+
alwaysShow = false,
13+
}: TorchGlowProps) {
1014
const isDarkMode = useThemeStore((state) => state.isDarkMode);
1115
const cursorGlow = useSettingsStore((state) => state.cursorGlow);
1216
const [mousePos, setMousePos] = useState<{ x: number; y: number } | null>(
@@ -43,8 +47,9 @@ export function TorchGlow({ containerRef }: TorchGlowProps) {
4347
};
4448
}, [containerRef]);
4549

46-
// Only show in dark mode when hovering and cursor glow is enabled
47-
if (!isDarkMode || !cursorGlow || !isHovering || !mousePos) return null;
50+
// Only show in dark mode when hovering and cursor glow is enabled (unless alwaysShow)
51+
const shouldShow = alwaysShow || (isDarkMode && cursorGlow);
52+
if (!shouldShow || !isHovering || !mousePos) return null;
4853

4954
return (
5055
<>

apps/twig/src/renderer/features/auth/components/AuthScreen.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { DraggableTitleBar } from "@components/DraggableTitleBar";
2+
import { TorchGlow } from "@components/TorchGlow";
23
import { useAuthStore } from "@features/auth/stores/authStore";
34
import { Box, Button, Flex, Text } from "@radix-ui/themes";
45
import caveHero from "@renderer/assets/images/cave-hero.jpg";
56
import twigLogo from "@renderer/assets/images/twig-logo.svg";
67
import { trpcVanilla } from "@renderer/trpc/client";
78
import type { CloudRegion } from "@shared/types/oauth";
89
import { useMutation } from "@tanstack/react-query";
9-
import { useState } from "react";
10+
import { useRef, useState } from "react";
1011
import { LoginForm } from "./LoginForm";
1112
import { SignupForm } from "./SignupForm";
1213

@@ -41,6 +42,7 @@ export const getErrorMessage = (error: unknown) => {
4142
type AuthMode = "login" | "signup";
4243

4344
export function AuthScreen() {
45+
const caveBackgroundRef = useRef<HTMLDivElement>(null);
4446
const [region, setRegion] = useState<CloudRegion>("us");
4547
const [authMode, setAuthMode] = useState<AuthMode>("login");
4648
const { loginWithOAuth, signupWithOAuth } = useAuthStore();
@@ -89,8 +91,13 @@ export function AuthScreen() {
8991
const errorMessage = getErrorMessage(error);
9092

9193
return (
92-
<Flex height="100vh" style={{ position: "relative" }}>
94+
<Flex
95+
ref={caveBackgroundRef}
96+
height="100vh"
97+
style={{ position: "relative" }}
98+
>
9399
<DraggableTitleBar />
100+
<TorchGlow containerRef={caveBackgroundRef} alwaysShow />
94101
{/* Full-screen cave painting background */}
95102
<div
96103
style={{
@@ -112,7 +119,7 @@ export function AuthScreen() {
112119
zIndex: 1,
113120
}}
114121
>
115-
<Flex direction="column" gap="6" style={{ maxWidth: "320px" }}>
122+
<Flex direction="column" gap="6" style={{ width: "320px" }}>
116123
<Flex direction="column" gap="4">
117124
<img
118125
src={twigLogo}

0 commit comments

Comments
 (0)