diff --git a/index.html b/index.html index a0a2139..df0cd00 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + DSA 5e Charakter Bogen diff --git a/manifest.json b/manifest.json deleted file mode 100644 index b553103..0000000 --- a/manifest.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "DSA 5e Character Sheet", - "id": "dsa5e-character-sheet", - "version": "1.0.0", - "description": "Ein interaktiver DSA 5e Charakterbogen mit Optolith JSON Support", - "author": "Matthias Puchstein", - "entryPoint": "index.html", - "extras": [ - "colorStyles" - ], - "capabilities": [ - "chat", - "dice" - ], - "minTaleSpireVersion": "1.0.0", - "tags": [ - "character-sheet", - "dsa", - "das-schwarze-auge", - "optolith", - "dsa5e" - ], - "icon": "icon.svg", - "screenshots": [ - "screenshot1.png" - ], - "website": "https://gitea.puchstein.bayern/s0wlz_talespire_symbiotes/dsa5e_character_sheet", - "license": "GPL-3" -} diff --git a/public/icon.png b/public/icon.png new file mode 100644 index 0000000..3de5bf9 Binary files /dev/null and b/public/icon.png differ diff --git a/public/icon.svg b/public/icon.svg deleted file mode 100644 index 26107bd..0000000 --- a/public/icon.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..bbb9836 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,23 @@ +{ + "manifestVersion": 1, + "name": "DSA 5e Character Sheet", + "entryPoint": "/index.html", + "summary": "Ein interaktiver DSA 5e Charakterbogen mit Optolith JSON Support", + "version": "1.0.0", + "license": "GPL-3", + "about": { + "website": "https://gitea.puchstein.bayern/s0wlz_talespire_symbiotes/dsa5e_character_sheet", + "authors": ["Matthias Puchstein"] + }, + "api": { + "version": "0.1", + "initTimeout": 10 + }, + "icons": { + "64x64": "/icon.png" + }, + "environment": { + "capabilities": ["chat", "dice"], + "extras": ["colorStyles"] + } +} diff --git a/public/vite.svg b/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index eccb581..f4a4e06 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,14 @@ import CharacterSheet from './components/CharacterSheet'; import './App.css'; +import { ThemeProvider } from './contexts/ThemeContext'; function App() { return ( -
- -
+ +
+ +
+
); } diff --git a/src/components/CharacterSheet.css b/src/components/CharacterSheet.css index 515aaa9..236c21c 100644 --- a/src/components/CharacterSheet.css +++ b/src/components/CharacterSheet.css @@ -489,4 +489,55 @@ button:active { font-size: 2rem; text-align: center; } -} \ No newline at end of file +} + +/* Dark Theme (Default) */ +:root[data-theme='dark'] { + --ts-color-surface: #1a1a1a; + --ts-color-on-surface: #e0e0e0; + --ts-color-surface-variant: #2d2d2d; + --ts-color-primary: #9d4edd; + --ts-color-secondary: #7209b7; + --ts-color-outline: #404040; + --text-color: #e0e0e0; + --background-color: #121212; + --surface-color: #1a1a1a; + --surface-variant-color: #2d2d2d; +} + +/* Light Theme */ +:root[data-theme='light'] { + --ts-color-surface: #ffffff; + --ts-color-on-surface: #1a1a1a; + --ts-color-surface-variant: #f9f9f9; + --ts-color-primary: #7b2cbf; + --ts-color-secondary: #3a0ca3; + --ts-color-outline: #cccccc; + --text-color: #222; + --background-color: #f5f5f5; + --surface-color: #ffffff; + --surface-variant-color: #f9f9f9; +} + +/* Theme Toggle Button */ +.theme-toggle { + position: fixed; + top: 20px; + right: 20px; + width: 50px; + height: 50px; + border-radius: 25px; + background: var(--ts-color-primary); + color: white; + border: none; + font-size: 1.5rem; + cursor: pointer; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); + transition: all 0.3s ease; + z-index: 1000; +} + +.theme-toggle:hover { + transform: scale(1.1); + box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); +} diff --git a/src/components/CharacterSheet.tsx b/src/components/CharacterSheet.tsx index 36bd316..4a0ee9a 100644 --- a/src/components/CharacterSheet.tsx +++ b/src/components/CharacterSheet.tsx @@ -5,6 +5,8 @@ import Attributes from './Attributes'; import Skills from './Skills'; import CombatValues from './CombatValues'; import './CharacterSheet.css'; +import ThemeToggle from "./ThemeToggle.tsx"; +import iconUrl from '/icon.png'; const initialCharacter: DSACharacter = { id: crypto.randomUUID(), @@ -40,8 +42,9 @@ const CharacterSheet: React.FC = () => { return (
+
- DSA 5e Logo + DSA 5e Logo

DSA 5 Character Sheet

diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx new file mode 100644 index 0000000..e764b0c --- /dev/null +++ b/src/components/ThemeToggle.tsx @@ -0,0 +1,18 @@ +import React from 'react'; +import { useTheme } from '../contexts/ThemeContext'; + +const ThemeToggle: React.FC = () => { + const { theme, toggleTheme } = useTheme(); + + return ( + + ); +}; + +export default ThemeToggle; diff --git a/src/contexts/ThemeContext.tsx b/src/contexts/ThemeContext.tsx new file mode 100644 index 0000000..fc19a42 --- /dev/null +++ b/src/contexts/ThemeContext.tsx @@ -0,0 +1,41 @@ +import React, { createContext, useContext, useEffect, useState } from 'react'; + +type Theme = 'light' | 'dark'; + +interface ThemeContextType { + theme: Theme; + toggleTheme: () => void; +} + +const ThemeContext = createContext(undefined); + +export const useTheme = () => { + const context = useContext(ThemeContext); + if (!context) { + throw new Error('useTheme must be used within ThemeProvider'); + } + return context; +}; + +export const ThemeProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const [theme, setTheme] = useState(() => { + // Aus localStorage laden oder Default zu dark (passt zu TaleSpire) + const saved = localStorage.getItem('dsa5e-theme'); + return (saved as Theme) || 'dark'; + }); + + useEffect(() => { + document.documentElement.setAttribute('data-theme', theme); + localStorage.setItem('dsa5e-theme', theme); + }, [theme]); + + const toggleTheme = () => { + setTheme(prev => prev === 'light' ? 'dark' : 'light'); + }; + + return ( + + {children} + + ); +}; diff --git a/vite.config.ts b/vite.config.ts index 8b0f57b..974f709 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,17 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; -// https://vite.dev/config/ export default defineConfig({ plugins: [react()], -}) + base: './', + build: { + minify: 'esbuild', // ← Statt terser + rollupOptions: { + output: { + assetFileNames: 'assets/[name].[ext]', + chunkFileNames: 'assets/[name].js', + entryFileNames: 'assets/[name].js' + } + } + } +});