feat: initialize novel writer application with React, Zustand, and Vite

- Added main application structure with React and TypeScript.
- Implemented Zustand for state management, including novel, chapters, characters, and relationships.
- Created initial CSS styles for the application layout and components.
- Integrated SVG assets for branding.
- Set up Vite configuration for development and build processes.
- Established TypeScript configurations for app and node environments.
This commit is contained in:
2026-01-06 18:39:16 +05:00
parent d3be98e0a7
commit 8af220f873
16 changed files with 6131 additions and 0 deletions

829
novel-writer/src/index.css Normal file
View File

@@ -0,0 +1,829 @@
:root {
--bg-primary: #0f0f0f;
--bg-secondary: #1a1a1a;
--bg-tertiary: #252525;
--bg-hover: #2a2a2a;
--text-primary: #e5e5e5;
--text-secondary: #a3a3a3;
--text-muted: #737373;
--accent-primary: #6366f1;
--accent-secondary: #818cf8;
--accent-success: #10b981;
--accent-danger: #ef4444;
--accent-warning: #f59e0b;
--border-color: #333;
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
overflow: hidden;
}
#root {
height: 100vh;
width: 100vw;
}
.app-container {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1.5rem;
background-color: var(--bg-secondary);
border-bottom: 1px solid var(--border-color);
height: 56px;
flex-shrink: 0;
}
.header-left {
display: flex;
align-items: center;
gap: 1rem;
}
.logo {
font-size: 1.25rem;
font-weight: 700;
color: var(--accent-primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
.novel-title-input {
background: transparent;
border: none;
color: var(--text-primary);
font-size: 1rem;
font-weight: 600;
padding: 0.5rem;
border-radius: 0.375rem;
width: 200px;
transition: background-color 0.2s;
}
.novel-title-input:hover,
.novel-title-input:focus {
background-color: var(--bg-tertiary);
outline: none;
}
.header-right {
display: flex;
align-items: center;
gap: 0.75rem;
}
.model-select {
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
color: var(--text-primary);
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
font-size: 0.875rem;
cursor: pointer;
outline: none;
transition: border-color 0.2s;
}
.model-select:hover,
.model-select:focus {
border-color: var(--accent-primary);
}
.main-content {
display: flex;
flex: 1;
overflow: hidden;
}
.sidebar-left {
width: 280px;
background-color: var(--bg-secondary);
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
}
.sidebar-left .sidebar-content {
min-height: 0;
flex: 1;
}
.sidebar-tabs {
display: flex;
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.sidebar-tab {
flex: 1;
padding: 0.75rem;
background: transparent;
border: none;
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
border-bottom: 2px solid transparent;
}
.sidebar-tab:hover {
color: var(--text-primary);
background-color: var(--bg-tertiary);
}
.sidebar-tab.active {
color: var(--accent-primary);
border-bottom-color: var(--accent-primary);
}
.sidebar-content {
flex: 1;
overflow-y: auto;
padding: 0.75rem;
}
.volume-item {
margin-bottom: 0.5rem;
}
.volume-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 0.75rem;
background-color: var(--bg-tertiary);
border-radius: 0.5rem;
cursor: pointer;
transition: background-color 0.2s;
}
.volume-header:hover {
background-color: var(--bg-hover);
}
.volume-title {
font-weight: 600;
font-size: 0.875rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.chapter-list {
padding-left: 1rem;
margin-top: 0.25rem;
}
.chapter-item {
display: flex;
align-items: center;
padding: 0.5rem 0.75rem;
border-radius: 0.375rem;
cursor: pointer;
transition: all 0.2s;
font-size: 0.875rem;
color: var(--text-secondary);
margin-top: 0.125rem;
}
.chapter-item:hover {
background-color: var(--bg-tertiary);
color: var(--text-primary);
}
.chapter-item.active {
background-color: var(--accent-primary);
color: white;
}
.add-button {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
width: 100%;
padding: 0.625rem;
margin-top: 0.5rem;
background-color: var(--bg-tertiary);
border: 1px dashed var(--border-color);
border-radius: 0.5rem;
color: var(--text-secondary);
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s;
}
.add-button:hover {
border-color: var(--accent-primary);
color: var(--accent-primary);
background-color: rgba(99, 102, 241, 0.1);
}
.editor-container {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
background-color: var(--bg-primary);
}
.editor-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1.5rem;
background-color: var(--bg-secondary);
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.chapter-title-input {
background: transparent;
border: none;
color: var(--text-primary);
font-size: 1.125rem;
font-weight: 600;
padding: 0.5rem;
border-radius: 0.375rem;
flex: 1;
max-width: 400px;
transition: background-color 0.2s;
}
.chapter-title-input:hover,
.chapter-title-input:focus {
background-color: var(--bg-tertiary);
outline: none;
}
.editor-stats {
display: flex;
gap: 1.5rem;
font-size: 0.875rem;
color: var(--text-secondary);
}
.editor-textarea {
flex: 1;
width: 100%;
padding: 1.5rem;
background-color: var(--bg-primary);
border: none;
color: var(--text-primary);
font-size: 1rem;
line-height: 1.8;
resize: none;
outline: none;
font-family: 'Georgia', serif;
max-width: 900px;
margin: 0 auto;
display: block;
}
.editor-textarea::placeholder {
color: var(--text-muted);
}
.sidebar-right {
width: 360px;
background-color: var(--bg-secondary);
border-left: 1px solid var(--border-color);
display: flex;
flex-direction: column;
overflow: hidden;
flex-shrink: 0;
}
.chat-container {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
.chat-header {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-color);
font-weight: 600;
font-size: 0.875rem;
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
}
.chat-messages {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
min-height: 0;
}
.message {
max-width: 90%;
padding: 0.75rem 1rem;
border-radius: 0.75rem;
font-size: 0.875rem;
line-height: 1.5;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.message.user {
align-self: flex-end;
background-color: var(--accent-primary);
color: white;
border-bottom-right-radius: 0.25rem;
}
.message.assistant {
align-self: flex-start;
background-color: var(--bg-tertiary);
color: var(--text-primary);
border-bottom-left-radius: 0.25rem;
}
.chat-input-container {
padding: 1rem;
border-top: 1px solid var(--border-color);
flex-shrink: 0;
}
.chat-input-wrapper {
display: flex;
gap: 0.5rem;
align-items: flex-end;
}
.chat-input {
flex: 1;
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
color: var(--text-primary);
font-size: 0.875rem;
resize: none;
max-height: 120px;
outline: none;
transition: border-color 0.2s;
}
.chat-input:focus {
border-color: var(--accent-primary);
}
.chat-input::placeholder {
color: var(--text-muted);
}
.send-button {
background-color: var(--accent-primary);
border: none;
border-radius: 0.5rem;
padding: 0.75rem;
color: white;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
}
.send-button:hover:not(:disabled) {
background-color: var(--accent-secondary);
}
.send-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.ollama-settings {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-color);
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
flex-shrink: 0;
}
.setting-input {
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: 0.375rem;
padding: 0.5rem;
color: var(--text-primary);
font-size: 0.75rem;
flex: 1;
min-width: 0;
}
.setting-input:focus {
outline: none;
border-color: var(--accent-primary);
}
.character-section {
display: flex;
flex-direction: column;
height: 100%;
}
.character-header {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border-color);
font-weight: 600;
font-size: 0.875rem;
flex-shrink: 0;
}
.character-graph {
flex: 1;
background-color: var(--bg-primary);
position: relative;
}
.graph-legend {
position: absolute;
bottom: 1rem;
left: 1rem;
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
font-size: 0.75rem;
}
.legend-item {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.25rem;
}
.legend-color {
width: 12px;
height: 12px;
border-radius: 50%;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
color: var(--text-muted);
text-align: center;
padding: 2rem;
}
.empty-state-icon {
font-size: 3rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.empty-state-text {
font-size: 0.875rem;
margin-bottom: 1rem;
}
.modal-overlay {
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
animation: fadeIn 0.2s ease;
}
.modal {
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 0.75rem;
padding: 1.5rem;
width: 100%;
max-width: 400px;
animation: slideUp 0.3s ease;
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.modal-title {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 1rem;
}
.modal-input {
width: 100%;
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
color: var(--text-primary);
font-size: 0.875rem;
margin-bottom: 0.75rem;
outline: none;
transition: border-color 0.2s;
}
.modal-input:focus {
border-color: var(--accent-primary);
}
.modal-select {
width: 100%;
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
color: var(--text-primary);
font-size: 0.875rem;
margin-bottom: 0.75rem;
outline: none;
cursor: pointer;
}
.modal-actions {
display: flex;
gap: 0.5rem;
justify-content: flex-end;
margin-top: 1rem;
}
.modal-button {
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s;
}
.modal-button.secondary {
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
color: var(--text-primary);
}
.modal-button.primary {
background-color: var(--accent-primary);
border: none;
color: white;
}
.modal-button:hover {
transform: translateY(-1px);
}
.sidebar-left .sidebar-content {
min-height: 0;
flex: 1;
}
.character-list {
padding: 0.75rem;
overflow-y: auto;
flex: 1;
min-height: 0;
}
.character-card {
background-color: var(--bg-tertiary);
border-radius: 0.5rem;
padding: 0.75rem;
margin-bottom: 0.5rem;
cursor: pointer;
transition: all 0.2s;
border: 1px solid transparent;
}
.character-card:hover {
background-color: var(--bg-hover);
}
.character-card.selected {
border-color: var(--accent-primary);
}
.character-card-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.5rem;
}
.character-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: 600;
font-size: 0.875rem;
}
.character-name {
font-weight: 600;
font-size: 0.875rem;
}
.character-role {
font-size: 0.75rem;
color: var(--text-secondary);
text-transform: capitalize;
}
.character-description {
font-size: 0.8rem;
color: var(--text-secondary);
line-height: 1.4;
}
.character-actions {
display: flex;
gap: 0.5rem;
margin-top: 0.5rem;
}
.character-action-btn {
flex: 1;
padding: 0.375rem;
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 0.25rem;
color: var(--text-secondary);
font-size: 0.75rem;
cursor: pointer;
transition: all 0.2s;
}
.character-action-btn:hover {
border-color: var(--accent-primary);
color: var(--accent-primary);
}
.scrollbar-thin::-webkit-scrollbar {
width: 6px;
}
.scrollbar-thin::-webkit-scrollbar-track {
background: var(--bg-primary);
}
.scrollbar-thin::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 3px;
}
.scrollbar-thin::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
}
.word-count {
font-size: 0.75rem;
color: var(--text-muted);
margin-top: 0.5rem;
}
.typing-indicator {
display: flex;
gap: 4px;
padding: 0.5rem;
}
.typing-indicator span {
width: 8px;
height: 8px;
background-color: var(--accent-primary);
border-radius: 50%;
animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) {
animation-delay: 0s;
}
.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes typing {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-10px);
}
}
.context-indicator {
font-size: 0.7rem;
color: var(--accent-success);
display: flex;
align-items: center;
gap: 0.25rem;
}
.loading-spinner {
width: 16px;
height: 16px;
border: 2px solid var(--border-color);
border-top-color: var(--accent-primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.context-modal-textarea {
width: 100%;
background-color: var(--bg-tertiary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
color: var(--text-primary);
font-size: 0.875rem;
resize: none;
outline: none;
transition: border-color 0.2s;
}
.context-modal-textarea:focus {
border-color: var(--accent-primary);
}
@media (max-width: 1200px) {
.sidebar-left {
width: 240px;
}
.sidebar-right {
width: 320px;
}
}
@media (max-width: 900px) {
.sidebar-right {
display: none;
}
}