Skip to content

Commit

Permalink
Merge pull request #23 from DeutscheModelUnitedNations/14-pronouns-fi…
Browse files Browse the repository at this point in the history
…eld-should-be-prefilled-with-hehim-or-sheher-when-male-or-female-is-selected-as-gender

⬆️ improvement (App Frontend): Pronouns are now prefilled when binary genders are selected
  • Loading branch information
Strehk authored Sep 16, 2024
2 parents 2b1ba61 + 23d3573 commit 05192f0
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/api/routes/roleApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const roleApplication = new Elysia()
rank: -1
}
});

await db.roleApplication.update({
where: {
id: roleApplication.id
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const user = new Elysia({
where: permissions.allowDatabaseAccessTo('read').ConferenceParticipantStatus
},
conferenceSupervisor: {
where: permissions.allowDatabaseAccessTo('read').ConferenceSupervisor,
where: permissions.allowDatabaseAccessTo('read').ConferenceSupervisor
},
teamMember: {
where: permissions.allowDatabaseAccessTo('read').TeamMember
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,7 @@
"willNotBePresentAtConference": "Ich werde <strong><u>nicht</u></strong> an der Konferenz teilnehmen.",
"presentAtConference": "Anwesend auf der Konferenz",
"registeredAsSupervisor": "Sie sind als Betreuer*in angemeldet und können hier den Status ihrer Delegationen überwachen. Wenn Sie weitere Delegationen hinzufügen möchten, folgen Sie einfach erneut dem Anmeldeprozess.",
"addAnotherDelegation": "Weitere Delegation hinzufügen"
}
"addAnotherDelegation": "Weitere Delegation hinzufügen",
"pronounsHeHim": "er/ihm",
"pronounsSheHer": "sie/ihr"
}
6 changes: 4 additions & 2 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,7 @@
"willBePresentAtConference": "I will be present at the conference",
"willNotBePresentAtConference": "I will not be present at the conference",
"registeredAsSupervisor": "You are logged in as a supervisor and can monitor the status of your delegations here. If you want to add more delegations, simply follow the registration process again.",
"addAnotherDelegation": "Add another delegation"
}
"addAnotherDelegation": "Add another delegation",
"pronounsHeHim": "He/Him",
"pronounsSheHer": "She/Her"
}
3 changes: 1 addition & 2 deletions src/routes/(authenticated)/dashboard/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { redirect } from '@sveltejs/kit';
import type { PageLoad } from './$types';

Expand All @@ -8,4 +7,4 @@ export const load: PageLoad = async ({ parent }) => {
if (data.conferences.length === 1) {
redirect(303, `/dashboard/${data.conferences[0].id}`);
}
};
};
24 changes: 24 additions & 0 deletions src/routes/(authenticated)/my-account/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
);
let wantsJoinTeamInformation = $state(data.fullUser.wantsJoinTeamInformation ?? false);
let pronounsHaveChanged = $state(false);
const onPersonalDataFormSubmit = async (e: Event) => {
e.preventDefault();
Expand All @@ -52,6 +54,28 @@
}
//TODO notify user of success
};
$effect(() => {
if (pronouns !== '' && !pronounsHaveChanged) {
pronounsHaveChanged = true;
}
});
$effect(() => {
if (pronouns === '' && !pronounsHaveChanged) {
switch (gender) {
case 'm':
pronouns = m.pronounsHeHim();
break;
case 'f':
pronouns = m.pronounsSheHer();
break;
default:
pronouns = '';
break;
}
}
});
</script>

{#if data.redirectUrl}
Expand Down

0 comments on commit 05192f0

Please sign in to comment.