Fix: Ensure all skills are tracked as files, not submodules

This commit is contained in:
sck_0
2026-01-14 18:48:48 +01:00
parent 7f46ed8ca1
commit 8bd204708b
1113 changed files with 82065 additions and 2 deletions

View File

@@ -0,0 +1,384 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
scroll-behavior: smooth;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
min-height: 100vh;
line-height: 1.6;
}
.app {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.app-header {
text-align: center;
margin-bottom: 30px;
}
.app-header h1 {
color: #333;
font-size: 2.5rem;
font-weight: 600;
letter-spacing: -0.5px;
}
.app-main {
background: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
/* TodoForm */
.todo-form {
display: flex;
gap: 12px;
margin-bottom: 24px;
}
.todo-input {
flex: 1;
padding: 12px 16px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 16px;
transition: all 0.2s ease;
font-family: inherit;
}
.todo-input:focus {
outline: none;
border-color: #4CAF50;
box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}
.todo-input:disabled {
background-color: #f5f5f5;
color: #999;
cursor: not-allowed;
}
.add-button {
padding: 12px 24px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
}
.add-button:hover:not(:disabled) {
background-color: #45a049;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}
.add-button:active:not(:disabled) {
transform: translateY(0);
}
.add-button:disabled {
background-color: #ccc;
cursor: not-allowed;
opacity: 0.6;
}
/* TodoList */
.todo-list {
display: flex;
flex-direction: column;
gap: 12px;
}
/* TodoItem */
.todo-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
background: #f9f9f9;
border: 1px solid #e8e8e8;
border-radius: 8px;
transition: all 0.2s ease;
}
.todo-item:hover {
background: #f0f0f0;
border-color: #d0d0d0;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.todo-content {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
min-width: 0;
}
.todo-checkbox {
width: 20px;
height: 20px;
cursor: pointer;
accent-color: #4CAF50;
flex-shrink: 0;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.todo-checkbox:hover {
transform: scale(1.15);
}
.todo-checkbox:focus {
outline: 2px solid #4CAF50;
outline-offset: 2px;
}
.todo-title {
font-size: 16px;
color: #333;
word-break: break-word;
transition: all 0.2s ease;
}
.todo-title.completed {
text-decoration: line-through;
color: #999;
}
.delete-button {
padding: 8px 16px;
background-color: #f44336;
color: white;
border: none;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
flex-shrink: 0;
margin-left: 8px;
font-weight: 500;
}
.delete-button:hover {
background-color: #da190b;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}
.delete-button:active {
transform: translateY(0);
}
.delete-button:focus {
outline: 2px solid #f44336;
outline-offset: 2px;
}
/* EmptyState */
.empty-state {
text-align: center;
padding: 48px 24px;
color: #999;
}
.empty-message {
font-size: 20px;
font-weight: 500;
color: #666;
margin-bottom: 8px;
}
.empty-hint {
font-size: 14px;
color: #999;
}
/* Loading State */
.loading {
text-align: center;
padding: 40px 20px;
color: #666;
font-size: 16px;
}
/* Error Message */
.error-message {
padding: 12px 16px;
background-color: #ffebee;
color: #c62828;
border: 1px solid #ef5350;
border-radius: 8px;
margin-bottom: 16px;
font-size: 14px;
text-align: center;
}
/* ConfirmDialog */
.dialog-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.dialog-content {
background: white;
padding: 24px;
border-radius: 12px;
max-width: 400px;
width: 90%;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
animation: slideUp 0.2s ease;
}
@keyframes slideUp {
from {
transform: translateY(10px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.dialog-message {
margin-bottom: 20px;
font-size: 16px;
color: #333;
line-height: 1.5;
}
.dialog-buttons {
display: flex;
gap: 12px;
justify-content: flex-end;
}
.cancel-button {
padding: 10px 20px;
background-color: #f0f0f0;
color: #333;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
}
.cancel-button:hover {
background-color: #e0e0e0;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.cancel-button:focus {
outline: 2px solid #333;
outline-offset: 2px;
}
.confirm-button {
padding: 10px 20px;
background-color: #f44336;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
}
.confirm-button:hover {
background-color: #da190b;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}
.confirm-button:active {
transform: translateY(0);
}
.confirm-button:focus {
outline: 2px solid #f44336;
outline-offset: 2px;
}
/* Responsive Design */
@media (max-width: 640px) {
.app {
padding: 12px;
}
.app-header h1 {
font-size: 2rem;
}
.app-main {
padding: 16px;
}
.todo-form {
flex-direction: column;
gap: 10px;
}
.add-button {
width: 100%;
}
.todo-item {
flex-direction: column;
align-items: flex-start;
gap: 12px;
}
.todo-content {
width: 100%;
}
.delete-button {
width: 100%;
margin-left: 0;
}
.dialog-content {
width: 95%;
}
}

View File

@@ -0,0 +1,81 @@
import { useState } from 'react';
import { useTodos } from './hooks/useTodos';
import { TodoForm } from './components/TodoForm';
import { TodoList } from './components/TodoList';
import { EmptyState } from './components/EmptyState';
import { ConfirmDialog } from './components/ConfirmDialog';
import './App.css';
function App() {
const { todos, loading, error, addTodo, toggleTodo, removeTodo } = useTodos();
const [confirmDialog, setConfirmDialog] = useState<{
isOpen: boolean;
todoId: number | null;
}>({
isOpen: false,
todoId: null,
});
const handleDeleteClick = (todoId: number) => {
setConfirmDialog({
isOpen: true,
todoId,
});
};
const handleConfirmDelete = async () => {
if (confirmDialog.todoId !== null) {
await removeTodo(confirmDialog.todoId);
setConfirmDialog({
isOpen: false,
todoId: null,
});
}
};
const handleCancelDelete = () => {
setConfirmDialog({
isOpen: false,
todoId: null,
});
};
return (
<div className="app">
<header className="app-header">
<h1>Todo App</h1>
</header>
<main className="app-main">
<TodoForm onAddTodo={addTodo} />
{error && (
<div className="error-message">
{error}
</div>
)}
{loading ? (
<div className="loading">Loading todos...</div>
) : todos.length === 0 ? (
<EmptyState />
) : (
<TodoList
todos={todos}
onToggle={toggleTodo}
onDelete={handleDeleteClick}
/>
)}
</main>
<ConfirmDialog
isOpen={confirmDialog.isOpen}
message="Are you sure you want to delete this todo?"
onConfirm={handleConfirmDelete}
onCancel={handleCancelDelete}
/>
</div>
);
}
export default App;

View File

@@ -0,0 +1,57 @@
const API_BASE = '/api';
export interface Todo {
id: number;
title: string;
completed: boolean;
createdAt: string;
}
export interface CreateTodoRequest {
title: string;
}
export const fetchTodos = async (): Promise<Todo[]> => {
const response = await fetch(`${API_BASE}/todos`);
if (!response.ok) {
throw new Error('Failed to fetch todos');
}
return response.json();
};
export const createTodo = async (title: string): Promise<Todo> => {
const response = await fetch(`${API_BASE}/todos`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ title }),
});
if (!response.ok) {
throw new Error('Failed to create todo');
}
return response.json();
};
export const updateTodo = async (id: number, completed: boolean): Promise<Todo> => {
const response = await fetch(`${API_BASE}/todos/${id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ completed }),
});
if (!response.ok) {
throw new Error('Failed to update todo');
}
return response.json();
};
export const deleteTodo = async (id: number): Promise<void> => {
const response = await fetch(`${API_BASE}/todos/${id}`, {
method: 'DELETE',
});
if (!response.ok) {
throw new Error('Failed to delete todo');
}
};

View File

@@ -0,0 +1,26 @@
interface ConfirmDialogProps {
isOpen: boolean;
message: string;
onConfirm: () => void;
onCancel: () => void;
}
export const ConfirmDialog = ({ isOpen, message, onConfirm, onCancel }: ConfirmDialogProps) => {
if (!isOpen) return null;
return (
<div className="dialog-overlay">
<div className="dialog-content">
<p className="dialog-message">{message}</p>
<div className="dialog-buttons">
<button onClick={onCancel} className="cancel-button">
Cancel
</button>
<button onClick={onConfirm} className="confirm-button">
Confirm
</button>
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,8 @@
export const EmptyState = () => {
return (
<div className="empty-state">
<p className="empty-message">No todos yet!</p>
<p className="empty-hint">Add your first todo above to get started.</p>
</div>
);
};

View File

@@ -0,0 +1,43 @@
import { useState, FormEvent } from 'react';
interface TodoFormProps {
onAddTodo: (title: string) => Promise<void>;
}
export const TodoForm = ({ onAddTodo }: TodoFormProps) => {
const [title, setTitle] = useState('');
const [isSubmitting, setIsSubmitting] = useState(false);
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
const trimmedTitle = title.trim();
if (!trimmedTitle) return;
try {
setIsSubmitting(true);
await onAddTodo(trimmedTitle);
setTitle('');
} catch (err) {
console.error('Failed to add todo:', err);
} finally {
setIsSubmitting(false);
}
};
return (
<form onSubmit={handleSubmit} className="todo-form">
<input
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder="Add a new todo..."
disabled={isSubmitting}
className="todo-input"
/>
<button type="submit" disabled={isSubmitting || !title.trim()} className="add-button">
{isSubmitting ? 'Adding...' : 'Add Todo'}
</button>
</form>
);
};

View File

@@ -0,0 +1,36 @@
import { Todo } from '../api/todos';
interface TodoItemProps {
todo: Todo;
onToggle: (id: number) => Promise<void>;
onDelete: (id: number) => Promise<void>;
}
export const TodoItem = ({ todo, onToggle, onDelete }: TodoItemProps) => {
const handleToggle = () => {
onToggle(todo.id);
};
const handleDelete = () => {
onDelete(todo.id);
};
return (
<div className="todo-item">
<div className="todo-content">
<input
type="checkbox"
checked={todo.completed}
onChange={handleToggle}
className="todo-checkbox"
/>
<span className={todo.completed ? 'todo-title completed' : 'todo-title'}>
{todo.title}
</span>
</div>
<button onClick={handleDelete} className="delete-button">
Delete
</button>
</div>
);
};

View File

@@ -0,0 +1,27 @@
import { Todo } from '../api/todos';
import { TodoItem } from './TodoItem';
interface TodoListProps {
todos: Todo[];
onToggle: (id: number) => Promise<void>;
onDelete: (id: number) => Promise<void>;
}
export const TodoList = ({ todos, onToggle, onDelete }: TodoListProps) => {
if (todos.length === 0) {
return null;
}
return (
<div className="todo-list">
{todos.map(todo => (
<TodoItem
key={todo.id}
todo={todo}
onToggle={onToggle}
onDelete={onDelete}
/>
))}
</div>
);
};

View File

@@ -0,0 +1,81 @@
import { useState, useEffect } from 'react';
import { Todo, fetchTodos, createTodo, updateTodo, deleteTodo } from '../api/todos';
interface UseTodosReturn {
todos: Todo[];
loading: boolean;
error: string | null;
addTodo: (title: string) => Promise<void>;
toggleTodo: (id: number) => Promise<void>;
removeTodo: (id: number) => Promise<void>;
}
export const useTodos = (): UseTodosReturn => {
const [todos, setTodos] = useState<Todo[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
// Fetch todos on mount
useEffect(() => {
const loadTodos = async () => {
try {
setLoading(true);
setError(null);
const data = await fetchTodos();
setTodos(data);
} catch (err) {
setError('Failed to load todos');
console.error(err);
} finally {
setLoading(false);
}
};
loadTodos();
}, []);
const addTodo = async (title: string) => {
try {
const newTodo = await createTodo(title);
setTodos([newTodo, ...todos]);
} catch (err) {
setError('Failed to create todo');
console.error(err);
throw err;
}
};
const toggleTodo = async (id: number) => {
const todo = todos.find(t => t.id === id);
if (!todo) return;
try {
const updatedTodo = await updateTodo(id, !todo.completed);
setTodos(todos.map(t => t.id === id ? updatedTodo : t));
} catch (err) {
setError('Failed to update todo');
console.error(err);
throw err;
}
};
const removeTodo = async (id: number) => {
try {
await deleteTodo(id);
setTodos(todos.filter(t => t.id !== id));
} catch (err) {
setError('Failed to delete todo');
console.error(err);
throw err;
}
};
return {
todos,
loading,
error,
addTodo,
toggleTodo,
removeTodo,
};
};

View File

@@ -0,0 +1,48 @@
:root {
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />