1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-28 17:29:36 +02:00

Update AdventureCard component to remove commented out code and add exportData function to log page

This commit is contained in:
Sean Morley 2024-04-14 23:47:05 +00:00
parent 6aca3d72b0
commit 1710c5b54d
3 changed files with 237 additions and 226 deletions

View file

@ -1,221 +1,226 @@
INSERT INTO "worldTravelCountryRegions" (id, name, country_code) -- INSERT INTO "worldTravelCountryRegions" (id, name, country_code)
VALUES -- VALUES
('US-AL', 'Alabama', 'us', '{ -- ('US-AL', 'Alabama', 'us', '{
"name": "Alabama", -- "name": "Alabama",
"abbreviation": "AL", -- "abbreviation": "AL",
"description": "Alabama is a state located in the southeastern region of the United States. Known for its rich history, including its role in the American Civil War and the Civil Rights Movement, Alabama offers a diverse landscape of mountains, plains, and coastal areas. The state boasts a humid subtropical climate and is known for its strong tradition in college sports, particularly football. Alabama''s economy is diverse, with major industries including automotive manufacturing, agriculture, and aerospace. Tourists are drawn to Alabama''s natural beauty, historical sites, and cultural landmarks.", -- "description": "Alabama is a state located in the southeastern region of the United States. Known for its rich history, including its role in the American Civil War and the Civil Rights Movement, Alabama offers a diverse landscape of mountains, plains, and coastal areas. The state boasts a humid subtropical climate and is known for its strong tradition in college sports, particularly football. Alabama''s economy is diverse, with major industries including automotive manufacturing, agriculture, and aerospace. Tourists are drawn to Alabama''s natural beauty, historical sites, and cultural landmarks.",
"capital": "Montgomery", -- "capital": "Montgomery",
"largest_city": "Birmingham", -- "largest_city": "Birmingham",
"area": { -- "area": {
"total": 52420, -- "total": 52420,
"units": "square miles" -- "units": "square miles"
}, -- },
"population": { -- "population": {
"estimate": 4903185, -- "estimate": 4903185,
"year": 2020 -- "year": 2020
}, -- },
"state_flower": "Camellia", -- "state_flower": "Camellia",
"state_bird": "Yellowhammer", -- "state_bird": "Yellowhammer",
"state_tree": "Southern Longleaf Pine", -- "state_tree": "Southern Longleaf Pine",
"climate": { -- "climate": {
"description": "Humid subtropical", -- "description": "Humid subtropical",
"summer_highs": "80-90°F", -- "summer_highs": "80-90°F",
"winter_lows": "30-50°F", -- "winter_lows": "30-50°F",
"precipitation": "Abundant throughout the year" -- "precipitation": "Abundant throughout the year"
}, -- },
"economy": { -- "economy": {
"industries": [ -- "industries": [
"Automotive Manufacturing", -- "Automotive Manufacturing",
"Agriculture", -- "Agriculture",
"Mining", -- "Mining",
"Technology", -- "Technology",
"Aerospace" -- "Aerospace"
], -- ],
"agricultural_products": [ -- "agricultural_products": [
"Poultry", -- "Poultry",
"Cotton", -- "Cotton",
"Peanuts", -- "Peanuts",
"Soybeans", -- "Soybeans",
"Corn" -- "Corn"
] -- ]
}, -- },
"tourism": { -- "tourism": {
"attractions": [ -- "attractions": [
"U.S. Space & Rocket Center", -- "U.S. Space & Rocket Center",
"Gulf Shores and Orange Beach", -- "Gulf Shores and Orange Beach",
"Rosa Parks Museum", -- "Rosa Parks Museum",
"Civil Rights Institute", -- "Civil Rights Institute",
"Little River Canyon National Preserve" -- "Little River Canyon National Preserve"
] -- ]
}, -- },
"major_sports_teams": [ -- "major_sports_teams": [
"Alabama Crimson Tide (NCAA)", -- "Alabama Crimson Tide (NCAA)",
"Auburn Tigers (NCAA)" -- "Auburn Tigers (NCAA)"
] -- ]
}'), -- }'),
('US-AK', 'Alaska', 'us', '{ -- ('US-AK', 'Alaska', 'us', '{
"name": "Alaska", -- "name": "Alaska",
"abbreviation": "AK", -- "abbreviation": "AK",
"description": "Alaska is the largest state in the United States by area, known for its rugged and breathtaking natural beauty. It is situated in the northwesternmost region of North America and is bordered by Canada to the east, the Arctic Ocean to the north, and the Pacific Ocean to the west and south. Alaska is renowned for its diverse wildlife, glaciers, and majestic mountains. The state is sparsely populated, with the majority of its residents living in and around Anchorage and Fairbanks. Alaska''s economy is heavily dependent on oil and gas production, as well as fishing, tourism, and mining.", -- "description": "Alaska is the largest state in the United States by area, known for its rugged and breathtaking natural beauty. It is situated in the northwesternmost region of North America and is bordered by Canada to the east, the Arctic Ocean to the north, and the Pacific Ocean to the west and south. Alaska is renowned for its diverse wildlife, glaciers, and majestic mountains. The state is sparsely populated, with the majority of its residents living in and around Anchorage and Fairbanks. Alaska''s economy is heavily dependent on oil and gas production, as well as fishing, tourism, and mining.",
"capital": "Juneau", -- "capital": "Juneau",
"largest_city": "Anchorage", -- "largest_city": "Anchorage",
"area": { -- "area": {
"total": 663267, -- "total": 663267,
"units": "square miles" -- "units": "square miles"
}, -- },
"population": { -- "population": {
"estimate": 731158, -- "estimate": 731158,
"year": 2020 -- "year": 2020
}, -- },
"state_flower": "Forget-Me-Not", -- "state_flower": "Forget-Me-Not",
"state_bird": "Willow Ptarmigan", -- "state_bird": "Willow Ptarmigan",
"state_tree": "Sitka Spruce", -- "state_tree": "Sitka Spruce",
"climate": { -- "climate": {
"description": "Varies by region, with subarctic and arctic climates in the interior and north and more temperate maritime climates along the coast.", -- "description": "Varies by region, with subarctic and arctic climates in the interior and north and more temperate maritime climates along the coast.",
"summer_highs": "50-70°F (varies by region)", -- "summer_highs": "50-70°F (varies by region)",
"winter_lows": "-40 to 20°F (varies by region)", -- "winter_lows": "-40 to 20°F (varies by region)",
"precipitation": "Ranges from low in the interior to high along the coast" -- "precipitation": "Ranges from low in the interior to high along the coast"
}, -- },
"economy": { -- "economy": {
"industries": [ -- "industries": [
"Oil and Gas", -- "Oil and Gas",
"Fishing", -- "Fishing",
"Mining", -- "Mining",
"Tourism", -- "Tourism",
"Forestry" -- "Forestry"
], -- ],
"agricultural_products": [ -- "agricultural_products": [
"Cattle", -- "Cattle",
"Hay", -- "Hay",
"Vegetables", -- "Vegetables",
"Barley", -- "Barley",
"Dairy products" -- "Dairy products"
] -- ]
}, -- },
"tourism": { -- "tourism": {
"attractions": [ -- "attractions": [
"Denali National Park", -- "Denali National Park",
"Glacier Bay National Park", -- "Glacier Bay National Park",
"Kenai Fjords National Park", -- "Kenai Fjords National Park",
"Sitka National Historical Park", -- "Sitka National Historical Park",
"Anchorage Museum" -- "Anchorage Museum"
] -- ]
}, -- },
"major_sports_teams": [ -- "major_sports_teams": [
"Anchorage Wolverines (NAHL)", -- "Anchorage Wolverines (NAHL)",
"Alaska Aces (ECHL, formerly)" -- "Alaska Aces (ECHL, formerly)"
] -- ]
} -- }
'), -- '),
('US-AZ', 'Arizona', 'us', '{ -- ('US-AZ', 'Arizona', 'us', '{
"name": "Arizona", -- "name": "Arizona",
"abbreviation": "AZ", -- "abbreviation": "AZ",
"description": "Arizona is a state located in the southwestern region of the United States, known for its dramatic desert landscapes and vibrant history. The state is home to iconic landmarks such as the Grand Canyon and Monument Valley. Arizona''s diverse geography includes mountain ranges, forests, and high plateaus. The state has a warm desert climate in the southern and central areas and cooler mountain climates in the northern region. Arizona''s economy is driven by industries such as healthcare, technology, manufacturing, and tourism.", -- "description": "Arizona is a state located in the southwestern region of the United States, known for its dramatic desert landscapes and vibrant history. The state is home to iconic landmarks such as the Grand Canyon and Monument Valley. Arizona''s diverse geography includes mountain ranges, forests, and high plateaus. The state has a warm desert climate in the southern and central areas and cooler mountain climates in the northern region. Arizona''s economy is driven by industries such as healthcare, technology, manufacturing, and tourism.",
"capital": "Phoenix", -- "capital": "Phoenix",
"largest_city": "Phoenix", -- "largest_city": "Phoenix",
"area": { -- "area": {
"total": 113990, -- "total": 113990,
"units": "square miles" -- "units": "square miles"
}, -- },
"population": { -- "population": {
"estimate": 7151502, -- "estimate": 7151502,
"year": 2020 -- "year": 2020
}, -- },
"state_flower": "Saguaro Cactus Blossom", -- "state_flower": "Saguaro Cactus Blossom",
"state_bird": "Cactus Wren", -- "state_bird": "Cactus Wren",
"state_tree": "Palo Verde", -- "state_tree": "Palo Verde",
"climate": { -- "climate": {
"description": "Mostly arid and semi-arid, with desert climates in the southern and central regions and temperate climates in the north.", -- "description": "Mostly arid and semi-arid, with desert climates in the southern and central regions and temperate climates in the north.",
"summer_highs": "85-120°F (varies by region)", -- "summer_highs": "85-120°F (varies by region)",
"winter_lows": "30-60°F (varies by region)", -- "winter_lows": "30-60°F (varies by region)",
"precipitation": "Low in most areas, with higher amounts in mountain regions" -- "precipitation": "Low in most areas, with higher amounts in mountain regions"
}, -- },
"economy": { -- "economy": {
"industries": [ -- "industries": [
"Healthcare", -- "Healthcare",
"Technology", -- "Technology",
"Manufacturing", -- "Manufacturing",
"Tourism", -- "Tourism",
"Agriculture" -- "Agriculture"
], -- ],
"agricultural_products": [ -- "agricultural_products": [
"Cattle", -- "Cattle",
"Dairy", -- "Dairy",
"Lettuce", -- "Lettuce",
"Cotton", -- "Cotton",
"Alfalfa" -- "Alfalfa"
] -- ]
}, -- },
"tourism": { -- "tourism": {
"attractions": [ -- "attractions": [
"Grand Canyon National Park", -- "Grand Canyon National Park",
"Sedona", -- "Sedona",
"Monument Valley", -- "Monument Valley",
"Saguaro National Park", -- "Saguaro National Park",
"Petrified Forest National Park" -- "Petrified Forest National Park"
] -- ]
}, -- },
"major_sports_teams": [ -- "major_sports_teams": [
"Arizona Cardinals (NFL)", -- "Arizona Cardinals (NFL)",
"Phoenix Suns (NBA)", -- "Phoenix Suns (NBA)",
"Arizona Diamondbacks (MLB)", -- "Arizona Diamondbacks (MLB)",
"Arizona Coyotes (NHL)" -- "Arizona Coyotes (NHL)"
] -- ]
} -- }
'), -- '),
('US-AR', 'Arkansas', 'us', '{ -- ('US-AR', 'Arkansas', 'us', '{
"name": "Arkansas", -- "name": "Arkansas",
"abbreviation": "AR", -- "abbreviation": "AR",
"description": "Arkansas is a state located in the southeastern region of the United States, known for its natural beauty and diverse landscapes that include mountains, forests, and rivers. The state is nicknamed ''The Natural State'' due to its abundant natural resources and outdoor recreational opportunities. Arkansas has a rich history and played a significant role during the American Civil War. The state''s economy is driven by agriculture, manufacturing, and tourism, with key agricultural products including rice, poultry, and soybeans.", -- "description": "Arkansas is a state located in the southeastern region of the United States, known for its natural beauty and diverse landscapes that include mountains, forests, and rivers. The state is nicknamed ''The Natural State'' due to its abundant natural resources and outdoor recreational opportunities. Arkansas has a rich history and played a significant role during the American Civil War. The state''s economy is driven by agriculture, manufacturing, and tourism, with key agricultural products including rice, poultry, and soybeans.",
"capital": "Little Rock", -- "capital": "Little Rock",
"largest_city": "Little Rock", -- "largest_city": "Little Rock",
"area": { -- "area": {
"total": 53179, -- "total": 53179,
"units": "square miles" -- "units": "square miles"
}, -- },
"population": { -- "population": {
"estimate": 3013756, -- "estimate": 3013756,
"year": 2020 -- "year": 2020
}, -- },
"state_flower": "Apple Blossom", -- "state_flower": "Apple Blossom",
"state_bird": "Northern Mockingbird", -- "state_bird": "Northern Mockingbird",
"state_tree": "Pine", -- "state_tree": "Pine",
"climate": { -- "climate": {
"description": "Humid subtropical climate, with hot summers and mild winters.", -- "description": "Humid subtropical climate, with hot summers and mild winters.",
"summer_highs": "80-90°F", -- "summer_highs": "80-90°F",
"winter_lows": "20-40°F", -- "winter_lows": "20-40°F",
"precipitation": "High, especially in the spring" -- "precipitation": "High, especially in the spring"
}, -- },
"economy": { -- "economy": {
"industries": [ -- "industries": [
"Agriculture", -- "Agriculture",
"Manufacturing", -- "Manufacturing",
"Retail", -- "Retail",
"Tourism", -- "Tourism",
"Education" -- "Education"
], -- ],
"agricultural_products": [ -- "agricultural_products": [
"Rice", -- "Rice",
"Poultry", -- "Poultry",
"Soybeans", -- "Soybeans",
"Cotton", -- "Cotton",
"Catfish" -- "Catfish"
] -- ]
}, -- },
"tourism": { -- "tourism": {
"attractions": [ -- "attractions": [
"Hot Springs National Park", -- "Hot Springs National Park",
"Buffalo National River", -- "Buffalo National River",
"Crater of Diamonds State Park", -- "Crater of Diamonds State Park",
"Little Rock Central High School National Historic Site", -- "Little Rock Central High School National Historic Site",
"Ozark National Forest" -- "Ozark National Forest"
] -- ]
}, -- },
"major_sports_teams": [ -- "major_sports_teams": [
"Arkansas Razorbacks (NCAA)" -- "Arkansas Razorbacks (NCAA)"
] -- ]
} -- }
'), -- '),
INSERT INTO "worldTravelCountryRegions" (id, name, country_code) VALUES
('US-AL', 'Alabama', 'us'),
('US-AK', 'Alaska', 'us'),
('US-AZ', 'Arizona', 'us'),
('US-AR', 'Arkansas', 'us'),
('US-CA', 'California', 'us'), ('US-CA', 'California', 'us'),
('US-CO', 'Colorado', 'us'), ('US-CO', 'Colorado', 'us'),
('US-CT', 'Connecticut', 'us'), ('US-CT', 'Connecticut', 'us'),

View file

@ -128,7 +128,7 @@
<h2 class="card-title overflow-ellipsis">{name}</h2> <h2 class="card-title overflow-ellipsis">{name}</h2>
<p>{regionId}</p> <p>{regionId}</p>
<div class="card-actions justify-end"> <div class="card-actions justify-end">
<button class="btn btn-info" on:click={moreInfo}>More Info</button> <!-- <button class="btn btn-info" on:click={moreInfo}>More Info</button> -->
{#if !visited} {#if !visited}
<button class="btn btn-primary" on:click={markVisited} <button class="btn btn-primary" on:click={markVisited}
>Mark Visited</button >Mark Visited</button

View file

@ -6,7 +6,6 @@
import AdventureCard from "$lib/components/AdventureCard.svelte"; import AdventureCard from "$lib/components/AdventureCard.svelte";
import type { Adventure } from "$lib/utils/types"; import type { Adventure } from "$lib/utils/types";
import { onMount } from "svelte"; import { onMount } from "svelte";
import { exportData } from "../../services/export";
import exportFile from "$lib/assets/exportFile.svg"; import exportFile from "$lib/assets/exportFile.svg";
import deleteIcon from "$lib/assets/deleteIcon.svg"; import deleteIcon from "$lib/assets/deleteIcon.svg";
import SucessToast from "$lib/components/SucessToast.svelte"; import SucessToast from "$lib/components/SucessToast.svelte";
@ -48,6 +47,18 @@
}, 3000); }, 3000);
} }
function exportData() {
let jsonString = JSON.stringify(adventures);
let blob = new Blob([jsonString], { type: "application/json" });
let url = URL.createObjectURL(blob);
let link = document.createElement("a");
link.download = "data.json";
link.href = url;
link.click();
URL.revokeObjectURL(url);
}
const createNewAdventure = () => { const createNewAdventure = () => {
let currentDate = new Date(); let currentDate = new Date();
let dateString = currentDate.toISOString().slice(0, 10); // Get date in "yyyy-mm-dd" format let dateString = currentDate.toISOString().slice(0, 10); // Get date in "yyyy-mm-dd" format
@ -290,12 +301,7 @@
<div <div
class="flex flex-row items-center justify-center mt-2 gap-4 mb-4 flex-wrap" class="flex flex-row items-center justify-center mt-2 gap-4 mb-4 flex-wrap"
> >
<button <button class="btn btn-neutral" on:click={exportData}>
class="btn btn-neutral"
on:click={async () => {
window.location.href = exportData();
}}
>
<img src={exportFile} class="inline-block -mt-1" alt="Logo" /> Save as File <img src={exportFile} class="inline-block -mt-1" alt="Logo" /> Save as File
</button> </button>
<button class="btn btn-neutral" on:click={deleteData}> <button class="btn btn-neutral" on:click={deleteData}>