From f49d9fb80769137fec5b92c02b4073c2cdb23b0c Mon Sep 17 00:00:00 2001 From: "andreas.dinauer" Date: Sat, 3 Oct 2026 12:01:47 +0000 Subject: [PATCH] Update frontend/CLAUDE.md --- frontend/CLAUDE.md | 56 ++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/frontend/CLAUDE.md b/frontend/CLAUDE.md index 39ee221..b3e1c3c 100644 --- a/frontend/CLAUDE.md +++ b/frontend/CLAUDE.md @@ -1,23 +1,41 @@ -# Code Style -- You never use comments -- We use `npm i @stdlib/string-format` for formatting strings. Always. Install if not yet done. -- We always use NUXT's useFetch -- We always use feature first packaging. Every class that is part of a entity is in its own folder -- We always define types like this (image/Image.ts): -```typescript -export interface Image { - id: string; - name: string; - tags?: Tag[]; +# Setup +- We always use Nuxt together with Tailwind. Install tailwind like that: https://tailwindcss.com/docs/installation/framework-guides/nuxt + +# Components +- Ausnahmslos template -> script -> style von oben nach unten +- Immer ` und ` + +# General Code Best Practices: +- Keine ternären Operatoren, Immer switch oder if +- Null-Checks so früh wie möglich. Vermeiden von ! oder ? +- Nutz shared/useHttp für Requests. +- Nutz `import format from "@stdlib/string-format";` + +# Types und API Calls +- Types und Api Calls werden wie folgt unterteilt. Immer ein Type und ein API Objekt wie +```javascript +export interface Project { + name: string } -``` -- And a types API like this (image/ImageAPI.ts): -```typescript -export class ImageAPI { - static getAll() { - return useFetch('/api/images/', { server: false }); + +export class ProjectAPI { + static get() { + return usePost("/api/projects"); } } ``` -- We put sections/components that are part of a pages into its own dedicated folder inside ./components -- Always identify snippets of code that can be extracted \ No newline at end of file +- Verwendung im Komponente: +```javascript + +``` + +# Pages und Components +- Seiten beinhalten minimal Inhalt. Der Hauptteil des Inhalts ist in components. +Dort werden auch Types/Klassen/Interfaces/Requests angelegt. +Wir arbeiten feature-first, also packen alle inhaltlich zusammengehörigen Code in einen Bereich also components/projects oder components/images \ No newline at end of file