mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 14:59:36 +02:00
feat: Enhance City and Lodging components with region and country names, and improve password disable functionality
This commit is contained in:
parent
eb541225bd
commit
4e543fad55
6 changed files with 64 additions and 33 deletions
|
@ -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}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue