mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-12 13:59:08 +02:00
fixup render on creation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { components } from '$lib/api/api.gen.ts';
|
||||
import { child, spouse, parent, sibling } from '$lib/paraglide/messages';
|
||||
import { getSmoothStepPath, BaseEdge, EdgeLabelRenderer, type EdgeProps } from '@xyflow/svelte';
|
||||
import { getSmoothStepPath, BaseEdge, type EdgeProps } from '@xyflow/svelte';
|
||||
|
||||
let {
|
||||
sourceX,
|
||||
|
@@ -2,7 +2,7 @@ import type { Connection } from '@xyflow/svelte';
|
||||
import type { EdgeBase } from '@xyflow/system';
|
||||
|
||||
export function isValidConnection(edge: EdgeBase | Connection) {
|
||||
if (edge.source !== edge.target) {
|
||||
if (Number(edge.source) !== Number(edge.target)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -96,17 +96,18 @@
|
||||
}
|
||||
let data = (await response.json()) as {
|
||||
person?: components['schemas']['Person'];
|
||||
relationships?: components['schemas']['Relationship'][];
|
||||
relationships?: components['schemas']['dbtypeRelationship'][];
|
||||
};
|
||||
if (onCreation !== undefined) {
|
||||
let edges: Array<Edge> = [];
|
||||
data.relationships?.map((relationship) =>
|
||||
edges.push({
|
||||
id: String(relationship.id),
|
||||
source: String(relationship.start),
|
||||
target: String(relationship.end),
|
||||
id: String(relationship.Id),
|
||||
source: String(relationship.StartElementId),
|
||||
target: String(relationship.EndElementId),
|
||||
data: {
|
||||
...relationship.properties
|
||||
...relationship.Props,
|
||||
type: relationship.Type
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@@ -6,6 +6,6 @@
|
||||
<label for="my-drawer" aria-label="close sidebar" class="drawer-overlay"></label>
|
||||
<ul class="menu bg-base-200 text-base-content min-h-full w-80 p-4 gap-4 pt-16">
|
||||
<!-- Sidebar content here -->
|
||||
<li><button class="btn btn-primary">{managed_profiles()}</button></li>
|
||||
<li><button class="btn btn-primary" aria-label="close sidebar">{managed_profiles()}</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@@ -37,8 +37,6 @@
|
||||
let with_out_spouse = $state(false);
|
||||
|
||||
let familyTreeDAG = new FamilyTree();
|
||||
let nodes = $state.raw<Node[]>([]);
|
||||
let edges = $state.raw<Edge[]>([]);
|
||||
let layout = familyTreeDAG.getLayoutedElements(
|
||||
data.Nodes,
|
||||
data.Edges,
|
||||
@@ -46,8 +44,11 @@
|
||||
tailwindClassToPixels('h-40') || 160,
|
||||
'TB'
|
||||
);
|
||||
nodes = layout.Nodes;
|
||||
edges = layout.Edges;
|
||||
console.log('layout', layout);
|
||||
console.log('dagEdges',familyTreeDAG.edges());
|
||||
console.log('dagNodes',familyTreeDAG.nodes());
|
||||
let nodes = $state.raw<Node[]>(layout.Nodes);
|
||||
let edges = $state.raw<Edge[]>(layout.Edges);
|
||||
|
||||
let relationshipStart: number | null = $state(null);
|
||||
let createPerson = $state(false);
|
||||
@@ -134,7 +135,7 @@
|
||||
tailwindClassToPixels('h-40') || 160,
|
||||
'TB'
|
||||
);
|
||||
|
||||
console.log('newLayout', newLayout);
|
||||
edges = newLayout.Edges;
|
||||
nodes = newLayout.Nodes;
|
||||
};
|
||||
|
Reference in New Issue
Block a user