initial commit

This commit is contained in:
2026-08-09 12:22:40 +02:00
parent a36b2fa801
commit d6dbc1881a
44 changed files with 5787 additions and 1 deletions
+140
View File
@@ -0,0 +1,140 @@
using FocusApp.Data;
using FocusApp.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace FocusApp.Controllers;
[ApiController]
[Route("api/[controller]")]
public class FocusTasksController : ControllerBase
{
private readonly FocusContext _context;
private readonly ILogger<FocusTasksController> _logger;
public FocusTasksController(FocusContext context, ILogger<FocusTasksController> logger)
{
_context = context;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<FocusTask>>> GetTasks()
{
var tasks = await _context.FocusTasks
.OrderByDescending(t => t.Order)
.ToListAsync();
return Ok(tasks);
}
[HttpPost]
public async Task<ActionResult<FocusTask>> CreateTask([FromBody] CreateTaskDto dto)
{
if (string.IsNullOrWhiteSpace(dto.Title))
return BadRequest("Title is required");
var maxOrder = await _context.FocusTasks.MaxAsync(t => (int?)t.Order) ?? 0;
var task = new FocusTask
{
Title = dto.Title,
Description = dto.Description,
Order = maxOrder + 1,
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
};
_context.FocusTasks.Add(task);
await _context.SaveChangesAsync();
return CreatedAtAction(nameof(GetTasks), new { id = task.Id }, task);
}
[HttpPut("{id}")]
public async Task<IActionResult> UpdateTask(int id, [FromBody] UpdateTaskDto dto)
{
var task = await _context.FocusTasks.FindAsync(id);
if (task == null)
return NotFound();
if (!string.IsNullOrWhiteSpace(dto.Title))
task.Title = dto.Title;
if (dto.Description != null)
task.Description = dto.Description;
if (dto.Order.HasValue)
task.Order = dto.Order.Value;
task.UpdatedAt = DateTime.UtcNow;
_context.FocusTasks.Update(task);
await _context.SaveChangesAsync();
return Ok(task);
}
[HttpPut("reorder")]
public async Task<IActionResult> ReorderTasks([FromBody] ReorderDto dto)
{
if (dto.Orders == null || dto.Orders.Count == 0)
return BadRequest("Orders are required");
// Finde maximale Order-Nummer
int maxOrder = dto.Orders.Max(o => o.Order);
foreach (var order in dto.Orders)
{
var task = await _context.FocusTasks.FindAsync(order.Id);
if (task != null)
{
// Invertiere die Order: höchste wird niedrigste und umgekehrt
task.Order = maxOrder - order.Order;
task.UpdatedAt = DateTime.UtcNow;
_context.FocusTasks.Update(task);
}
}
await _context.SaveChangesAsync();
// Rückgabe: absteigend sortiert (neue oben)
return Ok(await _context.FocusTasks.OrderByDescending(t => t.Order).ToListAsync());
}
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteTask(int id)
{
var task = await _context.FocusTasks.FindAsync(id);
if (task == null)
return NotFound();
_context.FocusTasks.Remove(task);
await _context.SaveChangesAsync();
return NoContent();
}
}
public class CreateTaskDto
{
public string Title { get; set; } = string.Empty;
public string? Description { get; set; }
}
public class UpdateTaskDto
{
public string? Title { get; set; }
public string? Description { get; set; }
public int? Order { get; set; }
}
public class ReorderDto
{
public List<OrderItem> Orders { get; set; } = new();
}
public class OrderItem
{
public int Id { get; set; }
public int Order { get; set; }
}
+28
View File
@@ -0,0 +1,28 @@
using FocusApp.Models;
using Microsoft.EntityFrameworkCore;
namespace FocusApp.Data;
public class FocusContext : DbContext
{
public DbSet<FocusTask> FocusTasks { get; set; }
public FocusContext(DbContextOptions<FocusContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<FocusTask>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Title).IsRequired().HasMaxLength(255);
entity.Property(e => e.Description).HasMaxLength(2000);
entity.Property(e => e.Order).IsRequired();
entity.Property(e => e.CreatedAt).IsRequired();
entity.Property(e => e.UpdatedAt).IsRequired();
});
}
}
+24
View File
@@ -0,0 +1,24 @@
<Project>
<!-- Exclude node_modules from Visual Studio -->
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);client\node_modules\**</DefaultItemExcludes>
<EnableDefaultItems>true</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<!-- Komplett von VS ausschließen -->
<Compile Remove="client\node_modules\**" />
<Content Remove="client\node_modules\**" />
<EmbeddedResource Remove="client\node_modules\**" />
<None Remove="client\node_modules\**" />
<!-- Auch Build/Dist ausschließen -->
<Compile Remove="client\build\**" />
<Content Remove="client\build\**" />
<None Remove="client\build\**" />
<Compile Remove="client\dist\**" />
<Content Remove="client\dist\**" />
<None Remove="client\dist\**" />
</ItemGroup>
</Project>
+38
View File
@@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.Text.Json" Version="8.0.6" />
</ItemGroup>
<ItemGroup>
<!-- Frontend Build Output inkludieren -->
<Content Include="client\build\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<!-- Automatisches Frontend-Build bei Publish (nur Release) -->
<Target Name="BuildFrontend" BeforeTargets="Publish" Condition="'$(Configuration)' == 'Release'">
<Message Text="🔨 Building React Frontend..." Importance="high" />
<!-- NPM Install falls node_modules nicht existiert -->
<Exec Command="cd client &amp;&amp; npm install" Condition="!Exists('client\node_modules')" WorkingDirectory="$(ProjectDir)" />
<!-- NPM Build -->
<Exec Command="cd client &amp;&amp; npm run build" WorkingDirectory="$(ProjectDir)" />
<Message Text="✅ Frontend Build abgeschlossen!" Importance="high" />
</Target>
</Project>
+39
View File
@@ -0,0 +1,39 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FocusApp", "FocusApp.csproj", "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{12345678-1234-1234-1234-123456789012}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
deploy.ps1 = deploy.ps1
Directory.Build.props = Directory.Build.props
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client", "client", "{23456789-2345-2345-2345-234567890123}"
ProjectSection(SolutionItems) = preProject
client\package.json = client\package.json
client\tsconfig.json = client\tsconfig.json
client\vite.config.ts = client\vite.config.ts
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA9C148F-90B2-4778-8D97-6A66BFBD0CDE}
EndGlobalSection
EndGlobal
+16
View File
@@ -0,0 +1,16 @@
namespace FocusApp.Models;
public class FocusTask
{
public int Id { get; set; }
public string Title { get; set; } = string.Empty;
public string? Description { get; set; }
public int Order { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
+97
View File
@@ -0,0 +1,97 @@
using FocusApp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.FileProviders;
var builder = WebApplication.CreateBuilder(args);
// Add services
builder.Services.AddDbContext<FocusContext>(options =>
options.UseMySql(
builder.Configuration.GetConnectionString("DefaultConnection"),
ServerVersion.AutoDetect(builder.Configuration.GetConnectionString("DefaultConnection"))
)
);
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowReact", policy =>
{
policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.WebHost.UseUrls("http://0.0.0.0:5000");
var app = builder.Build();
// Ensure database is created
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<FocusContext>();
db.Database.EnsureCreated();
}
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseCors("AllowReact");
// STATIC FILES VOR UseRouting!
var clientPath = Path.Combine(app.Environment.ContentRootPath, "client", "build");
Console.WriteLine($"Looking for frontend at: {clientPath}");
Console.WriteLine($"Directory exists: {Directory.Exists(clientPath)}");
if (Directory.Exists(clientPath))
{
Console.WriteLine("Serving React frontend from client/build/");
app.UseDefaultFiles(new DefaultFilesOptions
{
FileProvider = new PhysicalFileProvider(clientPath)
});
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(clientPath),
RequestPath = ""
});
}
else
{
Console.WriteLine("client/build/ not found! Run: cd client && npm run build");
}
app.UseAuthorization();
app.MapControllers();
// FALLBACK für SPA (alle nicht-API Routes >> index.html)
app.MapFallback(async context =>
{
var indexPath = Path.Combine(clientPath, "index.html");
if (File.Exists(indexPath))
{
context.Response.ContentType = "text/html";
await context.Response.SendFileAsync(indexPath);
}
else
{
context.Response.StatusCode = 404;
await context.Response.WriteAsync("Frontend not built. Run: cd client && npm run build");
}
});
Console.WriteLine("FocusApp started!");
Console.WriteLine("Backend API: http://localhost:5000");
Console.WriteLine("Swagger: http://localhost:5000/swagger");
Console.WriteLine("Frontend: http://localhost:5000");
app.Run();
+12
View File
@@ -0,0 +1,12 @@
{
"profiles": {
"FocusApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:62966;http://localhost:62967"
}
}
}
+430 -1
View File
@@ -1 +1,430 @@
# focusApp # FocusApp - Todo Application
Eine moderne, minimalistische Todo-Anwendung mit Drag & Drop, gebaut mit React und ASP.NET Core.
## 🚀 Features
-**Todo-Verwaltung** - Erstellen, Bearbeiten, Löschen von Aufgaben
- 🎯 **Drag & Drop** - Intuitive Neuordnung der Aufgaben
- 🎨 **Dark/Light Mode** - Automatische Theme-Erkennung
- 📱 **Responsive Design** - Optimiert für Desktop und Mobile
- 💾 **Persistente Speicherung** - Daten bleiben nach Neustart erhalten
- 🔄 **RESTful API** - Saubere Backend-Architektur
## 📋 Voraussetzungen
- **.NET 9.0 SDK** oder höher
- **Node.js 18+** und **npm** (für React-Entwicklung)
- **Linux Server** (Ubuntu/Debian empfohlen) für Deployment
## 🛠️ Installation & Setup
### 1. Projekt klonen/kopieren
```bash
# Projektverzeichnis erstellen
sudo mkdir -p /opt/tools/FocusApp
sudo chown $USER:$USER /opt/tools/FocusApp
```
### 2. .NET Runtime installieren
```bash
# .NET 9.0 Runtime herunterladen
cd /tmp
wget https://download.visualstudio.microsoft.com/download/pr/...dotnet-runtime-9.0.0-linux-x64.tar.gz
# Entpacken nach /opt/dotnet
sudo mkdir -p /opt/dotnet
sudo tar -xzf dotnet-runtime-9.0.0-linux-x64.tar.gz -C /opt/dotnet
# PATH setzen
echo 'export PATH=$PATH:/opt/dotnet' >> ~/.bashrc
source ~/.bashrc
```
### 3. React Frontend bauen
```bash
cd /pfad/zu/deinem/projekt/FocusApp/ClientApp
# Dependencies installieren
npm install
# Production Build erstellen
npm run build
```
**Wichtig:** Der Build landet in `ClientApp/build/` und wird automatisch vom Backend ausgeliefert.
### 4. ASP.NET Backend veröffentlichen
```bash
cd /pfad/zu/deinem/projekt/FocusApp
# Release Build erstellen
dotnet publish -c Release -o /opt/tools/FocusApp
```
## ⚙️ Konfiguration
### appsettings.Production.json
Erstelle `/opt/tools/FocusApp/appsettings.Production.json`:
```json
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
```
**Log Levels:**
- `Error` - Nur Fehler
- `Warning` - Warnungen + Fehler (empfohlen)
- `Information` - Mehr Details
- `None` - Kein Logging
## 🔧 Systemd Service Setup
### Service-Datei erstellen
```bash
sudo vim /etc/systemd/system/focusapp.service
```
**Inhalt:**
```ini
[Unit]
Description=FocusApp Todo Application
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/tools/FocusApp
ExecStart=/opt/dotnet/dotnet /opt/tools/FocusApp/FocusApp.dll
Restart=always
RestartSec=10
User=stefan
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_ROOT=/opt/dotnet
Environment=ASPNETCORE_URLS=http://0.0.0.0:5000
SyslogIdentifier=focusapp
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
```
**Wichtig:**
- `Type=simple` verwenden (nicht `notify`)
- `User` anpassen auf deinen Linux-User
- Port `5000` ist der Standard, kann angepasst werden
### Service aktivieren
```bash
# Service neu laden
sudo systemctl daemon-reload
# Service starten
sudo systemctl start focusapp.service
# Service beim Boot aktivieren
sudo systemctl enable focusapp.service
# Status prüfen
sudo systemctl status focusapp.service
```
## 📡 API Endpoints
### Todos abrufen
```http
GET /api/todos
```
**Response:**
```json
[
{
"id": 1,
"title": "Erste Aufgabe",
"description": "Beschreibung",
"createdAt": "2026-01-29T22:00:00Z",
"order": 0
}
]
```
### Todo erstellen
```http
POST /api/todos
Content-Type: application/json
{
"title": "Neue Aufgabe",
"description": "Optional"
}
```
### Todo aktualisieren
```http
PUT /api/todos/{id}
Content-Type: application/json
{
"id": 1,
"title": "Geändert",
"description": "Neue Beschreibung"
}
```
### Todo löschen
```http
DELETE /api/todos/{id}
```
### Reihenfolge aktualisieren
```http
POST /api/todos/reorder
Content-Type: application/json
[1, 3, 2, 4]
```
## 🎯 Entwicklung
### Backend starten (Development)
```bash
cd FocusApp
dotnet run
```
API läuft auf: `http://localhost:5000`
### Frontend starten (Development)
```bash
cd FocusApp/ClientApp
npm start
```
React Dev Server läuft auf: `http://localhost:3000`
**Proxy:** API-Calls werden automatisch an `http://localhost:5000` weitergeleitet (siehe `package.json`).
### Datenbank
Todos werden in einer **SQLite-Datenbank** gespeichert:
- Datei: `/opt/tools/FocusApp/todos.db`
- Automatische Erstellung beim ersten Start
- Entity Framework Core mit Code-First Migrations
## 🐛 Troubleshooting
### Service startet nicht
```bash
# Logs ansehen
sudo journalctl -u focusapp.service -n 50 --no-pager
# Manuell testen
cd /opt/tools/FocusApp
/opt/dotnet/dotnet FocusApp.dll
```
### Service hängt bei "starting"
**Problem:** `Type=notify` statt `Type=simple` in Service-Datei.
**Lösung:** Service-Datei editieren, `Type=simple` verwenden, dann:
```bash
sudo systemctl daemon-reload
sudo systemctl restart focusapp.service
```
### Port bereits belegt
```bash
# Port-Verwendung prüfen
sudo netstat -tlnp | grep 5000
# Anderen Port in Service-Datei setzen
Environment=ASPNETCORE_URLS=http://0.0.0.0:5001
```
### Datenbank-Fehler
```bash
# Datenbank löschen und neu erstellen lassen
rm /opt/tools/FocusApp/todos.db
sudo systemctl restart focusapp.service
```
## 📦 Projektstruktur
```
FocusApp/
├── ClientApp/ # React Frontend
│ ├── public/
│ ├── src/
│ │ ├── components/ # React Komponenten
│ │ ├── App.js # Haupt-App
│ │ ├── App.css # Styles
│ │ └── index.js # Entry Point
│ ├── package.json
│ └── build/ # Production Build (nach npm run build)
├── Controllers/
│ └── TodosController.cs # API Controller
├── Models/
│ ├── TodoItem.cs # Todo Model
│ └── TodoContext.cs # EF Core DbContext
├── Program.cs # ASP.NET Startup
├── FocusApp.csproj # Projekt-Datei
├── appsettings.json # Basis-Config
├── appsettings.Production.json # Production-Config
└── todos.db # SQLite Datenbank (runtime)
```
## 🔐 Sicherheit
### Firewall-Regeln
```bash
# Nur lokalen Zugriff erlauben (Standard)
sudo ufw deny 5000
# Für Netzwerkzugriff:
sudo ufw allow 5000/tcp
```
### Reverse Proxy (nginx)
Für Production empfohlen:
```nginx
server {
listen 80;
server_name focus.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
## 📊 Monitoring
### Service-Status prüfen
```bash
# Aktiver Status
sudo systemctl status focusapp.service
# Letzte Logs
sudo journalctl -u focusapp.service -n 50
# Live-Logs folgen
sudo journalctl -u focusapp.service -f
```
### Ressourcen-Nutzung
```bash
# Prozess finden
ps aux | grep FocusApp
# Speicher/CPU-Nutzung
top -p $(pgrep -f FocusApp.dll)
```
## 🚀 Updates & Deployment
### 1. Code aktualisieren
```bash
# Frontend neu bauen
cd ClientApp
npm run build
# Backend neu veröffentlichen
cd ..
dotnet publish -c Release -o /opt/tools/FocusApp
```
### 2. Service neu starten
```bash
sudo systemctl restart focusapp.service
sudo systemctl status focusapp.service
```
### 3. Datenbank-Migration (bei Schema-Änderungen)
```bash
cd FocusApp
# Migration erstellen
dotnet ef migrations add MigrationName
# Migration anwenden
dotnet ef database update
# Oder automatisch beim Start (bereits konfiguriert in Program.cs)
```
## 📝 Nützliche Befehle
```bash
# Service-Befehle
sudo systemctl start focusapp.service # Starten
sudo systemctl stop focusapp.service # Stoppen
sudo systemctl restart focusapp.service # Neustarten
sudo systemctl status focusapp.service # Status
sudo systemctl enable focusapp.service # Auto-Start aktivieren
sudo systemctl disable focusapp.service # Auto-Start deaktivieren
# Logs
sudo journalctl -u focusapp.service # Alle Logs
sudo journalctl -u focusapp.service -f # Live-Logs
sudo journalctl -u focusapp.service --since "1 hour ago" # Letzte Stunde
# Datenbank
sqlite3 /opt/tools/FocusApp/todos.db # DB öffnen
.tables # Tabellen anzeigen
SELECT * FROM TodoItems; # Alle Todos
.quit # Beenden
```
## 🎨 Design System
Die App verwendet ein eigenes Design System mit:
- CSS Custom Properties für theming
- Responsive Design (Mobile-First)
- Accessibility-Features (ARIA, Keyboard-Navigation)
- Dark/Light Mode Support
---
**Version:** 1.0.0
**Letzte Aktualisierung:** 29. Januar 2026
**Status:** ✅ Production Ready
+8
View File
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Information"
}
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.Hosting.Lifetime": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=maria-db-server.domain.local;Port=3306;Database=focusapp;User=focusapp;Password=[change-password]"
}
}
+1
View File
@@ -0,0 +1 @@
REACT_APP_API_URL=http://localhost:5000
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+32
View File
@@ -0,0 +1,32 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon-32x32.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Focus Tasks</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
</style>
<script type="module" crossorigin src="/assets/index-C7wD1ms3.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DjQQ8_vC.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
+31
View File
@@ -0,0 +1,31 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon-32x32.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Focus Tasks</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+2210
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
{
"name": "focus-app-client",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"axios": "^1.6.0"
},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-beautiful-dnd": "^13.1.5",
"@types/node": "^20.0.0",
"typescript": "^5.0.0",
"vite": "^5.0.0",
"@vitejs/plugin-react": "^4.2.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"proxy": "http://localhost:5000"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+91
View File
@@ -0,0 +1,91 @@
.app {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
}
.header {
text-align: center;
color: white;
margin-bottom: 40px;
animation: slideDown 0.6s ease-out;
}
.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
font-weight: 700;
}
.header p {
font-size: 1.1rem;
opacity: 0.9;
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.error-message {
background-color: #ef5350;
color: white;
padding: 15px 20px;
border-radius: 8px;
margin-bottom: 20px;
animation: pulse 0.3s ease-out;
}
.loading {
text-align: center;
color: white;
font-size: 1.2rem;
padding: 40px 20px;
}
.empty-state {
text-align: center;
color: white;
padding: 60px 20px;
font-size: 1.1rem;
}
.tasks-list {
transition: background-color 0.2s ease;
}
.tasks-list.dragging {
background-color: rgba(255, 255, 255, 0.05);
border-radius: 12px;
padding: 10px;
}
@keyframes pulse {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@media (max-width: 768px) {
.header h1 {
font-size: 1.8rem;
}
.header p {
font-size: 1rem;
}
}
+144
View File
@@ -0,0 +1,144 @@
import React, { useState, useEffect } from 'react';
import { DragDropContext, Droppable, Draggable, DropResult } from 'react-beautiful-dnd';
import { focusTaskApi } from './api';
import { FocusTask } from './types';
import TaskCard from './components/TaskCard';
import TaskForm from './components/TaskForm';
import './App.css';
const App: React.FC = () => {
const [tasks, setTasks] = useState<FocusTask[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
loadTasks();
}, []);
const loadTasks = async () => {
try {
setLoading(true);
const data = await focusTaskApi.getTasks();
setTasks(data);
setError(null);
} catch (err) {
setError('Failed to load tasks');
console.error(err);
} finally {
setLoading(false);
}
};
const handleAddTask = async (title: string, description?: string) => {
try {
const newTask = await focusTaskApi.createTask({ title, description });
setTasks([newTask, ...tasks]);
} catch (err) {
setError('Failed to create task');
console.error(err);
}
};
const handleUpdateTask = async (id: number, title: string, description?: string) => {
try {
const updated = await focusTaskApi.updateTask(id, { title, description });
setTasks(tasks.map(t => t.id === id ? updated : t));
} catch (err) {
setError('Failed to update task');
console.error(err);
}
};
const handleDeleteTask = async (id: number) => {
try {
await focusTaskApi.deleteTask(id);
setTasks(tasks.filter(t => t.id !== id));
} catch (err) {
setError('Failed to delete task');
console.error(err);
}
};
const handleDragEnd = async (result: DropResult) => {
const { source, destination } = result;
if (!destination) return;
if (source.index === destination.index) return;
const newTasks = Array.from(tasks);
const [movedTask] = newTasks.splice(source.index, 1);
newTasks.splice(destination.index, 0, movedTask);
setTasks(newTasks);
// Update order in backend
try {
const orders = newTasks.map((task, index) => ({
id: task.id,
order: index + 1,
}));
await focusTaskApi.reorderTasks(orders);
} catch (err) {
setError('Failed to reorder tasks');
console.error(err);
loadTasks(); // Reload on error
}
};
return (
<div className="app">
<div className="container">
<header className="header">
<h1>🎯 Focus Tasks</h1>
<p>Deine aktiven Schwerpunkte für die nächsten 2-3 Wochen</p>
</header>
{error && <div className="error-message">{error}</div>}
<TaskForm onAdd={handleAddTask} />
{loading ? (
<div className="loading">Lade Tasks...</div>
) : tasks.length === 0 ? (
<div className="empty-state">
<p>Keine Tasks vorhanden. Füge einen neuen Task hinzu!</p>
</div>
) : (
<DragDropContext onDragEnd={handleDragEnd}>
<Droppable droppableId="tasks">
{(provided, snapshot) => (
<div
className={`tasks-list ${snapshot.isDraggingOver ? 'dragging' : ''}`}
{...provided.droppableProps}
ref={provided.innerRef}
>
{tasks.map((task, index) => (
<Draggable key={task.id} draggableId={task.id.toString()} index={index}>
{(provided, snapshot) => (
<div
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
className={snapshot.isDragging ? 'dragging' : ''}
>
<TaskCard
task={task}
onUpdate={(title, desc) => handleUpdateTask(task.id, title, desc)}
onDelete={() => handleDeleteTask(task.id)}
/>
</div>
)}
</Draggable>
))}
{provided.placeholder}
</div>
)}
</Droppable>
</DragDropContext>
)}
</div>
</div>
);
};
export default App;
+39
View File
@@ -0,0 +1,39 @@
import axios from 'axios';
import { FocusTask, CreateTaskDto, UpdateTaskDto } from './types';
const API_URL = '/api/focustasks';
const api = axios.create({
baseURL: API_URL,
headers: {
'Content-Type': 'application/json',
},
});
export const focusTaskApi = {
getTasks: async (): Promise<FocusTask[]> => {
const { data } = await api.get('');
return data;
},
createTask: async (dto: CreateTaskDto): Promise<FocusTask> => {
const { data } = await api.post('', dto);
return data;
},
updateTask: async (id: number, dto: UpdateTaskDto): Promise<FocusTask> => {
const { data } = await api.put(`/${id}`, dto);
return data;
},
deleteTask: async (id: number): Promise<void> => {
await api.delete(`/${id}`);
},
reorderTasks: async (
orders: Array<{ id: number; order: number }>
): Promise<FocusTask[]> => {
const { data } = await api.put('/reorder', { orders });
return data;
},
};
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
import React, { useState } from 'react';
import { FocusTask } from '../types';
import './TaskCard.css';
interface TaskCardProps {
task: FocusTask;
onUpdate: (title: string, description?: string) => void;
onDelete: () => void;
}
const TaskCard: React.FC<TaskCardProps> = ({ task, onUpdate, onDelete }) => {
const [isEditing, setIsEditing] = useState(false);
const [editTitle, setEditTitle] = useState(task.title);
const [editDescription, setEditDescription] = useState(task.description || '');
const handleSave = () => {
if (editTitle.trim()) {
onUpdate(editTitle, editDescription);
setIsEditing(false);
}
};
const handleCancel = () => {
setEditTitle(task.title);
setEditDescription(task.description || '');
setIsEditing(false);
};
if (isEditing) {
return (
<div className="task-card editing">
<div className="edit-form">
<input
type="text"
value={editTitle}
onChange={(e) => setEditTitle(e.target.value)}
className="edit-input"
autoFocus
/>
<textarea
value={editDescription}
onChange={(e) => setEditDescription(e.target.value)}
className="edit-textarea"
rows={3}
/>
<div className="edit-actions">
<button className="btn-save" onClick={handleSave}>
Speichern
</button>
<button className="btn-cancel" onClick={handleCancel}>
Abbrechen
</button>
</div>
</div>
</div>
);
}
return (
<div className="task-card">
<div className="task-handle"></div>
<div className="task-content">
<h3 className="task-title">{task.title}</h3>
{task.description && <p className="task-description">{task.description}</p>}
<div className="task-meta">
<span className="task-date">
{new Date(task.updatedAt).toLocaleDateString('de-DE', {
year: 'numeric',
month: 'short',
day: 'numeric',
})}
</span>
</div>
</div>
<div className="task-actions">
<button className="btn-edit" onClick={() => setIsEditing(true)} title="Bearbeiten">
</button>
<button className="btn-delete" onClick={onDelete} title="Löschen">
</button>
</div>
</div>
);
};
export default TaskCard;
+917
View File
@@ -0,0 +1,917 @@
:root {
/* Primitive Color Tokens */
--color-white: rgba(255, 255, 255, 1);
--color-black: rgba(0, 0, 0, 1);
--color-cream-50: rgba(252, 252, 249, 1);
--color-cream-100: rgba(255, 255, 253, 1);
--color-gray-200: rgba(245, 245, 245, 1);
--color-gray-300: rgba(167, 169, 169, 1);
--color-gray-400: rgba(119, 124, 124, 1);
--color-slate-500: rgba(98, 108, 113, 1);
--color-brown-600: rgba(94, 82, 64, 1);
--color-charcoal-700: rgba(31, 33, 33, 1);
--color-charcoal-800: rgba(38, 40, 40, 1);
--color-slate-900: rgba(19, 52, 59, 1);
--color-teal-300: rgba(50, 184, 198, 1);
--color-teal-400: rgba(45, 166, 178, 1);
--color-teal-500: rgba(33, 128, 141, 1);
--color-teal-600: rgba(29, 116, 128, 1);
--color-teal-700: rgba(26, 104, 115, 1);
--color-teal-800: rgba(41, 150, 161, 1);
--color-red-400: rgba(255, 84, 89, 1);
--color-red-500: rgba(192, 21, 47, 1);
--color-orange-400: rgba(230, 129, 97, 1);
--color-orange-500: rgba(168, 75, 47, 1);
/* RGB versions for opacity control */
--color-brown-600-rgb: 94, 82, 64;
--color-teal-500-rgb: 33, 128, 141;
--color-slate-900-rgb: 19, 52, 59;
--color-slate-500-rgb: 98, 108, 113;
--color-red-500-rgb: 192, 21, 47;
--color-red-400-rgb: 255, 84, 89;
--color-orange-500-rgb: 168, 75, 47;
--color-orange-400-rgb: 230, 129, 97;
/* Background color tokens (Light Mode) */
--color-bg-1: rgba(59, 130, 246, 0.08); /* Light blue */
--color-bg-2: rgba(245, 158, 11, 0.08); /* Light yellow */
--color-bg-3: rgba(34, 197, 94, 0.08); /* Light green */
--color-bg-4: rgba(239, 68, 68, 0.08); /* Light red */
--color-bg-5: rgba(147, 51, 234, 0.08); /* Light purple */
--color-bg-6: rgba(249, 115, 22, 0.08); /* Light orange */
--color-bg-7: rgba(236, 72, 153, 0.08); /* Light pink */
--color-bg-8: rgba(6, 182, 212, 0.08); /* Light cyan */
/* Semantic Color Tokens (Light Mode) */
--color-background: var(--color-cream-50);
--color-surface: var(--color-cream-100);
--color-text: var(--color-slate-900);
--color-text-secondary: var(--color-slate-500);
--color-primary: var(--color-teal-500);
--color-primary-hover: var(--color-teal-600);
--color-primary-active: var(--color-teal-700);
--color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
--color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
--color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
--color-border: rgba(var(--color-brown-600-rgb), 0.2);
--color-btn-primary-text: var(--color-cream-50);
--color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
--color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
--color-error: var(--color-red-500);
--color-success: var(--color-teal-500);
--color-warning: var(--color-orange-500);
--color-info: var(--color-slate-500);
--color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
--color-select-caret: rgba(var(--color-slate-900-rgb), 0.8);
/* Common style patterns */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for opacity control */
--color-success-rgb: 33, 128, 141;
--color-error-rgb: 192, 21, 47;
--color-warning-rgb: 168, 75, 47;
--color-info-rgb: 98, 108, 113;
/* Typography */
--font-family-base: "FKGroteskNeue", "Geist", "Inter", -apple-system,
BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo,
Monaco, Consolas, monospace;
--font-size-xs: 11px;
--font-size-sm: 12px;
--font-size-base: 14px;
--font-size-md: 14px;
--font-size-lg: 16px;
--font-size-xl: 18px;
--font-size-2xl: 20px;
--font-size-3xl: 24px;
--font-size-4xl: 30px;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 550;
--font-weight-bold: 600;
--line-height-tight: 1.2;
--line-height-normal: 1.5;
--letter-spacing-tight: -0.01em;
/* Spacing */
--space-0: 0;
--space-1: 1px;
--space-2: 2px;
--space-4: 4px;
--space-6: 6px;
--space-8: 8px;
--space-10: 10px;
--space-12: 12px;
--space-16: 16px;
--space-20: 20px;
--space-24: 24px;
--space-32: 32px;
/* Border Radius */
--radius-sm: 6px;
--radius-base: 8px;
--radius-md: 10px;
--radius-lg: 12px;
--radius-full: 9999px;
/* Shadows */
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
0 2px 4px -1px rgba(0, 0, 0, 0.02);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
0 4px 6px -2px rgba(0, 0, 0, 0.02);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
inset 0 -1px 0 rgba(0, 0, 0, 0.03);
/* Animation */
--duration-fast: 150ms;
--duration-normal: 250ms;
--ease-standard: cubic-bezier(0.16, 1, 0.3, 1);
/* Layout */
--container-sm: 640px;
--container-md: 768px;
--container-lg: 1024px;
--container-xl: 1280px;
}
/* Dark mode colors */
@media (prefers-color-scheme: dark) {
:root {
/* RGB versions for opacity control (Dark Mode) */
--color-gray-400-rgb: 119, 124, 124;
--color-teal-300-rgb: 50, 184, 198;
--color-gray-300-rgb: 167, 169, 169;
--color-gray-200-rgb: 245, 245, 245;
/* Background color tokens (Dark Mode) */
--color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
--color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
--color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
--color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
--color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
--color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
--color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
--color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */
/* Semantic Color Tokens (Dark Mode) */
--color-background: var(--color-charcoal-700);
--color-surface: var(--color-charcoal-800);
--color-text: var(--color-gray-200);
--color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
--color-primary: var(--color-teal-300);
--color-primary-hover: var(--color-teal-400);
--color-primary-active: var(--color-teal-800);
--color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
--color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
--color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
--color-border: rgba(var(--color-gray-400-rgb), 0.3);
--color-error: var(--color-red-400);
--color-success: var(--color-teal-300);
--color-warning: var(--color-orange-400);
--color-info: var(--color-gray-300);
--color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
--color-btn-primary-text: var(--color-slate-900);
--color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
--color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
inset 0 -1px 0 rgba(0, 0, 0, 0.15);
--button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
--color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
--color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);
/* Common style patterns - updated for dark mode */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for dark mode */
--color-success-rgb: var(--color-teal-300-rgb);
--color-error-rgb: var(--color-red-400-rgb);
--color-warning-rgb: var(--color-orange-400-rgb);
--color-info-rgb: var(--color-gray-300-rgb);
}
}
/* Data attribute for manual theme switching */
[data-color-scheme="dark"] {
/* RGB versions for opacity control (dark mode) */
--color-gray-400-rgb: 119, 124, 124;
--color-teal-300-rgb: 50, 184, 198;
--color-gray-300-rgb: 167, 169, 169;
--color-gray-200-rgb: 245, 245, 245;
/* Colorful background palette - Dark Mode */
--color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
--color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
--color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
--color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
--color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
--color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
--color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
--color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */
/* Semantic Color Tokens (Dark Mode) */
--color-background: var(--color-charcoal-700);
--color-surface: var(--color-charcoal-800);
--color-text: var(--color-gray-200);
--color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
--color-primary: var(--color-teal-300);
--color-primary-hover: var(--color-teal-400);
--color-primary-active: var(--color-teal-800);
--color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
--color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
--color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
--color-border: rgba(var(--color-gray-400-rgb), 0.3);
--color-error: var(--color-red-400);
--color-success: var(--color-teal-300);
--color-warning: var(--color-orange-400);
--color-info: var(--color-gray-300);
--color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
--color-btn-primary-text: var(--color-slate-900);
--color-card-border: rgba(var(--color-gray-400-rgb), 0.15);
--color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
--shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
inset 0 -1px 0 rgba(0, 0, 0, 0.15);
--color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
--color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);
/* Common style patterns - updated for dark mode */
--focus-ring: 0 0 0 3px var(--color-focus-ring);
--focus-outline: 2px solid var(--color-primary);
--status-bg-opacity: 0.15;
--status-border-opacity: 0.25;
--select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
/* RGB versions for dark mode */
--color-success-rgb: var(--color-teal-300-rgb);
--color-error-rgb: var(--color-red-400-rgb);
--color-warning-rgb: var(--color-orange-400-rgb);
--color-info-rgb: var(--color-gray-300-rgb);
}
[data-color-scheme="light"] {
/* RGB versions for opacity control (light mode) */
--color-brown-600-rgb: 94, 82, 64;
--color-teal-500-rgb: 33, 128, 141;
--color-slate-900-rgb: 19, 52, 59;
/* Semantic Color Tokens (Light Mode) */
--color-background: var(--color-cream-50);
--color-surface: var(--color-cream-100);
--color-text: var(--color-slate-900);
--color-text-secondary: var(--color-slate-500);
--color-primary: var(--color-teal-500);
--color-primary-hover: var(--color-teal-600);
--color-primary-active: var(--color-teal-700);
--color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
--color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
--color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
--color-border: rgba(var(--color-brown-600-rgb), 0.2);
--color-btn-primary-text: var(--color-cream-50);
--color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
--color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
--color-error: var(--color-red-500);
--color-success: var(--color-teal-500);
--color-warning: var(--color-orange-500);
--color-info: var(--color-slate-500);
--color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
/* RGB versions for light mode */
--color-success-rgb: var(--color-teal-500-rgb);
--color-error-rgb: var(--color-red-500-rgb);
--color-warning-rgb: var(--color-orange-500-rgb);
--color-info-rgb: var(--color-slate-500-rgb);
}
/* Base styles */
html {
font-size: var(--font-size-base);
font-family: var(--font-family-base);
line-height: var(--line-height-normal);
color: var(--color-text);
background-color: var(--color-background);
-webkit-font-smoothing: antialiased;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0;
font-weight: var(--font-weight-semibold);
line-height: var(--line-height-tight);
color: var(--color-text);
letter-spacing: var(--letter-spacing-tight);
}
h1 {
font-size: var(--font-size-4xl);
}
h2 {
font-size: var(--font-size-3xl);
}
h3 {
font-size: var(--font-size-2xl);
}
h4 {
font-size: var(--font-size-xl);
}
h5 {
font-size: var(--font-size-lg);
}
h6 {
font-size: var(--font-size-md);
}
p {
margin: 0 0 var(--space-16) 0;
}
a {
color: var(--color-primary);
text-decoration: none;
transition: color var(--duration-fast) var(--ease-standard);
}
a:hover {
color: var(--color-primary-hover);
}
code,
pre {
font-family: var(--font-family-mono);
font-size: calc(var(--font-size-base) * 0.95);
background-color: var(--color-secondary);
border-radius: var(--radius-sm);
}
code {
padding: var(--space-1) var(--space-4);
}
pre {
padding: var(--space-16);
margin: var(--space-16) 0;
overflow: auto;
border: 1px solid var(--color-border);
}
pre code {
background: none;
padding: 0;
}
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--space-8) var(--space-16);
border-radius: var(--radius-base);
font-size: var(--font-size-base);
font-weight: 500;
line-height: 1.5;
cursor: pointer;
transition: all var(--duration-normal) var(--ease-standard);
border: none;
text-decoration: none;
position: relative;
}
.btn:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
.btn--primary {
background: var(--color-primary);
color: var(--color-btn-primary-text);
}
.btn--primary:hover {
background: var(--color-primary-hover);
}
.btn--primary:active {
background: var(--color-primary-active);
}
.btn--secondary {
background: var(--color-secondary);
color: var(--color-text);
}
.btn--secondary:hover {
background: var(--color-secondary-hover);
}
.btn--secondary:active {
background: var(--color-secondary-active);
}
.btn--outline {
background: transparent;
border: 1px solid var(--color-border);
color: var(--color-text);
}
.btn--outline:hover {
background: var(--color-secondary);
}
.btn--sm {
padding: var(--space-4) var(--space-12);
font-size: var(--font-size-sm);
border-radius: var(--radius-sm);
}
.btn--lg {
padding: var(--space-10) var(--space-20);
font-size: var(--font-size-lg);
border-radius: var(--radius-md);
}
.btn--full-width {
width: 100%;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* Form elements */
.form-control {
display: block;
width: 100%;
padding: var(--space-8) var(--space-12);
font-size: var(--font-size-md);
line-height: 1.5;
color: var(--color-text);
background-color: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: var(--radius-base);
transition: border-color var(--duration-fast) var(--ease-standard),
box-shadow var(--duration-fast) var(--ease-standard);
}
textarea.form-control {
font-family: var(--font-family-base);
font-size: var(--font-size-base);
}
select.form-control {
padding: var(--space-8) var(--space-12);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: var(--select-caret-light);
background-repeat: no-repeat;
background-position: right var(--space-12) center;
background-size: 16px;
padding-right: var(--space-32);
}
/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
select.form-control {
background-image: var(--select-caret-dark);
}
}
/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
background-image: var(--select-caret-dark);
}
[data-color-scheme="light"] select.form-control {
background-image: var(--select-caret-light);
}
.form-control:focus {
border-color: var(--color-primary);
outline: var(--focus-outline);
}
.form-label {
display: block;
margin-bottom: var(--space-8);
font-weight: var(--font-weight-medium);
font-size: var(--font-size-sm);
}
.form-group {
margin-bottom: var(--space-16);
}
/* Card component */
.card {
background-color: var(--color-surface);
border-radius: var(--radius-lg);
border: 1px solid var(--color-card-border);
box-shadow: var(--shadow-sm);
overflow: hidden;
transition: box-shadow var(--duration-normal) var(--ease-standard);
}
.card:hover {
box-shadow: var(--shadow-md);
}
.card__body {
padding: var(--space-16);
}
.card__header,
.card__footer {
padding: var(--space-16);
border-bottom: 1px solid var(--color-card-border-inner);
}
/* Status indicators - simplified with CSS variables */
.status {
display: inline-flex;
align-items: center;
padding: var(--space-6) var(--space-12);
border-radius: var(--radius-full);
font-weight: var(--font-weight-medium);
font-size: var(--font-size-sm);
}
.status--success {
background-color: rgba(
var(--color-success-rgb, 33, 128, 141),
var(--status-bg-opacity)
);
color: var(--color-success);
border: 1px solid
rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}
.status--error {
background-color: rgba(
var(--color-error-rgb, 192, 21, 47),
var(--status-bg-opacity)
);
color: var(--color-error);
border: 1px solid
rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}
.status--warning {
background-color: rgba(
var(--color-warning-rgb, 168, 75, 47),
var(--status-bg-opacity)
);
color: var(--color-warning);
border: 1px solid
rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}
.status--info {
background-color: rgba(
var(--color-info-rgb, 98, 108, 113),
var(--status-bg-opacity)
);
color: var(--color-info);
border: 1px solid
rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}
/* Container layout */
.container {
width: 100%;
margin-right: auto;
margin-left: auto;
padding-right: var(--space-16);
padding-left: var(--space-16);
}
@media (min-width: 640px) {
.container {
max-width: var(--container-sm);
}
}
@media (min-width: 768px) {
.container {
max-width: var(--container-md);
}
}
@media (min-width: 1024px) {
.container {
max-width: var(--container-lg);
}
}
@media (min-width: 1280px) {
.container {
max-width: var(--container-xl);
}
}
/* Utility classes */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-center {
justify-content: center;
}
.justify-between {
justify-content: space-between;
}
.gap-4 {
gap: var(--space-4);
}
.gap-8 {
gap: var(--space-8);
}
.gap-16 {
gap: var(--space-16);
}
.m-0 {
margin: 0;
}
.mt-8 {
margin-top: var(--space-8);
}
.mb-8 {
margin-bottom: var(--space-8);
}
.mx-8 {
margin-left: var(--space-8);
margin-right: var(--space-8);
}
.my-8 {
margin-top: var(--space-8);
margin-bottom: var(--space-8);
}
.p-0 {
padding: 0;
}
.py-8 {
padding-top: var(--space-8);
padding-bottom: var(--space-8);
}
.px-8 {
padding-left: var(--space-8);
padding-right: var(--space-8);
}
.py-16 {
padding-top: var(--space-16);
padding-bottom: var(--space-16);
}
.px-16 {
padding-left: var(--space-16);
padding-right: var(--space-16);
}
.block {
display: block;
}
.hidden {
display: none;
}
/* Accessibility */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
:focus-visible {
outline: var(--focus-outline);
outline-offset: 2px;
}
/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
border: 1px solid var(--color-border-secondary);
}
@font-face {
font-family: 'FKGroteskNeue';
src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2')
format('woff2');
}
.task-form {
background: var(--color-surface);
border-radius: var(--radius-lg);
padding: var(--space-16);
margin-bottom: var(--space-32);
box-shadow: var(--shadow-md);
border: 1px solid var(--color-card-border);
animation: slideUp 0.4s var(--ease-standard);
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(var(--space-10));
}
to {
opacity: 1;
transform: translateY(0);
}
}
.task-input {
width: 100%;
padding: var(--space-12);
border: 1px solid var(--color-border);
border-radius: var(--radius-base);
font-size: var(--font-size-md);
font-family: var(--font-family-base);
color: var(--color-text);
background-color: var(--color-surface);
transition: all var(--duration-normal) var(--ease-standard);
outline: none;
}
.task-input:focus {
border-color: var(--color-primary);
outline: var(--focus-outline);
outline-offset: 0;
}
.task-input:focus-visible {
box-shadow: var(--focus-ring);
}
.form-expanded {
margin-top: var(--space-16);
animation: slideDown var(--duration-normal) var(--ease-standard);
}
@keyframes slideDown {
from {
opacity: 0;
max-height: 0;
}
to {
opacity: 1;
max-height: 300px;
}
}
.description-input {
width: 100%;
padding: var(--space-12);
border: 1px solid var(--color-border);
border-radius: var(--radius-base);
font-size: var(--font-size-base);
font-family: var(--font-family-base);
color: var(--color-text);
background-color: var(--color-surface);
resize: vertical;
min-height: 80px;
transition: all var(--duration-normal) var(--ease-standard);
outline: none;
}
.description-input:focus {
border-color: var(--color-primary);
outline: var(--focus-outline);
outline-offset: 0;
}
.description-input:focus-visible {
box-shadow: var(--focus-ring);
}
.form-actions {
display: flex;
gap: var(--space-10);
margin-top: var(--space-12);
}
.btn {
flex: 1;
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--space-8) var(--space-16);
border: none;
border-radius: var(--radius-base);
font-size: var(--font-size-base);
font-weight: var(--font-weight-medium);
font-family: var(--font-family-base);
line-height: var(--line-height-normal);
cursor: pointer;
transition: all var(--duration-normal) var(--ease-standard);
position: relative;
}
.btn:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
.btn-primary {
background: var(--color-primary);
color: var(--color-btn-primary-text);
}
.btn-primary:hover {
background: var(--color-primary-hover);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
}
.btn-primary:active {
background: var(--color-primary-active);
transform: translateY(0);
box-shadow: var(--shadow-sm);
}
.btn-secondary {
background: var(--color-secondary);
color: var(--color-text);
}
.btn-secondary:hover {
background: var(--color-secondary-hover);
}
.btn-secondary:active {
background: var(--color-secondary-active);
}
/* Responsive styles for mobile portrait (480px and below) */
@media (max-width: 480px) {
.task-form {
padding: var(--space-12);
margin-bottom: var(--space-20);
border-radius: var(--radius-md);
}
.task-input {
padding: var(--space-10);
font-size: var(--font-size-base);
}
.description-input {
padding: var(--space-10);
font-size: var(--font-size-sm);
min-height: 60px;
}
.form-expanded {
margin-top: var(--space-12);
}
.form-actions {
flex-direction: column;
gap: var(--space-8);
margin-top: var(--space-10);
}
.btn {
width: 100%;
padding: var(--space-10) var(--space-12);
font-size: var(--font-size-sm);
}
}
+64
View File
@@ -0,0 +1,64 @@
import React, { useState } from 'react';
import './TaskForm.css';
interface TaskFormProps {
onAdd: (title: string, description?: string) => void;
}
const TaskForm: React.FC<TaskFormProps> = ({ onAdd }) => {
const [title, setTitle] = useState('');
const [description, setDescription] = useState('');
const [isExpanded, setIsExpanded] = useState(false);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (title.trim()) {
onAdd(title, description);
setTitle('');
setDescription('');
setIsExpanded(false);
}
};
return (
<form className="task-form" onSubmit={handleSubmit}>
<input
type="text"
placeholder="Neuen Fokus-Task hinzufügen..."
value={title}
onChange={(e) => setTitle(e.target.value)}
onFocus={() => setIsExpanded(true)}
className="task-input"
/>
{isExpanded && (
<div className="form-expanded">
<textarea
placeholder="Optionale Notiz (z.B. Gedanken, Checkliste, Status)"
value={description}
onChange={(e) => setDescription(e.target.value)}
className="description-input"
rows={3}
/>
<div className="form-actions">
<button type="submit" className="btn btn-primary">
Hinzufügen
</button>
<button
type="button"
className="btn btn-secondary"
onClick={() => {
setIsExpanded(false);
setDescription('');
}}
>
Abbrechen
</button>
</div>
</div>
)}
</form>
);
};
export default TaskForm;
+12
View File
@@ -0,0 +1,12 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
+10
View File
@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
+19
View File
@@ -0,0 +1,19 @@
export interface FocusTask {
id: number;
title: string;
description?: string;
order: number;
createdAt: string;
updatedAt: string;
}
export interface CreateTaskDto {
title: string;
description?: string;
}
export interface UpdateTaskDto {
title?: string;
description?: string;
order?: number;
}
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": [ "ES2020", "DOM", "DOM.Iterable" ],
"module": "ESNext",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": [ "src" ],
"references": [ { "path": "./tsconfig.node.json" } ]
}
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': {
target: 'http://localhost:5000',
changeOrigin: true
}
}
},
build: {
outDir: 'build',
emptyOutDir: true
}
})
+69
View File
@@ -0,0 +1,69 @@
# Visual Studio / .NET
.vs/
bin/
obj/
*.user
*.suo
*.userprefs
*.sln.docstates
*.swp
*~
# Node/React
node_modules/
client/node_modules/
client/build/
client/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# Environment & Secrets
.env
.env.local
.env.production
appsettings.*.json
!appsettings.json
# Databases
*.db
*.sqlite
*.sqlite3
# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Desktop.ini
# IDE
.vscode/
.idea/
*.code-workspace
# Build artifacts
publish/
dist/
build/
# Logs
logs/
*.log
npm-debug.log*
pids
*.pid
*.seed
*.pid.lock
# Testing
coverage/
.nyc_output/
# Temporary files
tmp/
temp/