Update AdventureCard component to include regionId and visited properties, and add country flag support
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import locationDot from "$lib/assets/locationDot.svg";
|
||||
import calendar from "$lib/assets/calendar.svg";
|
||||
import { goto } from "$app/navigation";
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let type: String;
|
||||
@@ -12,6 +13,7 @@
|
||||
export let id: Number | undefined = undefined;
|
||||
export let regionId: String | undefined = undefined;
|
||||
export let visited: Boolean | undefined = undefined;
|
||||
export let countryCode: String | undefined = undefined;
|
||||
|
||||
function remove() {
|
||||
dispatch("remove", id);
|
||||
@@ -30,6 +32,10 @@
|
||||
dispatch("removeVisit", regionId);
|
||||
visited = false;
|
||||
}
|
||||
|
||||
function moreInfo() {
|
||||
goto(`/worldtravel/${countryCode}/${regionId}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if type === "mylog"}
|
||||
@@ -122,6 +128,7 @@
|
||||
<h2 class="card-title overflow-ellipsis">{name}</h2>
|
||||
<p>{regionId}</p>
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-info" on:click={moreInfo}>More Info</button>
|
||||
{#if !visited}
|
||||
<button class="btn btn-primary" on:click={markVisited}
|
||||
>Mark Visited</button
|
||||
|
||||
@@ -66,6 +66,7 @@ export const worldTravelCountryRegions = pgTable("worldTravelCountryRegions", {
|
||||
country_code: text("country_code")
|
||||
.notNull()
|
||||
.references(() => worldTravelCountries.country_code),
|
||||
info: json("info"),
|
||||
});
|
||||
|
||||
export const userVisitedWorldTravel = pgTable("userVisitedWorldTravel", {
|
||||
|
||||
@@ -4,3 +4,36 @@ export interface Adventure {
|
||||
location: string;
|
||||
created: string;
|
||||
}
|
||||
|
||||
export interface RegionInfo {
|
||||
name: string;
|
||||
abbreviation: string;
|
||||
description: string;
|
||||
capital: string;
|
||||
largest_city: string;
|
||||
area: {
|
||||
total: number;
|
||||
units: string;
|
||||
};
|
||||
population: {
|
||||
estimate: number;
|
||||
year: number;
|
||||
};
|
||||
state_flower: string;
|
||||
state_bird: string;
|
||||
state_tree: string;
|
||||
climate: {
|
||||
description: string;
|
||||
summer_highs: string;
|
||||
winter_lows: string;
|
||||
precipitation: string;
|
||||
};
|
||||
economy: {
|
||||
industries: string[];
|
||||
agricultural_products: string[];
|
||||
};
|
||||
tourism: {
|
||||
attractions: string[];
|
||||
};
|
||||
major_sports_teams: string[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user