WIP: cohesion grid
This commit is contained in:
parent
231be64e45
commit
f9fe63bea2
@ -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() {
|
||||
/>
|
||||
|
||||
<Suspense fallback={<SkeletonTable />}>
|
||||
<GroupsTable
|
||||
<GroupsTable
|
||||
groups={groups}
|
||||
onUpdate={refreshGroups}
|
||||
onEdit={(group) => setGroupBeingEdited(group)}
|
||||
@ -86,6 +86,13 @@ export default function Page() {
|
||||
</Suspense>
|
||||
</div>
|
||||
</ TabPanel>
|
||||
<TabPanel header="Affinities" leftIcon="pi pi-heart mx-2">
|
||||
<div className="flex flex-col w-full items-center justify-between">
|
||||
<Suspense fallback={<SkeletonTable />}>
|
||||
<GroupsAffinityTable groups = {groups}/>
|
||||
</Suspense>
|
||||
</div>
|
||||
</TabPanel>
|
||||
</ TabView>
|
||||
</div>
|
||||
|
||||
|
31
app/lib/affinity.ts
Normal file
31
app/lib/affinity.ts
Normal file
@ -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';
|
||||
}
|
||||
}
|
11
app/ui/groups/affinities.tsx
Normal file
11
app/ui/groups/affinities.tsx
Normal file
@ -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 (
|
||||
<>
|
||||
</>
|
||||
)
|
||||
}
|
@ -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[],
|
||||
|
Loading…
x
Reference in New Issue
Block a user