1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-21 13:59:36 +02:00

Add default category icon and improve visit display:

- Set default icon for empty category in AdventureModal
- Enhance layout for visit buttons and validation messages in DateRangeCollapse
- Update localization files to include "no visits" strings in multiple languages
This commit is contained in:
Sean Morley 2025-05-09 21:17:11 -04:00
parent 3caebd37dd
commit 04f9227ae6
13 changed files with 157 additions and 125 deletions

View file

@ -463,6 +463,13 @@
event.preventDefault();
triggerMarkVisted = true;
// if category icon is empty, set it to the default icon
if (adventure.category?.icon == '' || adventure.category?.icon == null) {
if (adventure.category) {
adventure.category.icon = '🌍';
}
}
if (adventure.id === '') {
if (adventure.category?.display_name == '') {
if (categories.some((category) => category.name === 'general')) {
@ -479,6 +486,7 @@
};
}
}
let res = await fetch('/api/adventures', {
method: 'POST',
headers: {
@ -708,10 +716,12 @@
<span>{$t('adventures.warning')}: {warningMessage}</span>
</div>
{/if}
<div class="flex flex-row gap-2">
<button type="submit" class="btn btn-primary">{$t('adventures.save_next')}</button>
<button type="button" class="btn" on:click={close}>{$t('about.close')}</button>
</div>
</div>
</div>
</form>
</div>
{:else}

View file

@ -258,6 +258,36 @@
></textarea>
</div>
{/if}
{#if type === 'adventure'}
<button
class="btn btn-primary"
type="button"
on:click={() => {
const newVisit = {
id: crypto.randomUUID(),
start_date: utcStartDate ?? '',
end_date: utcEndDate ?? utcStartDate ?? '',
notes: note ?? ''
};
// Ensure reactivity by assigning a *new* array
if (visits) {
visits = [...visits, newVisit];
} else {
visits = [newVisit];
}
// Optionally clear the form
note = '';
localStartDate = '';
localEndDate = '';
utcStartDate = null;
utcEndDate = null;
}}
>
{$t('adventures.add')}
</button>
{/if}
</div>
<!-- Validation Message -->
@ -280,6 +310,20 @@
</div>
{/if}
{#if type === 'adventure'}
<div class="border-t border-neutral pt-4">
<h3 class="text-xl font-semibold">
{$t('adventures.visits')}
</h3>
<!-- Visits List -->
{#if visits && visits.length === 0}
<p class="text-sm text-base-content opacity-70">
{$t('adventures.no_visits')}
</p>
{/if}
</div>
{#if visits && visits.length > 0}
<div class="space-y-4">
{#each visits as visit}
@ -306,18 +350,6 @@
{/if}
<div class="flex gap-2 mt-2">
<button
class="btn btn-error btn-sm"
type="button"
on:click={() => {
if (visits) {
visits = visits.filter((v) => v.id !== visit.id);
}
}}
>
{$t('adventures.remove')}
</button>
<button
class="btn btn-primary btn-sm"
type="button"
@ -364,43 +396,22 @@
>
{$t('lodging.edit')}
</button>
<button
class="btn btn-error btn-sm"
type="button"
on:click={() => {
if (visits) {
visits = visits.filter((v) => v.id !== visit.id);
}
}}
>
{$t('adventures.remove')}
</button>
</div>
</div>
{/each}
</div>
{/if}
<div class="flex gap-2 mb-1">
<!-- add button -->
{#if type === 'adventure'}
<button
class="btn btn-primary"
type="button"
on:click={() => {
const newVisit = {
id: crypto.randomUUID(),
start_date: utcStartDate ?? '',
end_date: utcEndDate ?? utcStartDate ?? '',
notes: note ?? ''
};
// Ensure reactivity by assigning a *new* array
if (visits) {
visits = [...visits, newVisit];
} else {
visits = [newVisit];
}
// Optionally clear the form
note = '';
localStartDate = '';
localEndDate = '';
utcStartDate = null;
utcEndDate = null;
}}
>
{$t('adventures.add')}
</button>
{/if}
</div>
</div>
</div>

View file

@ -256,7 +256,8 @@
"additional_info": "Weitere Informationen",
"invalid_date_range": "Ungültiger Datumsbereich",
"sunrise_sunset": "Sonnenaufgang",
"timezone": "Zeitzone"
"timezone": "Zeitzone",
"no_visits": "Keine Besuche"
},
"home": {
"desc_1": "Entdecken, planen und erkunden Sie mühelos",

View file

@ -64,6 +64,7 @@
"collection_link_success": "Adventure linked to collection successfully!",
"invalid_date_range": "Invalid date range",
"timezone": "Timezone",
"no_visits": "No visits",
"no_image_found": "No image found",
"collection_link_error": "Error linking adventure to collection",
"adventure_delete_confirm": "Are you sure you want to delete this adventure? This action cannot be undone.",

View file

@ -304,7 +304,8 @@
"additional_info": "información adicional",
"invalid_date_range": "Rango de fechas no válido",
"sunrise_sunset": "Amanecer",
"timezone": "Zona horaria"
"timezone": "Zona horaria",
"no_visits": "No hay visitas"
},
"worldtravel": {
"all": "Todo",

View file

@ -256,7 +256,8 @@
"additional_info": "Informations Complémentaires",
"invalid_date_range": "Plage de dates non valide",
"sunrise_sunset": "Lever du soleil",
"timezone": "Fuseau horaire"
"timezone": "Fuseau horaire",
"no_visits": "Pas de visites"
},
"home": {
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",

View file

@ -256,7 +256,8 @@
"additional_info": "Ulteriori informazioni",
"invalid_date_range": "Intervallo di date non valido",
"sunrise_sunset": "Alba",
"timezone": "Fuso orario"
"timezone": "Fuso orario",
"no_visits": "Nessuna visita"
},
"home": {
"desc_1": "Scopri, pianifica ed esplora con facilità",

View file

@ -256,7 +256,8 @@
"additional_info": "추가 정보",
"invalid_date_range": "잘못된 날짜 범위",
"sunrise_sunset": "해돋이",
"timezone": "시간대"
"timezone": "시간대",
"no_visits": "방문 없음"
},
"auth": {
"both_passwords_required": "두 암호 모두 필요합니다",

View file

@ -256,7 +256,8 @@
"additional_info": "Aanvullende informatie",
"invalid_date_range": "Ongeldige datumbereik",
"sunrise_sunset": "Zonsopgang",
"timezone": "Tijdzone"
"timezone": "Tijdzone",
"no_visits": "Geen bezoeken"
},
"home": {
"desc_1": "Ontdek, plan en verken met gemak",

View file

@ -304,7 +304,8 @@
"no_ordered_items": "Legg til varer med datoer i samlingen for å se dem her.",
"ordered_itinerary": "Bestilt reiserute",
"sunrise_sunset": "Soloppgang",
"timezone": "Tidssone"
"timezone": "Tidssone",
"no_visits": "Ingen besøk"
},
"worldtravel": {
"country_list": "Liste over land",

View file

@ -304,7 +304,8 @@
"additional_info": "Dodatkowe informacje",
"invalid_date_range": "Niepoprawny zakres dat",
"sunrise_sunset": "Wschód słońca",
"timezone": "Strefa czasowa"
"timezone": "Strefa czasowa",
"no_visits": "Brak wizyt"
},
"worldtravel": {
"country_list": "Lista krajów",

View file

@ -256,7 +256,8 @@
"additional_info": "Ytterligare information",
"invalid_date_range": "Ogiltigt datumintervall",
"sunrise_sunset": "Soluppgång",
"timezone": "Tidszon"
"timezone": "Tidszon",
"no_visits": "Inga besök"
},
"home": {
"desc_1": "Upptäck, planera och utforska med lätthet",

View file

@ -304,7 +304,8 @@
"additional_info": "附加信息",
"invalid_date_range": "无效的日期范围",
"sunrise_sunset": "日出",
"timezone": "时区"
"timezone": "时区",
"no_visits": "没有访问"
},
"auth": {
"forgot_password": "忘记密码?",