small fixes on profile and nodes

This commit is contained in:
2025-04-29 22:09:31 +02:00
parent 3ffc12012f
commit 466ea365de
13 changed files with 2300 additions and 2274 deletions

View File

@@ -36,6 +36,7 @@
"cookie_policy": "Cookie Policy",
"country": "Country",
"create": "Create",
"create_invite_code": "Create invite code",
"create_person": "Create person",
"create_relationship_and_person": "Create relationship and person",
"dark": "Dark",
@@ -76,6 +77,7 @@
"ingridients": "Ingridients",
"interest": "Interest",
"intersex": "Intersex",
"invite_code": "Invite Code",
"language": "Language",
"last_name": "Last Name",
"life_events": "Life Events",

View File

@@ -36,6 +36,7 @@
"cookie_policy": "Süti szabályzat",
"country": "Ország",
"create": "Létrehozás",
"create_invite_code": "Meghívó kód létrehozása",
"create_person": "Személy létrehozása",
"create_relationship_and_person": "Kapcsolat és személy létrehozása",
"dark": "Sötét",
@@ -76,6 +77,7 @@
"ingridients": "Hozzávalók",
"interest": "Érdeklődés",
"intersex": "Interszex",
"invite_code": "Meghívó kód",
"language": "Nyelv",
"last_name": "Vezetéknév",
"life_events": "Életesemények",

View File

@@ -69,4 +69,4 @@
"openapi-fetch": "^0.13.5",
"pikaday": "^1.8.2"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -34,14 +34,15 @@
if (bottom) {
contextMenu.style.bottom = `${bottom}px`;
}
fetch(`/api/admin/${id}/${XUserId}`
).then((response) => {
if(response.status === 200){
fetch(`/api/admin/${id}/${XUserId}`)
.then((response) => {
if (response.status === 200) {
isAdmin = true;
}else {
isAdmin = false
} else {
isAdmin = false;
}
}).catch((error) => {
})
.catch((error) => {
console.error('Error fetching admin status:', error);
});
});
@@ -64,7 +65,7 @@
</button>
<button onclick={addRelationship} class="btn">{add_relationship()}</button>
<button onclick={addAdmin} class="btn">{add_administrator()}</button>
{#if (Number(XUserId) !== Number(id)) && isAdmin}
{#if Number(XUserId) !== Number(id) && isAdmin}
<button onclick={deleteNode} class="btn">{remove()}</button>
{/if}
</div>

View File

@@ -41,7 +41,7 @@
</div>
</div>
<div class="px-2 text-center">
<div class="px-2 text-center" style="z-index: 2; cursor: pointer;">
<h2 class="text-sm leading-tight font-semibold">
{data.first_name}
{data.middle_name ? data.middle_name : ''}

View File

@@ -4,7 +4,7 @@ import PersonNode from './PersonNode.svelte';
export const nodeTypes: NodeTypes = { personNode: PersonNode };
export const edgeTypes: EdgeTypes = {
familyEdge: FamilyEdge
familyEdge: FamilyEdge
};
export type NodeMenu = {

View File

@@ -7,7 +7,7 @@
import LifeEventsTimeline from './LifeEventsTimeline.svelte';
import OtherDetails from './OtherDetails.svelte';
import type { components } from '$lib/api/api.gen.js';
import { life_events } from '$lib/paraglide/messages';
let {
closeModal = () => {},
person = {}

View File

@@ -17,7 +17,8 @@
middle_name,
mothers_first_name,
mothers_last_name,
profile_picture
profile_picture,
create_invite_code
} from '$lib/paraglide/messages';
import { callMessageFunction } from '$lib/i18n';
import type { MessageKeys } from '$lib/i18n';
@@ -80,14 +81,14 @@
<div class="grid flex-1 grid-cols-1 gap-4 md:grid-cols-2">
<div>
<p>
<strong>{first_name()}:</strong>
<strong>{first_name()}: </strong>
{#if editorMode}<input
bind:value={person.first_name}
class="input input-sm input-bordered w-full"
/>{:else}{person.first_name ?? '-'}{/if}
</p>
<p>
<strong>{last_name()}:</strong>
<strong>{last_name()}: </strong>
{#if editorMode}<input
bind:value={person.last_name}
class="input input-sm input-bordered w-full"
@@ -101,7 +102,7 @@
/>{:else}{person.middle_name ?? '-'}{/if}
</p>
<p>
<strong>{born()}:</strong>
<strong>{born()}: </strong>
{#if editorMode}<input
type="text"
class="pika-single w-full"
@@ -112,7 +113,7 @@
{:else}{person.born ?? '-'}{/if}
</p>
<p>
<strong>{died()}:</strong>
<strong>{died()}: </strong>
{#if editorMode}<input
type="text"
class="pika-single w-full"
@@ -123,7 +124,7 @@
/>{:else}{person.died ?? '-'}{/if}
</p>
<p>
<strong>{biological_sex()}:</strong>
<strong>{biological_sex()}: </strong>
{#if editorMode}
<select
name="biological_sex"
@@ -162,8 +163,11 @@
class="input input-sm input-bordered w-full"
/>{:else}{person.mothers_last_name ?? '-'}{/if}
</p>
<p><strong> {id()}:</strong>{person.id ?? '-'}</p>
<p><strong> Limit:</strong>{person.limit ?? '-'}</p>
<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 !== '')}
<button class="btn btn-accent-soft btn-sm">{create_invite_code()}</button>
{/if}
</div>
</div>
</div>

View File

@@ -5,7 +5,7 @@
{#if show}
<label for="my-drawer" class="btn btn-circle drawer-button swap swap-rotate">
<!-- this hidden checkbox controls the state -->
<input id="my-drawer" type="checkbox" class="drawer-toggle" />
<input id="my-drawer" type="checkbox" class="drawer-toggle" />
<!-- hamburger icon -->
<svg

View File

@@ -7,10 +7,10 @@
SvelteFlow,
Controls,
MiniMap,
ConnectionLineType,
ConnectionLineType
} from '@xyflow/svelte';
import '@xyflow/svelte/dist/style.css';
import type {OnConnectEnd, Node, Edge, NodeEventWithPointer } from '@xyflow/svelte';
import type { OnConnectEnd, Node, Edge, NodeEventWithPointer } from '@xyflow/svelte';
import PersonModal from '$lib/profile/Modal.svelte';
import PersonMenu from '$lib/graph/PersonMenu.svelte';
@@ -165,6 +165,7 @@
selectedPerson = data.Props as components['schemas']['PersonProperties'] & {
id: number | null;
};
selectedPerson.id = person.id;
}
});
}
@@ -177,13 +178,13 @@
const handleConnectEnd: OnConnectEnd = (event, connectionState) => {
if (connectionState.isValid) return;
const sourceNodeId = connectionState.fromNode?.id
const sourceNodeId = connectionState.fromNode?.id;
if (sourceNodeId === undefined) return;
relationshipStart = Number(sourceNodeId);
createPerson = true;
console.log('createPerson', createPerson);
console.log('relationshipStart', relationshipStart);
}
};
</script>
<svelte:head>

View File

@@ -35,7 +35,7 @@ export async function GET(event: RequestEvent): Promise<Response> {
message: 'Family tree is empty'
});
}
var graphToReturn: components['schemas']['FamilyTree'] = {
people: [],
relationships: response.data.relationships

View File

@@ -34,7 +34,6 @@ export const load: PageServerLoad = async (event: RequestEvent) => {
return {};
}
const storedState = event.cookies.get('google_oauth_state') ?? null;
const codeVerifier = event.cookies.get('google_code_verifier') ?? null;
const code = event.url.searchParams.get('code');
@@ -101,13 +100,13 @@ export const load: PageServerLoad = async (event: RequestEvent) => {
email: email
};
event.cookies.set('already_loaded', 'true',{
event.cookies.set('already_loaded', 'true', {
path: '/login/google/callback',
sameSite: 'lax',
httpOnly: true,
maxAge: 60 * 10,
secure: import.meta.env.PROD,
})
secure: import.meta.env.PROD
});
return {
props: personP
@@ -133,17 +132,20 @@ async function register(event: RequestEvent) {
mothers_first_name: data.get('mothers_first_name'),
mothers_last_name: data.get('mothers_last_name'),
google_id: data.get('google_id'),
limit: StorageLimit,
limit: StorageLimit
} as components['schemas']['PersonRegistration'];
if (!event.platform || !event.platform.env || !event.platform.env.GH_SESSIONS) {
return fail(500, { data: parsedData, message: 'Server configuration error. GH_SESSIONS KeyValue store missing' });
return fail(500, {
data: parsedData,
message: 'Server configuration error. GH_SESSIONS KeyValue store missing'
});
}
const first_name_f = data.get('first_name');
if (first_name_f === null || first_name_f === '') {
return fail(400, {
data:parsedData,
data: parsedData,
message: missing_field({
field: first_name()
})
@@ -287,14 +289,12 @@ async function register(event: RequestEvent) {
setSessionTokenCookie(event, sessionToken, session.expiresAt);
event.cookies.delete('already_loaded',
{
path: '/login/google/callback',
sameSite: 'lax',
httpOnly: true,
maxAge: 0,
secure: import.meta.env.PROD
}
);
event.cookies.delete('already_loaded', {
path: '/login/google/callback',
sameSite: 'lax',
httpOnly: true,
maxAge: 0,
secure: import.meta.env.PROD
});
return redirect(302, '/');
}