Skip to content

Commit 99664b2

Browse files
committed
refactor: add WIP
1 parent 3b89812 commit 99664b2

File tree

11 files changed

+932
-2123
lines changed

11 files changed

+932
-2123
lines changed

app/components/ThemeChanger.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export const ThemeChanger = () => {
2222
const setEditorTheme = useSetAtom(editorThemeAtom);
2323
const memoizedIcon = useMemo(() => <FontAwesomeIcon icon={faPalette} />, []);
2424

25+
console.log(theme);
26+
2527
useEffect(() => {
2628
const details = [...document.querySelectorAll('details.dropdown')];
2729
const handleClickOutside = (event: MouseEvent) => {
@@ -43,14 +45,12 @@ export const ThemeChanger = () => {
4345
}
4446
};
4547
document.addEventListener('click', handleClickOutside);
46-
return () => {
47-
document.removeEventListener('click', handleClickOutside);
48-
};
4948
}, []);
5049

5150
const handleClick = useCallback(
5251
(e: MouseEvent<HTMLButtonElement>) => {
5352
const button = e.currentTarget;
53+
console.log(button);
5454
setTheme(button.dataset.theme as string);
5555
setEditorTheme(getEditorTheme(button.dataset.theme as string));
5656
},
@@ -60,14 +60,14 @@ export const ThemeChanger = () => {
6060
const updateSelected = useCallback(() => {
6161
const selectedSVGs = document.querySelectorAll('svg.themeSelected');
6262
for (const svg of selectedSVGs) {
63-
svg.classList.add('invisible');
63+
svg.classList.add('hidden');
6464
}
6565
const buttons = document.querySelectorAll('button');
6666
for (const button of buttons) {
6767
if (button.getAttribute('data-theme') === theme) {
6868
const svg = button.querySelector('svg');
6969
if (svg) {
70-
svg.classList.remove('invisible');
70+
svg.classList.remove('hidden');
7171
svg.scrollIntoView({
7272
behavior: 'smooth',
7373
block: 'center',
@@ -107,7 +107,7 @@ export const ThemeChanger = () => {
107107
height="16"
108108
viewBox="0 0 24 24"
109109
fill="currentColor"
110-
className="invisible w-3 h-3 shrink-0 themeSelected"
110+
className="hidden w-3 h-3 shrink-0 themeSelected"
111111
>
112112
<path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" />
113113
</svg>

app/components/UserAvatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const UserAvatar = memo(() => {
114114
<span className="hidden mr-2 text-sm lg:flex">{email}</span>
115115
<div className="dropdown dropdown-end bg-base-300">
116116
{/* biome-ignore lint/a11y/noLabelWithoutControl: <explanation> */}
117-
<label tabIndex={0} className="avatar placeholder">
117+
<label tabIndex={0} className="avatar avatar-placeholder">
118118
<div
119119
className={clsx(
120120
'rounded-full bg-primary text-primary-content cursor-pointer',

app/globals.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@import "tailwindcss";
2+
3+
@plugin "daisyui" {
4+
themes: night, autumn, light, dark, abyss, acid, aqua, black, bumblebee, business, caramellatte, cmyk, coffee, corporate, cupcake, cyberpunk, dim, dracula, emerald, fantasy, forest, garden, halloween, lemonade, lofi, luxury, nord, pastel, retro, silk, sunset, synthwave, valentine, winter, wireframe;
5+
};
6+
7+
@plugin "daisyui/theme" {
8+
name: cyberpunk;
9+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
10+
}
11+
12+
@plugin "daisyui/theme" {
13+
name: wireframe;
14+
font-family: Chalkboard, "comic sans ms", sans-serif;
15+
}
16+
17+
.page-wrapper {
18+
min-height: 100vh;
19+
}
20+
21+
.chat-bubble.prose > p {
22+
margin-top: 0;
23+
margin-bottom: calc(var(--spacing) * 3)
24+
}
25+
26+
.chat-bubble.prose > p:last-of-type {
27+
margin-bottom: 0;
28+
}
29+
30+
div.chat-bubble > .clipboard-container:first-child,
31+
div.chat-bubble > .delete-container,
32+
div.chat-bubble > .reload-container {
33+
margin-top: calc(var(--spacing) * -10);
34+
}
35+
36+
.code-pre {
37+
background-color: transparent;
38+
margin-top: 0;
39+
margin-bottom: calc(var(--spacing) * 2);
40+
padding-block: 0;
41+
}
42+
43+
.code-pre>div:last-of-type {
44+
border-radius: var(--radius-md);
45+
padding: calc(var(--spacing) * 1);
46+
}
47+
48+
.menu ul > li div:hover, .menu ul > li span:hover {
49+
background-color: transparent;
50+
}
51+
52+
/* fix some display issue in bot chat bubbles in light mode */
53+
.chat-bubble.bot code,
54+
.chat-bubble.bot strong,
55+
.chat-bubble.bot blockquote,
56+
.chat-bubble.bot h1,
57+
.chat-bubble.bot h2,
58+
.chat-bubble.bot h3,
59+
.chat-bubble.bot h4,
60+
.chat-bubble.bot h5,
61+
.chat-bubble.bot ul,
62+
.chat-bubble.bot ol,
63+
.chat-bubble.bot li,
64+
.chat-bubble.bot li::marker {
65+
color: var(--color-secondary-content);
66+
}
67+
68+
.chat-footer.bot {
69+
margin-top: calc(var(--spacing) * 1);
70+
}

app/globals.scss

Lines changed: 0 additions & 49 deletions
This file was deleted.

app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type React from 'react';
2-
import './globals.scss';
2+
3+
import './globals.css';
34

45
import { Providers } from '@/app/providers';
56

app/providers.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import { Provider } from 'jotai';
22
import { ThemeProvider } from 'next-themes';
33
import type React from 'react';
44

5+
import { themes } from '@/app/utils/themes';
6+
57
export const Providers = ({ children }: { children: React.ReactNode }) => {
68
return (
79
<>
810
<Provider>
9-
<ThemeProvider attribute="data-theme" defaultTheme="dark">
11+
<ThemeProvider
12+
attribute="data-theme"
13+
defaultTheme="dark"
14+
themes={themes}
15+
>
1016
{children}
1117
</ThemeProvider>
1218
</Provider>

0 commit comments

Comments
 (0)