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:
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,8 +716,10 @@
|
||||||
<span>{$t('adventures.warning')}: {warningMessage}</span>
|
<span>{$t('adventures.warning')}: {warningMessage}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<button type="submit" class="btn btn-primary">{$t('adventures.save_next')}</button>
|
<div class="flex flex-row gap-2">
|
||||||
<button type="button" class="btn" on:click={close}>{$t('about.close')}</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>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -258,119 +258,6 @@
|
||||||
></textarea>
|
></textarea>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Validation Message -->
|
|
||||||
{#if !validateDateRange(localStartDate, localEndDate).valid}
|
|
||||||
<div role="alert" class="alert alert-error">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-6 shrink-0 stroke-current"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<span>{$t('adventures.invalid_date_range')}</span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if visits && visits.length > 0}
|
|
||||||
<div class="space-y-4">
|
|
||||||
{#each visits as visit}
|
|
||||||
<div
|
|
||||||
class="p-4 border border-neutral rounded-lg bg-base-100 shadow-sm flex flex-col gap-2"
|
|
||||||
>
|
|
||||||
<p class="text-sm text-base-content font-medium">
|
|
||||||
{#if isAllDay(visit.start_date)}
|
|
||||||
<span class="badge badge-outline mr-2">{$t('adventures.all_day')}</span>
|
|
||||||
{visit.start_date.split('T')[0]} – {visit.end_date.split('T')[0]}
|
|
||||||
{:else}
|
|
||||||
{new Date(visit.start_date).toLocaleString()} – {new Date(
|
|
||||||
visit.end_date
|
|
||||||
).toLocaleString()}
|
|
||||||
{/if}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<!-- If the selected timezone is not the current one show the timezone + the time converted there -->
|
|
||||||
|
|
||||||
{#if visit.notes}
|
|
||||||
<p class="text-sm text-base-content opacity-70 italic">
|
|
||||||
"{visit.notes}"
|
|
||||||
</p>
|
|
||||||
{/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"
|
|
||||||
on:click={() => {
|
|
||||||
isEditing = true;
|
|
||||||
const isAllDayEvent = isAllDay(visit.start_date);
|
|
||||||
allDay = isAllDayEvent;
|
|
||||||
|
|
||||||
if (isAllDayEvent) {
|
|
||||||
localStartDate = visit.start_date.split('T')[0];
|
|
||||||
localEndDate = visit.end_date.split('T')[0];
|
|
||||||
} else {
|
|
||||||
const startDate = new Date(visit.start_date);
|
|
||||||
const endDate = new Date(visit.end_date);
|
|
||||||
|
|
||||||
localStartDate = `${startDate.getFullYear()}-${String(
|
|
||||||
startDate.getMonth() + 1
|
|
||||||
).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}T${String(
|
|
||||||
startDate.getHours()
|
|
||||||
).padStart(2, '0')}:${String(startDate.getMinutes()).padStart(2, '0')}`;
|
|
||||||
|
|
||||||
localEndDate = `${endDate.getFullYear()}-${String(
|
|
||||||
endDate.getMonth() + 1
|
|
||||||
).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}T${String(
|
|
||||||
endDate.getHours()
|
|
||||||
).padStart(2, '0')}:${String(endDate.getMinutes()).padStart(2, '0')}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove it from visits
|
|
||||||
if (visits) {
|
|
||||||
visits = visits.filter((v) => v.id !== visit.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
note = visit.notes;
|
|
||||||
constrainDates = true;
|
|
||||||
utcStartDate = visit.start_date;
|
|
||||||
utcEndDate = visit.end_date;
|
|
||||||
type = 'adventure';
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
isEditing = false;
|
|
||||||
}, 0);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{$t('lodging.edit')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="flex gap-2 mb-1">
|
|
||||||
<!-- add button -->
|
|
||||||
{#if type === 'adventure'}
|
{#if type === 'adventure'}
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
|
@ -402,5 +289,129 @@
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Validation Message -->
|
||||||
|
{#if !validateDateRange(localStartDate, localEndDate).valid}
|
||||||
|
<div role="alert" class="alert alert-error">
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="h-6 w-6 shrink-0 stroke-current"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
<span>{$t('adventures.invalid_date_range')}</span>
|
||||||
|
</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}
|
||||||
|
<div
|
||||||
|
class="p-4 border border-neutral rounded-lg bg-base-100 shadow-sm flex flex-col gap-2"
|
||||||
|
>
|
||||||
|
<p class="text-sm text-base-content font-medium">
|
||||||
|
{#if isAllDay(visit.start_date)}
|
||||||
|
<span class="badge badge-outline mr-2">{$t('adventures.all_day')}</span>
|
||||||
|
{visit.start_date.split('T')[0]} – {visit.end_date.split('T')[0]}
|
||||||
|
{:else}
|
||||||
|
{new Date(visit.start_date).toLocaleString()} – {new Date(
|
||||||
|
visit.end_date
|
||||||
|
).toLocaleString()}
|
||||||
|
{/if}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- If the selected timezone is not the current one show the timezone + the time converted there -->
|
||||||
|
|
||||||
|
{#if visit.notes}
|
||||||
|
<p class="text-sm text-base-content opacity-70 italic">
|
||||||
|
"{visit.notes}"
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="flex gap-2 mt-2">
|
||||||
|
<button
|
||||||
|
class="btn btn-primary btn-sm"
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
isEditing = true;
|
||||||
|
const isAllDayEvent = isAllDay(visit.start_date);
|
||||||
|
allDay = isAllDayEvent;
|
||||||
|
|
||||||
|
if (isAllDayEvent) {
|
||||||
|
localStartDate = visit.start_date.split('T')[0];
|
||||||
|
localEndDate = visit.end_date.split('T')[0];
|
||||||
|
} else {
|
||||||
|
const startDate = new Date(visit.start_date);
|
||||||
|
const endDate = new Date(visit.end_date);
|
||||||
|
|
||||||
|
localStartDate = `${startDate.getFullYear()}-${String(
|
||||||
|
startDate.getMonth() + 1
|
||||||
|
).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}T${String(
|
||||||
|
startDate.getHours()
|
||||||
|
).padStart(2, '0')}:${String(startDate.getMinutes()).padStart(2, '0')}`;
|
||||||
|
|
||||||
|
localEndDate = `${endDate.getFullYear()}-${String(
|
||||||
|
endDate.getMonth() + 1
|
||||||
|
).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}T${String(
|
||||||
|
endDate.getHours()
|
||||||
|
).padStart(2, '0')}:${String(endDate.getMinutes()).padStart(2, '0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove it from visits
|
||||||
|
if (visits) {
|
||||||
|
visits = visits.filter((v) => v.id !== visit.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
note = visit.notes;
|
||||||
|
constrainDates = true;
|
||||||
|
utcStartDate = visit.start_date;
|
||||||
|
utcEndDate = visit.end_date;
|
||||||
|
type = 'adventure';
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
isEditing = false;
|
||||||
|
}, 0);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$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}
|
||||||
|
{/if}
|
||||||
</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