Skip to content

Commit 49852f6

Browse files
authored
Merge branch 'staging' into docs/add-agents-md
2 parents c337d71 + 0ca2ca9 commit 49852f6

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

app/src/components/theme-provider.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ type ThemeProviderState = {
99
setTheme: (theme: Theme) => void
1010
}
1111

12-
const ThemeProviderContext = createContext<ThemeProviderState>({
13-
theme: "system",
14-
resolvedTheme: "light",
15-
setTheme: () => null,
16-
})
12+
const VALID_THEMES: Theme[] = ["light", "dark", "system"]
13+
14+
const ThemeProviderContext = createContext<ThemeProviderState | undefined>(undefined)
1715

1816
const MEDIA_QUERY = "(prefers-color-scheme: dark)"
1917

@@ -29,9 +27,10 @@ export function ThemeProvider({
2927
defaultTheme?: Theme
3028
storageKey?: string
3129
}) {
32-
const [theme, setTheme] = useState<Theme>(
33-
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme
34-
)
30+
const [theme, setTheme] = useState<Theme>(() => {
31+
const stored = localStorage.getItem(storageKey)
32+
return stored && VALID_THEMES.includes(stored as Theme) ? (stored as Theme) : defaultTheme
33+
})
3534
const [systemTheme, setSystemTheme] = useState<ResolvedTheme>(getSystemTheme)
3635

3736
useEffect(() => {

app/src/components/theme-toggle.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function ThemeToggle() {
1313
size="icon"
1414
onClick={() => setTheme(isDark ? "light" : "dark")}
1515
title={isDark ? "Switch to light mode" : "Switch to dark mode"}
16+
aria-label={isDark ? "Switch to light mode" : "Switch to dark mode"}
1617
>
1718
{isDark ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
1819
</Button>

e2e/logic/POM/codeGraph.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class CodeGraph extends BasePage {
3737
return (navItem: string) => {
3838
const navItemSelectors: Record<string, string> = {
3939
"Main Website": "//a[@title='Home' or .//p[normalize-space()='Main Website'] or contains(@href, 'falkordb.com')]",
40-
"Github": "//a[@title='GitHub' or .//p[normalize-space()='GitHub'] or contains(@href, 'github.com/FalkorDB/code-graph')]",
40+
"GitHub": "//a[@title='GitHub' or .//p[normalize-space()='GitHub'] or contains(@href, 'github.com/FalkorDB/code-graph')]",
4141
"Discord": "//a[@title='Discord' or .//p[normalize-space()='Discord'] or contains(@href, 'discord.gg/falkordb')]",
4242
};
4343
const selector = navItemSelectors[navItem] ?? `//a[@title='${navItem}' or .//p[normalize-space()='${navItem}']]`;

e2e/tests/navBar.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test.describe(' Navbar tests', () => {
2222

2323
const navitems: { navItem: string; expectedRes: string }[] = [
2424
{ navItem: "Main Website", expectedRes: urls.falkorDBUrl },
25-
{ navItem: "Github", expectedRes: urls.falkorDbGithubUrl }
25+
{ navItem: "GitHub", expectedRes: urls.falkorDbGithubUrl }
2626
];
2727

2828
navitems.forEach(({navItem, expectedRes}) => {

0 commit comments

Comments
 (0)