From f9fe63bea21eb9fa06a184be14d64ea9cb7dd033 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Wed, 18 Dec 2024 21:53:10 +0100 Subject: [PATCH] WIP: cohesion grid --- app/[slug]/dashboard/guests/page.tsx | 11 ++++++++-- app/lib/affinity.ts | 31 ++++++++++++++++++++++++++++ app/ui/groups/affinities.tsx | 11 ++++++++++ app/ui/groups/table.tsx | 7 +++---- 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 app/lib/affinity.ts create mode 100644 app/ui/groups/affinities.tsx diff --git a/app/[slug]/dashboard/guests/page.tsx b/app/[slug]/dashboard/guests/page.tsx index beb73f8..2690adc 100644 --- a/app/[slug]/dashboard/guests/page.tsx +++ b/app/[slug]/dashboard/guests/page.tsx @@ -2,7 +2,7 @@ 'use client'; -import { AbstractApi, } from '@/app/api/abstract-api'; +import { AbstractApi, } from '@/app/api/abstract-api'; import { Guest, GuestSerializer } from '@/app/lib/guest'; import { classNames } from '@/app/ui/components/button'; import GroupFormDialog from '@/app/ui/components/group-form-dialog'; @@ -78,7 +78,7 @@ export default function Page() { /> }> - setGroupBeingEdited(group)} @@ -86,6 +86,13 @@ export default function Page() { + +
+ }> + + +
+
diff --git a/app/lib/affinity.ts b/app/lib/affinity.ts new file mode 100644 index 0000000..fe147a4 --- /dev/null +++ b/app/lib/affinity.ts @@ -0,0 +1,31 @@ +import { Entity } from "./definitions"; + +export class Affinity implements Entity { + id?: string; + groupId: string; + affinities: { [key: string]: number }; + + constructor(id: string, groupId: string, affinities: { [key: string]: number }) { + this.id = id; + this.groupId = groupId; + this.affinities = affinities; + } +} + +export class AffinitySerializer { + fromJson(json: any): Affinity { + return new Affinity(json.id, json.groupId, json.affinities); + } + + toJson(affinity: Affinity): any { + return { + id: affinity.id, + groupId: affinity.groupId, + affinities: affinity.affinities + }; + } + + apiPath(): string { + return 'affinities'; + } +} \ No newline at end of file diff --git a/app/ui/groups/affinities.tsx b/app/ui/groups/affinities.tsx new file mode 100644 index 0000000..6000d6e --- /dev/null +++ b/app/ui/groups/affinities.tsx @@ -0,0 +1,11 @@ +'use client' + +import { Group } from "@/app/lib/group" + + +export default function Affinities({groups, affinities}: {groups: Group[], affinities: {[key: string]: number}[]}) { + return ( + <> + + ) +} \ No newline at end of file diff --git a/app/ui/groups/table.tsx b/app/ui/groups/table.tsx index 41af307..4088cfa 100644 --- a/app/ui/groups/table.tsx +++ b/app/ui/groups/table.tsx @@ -2,13 +2,12 @@ 'use client'; -import { Group, GroupSerializer } from '@/app/lib/group'; -import TableOfContents from '../components/table-of-contents'; -import { MapPinIcon, PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; import { AbstractApi } from '@/app/api/abstract-api'; -import { TreeTable } from 'primereact/treetable'; +import { Group, GroupSerializer } from '@/app/lib/group'; +import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline'; import { Column } from 'primereact/column'; import { TreeNode } from 'primereact/treenode'; +import { TreeTable } from 'primereact/treetable'; export default function GroupsTable({ groups, onUpdate, onEdit }: { groups: Group[],