diff --git a/src/games/storywriter/assets/lore-editor.module.css b/src/games/storywriter/assets/lore-editor.module.css new file mode 100644 index 0000000..4e2c820 --- /dev/null +++ b/src/games/storywriter/assets/lore-editor.module.css @@ -0,0 +1,200 @@ +.loreEditor { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + gap: 24px; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding-bottom: 16px; + border-bottom: 1px solid var(--border); +} + +.header h2 { + margin: 0; + font-size: 24px; + font-weight: 600; + color: var(--text); +} + +.addEntry { + display: flex; + gap: 8px; + align-items: center; +} + +.titleInput { + padding: 8px 12px; + background: var(--bg); + border: 1px solid var(--border); + border-radius: 6px; + font-size: 14px; + color: var(--text); + font-family: inherit; + width: 250px; + + &:focus { + outline: none; + border-color: var(--accent); + } +} + +.addButton { + padding: 8px 16px; + background: var(--accent); + color: var(--bg); + border: none; + border-radius: 6px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: opacity 0.2s; + + &:hover { + background: var(--accent-alt); + } +} + +.list { + flex: 1; + overflow-y: auto; + display: flex; + flex-direction: column; + gap: 16px; +} + +.empty { + color: var(--text-muted); + font-style: italic; + font-size: 14px; +} + +.entryCard { + background: var(--bg-secondary); + border-radius: 8px; + padding: 20px; + display: flex; + flex-direction: column; + gap: 12px; +} + +.cardHeader { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; +} + +.titleRow { + flex: 1; + min-width: 0; +} + +.entryTitle { + margin: 0; + font-size: 18px; + font-weight: 600; + color: var(--text); + cursor: pointer; + transition: color 0.2s; + + &:hover { + color: var(--accent); + } +} + +.titleEditInput { + width: 100%; + padding: 6px 10px; + background: var(--bg); + border: 1px solid var(--border); + border-radius: 6px; + font-size: 18px; + font-weight: 600; + color: var(--text); + font-family: inherit; + + &:focus { + outline: none; + border-color: var(--accent); + } +} + +.actions { + display: flex; + gap: 6px; + align-items: center; +} + +.moveButton { + width: 28px; + height: 28px; + display: flex; + align-items: center; + justify-content: center; + background: var(--bg); + border: 1px solid var(--border); + border-radius: 4px; + color: var(--text); + font-size: 14px; + cursor: pointer; + transition: all var(--transition); + + &:hover:not(:disabled) { + border-color: var(--accent); + color: var(--accent); + } + + &:disabled { + opacity: 0.3; + cursor: not-allowed; + } +} + +.deleteButton { + width: 28px; + height: 28px; + display: flex; + align-items: center; + justify-content: center; + background: transparent; + border: 1px solid var(--border); + border-radius: 4px; + color: var(--text-muted); + font-size: 18px; + cursor: pointer; + transition: all var(--transition); + + &:hover { + background: var(--danger); + border-color: var(--danger); + color: var(--bg); + } +} + +.content { + min-height: 80px; +} + +.textarea { + width: 100%; + padding: 10px 12px; + background: var(--bg); + border: 1px solid var(--border); + border-radius: 6px; + font-size: 14px; + color: var(--text); + font-family: inherit; + resize: vertical; + min-height: 80px; + box-sizing: border-box; + + &:focus { + outline: none; + border-color: var(--accent); + } +} diff --git a/src/games/storywriter/components/editor.tsx b/src/games/storywriter/components/editor.tsx index 2a89980..4355548 100644 --- a/src/games/storywriter/components/editor.tsx +++ b/src/games/storywriter/components/editor.tsx @@ -7,6 +7,7 @@ import clsx from "clsx"; import { CharacterEditor } from "./character-editor"; import { LocationEditor } from "./location-editor"; import { ChaptersEditor } from "./chapters-editor"; +import { LoreEditor } from "./lore-editor"; import { useInputCallback } from "@common/hooks/useInputCallback"; const TABS: { id: Tab; label: string }[] = [ @@ -29,15 +30,6 @@ export const Editor = () => { }); }, [currentStory?.id]); - const handleLoreInput = useInputCallback((lore: string) => { - if (!currentStory) return; - dispatch({ - type: 'EDIT_LORE', - id: currentStory.id, - lore, - }); - }, [currentStory?.id]); - const handleTabChange = (tab: Tab) => { if (!currentStory) return; dispatch({ @@ -48,7 +40,6 @@ export const Editor = () => { }; const storyValue = useMemo(() => currentStory ? highlight(currentStory.text) : '', [currentStory?.text]); - const loreValue = useMemo(() => currentStory ? highlight(currentStory.lore) : '', [currentStory?.lore]); if (!currentStory) { return
; @@ -69,12 +60,7 @@ export const Editor = () => { /> )} {currentStory.currentTab === "lore" && ( -No lore entries yet. Add your first entry!
+ )} + + {currentStory.lore.map((entry, index) => ( +