-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,628 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
type Theme = "inherit" | "light" | "dark"; | ||
|
||
export const useAutoDark = () => { | ||
const [theme, setTheme] = useState<Theme>("dark"); | ||
const handleThemeChange = (system: MediaQueryList) => { | ||
if (system.matches) { | ||
setTheme("dark"); | ||
} else { | ||
setTheme("light"); | ||
} | ||
}; | ||
const system = window.matchMedia("(prefers-color-scheme: dark)"); | ||
useEffect(() => { | ||
handleThemeChange(system); | ||
system.addEventListener("change", () => handleThemeChange(system)); | ||
return () => { | ||
system.removeEventListener("change", () => handleThemeChange(system)); | ||
}; | ||
}, []); | ||
return [theme, setTheme] as const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import router from "./router"; | ||
import { Toaster } from "react-hot-toast"; | ||
import { RouterProvider } from "react-router-dom"; | ||
import { Theme, ThemePanel } from "@radix-ui/themes"; | ||
import { useAutoDark } from "./../hooks/useAutoDark"; | ||
|
||
const App = () => { | ||
const [theme] = useAutoDark(); | ||
return ( | ||
<Theme | ||
scaling="95%" | ||
radius="large" | ||
grayColor="sand" | ||
appearance={theme} | ||
accentColor="crimson" | ||
> | ||
<RouterProvider router={router} /> | ||
<Toaster /> | ||
<ThemePanel /> | ||
</Theme> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import "./style.css"; | ||
import App from "./App"; | ||
import React from "react"; | ||
import router from "./router"; | ||
import "@radix-ui/themes/styles.css"; | ||
import { createRoot } from "react-dom/client"; | ||
import { ChakraProvider } from "@chakra-ui/react"; | ||
import { RouterProvider } from "react-router-dom"; | ||
|
||
const root = createRoot(document.getElementById("root")!); | ||
root.render( | ||
<React.StrictMode> | ||
<ChakraProvider> | ||
<RouterProvider router={router} /> | ||
</ChakraProvider> | ||
<App /> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export type Environment = { | ||
address: string; | ||
createdAt: number; | ||
description: string; | ||
host: string; | ||
updatedAt: number; | ||
zId: string; | ||
}; | ||
|
||
export type Share = { | ||
backendMode: "proxy" | "web" | "caddy" | "drive"; | ||
backendProxyEndpoint: string; | ||
createdAt: number; | ||
frontendEndpoint: string; | ||
frontendSelection: "public" | "private"; | ||
shareMode: "public" | "private"; | ||
token: string; | ||
updatedAt: number; | ||
zId: string; | ||
}; |
Oops, something went wrong.