diff --git a/.phase10-state.json b/.phase10-state.json index 9227da6..f39a336 100644 --- a/.phase10-state.json +++ b/.phase10-state.json @@ -1,5 +1,8 @@ { "completed_features": [], - "current_feature": "markdown-notes-time-entry", - "started_at": "2026-05-23T06:10:51.530595" + "current_feature": "customer-tags", + "started_at": "2026-05-23T06:10:51.530595", + "attempted_features": [ + "markdown-notes-time-entry" + ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index b27d8d0..dec1b3f 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -1170,3 +1170,22 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy +- `06:13:06` **INFO** Committed feature markdown-notes-time-entry +- `06:13:06` **INFO** Pushed: rc=0 + +## Phase-3 Feature: customer-tags (2026-05-23 06:13:06) + +- `06:13:06` **INFO** Description: Tags-Feld bei Customers + Filter-by-Tag +- `06:13:06` **INFO** Generating apps/api/src/db/schema.ts (ERWEITERT — füge `tags: text('tags').array().notNull().default([])` Sp…) +- `06:13:33` **INFO** wrote 3052 chars in 26.3s (attempt 1) +- `06:13:33` **INFO** Generating apps/web/src/pages/Customers.tsx (ERWEITERT — füge Tags-Input (kommagetrennt) zum Create-Form. Zeige Tag…) +- `06:14:36` **INFO** wrote 7956 chars in 63.5s (attempt 1) +- `06:14:36` **INFO** Running tsc --noEmit on api… +- `06:14:38` **WARN** tsc errors: +src/index.ts(27,25): error TS2769: No overload matches this call. + Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTypeProvider>, opts: { ...; }, done: (err?: Error | undefined) => void): void'. + Overload 2 of 3, '(plugin: FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginAsync<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, FastifyBaseLogger, FastifyTy diff --git a/apps/api/src/db/schema.ts b/apps/api/src/db/schema.ts index 16e4391..c194cb0 100644 --- a/apps/api/src/db/schema.ts +++ b/apps/api/src/db/schema.ts @@ -18,6 +18,7 @@ export const users = pgTable("users", { export const customers = pgTable("customers", { id: uuid("id").primaryKey().defaultRandom(), name: text("name").notNull(), + tags: text("tags").array().notNull().default([]), active: boolean("active").notNull().default(true), createdAt: timestamp("created_at").notNull().defaultNow() }) diff --git a/apps/web/src/pages/Customers.tsx b/apps/web/src/pages/Customers.tsx index 1ba4157..72530db 100644 --- a/apps/web/src/pages/Customers.tsx +++ b/apps/web/src/pages/Customers.tsx @@ -1,10 +1,12 @@ -import { useState, useRef } from "react" +import { useState, useRef, useMemo } from "react" import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query" import { api } from "../lib/api" export default function Customers() { const queryClient = useQueryClient() const [name, setName] = useState("") + const [tags, setTags] = useState("") + const [filterTag, setFilterTag] = useState("") const fileInputRef = useRef(null) const { data: customers, isLoading, isError } = useQuery({ @@ -13,10 +15,11 @@ export default function Customers() { }) const createMutation = useMutation({ - mutationFn: (name: string) => api.createCustomer({ name }), + mutationFn: (payload: { name: string; tags: string[] }) => api.createCustomer(payload), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ["customers"] }) setName("") + setTags("") } }) @@ -38,10 +41,20 @@ export default function Customers() { } }) + const filteredCustomers = useMemo(() => { + if (!customers) return [] + if (!filterTag.trim()) return customers + const search = filterTag.toLowerCase() + return customers.filter(c => + c.tags?.some(t => t.toLowerCase().includes(search)) + ) + }, [customers, filterTag]) + const handleSubmit = (e: React.FormEvent) => { e.preventDefault() if (!name.trim()) return - createMutation.mutate(name) + const tagsArray = tags.split(",").map(t => t.trim()).filter(Boolean) + createMutation.mutate({ name, tags: tagsArray }) } const handleFileChange = (e: React.ChangeEvent) => { @@ -84,7 +97,7 @@ export default function Customers() {

Add New Customer

-
+
+
+ + setTags(e.target.value)} + placeholder="VIP, Enterprise, Lead..." + /> +
@@ -108,23 +131,47 @@ export default function Customers() {
-
- - - - - - - - - {customers && customers.length > 0 ? ( - customers.map((customer: any) => ( +
+
+ Filter by tag: + setFilterTag(e.target.value)} + placeholder="Search tags..." + /> +
+ +
+
NameActions
+ + + + + + + + + {filteredCustomers.map((customer) => ( - + + - )) - ) : ( - - - - )} - -
CustomerTagsActions
{customer.name}{customer.name} +
+ {customer.tags?.map((tag) => ( + + {tag} + + )) || No tags} +
+
- No customers found. -
+ ))} + {filteredCustomers.length === 0 && ( + + + No customers found matching the filter. + + + )} + + +
)