Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,478 changes: 559 additions & 919 deletions examples/server/webui/package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions examples/server/webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
"dependencies": {
"@heroicons/react": "^2.2.0",
"@sec-ant/readable-stream": "^0.6.0",
"@tailwindcss/postcss": "^4.1.1",
"@tailwindcss/vite": "^4.1.1",
"@vscode/markdown-it-katex": "^1.1.1",
"autoprefixer": "^10.4.20",
"daisyui": "^4.12.14",
"daisyui": "^5.0.12",
"dexie": "^4.0.11",
"highlight.js": "^11.10.0",
"katex": "^0.16.15",
Expand All @@ -29,7 +31,7 @@
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"tailwindcss": "^3.4.15",
"tailwindcss": "^4.1.1",
"textlinestream": "^1.1.1",
"vite-plugin-singlefile": "^2.0.3"
},
Expand Down
3 changes: 1 addition & 2 deletions examples/server/webui/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
"@tailwindcss/postcss": {},
},
}
2 changes: 1 addition & 1 deletion examples/server/webui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function AppLayout() {
<>
<Sidebar />
<div
className="drawer-content grow flex flex-col h-screen w-screen mx-auto px-4 overflow-auto"
className="drawer-content grow flex flex-col h-screen w-screen mx-auto px-4 overflow-auto bg-base-100"
id="main-scroll"
>
<Header />
Expand Down
2 changes: 1 addition & 1 deletion examples/server/webui/src/Config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import daisyuiThemes from 'daisyui/src/theming/themes';
import daisyuiThemes from 'daisyui/theme/object';
import { isNumeric } from './utils/misc';

export const isDev = import.meta.env.MODE === 'development';
Expand Down
5 changes: 2 additions & 3 deletions examples/server/webui/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import StorageUtils from '../utils/storage';
import { useAppContext } from '../utils/app.context';
import { classNames } from '../utils/misc';
import daisyuiThemes from 'daisyui/src/theming/themes';
import daisyuiThemes from 'daisyui/theme/object';
import { THEMES } from '../Config';
import { useNavigate } from 'react-router';

Expand All @@ -13,14 +13,13 @@ export default function Header() {

const setTheme = (theme: string) => {
StorageUtils.setTheme(theme);
setSelectedTheme(theme);
setSelectedTheme(StorageUtils.getTheme());
};

useEffect(() => {
document.body.setAttribute('data-theme', selectedTheme);
document.body.setAttribute(
'data-color-scheme',
// @ts-expect-error daisyuiThemes complains about index type, but it should work
daisyuiThemes[selectedTheme]?.['color-scheme'] ?? 'auto'
);
}, [selectedTheme]);
Expand Down
11 changes: 8 additions & 3 deletions examples/server/webui/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
@use 'sass:meta';
@use 'tailwindcss';

@tailwind base;
@tailwind components;
@tailwind utilities;
@plugin 'daisyui' {
themes: 'light', 'dark', 'cupcake', 'bumblebee', 'emerald', 'corporate', 'synthwave', 'retro', 'cyberpunk', 'valentine', 'halloween', 'garden', 'forest', 'aqua', 'lofi', 'pastel', 'fantasy', 'wireframe', 'black', 'luxury', 'dracula', 'cmyk', 'autumn', 'business', 'acid', 'lemonade', 'night', 'coffee', 'winter', 'dim', 'nord', 'sunset',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

html {
scrollbar-gutter: auto;
}

.markdown {
h1,
Expand Down
7 changes: 6 additions & 1 deletion examples/server/webui/src/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ const StorageUtils = {
localStorage.setItem('config', JSON.stringify(config));
},
getTheme(): string {
return localStorage.getItem('theme') || 'auto';
const theme = localStorage.getItem('theme') || 'auto';
const activeTheme = (theme === 'auto') ?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The themes list didn't include auto on the website. Switching to themes: all added auto back, removed this.

(window.matchMedia("(prefers-color-scheme: light)").matches ? 'light' : 'dark') :
theme;

return activeTheme;
},
setTheme(theme: string) {
if (theme === 'auto') {
Expand Down