mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-21 22:09: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:
parent
3caebd37dd
commit
04f9227ae6
13 changed files with 157 additions and 125 deletions
|
@ -463,6 +463,13 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
triggerMarkVisted = true;
|
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.id === '') {
|
||||||
if (adventure.category?.display_name == '') {
|
if (adventure.category?.display_name == '') {
|
||||||
if (categories.some((category) => category.name === 'general')) {
|
if (categories.some((category) => category.name === 'general')) {
|
||||||
|
@ -479,6 +486,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = await fetch('/api/adventures', {
|
let res = await fetch('/api/adventures', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -708,10 +716,12 @@
|
||||||
<span>{$t('adventures.warning')}: {warningMessage}</span>
|
<span>{$t('adventures.warning')}: {warningMessage}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<div class="flex flex-row gap-2">
|
||||||
<button type="submit" class="btn btn-primary">{$t('adventures.save_next')}</button>
|
<button type="submit" class="btn btn-primary">{$t('adventures.save_next')}</button>
|
||||||
<button type="button" class="btn" on:click={close}>{$t('about.close')}</button>
|
<button type="button" class="btn" on:click={close}>{$t('about.close')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
@ -258,6 +258,36 @@
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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>
|
</div>
|
||||||
|
|
||||||
<!-- Validation Message -->
|
<!-- Validation Message -->
|
||||||
|
@ -280,6 +310,20 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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}
|
{#if visits && visits.length > 0}
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{#each visits as visit}
|
{#each visits as visit}
|
||||||
|
@ -306,18 +350,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="flex gap-2 mt-2">
|
<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
|
<button
|
||||||
class="btn btn-primary btn-sm"
|
class="btn btn-primary btn-sm"
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -364,43 +396,22 @@
|
||||||
>
|
>
|
||||||
{$t('lodging.edit')}
|
{$t('lodging.edit')}
|
||||||
</button>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "Weitere Informationen",
|
"additional_info": "Weitere Informationen",
|
||||||
"invalid_date_range": "Ungültiger Datumsbereich",
|
"invalid_date_range": "Ungültiger Datumsbereich",
|
||||||
"sunrise_sunset": "Sonnenaufgang",
|
"sunrise_sunset": "Sonnenaufgang",
|
||||||
"timezone": "Zeitzone"
|
"timezone": "Zeitzone",
|
||||||
|
"no_visits": "Keine Besuche"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Entdecken, planen und erkunden Sie mühelos",
|
"desc_1": "Entdecken, planen und erkunden Sie mühelos",
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
"collection_link_success": "Adventure linked to collection successfully!",
|
"collection_link_success": "Adventure linked to collection successfully!",
|
||||||
"invalid_date_range": "Invalid date range",
|
"invalid_date_range": "Invalid date range",
|
||||||
"timezone": "Timezone",
|
"timezone": "Timezone",
|
||||||
|
"no_visits": "No visits",
|
||||||
"no_image_found": "No image found",
|
"no_image_found": "No image found",
|
||||||
"collection_link_error": "Error linking adventure to collection",
|
"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.",
|
"adventure_delete_confirm": "Are you sure you want to delete this adventure? This action cannot be undone.",
|
||||||
|
|
|
@ -304,7 +304,8 @@
|
||||||
"additional_info": "información adicional",
|
"additional_info": "información adicional",
|
||||||
"invalid_date_range": "Rango de fechas no válido",
|
"invalid_date_range": "Rango de fechas no válido",
|
||||||
"sunrise_sunset": "Amanecer",
|
"sunrise_sunset": "Amanecer",
|
||||||
"timezone": "Zona horaria"
|
"timezone": "Zona horaria",
|
||||||
|
"no_visits": "No hay visitas"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"all": "Todo",
|
"all": "Todo",
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "Informations Complémentaires",
|
"additional_info": "Informations Complémentaires",
|
||||||
"invalid_date_range": "Plage de dates non valide",
|
"invalid_date_range": "Plage de dates non valide",
|
||||||
"sunrise_sunset": "Lever du soleil",
|
"sunrise_sunset": "Lever du soleil",
|
||||||
"timezone": "Fuseau horaire"
|
"timezone": "Fuseau horaire",
|
||||||
|
"no_visits": "Pas de visites"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "Ulteriori informazioni",
|
"additional_info": "Ulteriori informazioni",
|
||||||
"invalid_date_range": "Intervallo di date non valido",
|
"invalid_date_range": "Intervallo di date non valido",
|
||||||
"sunrise_sunset": "Alba",
|
"sunrise_sunset": "Alba",
|
||||||
"timezone": "Fuso orario"
|
"timezone": "Fuso orario",
|
||||||
|
"no_visits": "Nessuna visita"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "추가 정보",
|
"additional_info": "추가 정보",
|
||||||
"invalid_date_range": "잘못된 날짜 범위",
|
"invalid_date_range": "잘못된 날짜 범위",
|
||||||
"sunrise_sunset": "해돋이",
|
"sunrise_sunset": "해돋이",
|
||||||
"timezone": "시간대"
|
"timezone": "시간대",
|
||||||
|
"no_visits": "방문 없음"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"both_passwords_required": "두 암호 모두 필요합니다",
|
"both_passwords_required": "두 암호 모두 필요합니다",
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "Aanvullende informatie",
|
"additional_info": "Aanvullende informatie",
|
||||||
"invalid_date_range": "Ongeldige datumbereik",
|
"invalid_date_range": "Ongeldige datumbereik",
|
||||||
"sunrise_sunset": "Zonsopgang",
|
"sunrise_sunset": "Zonsopgang",
|
||||||
"timezone": "Tijdzone"
|
"timezone": "Tijdzone",
|
||||||
|
"no_visits": "Geen bezoeken"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Ontdek, plan en verken met gemak",
|
"desc_1": "Ontdek, plan en verken met gemak",
|
||||||
|
|
|
@ -304,7 +304,8 @@
|
||||||
"no_ordered_items": "Legg til varer med datoer i samlingen for å se dem her.",
|
"no_ordered_items": "Legg til varer med datoer i samlingen for å se dem her.",
|
||||||
"ordered_itinerary": "Bestilt reiserute",
|
"ordered_itinerary": "Bestilt reiserute",
|
||||||
"sunrise_sunset": "Soloppgang",
|
"sunrise_sunset": "Soloppgang",
|
||||||
"timezone": "Tidssone"
|
"timezone": "Tidssone",
|
||||||
|
"no_visits": "Ingen besøk"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"country_list": "Liste over land",
|
"country_list": "Liste over land",
|
||||||
|
|
|
@ -304,7 +304,8 @@
|
||||||
"additional_info": "Dodatkowe informacje",
|
"additional_info": "Dodatkowe informacje",
|
||||||
"invalid_date_range": "Niepoprawny zakres dat",
|
"invalid_date_range": "Niepoprawny zakres dat",
|
||||||
"sunrise_sunset": "Wschód słońca",
|
"sunrise_sunset": "Wschód słońca",
|
||||||
"timezone": "Strefa czasowa"
|
"timezone": "Strefa czasowa",
|
||||||
|
"no_visits": "Brak wizyt"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"country_list": "Lista krajów",
|
"country_list": "Lista krajów",
|
||||||
|
|
|
@ -256,7 +256,8 @@
|
||||||
"additional_info": "Ytterligare information",
|
"additional_info": "Ytterligare information",
|
||||||
"invalid_date_range": "Ogiltigt datumintervall",
|
"invalid_date_range": "Ogiltigt datumintervall",
|
||||||
"sunrise_sunset": "Soluppgång",
|
"sunrise_sunset": "Soluppgång",
|
||||||
"timezone": "Tidszon"
|
"timezone": "Tidszon",
|
||||||
|
"no_visits": "Inga besök"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Upptäck, planera och utforska med lätthet",
|
"desc_1": "Upptäck, planera och utforska med lätthet",
|
||||||
|
|
|
@ -304,7 +304,8 @@
|
||||||
"additional_info": "附加信息",
|
"additional_info": "附加信息",
|
||||||
"invalid_date_range": "无效的日期范围",
|
"invalid_date_range": "无效的日期范围",
|
||||||
"sunrise_sunset": "日出",
|
"sunrise_sunset": "日出",
|
||||||
"timezone": "时区"
|
"timezone": "时区",
|
||||||
|
"no_visits": "没有访问"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"forgot_password": "忘记密码?",
|
"forgot_password": "忘记密码?",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue