2024-03-29 21:41:22 +00:00
|
|
|
<script lang="ts">
|
2024-04-02 22:02:20 +00:00
|
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
import locationDot from "$lib/assets/locationDot.svg";
|
|
|
|
import calendar from "$lib/assets/calendar.svg";
|
2024-04-14 20:33:58 +00:00
|
|
|
import { goto } from "$app/navigation";
|
2024-04-02 22:02:20 +00:00
|
|
|
const dispatch = createEventDispatcher();
|
2024-03-29 21:41:22 +00:00
|
|
|
|
2024-04-02 22:02:20 +00:00
|
|
|
export let type: String;
|
2024-04-02 21:33:41 +00:00
|
|
|
|
2024-04-13 20:09:00 +00:00
|
|
|
export let name: String | undefined = undefined;
|
|
|
|
export let location: String | undefined = undefined;
|
|
|
|
export let created: String | undefined = undefined;
|
|
|
|
export let id: Number | undefined = undefined;
|
2024-04-13 23:09:52 +00:00
|
|
|
export let regionId: String | undefined = undefined;
|
|
|
|
export let visited: Boolean | undefined = undefined;
|
2024-04-14 20:33:58 +00:00
|
|
|
export let countryCode: String | undefined = undefined;
|
2024-03-29 21:41:22 +00:00
|
|
|
|
2024-04-02 22:02:20 +00:00
|
|
|
function remove() {
|
|
|
|
dispatch("remove", id);
|
|
|
|
}
|
|
|
|
function edit() {
|
|
|
|
dispatch("edit", id);
|
|
|
|
}
|
|
|
|
function add() {
|
|
|
|
dispatch("add", { name, location });
|
|
|
|
}
|
2024-04-13 23:09:52 +00:00
|
|
|
function markVisited() {
|
|
|
|
dispatch("markVisited", regionId);
|
|
|
|
visited = true;
|
|
|
|
}
|
|
|
|
function removeVisit() {
|
|
|
|
dispatch("removeVisit", regionId);
|
|
|
|
visited = false;
|
|
|
|
}
|
2024-04-14 20:33:58 +00:00
|
|
|
|
|
|
|
function moreInfo() {
|
|
|
|
goto(`/worldtravel/${countryCode}/${regionId}`);
|
|
|
|
}
|
2024-03-29 21:41:22 +00:00
|
|
|
</script>
|
|
|
|
|
2024-04-02 22:02:20 +00:00
|
|
|
{#if type === "mylog"}
|
|
|
|
<div
|
2024-04-17 00:15:27 +00:00
|
|
|
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-primary-content shadow-xl overflow-hidden text-base-content"
|
2024-04-02 22:02:20 +00:00
|
|
|
>
|
2024-03-30 21:26:21 +00:00
|
|
|
<div class="card-body">
|
|
|
|
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
2024-04-02 21:33:41 +00:00
|
|
|
{#if location !== ""}
|
2024-04-20 00:53:01 +00:00
|
|
|
<div class="inline-flex items-center">
|
|
|
|
<iconify-icon icon="mdi:map-marker" class="text-xl"></iconify-icon>
|
|
|
|
<p class="ml-.5">{location}</p>
|
|
|
|
</div>
|
2024-04-02 21:33:41 +00:00
|
|
|
{/if}
|
|
|
|
{#if created !== ""}
|
2024-04-20 00:53:01 +00:00
|
|
|
<div class="inline-flex items-center">
|
|
|
|
<iconify-icon icon="mdi:calendar" class="text-xl"></iconify-icon>
|
|
|
|
<p class="ml-1">{created}</p>
|
|
|
|
</div>
|
2024-04-02 21:33:41 +00:00
|
|
|
{/if}
|
2024-03-30 21:26:21 +00:00
|
|
|
<div class="card-actions justify-end">
|
|
|
|
<button class="btn btn-primary" on:click={edit}>Edit</button>
|
|
|
|
<button class="btn btn-secondary" on:click={remove}>Remove</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-02 22:02:20 +00:00
|
|
|
</div>
|
2024-04-02 21:33:41 +00:00
|
|
|
{/if}
|
|
|
|
|
2024-04-02 22:02:20 +00:00
|
|
|
{#if type === "featured"}
|
|
|
|
<div
|
2024-04-17 00:15:27 +00:00
|
|
|
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-primary-content shadow-xl overflow-hidden text-base-content"
|
2024-04-02 22:02:20 +00:00
|
|
|
>
|
|
|
|
<div class="card-body">
|
|
|
|
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
|
|
|
{#if location != ""}
|
2024-04-20 00:53:01 +00:00
|
|
|
<div class="inline-flex items-center">
|
|
|
|
<iconify-icon icon="mdi:map-marker" class="text-xl"></iconify-icon>
|
|
|
|
<p class="ml-.5">{location}</p>
|
|
|
|
</div>
|
2024-04-02 22:02:20 +00:00
|
|
|
{/if}
|
|
|
|
<div class="card-actions justify-end">
|
|
|
|
<button class="btn btn-primary" on:click={add}>Add</button>
|
|
|
|
</div>
|
2024-04-02 21:33:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-04-02 22:02:20 +00:00
|
|
|
{/if}
|
2024-04-11 21:15:34 +00:00
|
|
|
|
|
|
|
{#if type === "shared"}
|
|
|
|
<div
|
2024-04-17 00:15:27 +00:00
|
|
|
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-primary-content shadow-xl overflow-hidden text-base-content"
|
2024-04-11 21:15:34 +00:00
|
|
|
>
|
|
|
|
<div class="card-body">
|
|
|
|
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
|
|
|
{#if location !== ""}
|
2024-04-20 00:53:01 +00:00
|
|
|
<div class="inline-flex items-center">
|
|
|
|
<iconify-icon icon="mdi:map-marker" class="text-xl"></iconify-icon>
|
|
|
|
<p class="ml-.5">{location}</p>
|
|
|
|
</div>
|
2024-04-11 21:15:34 +00:00
|
|
|
{/if}
|
|
|
|
{#if created !== ""}
|
2024-04-20 00:53:01 +00:00
|
|
|
<div class="inline-flex items-center">
|
|
|
|
<iconify-icon icon="mdi:calendar" class="text-xl"></iconify-icon>
|
|
|
|
<p class="ml-1">{created}</p>
|
|
|
|
</div>
|
2024-04-11 21:15:34 +00:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2024-04-13 20:09:00 +00:00
|
|
|
|
|
|
|
{#if type === "worldtravelregion"}
|
|
|
|
<div
|
2024-04-17 00:15:27 +00:00
|
|
|
class="card min-w-max lg:w-96 md:w-80 sm:w-60 xs:w-40 bg-primary-content shadow-xl overflow-hidden text-base-content"
|
2024-04-13 20:09:00 +00:00
|
|
|
>
|
|
|
|
<div class="card-body">
|
|
|
|
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
2024-04-13 23:09:52 +00:00
|
|
|
<p>{regionId}</p>
|
2024-04-13 20:09:00 +00:00
|
|
|
<div class="card-actions justify-end">
|
2024-04-14 23:47:05 +00:00
|
|
|
<!-- <button class="btn btn-info" on:click={moreInfo}>More Info</button> -->
|
2024-04-13 23:09:52 +00:00
|
|
|
{#if !visited}
|
|
|
|
<button class="btn btn-primary" on:click={markVisited}
|
|
|
|
>Mark Visited</button
|
|
|
|
>
|
|
|
|
{/if}
|
|
|
|
{#if visited}
|
|
|
|
<button class="btn btn-warning" on:click={removeVisit}>Remove</button>
|
|
|
|
{/if}
|
2024-04-13 20:09:00 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|