feat: Enhance City and Lodging components with region and country names, and improve password disable functionality

This commit is contained in:
Sean Morley
2025-03-17 10:38:41 -04:00
parent eb541225bd
commit 4e543fad55
6 changed files with 64 additions and 33 deletions

View File

@@ -1,4 +1,5 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { addToast } from '$lib/toasts';
import type { City } from '$lib/types';
import { createEventDispatcher } from 'svelte';
@@ -45,7 +46,10 @@
<div class="card-body">
<h2 class="card-title overflow-ellipsis">{city.name}</h2>
<div class="flex flex-wrap gap-2">
<div class="badge badge-neutral-300">{city.id}</div>
<div class="badge badge-neutral-300">
{city.region_name}, {city.country_name}
</div>
<div class="badge badge-neutral-300">{city.region}</div>
</div>
<div class="card-actions justify-end">
{#if !visited}

View File

@@ -6,9 +6,18 @@
import { addToast } from '$lib/toasts';
import { t } from 'svelte-i18n';
import DeleteWarning from './DeleteWarning.svelte';
import { LODGING_TYPES_ICONS } from '$lib';
const dispatch = createEventDispatcher();
function getLodgingIcon(type: string) {
if (type in LODGING_TYPES_ICONS) {
return LODGING_TYPES_ICONS[type as keyof typeof LODGING_TYPES_ICONS];
} else {
return '🏨';
}
}
export let lodging: Lodging;
export let user: User | null = null;
export let collection: Collection | null = null;
@@ -91,7 +100,7 @@
<h2 class="card-title text-lg font-semibold truncate">{lodging.name}</h2>
<div class="flex items-center gap-2">
<div class="badge badge-secondary">
{$t(`lodging.${lodging.type}`)}
{$t(`lodging.${lodging.type}`) + ' ' + getLodgingIcon(lodging.type)}
</div>
<!-- {#if hotel.type == 'plane' && hotel.flight_number}
<div class="badge badge-neutral-200">{hotel.flight_number}</div>

View File

@@ -72,6 +72,8 @@ export type City = {
latitude: number | null;
longitude: number | null;
region: string;
region_name: string;
country_name: string;
};
export type VisitedRegion = {