frontend cleanup

This commit is contained in:
Alex
2025-02-07 22:00:43 +01:00
parent 3ae1ffd403
commit cce2866b52
7 changed files with 22 additions and 60 deletions

View File

@@ -80,7 +80,7 @@
}
}
$: isNewUser = user === null;
// $: isNewUser = user === null;
$: isLoading = user === undefined;
$: {
@@ -135,7 +135,8 @@
label: sub?.name ?? ''
}));
$: selectedSubscriptionModel =
subscriptions.find((sub) => sub?.id === localUser.membership?.subscription_model.id) || null;
subscriptions.find((sub) => sub?.name === localUser.membership?.subscription_model.name) ||
null;
/**
* creates groups of categories depending on the first letter
@@ -146,7 +147,7 @@
return Object.entries(categories)
.sort((a, b) => a[1].category.localeCompare(b[1].category))
.reduce(
(/** @type {Object.<string, App.Locals['licence_categories']>} */ acc, [_, category]) => {
(/** @type {Object.<string, App.Locals['licence_categories']>} */ acc, [, category]) => {
const firstLetter = category.category[0];
if (!acc[firstLetter]) {
acc[firstLetter] = [];
@@ -167,12 +168,12 @@
}
/** @type {import('../../routes/auth/about/[id]/$types').SubmitFunction} */
const handleUpdate = async ({ formData, action, cancel }) => {
const handleUpdate = async () => {
isUpdating = true;
return async ({ result }) => {
isUpdating = false;
if (result.type === 'success' || result.type === 'redirect') {
close();
dispatch('close');
} else {
document.querySelector('.modal .container')?.scrollTo({ top: 0, behavior: 'smooth' });
}
@@ -371,7 +372,7 @@
<div class="licence-categories">
<h3>{$t('licence_categories')}</h3>
<div class="checkbox-grid">
{#each Object.entries(groupedCategories) as [group, categories], groupIndex}
{#each Object.entries(groupedCategories) as [, categories], groupIndex}
{#if groupIndex > 0}
<div class="category-break"></div>
{/if}
@@ -417,11 +418,11 @@
<div class="subscription-column">
<p>
<strong>{$t('monthly_fee')}:</strong>
{selectedSubscriptionModel?.monthly_fee || '-'}
{selectedSubscriptionModel?.monthly_fee || '-'}
</p>
<p>
<strong>{$t('hourly_rate')}:</strong>
{selectedSubscriptionModel?.hourly_rate || '-'}
{selectedSubscriptionModel?.hourly_rate || '-'}
</p>
{#if selectedSubscriptionModel?.included_hours_per_year}
<p>