@checkstack/theme-frontend 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @checkstack/theme-frontend
2
2
 
3
+ ## 0.1.29
4
+
5
+ ### Patch Changes
6
+
7
+ - 4b0934d: Refactored UserMenu to use a responsive grid layout, improved menu item alignment, and implemented a full-screen scrollable portal for mobile devices. Fixed an issue where the UserMenu would instantly close and reopen when clicking the trigger while the menu was open.
8
+ - Updated dependencies [4b0934d]
9
+ - @checkstack/ui@1.3.6
10
+ - @checkstack/auth-frontend@0.5.25
11
+
12
+ ## 0.1.28
13
+
14
+ ### Patch Changes
15
+
16
+ - 286491a: Added automatic FPS detection that enables "Low Power Mode" once for devices running below 50 FPS, ensuring smooth performance even for users unaware of the manual toggle.
17
+ - Updated dependencies [286491a]
18
+ - @checkstack/ui@1.3.5
19
+ - @checkstack/auth-frontend@0.5.24
20
+
3
21
  ## 0.1.27
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/theme-frontend",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "main": "src/index.tsx",
6
6
  "checkstack": {
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "@checkstack/theme-common": "0.1.8",
16
16
  "@checkstack/frontend-api": "0.3.9",
17
- "@checkstack/auth-frontend": "0.5.18",
17
+ "@checkstack/auth-frontend": "0.5.24",
18
18
  "@checkstack/common": "0.6.5",
19
- "@checkstack/ui": "1.2.1",
19
+ "@checkstack/ui": "1.3.5",
20
20
  "react": "^18.2.0",
21
21
  "lucide-react": "^0.344.0"
22
22
  },
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { Zap, ZapOff } from "lucide-react";
3
+ import { useApi } from "@checkstack/frontend-api";
4
+ import { authApiRef } from "@checkstack/auth-frontend/api";
5
+ import { Button, usePerformance } from "@checkstack/ui";
6
+
7
+ /**
8
+ * Navbar performance toggle button for non-logged-in users.
9
+ *
10
+ * Shows a Zap icon button that toggles between high and low performance modes.
11
+ * Only renders when user is NOT logged in (logged-in users use the toggle in UserMenu).
12
+ */
13
+ export const NavbarPerformanceToggle = () => {
14
+ const { manualLowPower, toggleManualLowPower } = usePerformance();
15
+ const authApi = useApi(authApiRef);
16
+ const { data: session, isPending } = authApi.useSession();
17
+
18
+ // Don't render while loading session
19
+ if (isPending) {
20
+ return <React.Fragment />;
21
+ }
22
+
23
+ // Don't render for logged-in users (they use UserMenu toggle)
24
+ if (session?.user) {
25
+ return <React.Fragment />;
26
+ }
27
+
28
+ return (
29
+ <Button
30
+ variant="ghost"
31
+ size="icon"
32
+ onClick={toggleManualLowPower}
33
+ aria-label={manualLowPower ? "Switch to high performance" : "Switch to low power mode"}
34
+ className="rounded-full"
35
+ >
36
+ {manualLowPower ? <ZapOff className="h-5 w-5 text-muted-foreground" /> : <Zap className="h-5 w-5 text-primary" />}
37
+ </Button>
38
+ );
39
+ };
@@ -9,25 +9,27 @@ export const PerformanceToggleMenuItem = () => {
9
9
  const { manualLowPower, toggleManualLowPower } = usePerformance();
10
10
 
11
11
  return (
12
- <div className="flex items-center justify-between w-full px-4 py-2 text-sm text-popover-foreground">
13
- <div className="flex items-center gap-2">
14
- {manualLowPower ? (
15
- <ZapOff className="h-4 w-4 text-muted-foreground" />
16
- ) : (
17
- <Zap className="h-4 w-4 text-primary" />
18
- )}
19
- <div className="flex flex-col">
20
- <span>Low Power Mode</span>
21
- <span className="text-[10px] text-muted-foreground leading-tight">
22
- Disables blurs & animations
23
- </span>
12
+ <div className="flex items-center justify-between w-full px-4 py-2 text-sm text-popover-foreground hover:bg-accent hover:text-accent-foreground rounded-sm transition-colors">
13
+ <div className="flex flex-col flex-1 items-start">
14
+ <div className="flex items-center w-full">
15
+ {manualLowPower ? (
16
+ <ZapOff className="h-4 w-4 text-muted-foreground shrink-0 mr-3" />
17
+ ) : (
18
+ <Zap className="h-4 w-4 text-primary shrink-0 mr-3" />
19
+ )}
20
+ <span className="flex-1 text-left">Low Power Mode</span>
24
21
  </div>
22
+ <span className="text-[10px] text-muted-foreground mt-1 leading-tight text-left pl-7">
23
+ Disables blurs & animations
24
+ </span>
25
+ </div>
26
+ <div className="ml-2 shrink-0 flex items-center">
27
+ <Toggle
28
+ checked={manualLowPower}
29
+ onCheckedChange={toggleManualLowPower}
30
+ aria-label="Toggle low performance mode"
31
+ />
25
32
  </div>
26
- <Toggle
27
- checked={manualLowPower}
28
- onCheckedChange={toggleManualLowPower}
29
- aria-label="Toggle low performance mode"
30
- />
31
33
  </div>
32
34
  );
33
35
  };
@@ -47,17 +47,25 @@ export const ThemeToggleMenuItem = () => {
47
47
  };
48
48
 
49
49
  return (
50
- <div className="flex items-center justify-between w-full px-4 py-2 text-sm text-popover-foreground">
51
- <div className="flex items-center gap-2">
52
- {isDark ? <Moon className="h-4 w-4" /> : <Sun className="h-4 w-4" />}
53
- <span>Dark Mode</span>
50
+ <div className="flex items-center justify-between w-full px-4 py-2 text-sm text-popover-foreground hover:bg-accent hover:text-accent-foreground rounded-sm transition-colors">
51
+ <div className="flex flex-col flex-1 items-start">
52
+ <div className="flex items-center w-full">
53
+ {isDark ? (
54
+ <Moon className="h-4 w-4 text-muted-foreground shrink-0 mr-3" />
55
+ ) : (
56
+ <Sun className="h-4 w-4 text-muted-foreground shrink-0 mr-3" />
57
+ )}
58
+ <span className="flex-1 text-left">Dark Mode</span>
59
+ </div>
60
+ </div>
61
+ <div className="ml-2 shrink-0 flex items-center">
62
+ <Toggle
63
+ checked={isDark}
64
+ onCheckedChange={handleToggle}
65
+ disabled={setThemeMutation.isPending}
66
+ aria-label="Toggle dark mode"
67
+ />
54
68
  </div>
55
- <Toggle
56
- checked={isDark}
57
- onCheckedChange={handleToggle}
58
- disabled={setThemeMutation.isPending}
59
- aria-label="Toggle dark mode"
60
- />
61
69
  </div>
62
70
  );
63
71
  };
package/src/index.tsx CHANGED
@@ -8,6 +8,7 @@ import { ThemeToggleMenuItem } from "./components/ThemeToggleMenuItem";
8
8
  import { PerformanceToggleMenuItem } from "./components/PerformanceToggleMenuItem";
9
9
  import { ThemeSynchronizer } from "./components/ThemeSynchronizer";
10
10
  import { NavbarThemeToggle } from "./components/NavbarThemeToggle";
11
+ import { NavbarPerformanceToggle } from "./components/NavbarPerformanceToggle";
11
12
 
12
13
  export const themePlugin = createFrontendPlugin({
13
14
  metadata: pluginMetadata,
@@ -37,5 +38,11 @@ export const themePlugin = createFrontendPlugin({
37
38
  slot: NavbarRightSlot,
38
39
  component: NavbarThemeToggle,
39
40
  },
41
+ // Performance toggle button in navbar (for non-logged-in users)
42
+ {
43
+ id: "theme.navbar.performance.toggle",
44
+ slot: NavbarRightSlot,
45
+ component: NavbarPerformanceToggle,
46
+ },
40
47
  ],
41
48
  });