mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-26 00:09:38 +02:00
commit
bef9eb199f
8 changed files with 5184 additions and 15 deletions
|
@ -113,3 +113,4 @@ AdventureLog is licensed under the GNU General Public License v3.0.
|
||||||
|
|
||||||
- [Mexico GEOJSON](https://cartographyvectors.com/map/784-mexico-with-states)
|
- [Mexico GEOJSON](https://cartographyvectors.com/map/784-mexico-with-states)
|
||||||
- [Japan GEOJSON](https://cartographyvectors.com/map/361-japan)
|
- [Japan GEOJSON](https://cartographyvectors.com/map/361-japan)
|
||||||
|
- [Ireland GEOJSON](https://cartographyvectors.com/map/1399-ireland-provinces)
|
||||||
|
|
5130
backend/server/static/data/ie.json
Normal file
5130
backend/server/static/data/ie.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -56,10 +56,16 @@
|
||||||
let id = data[1];
|
let id = data[1];
|
||||||
let user_id = data[2];
|
let user_id = data[2];
|
||||||
|
|
||||||
console.log(newCollection);
|
if (id !== undefined && user_id !== undefined) {
|
||||||
dispatch('create', newCollection);
|
newCollection.id = id;
|
||||||
addToast('success', 'Collection created successfully!');
|
newCollection.user_id = user_id;
|
||||||
close();
|
console.log(newCollection);
|
||||||
|
dispatch('create', newCollection);
|
||||||
|
addToast('success', 'Collection created successfully!');
|
||||||
|
close();
|
||||||
|
} else {
|
||||||
|
addToast('error', 'Error creating collection');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import FileDocumentEdit from '~icons/mdi/file-document-edit';
|
import FileDocumentEdit from '~icons/mdi/file-document-edit';
|
||||||
|
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import type { Collection, Transportation } from '$lib/types';
|
import type { Collection, Transportation, User } from '$lib/types';
|
||||||
import { addToast } from '$lib/toasts';
|
import { addToast } from '$lib/toasts';
|
||||||
|
|
||||||
import Plus from '~icons/mdi/plus';
|
import Plus from '~icons/mdi/plus';
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
export let transportation: Transportation;
|
export let transportation: Transportation;
|
||||||
|
export let user: User | null = null;
|
||||||
|
|
||||||
function editTransportation() {
|
function editTransportation() {
|
||||||
dispatch('edit', transportation);
|
dispatch('edit', transportation);
|
||||||
|
@ -51,13 +52,15 @@
|
||||||
{#if transportation.date}
|
{#if transportation.date}
|
||||||
{new Date(transportation.date).toLocaleString()}
|
{new Date(transportation.date).toLocaleString()}
|
||||||
{/if}
|
{/if}
|
||||||
<div class="card-actions justify-end">
|
{#if user}
|
||||||
<button on:click={deleteTransportation} class="btn btn-secondary"
|
<div class="card-actions justify-end">
|
||||||
><TrashCanOutline class="w-5 h-5 mr-1" /></button
|
<button on:click={deleteTransportation} class="btn btn-secondary"
|
||||||
>
|
><TrashCanOutline class="w-5 h-5 mr-1" /></button
|
||||||
<button class="btn btn-primary" on:click={editTransportation}>
|
>
|
||||||
<FileDocumentEdit class="w-6 h-6" />
|
<button class="btn btn-primary" on:click={editTransportation}>
|
||||||
</button>
|
<FileDocumentEdit class="w-6 h-6" />
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -109,7 +109,13 @@ export const actions: Actions = {
|
||||||
formDataToSend.append('description', description || '');
|
formDataToSend.append('description', description || '');
|
||||||
formDataToSend.append('latitude', latitude || '');
|
formDataToSend.append('latitude', latitude || '');
|
||||||
formDataToSend.append('longitude', longitude || '');
|
formDataToSend.append('longitude', longitude || '');
|
||||||
formDataToSend.append('collection', collection || '');
|
|
||||||
|
if (!isNaN(Number(collection))) {
|
||||||
|
if (collection !== null) {
|
||||||
|
formDataToSend.append('collection', collection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (activity_types) {
|
if (activity_types) {
|
||||||
// Filter out empty and duplicate activity types, then trim each activity type
|
// Filter out empty and duplicate activity types, then trim each activity type
|
||||||
const cleanedActivityTypes = Array.from(
|
const cleanedActivityTypes = Array.from(
|
||||||
|
@ -129,6 +135,11 @@ export const actions: Actions = {
|
||||||
formDataToSend.append('link', link || '');
|
formDataToSend.append('link', link || '');
|
||||||
formDataToSend.append('image', image);
|
formDataToSend.append('image', image);
|
||||||
|
|
||||||
|
// log each key-value pair in the FormData
|
||||||
|
for (let pair of formDataToSend.entries()) {
|
||||||
|
console.log(pair[0] + ', ' + pair[1]);
|
||||||
|
}
|
||||||
|
|
||||||
let auth = event.cookies.get('auth');
|
let auth = event.cookies.get('auth');
|
||||||
|
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
|
|
|
@ -374,6 +374,7 @@
|
||||||
{#each transportations as transportation}
|
{#each transportations as transportation}
|
||||||
<TransportationCard
|
<TransportationCard
|
||||||
{transportation}
|
{transportation}
|
||||||
|
user={data?.user}
|
||||||
on:delete={(event) => {
|
on:delete={(event) => {
|
||||||
transportations = transportations.filter((t) => t.id != event.detail);
|
transportations = transportations.filter((t) => t.id != event.detail);
|
||||||
}}
|
}}
|
||||||
|
@ -430,6 +431,7 @@
|
||||||
{#each dayTransportations as transportation}
|
{#each dayTransportations as transportation}
|
||||||
<TransportationCard
|
<TransportationCard
|
||||||
{transportation}
|
{transportation}
|
||||||
|
user={data?.user}
|
||||||
on:delete={(event) => {
|
on:delete={(event) => {
|
||||||
transportations = transportations.filter((t) => t.id != event.detail);
|
transportations = transportations.filter((t) => t.id != event.detail);
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -33,7 +33,8 @@ export const load = (async (event) => {
|
||||||
return {
|
return {
|
||||||
lngLat: [adventure.longitude, adventure.latitude] as [number, number],
|
lngLat: [adventure.longitude, adventure.latitude] as [number, number],
|
||||||
name: adventure.name,
|
name: adventure.name,
|
||||||
type: adventure.type
|
type: adventure.type,
|
||||||
|
collection: adventure.collection
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
let showVisited = true;
|
let showVisited = true;
|
||||||
let showPlanned = true;
|
let showPlanned = true;
|
||||||
|
let showCollectionAdventures = false;
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (!showVisited) {
|
if (!showVisited) {
|
||||||
|
@ -33,6 +34,12 @@
|
||||||
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
|
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
|
||||||
markers = [...markers, ...plannedMarkers];
|
markers = [...markers, ...plannedMarkers];
|
||||||
}
|
}
|
||||||
|
if (!showCollectionAdventures) {
|
||||||
|
markers = markers.filter((marker) => marker.collection === null);
|
||||||
|
} else {
|
||||||
|
const collectionMarkers = data.props.markers.filter((marker) => marker.collection !== null);
|
||||||
|
markers = [...markers, ...collectionMarkers];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let newMarker = [];
|
let newMarker = [];
|
||||||
|
@ -117,6 +124,14 @@
|
||||||
<span class="label-text">Planned</span>
|
<span class="label-text">Planned</span>
|
||||||
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
|
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
|
||||||
</label>
|
</label>
|
||||||
|
<label class="label cursor-pointer">
|
||||||
|
<span class="label-text">Collection Adventures</span>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={showCollectionAdventures}
|
||||||
|
class="checkbox checkbox-primary"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
{#if newMarker.length > 0}
|
{#if newMarker.length > 0}
|
||||||
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
|
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue