mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 13:15:18 +02:00
Merge pull request #68 from seanmorley15/TripAdventure
Trip adventure feature
This commit is contained in:
commit
90ea29f859
8 changed files with 650 additions and 12 deletions
8
migrations/0001_salty_ser_duncan.sql
Normal file
8
migrations/0001_salty_ser_duncan.sql
Normal file
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE "adventures" ADD COLUMN "tripId" integer;--> statement-breakpoint
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "adventures" ADD CONSTRAINT "adventures_tripId_userPlannedTrips_id_fk" FOREIGN KEY ("tripId") REFERENCES "userPlannedTrips"("id") ON DELETE no action ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "userPlannedTrips" DROP COLUMN IF EXISTS "adventures";
|
524
migrations/meta/0001_snapshot.json
Normal file
524
migrations/meta/0001_snapshot.json
Normal file
|
@ -0,0 +1,524 @@
|
|||
{
|
||||
"id": "7b641b27-ea8e-4786-b130-0c827041d12c",
|
||||
"prevId": "7cce94bb-5a17-42ff-850f-e0a41834b739",
|
||||
"version": "5",
|
||||
"dialect": "pg",
|
||||
"tables": {
|
||||
"adventures": {
|
||||
"name": "adventures",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"type": {
|
||||
"name": "type",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"userId": {
|
||||
"name": "userId",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"location": {
|
||||
"name": "location",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"activityTypes": {
|
||||
"name": "activityTypes",
|
||||
"type": "json",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"rating": {
|
||||
"name": "rating",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"link": {
|
||||
"name": "link",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"imageUrl": {
|
||||
"name": "imageUrl",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"date": {
|
||||
"name": "date",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"tripId": {
|
||||
"name": "tripId",
|
||||
"type": "integer",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"adventures_userId_user_id_fk": {
|
||||
"name": "adventures_userId_user_id_fk",
|
||||
"tableFrom": "adventures",
|
||||
"tableTo": "user",
|
||||
"columnsFrom": [
|
||||
"userId"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"adventures_tripId_userPlannedTrips_id_fk": {
|
||||
"name": "adventures_tripId_userPlannedTrips_id_fk",
|
||||
"tableFrom": "adventures",
|
||||
"tableTo": "userPlannedTrips",
|
||||
"columnsFrom": [
|
||||
"tripId"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"featuredAdventures": {
|
||||
"name": "featuredAdventures",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"location": {
|
||||
"name": "location",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {
|
||||
"featuredAdventures_name_unique": {
|
||||
"name": "featuredAdventures_name_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"session": {
|
||||
"name": "session",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"expires_at": {
|
||||
"name": "expires_at",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"session_user_id_user_id_fk": {
|
||||
"name": "session_user_id_user_id_fk",
|
||||
"tableFrom": "session",
|
||||
"tableTo": "user",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"sharedAdventures": {
|
||||
"name": "sharedAdventures",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"data": {
|
||||
"name": "data",
|
||||
"type": "json",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"date": {
|
||||
"name": "date",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"userPlannedTrips": {
|
||||
"name": "userPlannedTrips",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"userId": {
|
||||
"name": "userId",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"adventureName": {
|
||||
"name": "adventureName",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"startDate": {
|
||||
"name": "startDate",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"endDate": {
|
||||
"name": "endDate",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"userPlannedTrips_userId_user_id_fk": {
|
||||
"name": "userPlannedTrips_userId_user_id_fk",
|
||||
"tableFrom": "userPlannedTrips",
|
||||
"tableTo": "user",
|
||||
"columnsFrom": [
|
||||
"userId"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"user": {
|
||||
"name": "user",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "text",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"username": {
|
||||
"name": "username",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"first_name": {
|
||||
"name": "first_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"last_name": {
|
||||
"name": "last_name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"icon": {
|
||||
"name": "icon",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"hashed_password": {
|
||||
"name": "hashed_password",
|
||||
"type": "varchar",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"signup_date": {
|
||||
"name": "signup_date",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"last_login": {
|
||||
"name": "last_login",
|
||||
"type": "timestamp with time zone",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
},
|
||||
"role": {
|
||||
"name": "role",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"userVisitedWorldTravel": {
|
||||
"name": "userVisitedWorldTravel",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"country_code": {
|
||||
"name": "country_code",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"region_id": {
|
||||
"name": "region_id",
|
||||
"type": "varchar",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk": {
|
||||
"name": "userVisitedWorldTravel_country_code_worldTravelCountries_country_code_fk",
|
||||
"tableFrom": "userVisitedWorldTravel",
|
||||
"tableTo": "worldTravelCountries",
|
||||
"columnsFrom": [
|
||||
"country_code"
|
||||
],
|
||||
"columnsTo": [
|
||||
"country_code"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userVisitedWorldTravel_user_id_user_id_fk": {
|
||||
"name": "userVisitedWorldTravel_user_id_user_id_fk",
|
||||
"tableFrom": "userVisitedWorldTravel",
|
||||
"tableTo": "user",
|
||||
"columnsFrom": [
|
||||
"user_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
},
|
||||
"userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk": {
|
||||
"name": "userVisitedWorldTravel_region_id_worldTravelCountryRegions_id_fk",
|
||||
"tableFrom": "userVisitedWorldTravel",
|
||||
"tableTo": "worldTravelCountryRegions",
|
||||
"columnsFrom": [
|
||||
"region_id"
|
||||
],
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"worldTravelCountries": {
|
||||
"name": "worldTravelCountries",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "serial",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"country_code": {
|
||||
"name": "country_code",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"continent": {
|
||||
"name": "continent",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {
|
||||
"worldTravelCountries_country_code_unique": {
|
||||
"name": "worldTravelCountries_country_code_unique",
|
||||
"nullsNotDistinct": false,
|
||||
"columns": [
|
||||
"country_code"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"worldTravelCountryRegions": {
|
||||
"name": "worldTravelCountryRegions",
|
||||
"schema": "",
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"name": {
|
||||
"name": "name",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"country_code": {
|
||||
"name": "country_code",
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true
|
||||
},
|
||||
"info": {
|
||||
"name": "info",
|
||||
"type": "json",
|
||||
"primaryKey": false,
|
||||
"notNull": false
|
||||
}
|
||||
},
|
||||
"indexes": {},
|
||||
"foreignKeys": {
|
||||
"worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk": {
|
||||
"name": "worldTravelCountryRegions_country_code_worldTravelCountries_country_code_fk",
|
||||
"tableFrom": "worldTravelCountryRegions",
|
||||
"tableTo": "worldTravelCountries",
|
||||
"columnsFrom": [
|
||||
"country_code"
|
||||
],
|
||||
"columnsTo": [
|
||||
"country_code"
|
||||
],
|
||||
"onDelete": "no action",
|
||||
"onUpdate": "no action"
|
||||
}
|
||||
},
|
||||
"compositePrimaryKeys": {},
|
||||
"uniqueConstraints": {}
|
||||
}
|
||||
},
|
||||
"enums": {},
|
||||
"schemas": {},
|
||||
"_meta": {
|
||||
"columns": {},
|
||||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,13 @@
|
|||
"when": 1715035790035,
|
||||
"tag": "0000_grey_iron_monger",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1715806684204,
|
||||
"tag": "0001_salty_ser_duncan",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -91,7 +91,6 @@ export const userPlannedTrips = pgTable("userPlannedTrips", {
|
|||
description: text("description"),
|
||||
startDate: text("startDate"),
|
||||
endDate: text("endDate"),
|
||||
adventures: json("adventures"),
|
||||
});
|
||||
|
||||
export const adventureTable = pgTable("adventures", {
|
||||
|
@ -106,4 +105,5 @@ export const adventureTable = pgTable("adventures", {
|
|||
link: text("link"),
|
||||
imageUrl: text("imageUrl"),
|
||||
date: text("date"),
|
||||
tripId: integer("tripId").references(() => userPlannedTrips.id),
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ export interface Adventure {
|
|||
link?: string | undefined;
|
||||
imageUrl?: string | undefined;
|
||||
date?: string | undefined;
|
||||
tripId?: number | undefined;
|
||||
}
|
||||
|
||||
export interface Trip {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { lucia } from "$lib/server/auth";
|
|||
import { error, type RequestEvent } from "@sveltejs/kit";
|
||||
import { adventureTable } from "$lib/db/schema";
|
||||
import { db } from "$lib/db/db.server";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { and, eq, isNull } from "drizzle-orm";
|
||||
import type { Adventure } from "$lib/utils/types";
|
||||
|
||||
// Gets all the adventures that the user has visited
|
||||
|
@ -21,7 +21,8 @@ export async function GET(event: RequestEvent): Promise<Response> {
|
|||
.where(
|
||||
and(
|
||||
eq(adventureTable.userId, event.locals.user.id),
|
||||
eq(adventureTable.type, "planner")
|
||||
eq(adventureTable.type, "planner"),
|
||||
isNull(adventureTable.tripId)
|
||||
)
|
||||
)
|
||||
.execute();
|
||||
|
@ -108,7 +109,7 @@ export async function POST(event: RequestEvent): Promise<Response> {
|
|||
});
|
||||
}
|
||||
|
||||
const { name, location, date, description, activityTypes, rating } =
|
||||
const { name, location, date, description, activityTypes, rating, tripId } =
|
||||
body.detailAdventure;
|
||||
|
||||
if (!name) {
|
||||
|
@ -133,6 +134,7 @@ export async function POST(event: RequestEvent): Promise<Response> {
|
|||
type: "planner",
|
||||
name: name,
|
||||
location: location || null,
|
||||
tripId: tripId || null,
|
||||
date: date || null,
|
||||
description: description || null,
|
||||
activityTypes: JSON.stringify(activityTypes) || null,
|
||||
|
|
|
@ -22,7 +22,7 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
|||
return json({ error: "Missing adventure ID" }, { status: 400 });
|
||||
}
|
||||
|
||||
const trip = await db
|
||||
let trip = await db
|
||||
.select()
|
||||
.from(userPlannedTrips)
|
||||
.where(
|
||||
|
@ -38,14 +38,37 @@ export const GET: RequestHandler = async ({ url, locals }) => {
|
|||
return json({ error: "Trip not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
let adventures = await db
|
||||
.select()
|
||||
.from(adventureTable)
|
||||
.where(eq(adventureTable.tripId, trip[0].id))
|
||||
.execute();
|
||||
|
||||
JSON.stringify(
|
||||
trip.map((r) => {
|
||||
const adventure: Trip = r as Trip;
|
||||
})
|
||||
);
|
||||
|
||||
if (adventures.length !== 0) {
|
||||
JSON.stringify(
|
||||
adventures.map((r) => {
|
||||
const adventure: Adventure = r as Adventure;
|
||||
if (typeof adventure.activityTypes === "string") {
|
||||
try {
|
||||
adventure.activityTypes = JSON.parse(adventure.activityTypes);
|
||||
} catch (error) {
|
||||
console.error("Error parsing activityTypes:", error);
|
||||
adventure.activityTypes = undefined;
|
||||
}
|
||||
}
|
||||
return adventure;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// console.log("GET /api/adventure?id=", id);
|
||||
// console.log("User:", user);
|
||||
|
||||
return json({ trip }, { status: 200 });
|
||||
return json({ trip, adventures }, { status: 200 });
|
||||
};
|
||||
|
|
|
@ -3,25 +3,98 @@
|
|||
import { onMount } from "svelte";
|
||||
import type { PageData } from "./$types";
|
||||
import { goto } from "$app/navigation";
|
||||
import CreateNewAdventure from "$lib/components/CreateNewAdventure.svelte";
|
||||
import { addAdventure } from "../../../services/adventureService";
|
||||
import AdventureCard from "$lib/components/AdventureCard.svelte";
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
let trip: Trip | null = null;
|
||||
let trip: Trip;
|
||||
|
||||
let isCreateModalOpen: boolean = false;
|
||||
|
||||
let adventuresPlans: Adventure[] = [];
|
||||
|
||||
onMount(() => {
|
||||
if (data.trip.trip) {
|
||||
trip = data.trip.trip[0];
|
||||
adventuresPlans = data.trip.adventures;
|
||||
console.log(adventuresPlans);
|
||||
} else {
|
||||
goto("/404");
|
||||
}
|
||||
});
|
||||
|
||||
const newAdventure = async (event: { detail: Adventure }) => {
|
||||
isCreateModalOpen = false;
|
||||
let detailAdventure = event.detail;
|
||||
detailAdventure.tripId = trip.id;
|
||||
let newArray = await addAdventure(detailAdventure, adventuresPlans);
|
||||
if (newArray.length > 0) {
|
||||
adventuresPlans = newArray;
|
||||
// showToast("Adventure added successfully!");
|
||||
} else {
|
||||
// showToast("Failed to add adventure");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<main>
|
||||
{#if trip}
|
||||
<h1>{trip.name}</h1>
|
||||
<p>{trip.description}</p>
|
||||
<p>{trip.startDate}</p>
|
||||
<p>{trip.endDate}</p>
|
||||
{#if trip && trip.name}
|
||||
<h1 class="text-center font-extrabold text-4xl mb-2">{trip.name}</h1>
|
||||
{/if}
|
||||
{#if trip && trip.description}
|
||||
<p class="text-center text-lg mt-4 pl-16 pr-16">{trip.description}</p>
|
||||
{/if}
|
||||
{#if trip && trip.startDate}
|
||||
<p class="text-center text-lg mt-4 pl-16 pr-16">
|
||||
Start Date: {trip.startDate}
|
||||
</p>
|
||||
{/if}
|
||||
{#if trip && trip.endDate}
|
||||
<p class="text-center text-lg mt-4 pl-16 pr-16">End Date: {trip.endDate}</p>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<div
|
||||
class="grid xl:grid-cols-3 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1 gap-4 mt-4 content-center auto-cols-auto ml-6 mr-6"
|
||||
>
|
||||
{#each adventuresPlans as adventure (adventure.id)}
|
||||
<AdventureCard {adventure} type="trip" />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="fixed bottom-4 right-4">
|
||||
<div class="flex flex-row items-center justify-center gap-4">
|
||||
<div class="dropdown dropdown-top dropdown-end">
|
||||
<div tabindex="0" role="button" class="btn m-1 size-16 btn-primary">
|
||||
<iconify-icon icon="mdi:plus" class="text-2xl"></iconify-icon>
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||
<ul
|
||||
tabindex="0"
|
||||
class="dropdown-content z-[1] menu p-4 shadow bg-base-300 text-base-content rounded-box w-52 gap-4"
|
||||
>
|
||||
<p class="text-center font-bold text-lg">Create new...</p>
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
on:click={() => (isCreateModalOpen = true)}>Adventure</button
|
||||
>
|
||||
<!-- <button
|
||||
class="btn btn-primary"
|
||||
on:click={() => (isShowingNewTrip = true)}>Trip Planner</button
|
||||
> -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if isCreateModalOpen}
|
||||
<CreateNewAdventure
|
||||
type="planner"
|
||||
on:close={() => {
|
||||
isCreateModalOpen = false;
|
||||
}}
|
||||
on:create={newAdventure}
|
||||
/>
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue