feat: add auto-save debounce, note refetch on switch, todos feature with markdown

Features implemented:
- Auto-save with counter-based debounce in note editor
- Note refetches when switching between notes (note_id prop changes)
- Todos feature with full CRUD operations
- Markdown rendering in todo titles
- API endpoints for todos (create, list, toggle, delete)
- Todo panel in sidebar with sorting (incomplete first, newest first)
- Todo items use TodoItem component for clean separation

Technical changes:
- Added Todo struct and API endpoints in api package
- Added markdown dependency to web package
- Implemented TodoPanel component with TodoItem sub-component
- Added mut keywords to signal bindings for Dioxus 0.7
- Fixed closure capture issues with cloning todo objects
This commit is contained in:
2026-02-04 13:29:33 +01:00
parent 25e498aff0
commit 3774c3347c
5 changed files with 454 additions and 7 deletions

View File

@@ -449,6 +449,161 @@ body {
background: var(--text-muted);
}
.todos-section {
padding: 1rem 1.5rem 0.5rem;
border-bottom: 1px solid var(--border);
background: var(--bg-tertiary);
}
.todos-title {
font-size: 1rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--text-primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
.todos-title::before {
content: "📋";
font-size: 1.2rem;
}
.todo-form {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
}
.todo-input {
flex: 1;
padding: 0.6rem 0.8rem;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg-primary);
color: var(--text-primary);
font-size: 0.85rem;
outline: none;
transition: all 0.2s;
}
.todo-input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
.todo-input::placeholder {
color: var(--text-muted);
}
.todo-add-button {
padding: 0.6rem 1rem;
background: var(--accent);
color: white;
border: none;
border-radius: 6px;
font-size: 0.85rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.todo-add-button:hover {
background: var(--accent-hover);
}
.todos-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.todo-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 0.8rem;
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 6px;
transition: all 0.2s;
cursor: pointer;
}
.todo-item:hover {
border-color: var(--accent);
background: var(--bg-hover);
}
.todo-item.completed {
opacity: 0.6;
}
.todo-item.completed .todo-title {
text-decoration: line-through;
color: var(--text-muted);
}
.todo-checkbox {
width: 18px;
height: 18px;
cursor: pointer;
accent-color: var(--accent);
}
.todo-title {
flex: 1;
font-size: 0.9rem;
color: var(--text-primary);
line-height: 1.4;
}
.todo-title strong {
font-weight: 700;
}
.todo-title em {
font-style: italic;
}
.todo-title code {
background: var(--bg-tertiary);
padding: 0.2rem 0.4rem;
border-radius: 4px;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 0.85rem;
}
.todo-title a {
color: var(--accent);
text-decoration: none;
}
.todo-title a:hover {
text-decoration: underline;
}
.todo-delete-button {
width: 24px;
height: 24px;
background: transparent;
border: none;
color: var(--text-muted);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: all 0.2s;
font-size: 1rem;
}
.todo-delete-button:hover {
background: var(--danger);
color: white;
}
@media (max-width: 768px) {
.sidebar {
width: 100%;