diff --git a/frontend/src/lib/family_tree/PersonNode.svelte b/frontend/src/lib/family_tree/PersonNode.svelte
index aff1246..b8f7ee9 100644
--- a/frontend/src/lib/family_tree/PersonNode.svelte
+++ b/frontend/src/lib/family_tree/PersonNode.svelte
@@ -1,7 +1,26 @@
-
-
+
-
+
-
- {person.Lastname}
- {person.Firstname}
- {person.Middlename}
+
+ {data.Lastname}
+ {data.Firstname}
+ {data.Middlename}
-
-
+
+
\ No newline at end of file
diff --git a/frontend/src/lib/family_tree/dagreLayout.ts b/frontend/src/lib/family_tree/dagreLayout.ts
index ca5eb96..1823401 100644
--- a/frontend/src/lib/family_tree/dagreLayout.ts
+++ b/frontend/src/lib/family_tree/dagreLayout.ts
@@ -4,8 +4,8 @@ import { Position, type Node, type Edge } from '@xyflow/svelte';
const dagreGraph = new dagre.graphlib.Graph();
dagreGraph.setDefaultEdgeLabel(() => ({}));
-const nodeWidth = 172;
-const nodeHeight = 36;
+const nodeWidth = 250;
+const nodeHeight = 250;
function getLayoutedElements(nodes: Node[], edges: Edge[], direction = 'TB') {
const isHorizontal = direction === 'LR';
diff --git a/frontend/src/lib/family_tree/dataAdapter.ts b/frontend/src/lib/family_tree/dataAdapter.ts
new file mode 100644
index 0000000..2a70b4a
--- /dev/null
+++ b/frontend/src/lib/family_tree/dataAdapter.ts
@@ -0,0 +1,57 @@
+import { type Node, type Edge } from '@xyflow/svelte';
+
+function AddToNodesData(data: any, i: number, pushToNodesCallback: (arg: Node) => void) {
+ if (data[0].Values[i] != null) {
+ if (Object.prototype.toString.call(data[0].Values[i]) === '[object Array]') {
+ data[0].Values[i].forEach((person: { ElementId: string; Props: {} }) => {
+ pushToNodesCallback({
+ id: person.ElementId,
+ type: 'custom',
+ data: person.Props,
+ position: { x: 0, y: 0 }
+ });
+ });
+ } else {
+ console.log(data[0].Values[i]);
+ pushToNodesCallback({
+ id: data[0].Values[i].ElementId,
+ type: 'custom',
+ data: data[0].Values[i].Props,
+ position: { x: 0, y: 0 }
+ });
+ }
+ }
+}
+
+function AddToEdgesData(data: any, i: number, pushToEdgesCallback: (arg: Edge) => void) {
+ if (data[0].Values[i] != null) {
+ if (Object.prototype.toString.call(data[0].Values[i]) === '[object Array]') {
+ data[0].Values[i].forEach((edge: { ElementId: string; StartElementId: string; EndElementId: string; Type: string; Props: {} }) => {
+ pushToEdgesCallback({
+ id: edge.ElementId,
+ source: edge.StartElementId,
+ sourceHandle: edge.Type === 'Parent' ? 'parent' : edge.Type === 'Child' ? 'child' : 'spouse',
+ target: edge.EndElementId,
+ targetHandle: edge.Type === 'Parent' ? 'child' : edge.Type === 'Child' ? 'parent' : 'spouse',
+ label: edge.Type,
+ data: edge.Props,
+ zIndex: edge.Type === 'Spouse' ? 1 : 0
+ });
+ });
+ } else {
+ console.log(data[0].Values[i]);
+ pushToEdgesCallback({
+ id: data[0].Values[i].ElementId,
+ source: data[0].Values[i].StartElementId,
+ sourceHandle: data[0].Values[i].Type === 'Parent' ? 'parent' : data[0].Values[i].Type === 'Child' ? 'child' : 'spouse',
+ target: data[0].Values[i].EndElementId,
+ targetHandle: data[0].Values[i].Type === 'Parent' ? 'child' : data[0].Values[i].Type === 'Child' ? 'parent' : 'spouse',
+ label: data[0].Values[i].Type,
+ data: data[0].Values[i].Props,
+ zIndex: data[0].Values[i].Type === 'Spouse' ? 1 : 0
+ });
+ }
+ }
+}
+
+export { AddToNodesData, AddToEdgesData };
\ No newline at end of file
diff --git a/frontend/src/lib/family_tree/getFamilyTree.ts b/frontend/src/lib/family_tree/getFamilyTree.ts
index 2727bc4..e5381ca 100644
--- a/frontend/src/lib/family_tree/getFamilyTree.ts
+++ b/frontend/src/lib/family_tree/getFamilyTree.ts
@@ -10,12 +10,14 @@ user.subscribe((value) => {
});
async function fetch_family_tree() {
+ console.log(PUBLIC_API_URL);
+
const response = await fetch(
- { PUBLIC_API_URL } + '/familyTree?id=8a8b9b05bdc24550a5cc73e0b55e8d7d',
+ PUBLIC_API_URL + '/familyTree?id=8a8b9b05bdc24550a5cc73e0b55e8d7d',
{
method: 'GET',
headers: {
- 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
Authorization: auth_token
}
}
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index 2cf8c5e..d31396c 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -1,14 +1,14 @@
-
-
+
+
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 17781ce..a3bcf4e 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -1,6 +1,7 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{html,svelte,js,ts}'],
+ important: true,
theme: {
extend: {}
},