run format

This commit is contained in:
2025-05-01 01:00:21 +02:00
parent 7f32896db0
commit c9e308d578
19 changed files with 2394 additions and 2366 deletions

View File

@@ -42,7 +42,7 @@
"dark": "Dark",
"date": "Date",
"death": "Death",
"delete_profile":"Delete profile",
"delete_profile": "Delete profile",
"deceased": "Deceased",
"deny": "Deny",
"description": "Description",

View File

@@ -43,7 +43,7 @@
"date": "Dátum",
"death": "Halál",
"deceased": "Elhunyt",
"delete_profile":"Delete profile",
"delete_profile": "Delete profile",
"deny": "Elutasítás",
"description": "Leírás",
"details": "Részletek",

View File

@@ -7,9 +7,7 @@
from_time,
admin,
create_relationship_and_person,
add_relationship
} from '$lib/paraglide/messages';
import ModalButtons from './ModalButtons.svelte';
import type { components, operations } from '$lib/api/api.gen';
@@ -19,8 +17,8 @@
editProfile = () => {},
onChange = () => {},
addRelationship = () => {},
createProfile = ()=> {},
createRelationshipAndProfile = () => {},
createProfile = () => {},
createRelationshipAndProfile = () => {}
} = $props<{
closeModal: () => void;
onChange?: () => void;
@@ -31,29 +29,29 @@
}>();
let managed_profiles_list: components['schemas']['Admin'][] = $state([]);
function fetchManagedProfiles(){
fetch(`/api/managed_profiles`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then((response) => {
if (!response.ok) {
console.log('Cannot get managed profiles, status: ' + response.status);
return;
function fetchManagedProfiles() {
fetch(`/api/managed_profiles`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then((response) => {
if (!response.ok) {
console.log('Cannot get managed profiles, status: ' + response.status);
return;
}
return response.json();
})
.then((data) => {
if (data) {
managed_profiles_list = [...(data as components['schemas']['Admin'][])];
}
})
.catch((error) => {
console.error('Error fetching managed profiles:', error);
});
return response.json();
})
.then((data) => {
if (data) {
managed_profiles_list = [...(data as components['schemas']['Admin'][])];
}
})
.catch((error) => {
console.error('Error fetching managed profiles:', error);
});
}
fetchManagedProfiles();
@@ -122,24 +120,27 @@
<div class="text-xs font-semibold uppercase opacity-60">{profile.label![0]}</div>
</div>
<button
class="btn btn-success btn-soft"
onclick={() => {
addRelationship(profile.id!);
}}>
{add_relationship()}
</button>
class="btn btn-success btn-soft"
onclick={() => {
addRelationship(profile.id!);
}}
>
{add_relationship()}
</button>
<button
class="btn btn-success btn-soft"
onclick={() => {
createRelationshipAndProfile(profile.id!);
}}>
{create_relationship_and_person()}
</button>
class="btn btn-success btn-soft"
onclick={() => {
createRelationshipAndProfile(profile.id!);
}}
>
{create_relationship_and_person()}
</button>
<button
class="btn btn-secondary"
onclick={() => {
editProfile(profile.id!);
}}>
}}
>
{edit()}
</button>
{#if profile.label?.includes('DeletedPerson')}

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,6 @@
data
}: EdgeProps = $props();
let edgeType = (
data as components['schemas']['FamilyRelationship'] & { type: string }
).type.toLowerCase();
@@ -70,7 +69,7 @@
edgeLabel = edgeType;
}
let [path, labelX, labelY] = $derived(
let [path, labelX, labelY] = $derived(
getBezierPath({
sourceX,
sourceY,
@@ -81,7 +80,7 @@
})
);
edgeColor = edgeColor +'stroke-opacity:unset; stroke-width=20;' +(style ?? '');
edgeColor = edgeColor + 'stroke-opacity:unset; stroke-width=20;' + (style ?? '');
const onEdgeClick = () => {
window.dispatchEvent(
@@ -96,4 +95,4 @@
};
</script>
<BaseEdge {path} {labelX} {labelY} {markerEnd} style={edgeColor} onclick={onEdgeClick}/>
<BaseEdge {path} {labelX} {labelY} {markerEnd} style={edgeColor} onclick={onEdgeClick} />

View File

@@ -10,24 +10,25 @@
let nodeColor = ' bg-neutral text-neutral-content';
switch (data.biological_sex) {
case ('female'):
case 'female':
nodeColor = ' bg-secondary text-secondary-content';
break;
case ('male'):
case 'male':
nodeColor = ' bg-primary text-primary-content';
break;
case ('intersex'):
case 'intersex':
nodeColor = ' bg-accent text-accent-content';
break;
}
</script>
<div
class={"card card-compact flex h-40 w-40 flex-col items-center justify-center rounded-full shadow-lg" + nodeColor}
class={'card card-compact flex h-40 w-40 flex-col items-center justify-center rounded-full shadow-lg' +
nodeColor}
>
<Handle
class="customHandle"
id='child'
id="child"
{isValidConnection}
isConnectable={true}
position={Position.Bottom}
@@ -35,7 +36,7 @@
style="z-index: 1;"
/>
<Handle
<Handle
class="customHandle"
{isValidConnection}
position={Position.Left}
@@ -45,33 +46,33 @@
/>
<Handle
class="customHandle"
{isValidConnection}
position={Position.Right}
isConnectable={true}
type="target"
isConnectableStart={false}
/>
<Handle
class="customHandle"
{isValidConnection}
position={Position.Left}
isConnectable={true}
type="source"
isConnectableStart={true}
/>
<Handle
class="customHandle"
{isValidConnection}
position={Position.Right}
isConnectable={true}
type="source"
isConnectableStart={true}
class="customHandle"
{isValidConnection}
position={Position.Right}
isConnectable={true}
type="target"
isConnectableStart={false}
/>
<Handle
class="customHandle"
id='parent'
{isValidConnection}
position={Position.Left}
isConnectable={true}
type="source"
isConnectableStart={true}
/>
<Handle
class="customHandle"
{isValidConnection}
position={Position.Right}
isConnectable={true}
type="source"
isConnectableStart={true}
/>
<Handle
class="customHandle"
id="parent"
{isValidConnection}
position={Position.Top}
isConnectable={true}
@@ -80,9 +81,7 @@
/>
<div class="avatar mb-2" style="z-index: 2; cursor: pointer;">
<div
class="bg-accent w-24 rounded-full border-0 ring-offset-1"
>
<div class="bg-accent w-24 rounded-full border-0 ring-offset-1">
<img
src={data.profile_picture || 'https://cdn-icons-png.flaticon.com/512/10628/10628885.png'}
alt="Picture of {data.last_name} {data.first_name}"

View File

@@ -35,10 +35,10 @@ export class FamilyTree extends dagre.graphlib.Graph {
if (String(edge.data?.type).toLowerCase() === 'child') {
newEdge.sourceHandle = 'child';
newEdge.targetHandle = 'parent';
}else if (String(edge.data?.type).toLowerCase() === 'parent') {
return
} else if (String(edge.data?.type).toLowerCase() === 'parent') {
return;
}
const sourceNode = this.node(edge.source);
const targetNode = this.node(edge.target);
if (!sourceNode || !targetNode) {
@@ -79,7 +79,6 @@ export class FamilyTree extends dagre.graphlib.Graph {
targetNode.x = desiredX;
targetNode.y = sourceNode.y;
}
if (String(edge.data?.type).toLowerCase() === 'spouse') {

View File

@@ -15,7 +15,7 @@ export function parseFamilyTree(data: components['schemas']['FamilyTree']): Layo
const nodes: Node[] = data.people.map((person) => {
let newNode = { data: { ...person } } as Node;
if (person.id !== null && person.id !== undefined) {
newNode.id = "person"+person.id.toString();
newNode.id = 'person' + person.id.toString();
}
newNode.position = { x: 0, y: 0 };
newNode.data.id = person.id;
@@ -26,13 +26,13 @@ export function parseFamilyTree(data: components['schemas']['FamilyTree']): Layo
if (data.relationships) {
relationships = data.relationships.map((relationship) => {
const newEdge = { data: { ...relationship.Props } } as Edge;
newEdge.id = "person"+relationship.ElementId;
newEdge.id = 'person' + relationship.ElementId;
newEdge.data!.type = relationship.Type?.toLowerCase();
if (relationship.StartElementId !== null && relationship.StartElementId !== undefined) {
newEdge.source = "person"+relationship.StartId!.toString();
newEdge.source = 'person' + relationship.StartId!.toString();
}
if (relationship.EndElementId !== null && relationship.EndElementId !== undefined) {
newEdge.target = "person"+relationship.EndId!.toString();
newEdge.target = 'person' + relationship.EndId!.toString();
}
return newEdge;

View File

@@ -38,7 +38,7 @@
mediaType = 'photo';
}}
>
{'+ '+photos()}
{'+ ' + photos()}
</button>
<button
class="btn btn-soft btn-xs"
@@ -47,7 +47,7 @@
mediaType = 'video';
}}
>
{'+ '+video()}
{'+ ' + video()}
</button>
</div>
{/if}

View File

@@ -69,7 +69,12 @@
return;
} else {
const errorDetails = await response.json();
alert('Error saving person data, status: ' + response.status + ' ' + JSON.stringify(errorDetails));
alert(
'Error saving person data, status: ' +
response.status +
' ' +
JSON.stringify(errorDetails)
);
}
} catch (error) {
alert('An unexpected error occurred: ' + error);

View File

@@ -20,9 +20,7 @@
mothers_last_name,
profile_picture,
create_invite_code,
invite_code
} from '$lib/paraglide/messages';
import { callMessageFunction } from '$lib/i18n';
import type { MessageKeys } from '$lib/i18n';
@@ -118,7 +116,7 @@
bind:this={birth_date}
placeholder={person.born}
onchange={() => onChange('born', birth_date.value)}
/>
/>
{:else}{person.born ?? '-'}{/if}
</p>
<p>
@@ -127,7 +125,7 @@
type="text"
class="pika-single w-full"
id="death_date"
placeholder={person.died??died()}
placeholder={person.died ?? died()}
bind:this={death_date}
onchange={() => onChange('died', death_date.value)}
/>{:else}{person.died ?? '-'}{/if}
@@ -179,16 +177,19 @@
<p><strong>{id()}: </strong>{' ' + (person.id ?? '-')}</p>
<p><strong>Limit: </strong>{' ' + (person.limit ?? '-')}</p>
{#if editorMode && (person.google_id === undefined || person.google_id === null || person.google_id === '')}
{#if new_invite_code===undefined}
<button class="btn btn-soft btn-accent btn-m" onclick={()=>{
new_invite_code = uuidv4();
person.invite_code = new_invite_code;
onChange('invite_code',new_invite_code);
}}>{create_invite_code()}</button>
{#if new_invite_code === undefined}
<button
class="btn btn-soft btn-accent btn-m"
onclick={() => {
new_invite_code = uuidv4();
person.invite_code = new_invite_code;
onChange('invite_code', new_invite_code);
}}>{create_invite_code()}</button
>
{:else}
<p>
<strong>{invite_code()}:</strong>{person.invite_code}
</p>
<p>
<strong>{invite_code()}:</strong>{person.invite_code}
</p>
{/if}
{/if}
</div>

View File

@@ -2,11 +2,11 @@
import { date, description, file, media_title, title, upload } from '$lib/paraglide/messages';
export let closeModal: () => void;
export let onCreation:(newMedia:{
url: string,
name: string,
description: string,
date: string
export let onCreation: (newMedia: {
url: string;
name: string;
description: string;
date: string;
}) => void = () => {};
export let mediaType: 'audio' | 'video' | 'photo' = 'photo';
@@ -48,14 +48,14 @@
// Clean up
selectedFile = null;
newMedia = { url: '', name: '', description: '', date: '' };
onCreation(newMedia);
onCreation(newMedia);
closeModal();
}
</script>
<div class="modal modal-open z-8">
<div class="modal-box w-full max-w-xl">
<h3 class="text-lg font-bold">{upload()+mediaType}</h3>
<h3 class="text-lg font-bold">{upload() + mediaType}</h3>
<div class="form-control mt-4">
<label for="mfile" class="label">{upload() + ' ' + file()}</label>

View File

@@ -44,7 +44,7 @@
.catch((error) => {
console.error('Error fetching admin status:', error);
});
fetch(`/api/admin/${edge.target}/${XUserId}`)
fetch(`/api/admin/${edge.target}/${XUserId}`)
.then((response) => {
if (response.status === 200) {
isAdmin = true;

View File

@@ -9,7 +9,7 @@
relation_type,
sibling,
spouse,
until,
until
} from '$lib/paraglide/messages';
import type { Edge } from '@xyflow/svelte';
import ModalButtons from '$lib/relationship/ModalButtons.svelte';
@@ -41,7 +41,13 @@
let relationshiptype: 'sibling' | 'child' | 'parent' | 'spouse' | undefined = $state('sibling');
async function getRelationships(startId: string, endId: string) {
if (startId === undefined || endId === undefined || startId === '' || endId === '' || startId === endId) {
if (
startId === undefined ||
endId === undefined ||
startId === '' ||
endId === '' ||
startId === endId
) {
return;
}
@@ -60,7 +66,7 @@
relationships.push((await response.json()) as components['schemas']['dbtypeRelationship']);
}
if (!createRelationship){
if (!createRelationship) {
getRelationships(startNode, endNode);
getRelationships(endNode, startNode);
}
@@ -92,7 +98,6 @@
} else {
console.log(`Failed to save relationship ${r.StartId}${r.EndId}`);
}
}
closeModal();
@@ -126,7 +131,7 @@
});
if (!response.ok) {
console.log('Cannot create relationship'+', status: ' + response.status);
console.log('Cannot create relationship' + ', status: ' + response.status);
return;
}
@@ -177,8 +182,8 @@
<p><strong>{id().toLowerCase()}:</strong>{startNode}</p>
</div>
<div class="form-control mt-1">
<label for="endNode" class="label">{relation()+' '+id().toLowerCase()}:</label>
<input id="endNode" type="text" bind:value={endNode} class="input input-bordered w-full"/>
<label for="endNode" class="label">{relation() + ' ' + id().toLowerCase()}:</label>
<input id="endNode" type="text" bind:value={endNode} class="input input-bordered w-full" />
</div>
{/if}
{#if !createRelationship}

View File

@@ -9,4 +9,4 @@ export interface RelationshipMenu {
bottom: number | undefined;
onClick: () => void;
deleteEdge: () => void;
}
}

View File

@@ -4,8 +4,10 @@
<div class="drawer-side">
<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">
<ul class="menu bg-base-200 text-base-content min-h-full w-80 gap-4 p-4 pt-16">
<!-- Sidebar content here -->
<li><button class="btn btn-primary" aria-label="close sidebar">{managed_profiles()}</button></li>
<li>
<button class="btn btn-primary" aria-label="close sidebar">{managed_profiles()}</button>
</li>
</ul>
</div>

View File

@@ -343,5 +343,9 @@
</div>
<div class="absolute top-2 left-2 flex flex-row items-center gap-2">
<HamburgerIcon open_admin_panel={()=>{adminMenu=!adminMenu}}/>
<HamburgerIcon
open_admin_panel={() => {
adminMenu = !adminMenu;
}}
/>
</div>

View File

@@ -192,8 +192,8 @@ async function register(event: RequestEvent) {
message: missing_field({
field: born()
})
});
}else {
});
} else {
birth_date = birth_date.toString();
}
@@ -249,17 +249,19 @@ async function register(event: RequestEvent) {
let invite_code = data.get('invite_code');
if (invite_code !== null) {
invite_code = invite_code.toString();
}else {
} else {
invite_code = '';
}
let responseData :{
Id?: number;
ElementId?: string;
Labels?: string[];
Props?: components["schemas"]["PersonProperties"];
} | undefined = undefined;
if (!(invite_code.length > 0)){
let responseData:
| {
Id?: number;
ElementId?: string;
Labels?: string[];
Props?: components['schemas']['PersonProperties'];
}
| undefined = undefined;
if (!(invite_code.length > 0)) {
let response = await client.POST('/person/google/{google_id}', {
params: {
data: parsedData,
@@ -282,7 +284,7 @@ async function register(event: RequestEvent) {
});
}
responseData = response.data;
}else {
} else {
let response = await client.PATCH('/person/google/{google_id}', {
params: {
path: { google_id: google_id.toString() }
@@ -290,7 +292,7 @@ async function register(event: RequestEvent) {
body: {
invite_code: invite_code,
person: personP
},
}
});
if (response.response.status !== 200) {
return fail(400, {

View File

@@ -17,12 +17,8 @@
female,
other,
intersex,
invite_code,
have_invite_code
} from '$lib/paraglide/messages';
import { onMount } from 'svelte';
import { enhance } from '$app/forms';
@@ -40,7 +36,6 @@
let birth_date: HTMLInputElement;
let birth_date_value: HTMLInputElement;
onMount(() => {
if (birth_date) {
import('pikaday').then(({ default: Pikaday }) => {
const picker = new Pikaday({