diff --git a/www/app/page.tsx b/www/app/page.tsx index fc31452..ad803f8 100644 --- a/www/app/page.tsx +++ b/www/app/page.tsx @@ -2,6 +2,7 @@ import Image from "next/image"; import banner from "@/public/bloom2x1.svg"; +import darkBanner from "@/public/bloom2x1dark.svg"; import Message from "@/components/message"; import Thoughts from "@/components/thoughts"; import Sidebar from "@/components/sidebar"; @@ -32,6 +33,7 @@ import { Session } from "@supabase/supabase-js"; import { createClientComponentClient } from "@supabase/auth-helpers-nextjs"; import Link from "next/link"; import MarkdownWrapper from "@/components/markdownWrapper"; +import { DarkModeSwitch } from "react-toggle-dark-mode"; interface Message { text: string; @@ -181,6 +183,13 @@ export default function Home() { }; }, []); + const [isDarkMode, setIsDarkMode] = useState( + window.matchMedia("(prefers-color-scheme: dark)").matches + ); + const toggleDarkMode = (checked: boolean) => { + setIsDarkMode(checked); + }; + // async function newChat() { // return await fetch(`${URL}/api/conversations/insert?user_id=${userId}`) // .then((res) => res.json()) @@ -292,7 +301,11 @@ export default function Home() { } return ( -
+
-
-
+ ); } diff --git a/www/package.json b/www/package.json index 090b200..b448fb8 100644 --- a/www/package.json +++ b/www/package.json @@ -26,6 +26,7 @@ "react-icons": "^4.10.1", "react-markdown": "^8.0.7", "react-syntax-highlighter": "^15.5.0", + "react-toggle-dark-mode": "^1.1.1", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0", "sharp": "^0.32.5", diff --git a/www/public/bloom2x1dark.svg b/www/public/bloom2x1dark.svg new file mode 100644 index 0000000..5d300fe --- /dev/null +++ b/www/public/bloom2x1dark.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/www/tailwind.config.ts b/www/tailwind.config.ts index 308ee89..15d4fb3 100644 --- a/www/tailwind.config.ts +++ b/www/tailwind.config.ts @@ -1,6 +1,7 @@ import type { Config } from "tailwindcss"; const config: Config = { + darkMode: "class", content: [ "./pages/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}", diff --git a/www/yarn.lock b/www/yarn.lock index e42ea20..8c12564 100644 --- a/www/yarn.lock +++ b/www/yarn.lock @@ -180,6 +180,85 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@react-spring/animated@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/animated/-/animated-9.7.3.tgz#4211b1a6d48da0ff474a125e93c0f460ff816e0f" + integrity sha512-5CWeNJt9pNgyvuSzQH+uy2pvTg8Y4/OisoscZIR8/ZNLIOI+CatFBhGZpDGTF/OzdNFsAoGk3wiUYTwoJ0YIvw== + dependencies: + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/core@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/core/-/core-9.7.3.tgz#60056bcb397f2c4f371c6c9a5f882db77ae90095" + integrity sha512-IqFdPVf3ZOC1Cx7+M0cXf4odNLxDC+n7IN3MDcVCTIOSBfqEcBebSv+vlY5AhM0zw05PDbjKrNmBpzv/AqpjnQ== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/konva@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/konva/-/konva-9.7.3.tgz#16bd29dd4860a99e960a72987c8bcfc828b22119" + integrity sha512-R9sY6SiPGYqz1383P5qppg5z57YfChVknOC1UxxaGxpw+WiZa8fZ4zmZobslrw+os3/+HAXZv8O+EvU/nQpf7g== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/core" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/native@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/native/-/native-9.7.3.tgz#ee38d7c23482cfb4916c9b3c021de2995a4f553a" + integrity sha512-4mpxX3FuEBCUT6ae2fjhxcJW6bhr2FBwFf274eXB7n+U30Gdg8Wo2qYwcUnmiAA0S3dvP8vLTazx3+CYWFShnA== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/core" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/shared@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/shared/-/shared-9.7.3.tgz#4cf29797847c689912aec4e62e34c99a4d5d9e53" + integrity sha512-NEopD+9S5xYyQ0pGtioacLhL2luflh6HACSSDUZOwLHoxA5eku1UPuqcJqjwSD6luKjjLfiLOspxo43FUHKKSA== + dependencies: + "@react-spring/types" "~9.7.3" + +"@react-spring/three@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/three/-/three-9.7.3.tgz#4358a0c4640efe2972c4f7d0f7cd4efe927471c1" + integrity sha512-Q1p512CqUlmMK8UMBF/Rj79qndhOWq4XUTayxMP9S892jiXzWQuj+xC3Xvm59DP/D4JXusXpxxqfgoH+hmOktA== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/core" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/types@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/types/-/types-9.7.3.tgz#ea78fd447cbc2612c1f5d55852e3c331e8172a0b" + integrity sha512-Kpx/fQ/ZFX31OtlqVEFfgaD1ACzul4NksrvIgYfIFq9JpDHFwQkMVZ10tbo0FU/grje4rcL4EIrjekl3kYwgWw== + +"@react-spring/web@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/web/-/web-9.7.3.tgz#d9f4e17fec259f1d65495a19502ada4f5b57fa3d" + integrity sha512-BXt6BpS9aJL/QdVqEIX9YoUy8CE6TJrU0mNCqSoxdXlIeNcEBWOfIyE6B14ENNsyQKS3wOWkiJfco0tCr/9tUg== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/core" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + +"@react-spring/zdog@~9.7.3": + version "9.7.3" + resolved "https://registry.yarnpkg.com/@react-spring/zdog/-/zdog-9.7.3.tgz#8ccc7316f6d3460ed244d9e3f60de9b4c4a848ac" + integrity sha512-L+yK/1PvNi9n8cldiJ309k4LdxcPkeWE0W18l1zrP1IBIyd5NB5EPA8DMsGr9gtNnnIujtEzZk+4JIOjT8u/tw== + dependencies: + "@react-spring/animated" "~9.7.3" + "@react-spring/core" "~9.7.3" + "@react-spring/shared" "~9.7.3" + "@react-spring/types" "~9.7.3" + "@rollup/plugin-commonjs@24.0.0": version "24.0.0" resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.0.tgz#fb7cf4a6029f07ec42b25daa535c75b05a43f75c" @@ -3523,6 +3602,18 @@ react-markdown@^8.0.7: unist-util-visit "^4.0.0" vfile "^5.0.0" +react-spring@^9.0.0-rc.3: + version "9.7.3" + resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-9.7.3.tgz#3211dea4c4d7c5b541260af5100261b87becb5d5" + integrity sha512-oTxDpFV5gzq7jQX6+bU0SVq+vX8VnuuT5c8Zwn6CpDErOPvCmV+DRkPiEBtaL3Ozgzwiy5yFx83N0h303j/r3A== + dependencies: + "@react-spring/core" "~9.7.3" + "@react-spring/konva" "~9.7.3" + "@react-spring/native" "~9.7.3" + "@react-spring/three" "~9.7.3" + "@react-spring/web" "~9.7.3" + "@react-spring/zdog" "~9.7.3" + react-syntax-highlighter@^15.5.0: version "15.5.0" resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-15.5.0.tgz#4b3eccc2325fa2ec8eff1e2d6c18fa4a9e07ab20" @@ -3534,6 +3625,13 @@ react-syntax-highlighter@^15.5.0: prismjs "^1.27.0" refractor "^3.6.0" +react-toggle-dark-mode@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/react-toggle-dark-mode/-/react-toggle-dark-mode-1.1.1.tgz#ca738d4c7cd613f5091fe08e5c174d091ef5d2f3" + integrity sha512-25dH8tvQucpW9c024WQ6gXLxJ6Irc5iTFgAIKuwCUUfbbahyVd1OKEq5TqExzoPHoORIXlQKYXV/+fuyclr6FQ== + dependencies: + react-spring "^9.0.0-rc.3" + react@18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"