1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 14:59:36 +02:00

Refactor release workflow to use "released" event type

This commit is contained in:
Sean Morley 2024-10-04 21:33:02 -04:00
parent d0791faad5
commit f354cd1ffe
5 changed files with 125 additions and 57 deletions

View file

@ -2,7 +2,7 @@ name: Upload the tagged release backend image to GHCR and Docker Hub
on: on:
release: release:
types: [published] types: [released]
env: env:
IMAGE_NAME: "adventurelog-backend" IMAGE_NAME: "adventurelog-backend"

View file

@ -2,7 +2,7 @@ name: Upload tagged release frontend image to GHCR and Docker Hub
on: on:
release: release:
types: [published] types: [released]
env: env:
IMAGE_NAME: "adventurelog-frontend" IMAGE_NAME: "adventurelog-frontend"

View file

@ -19,14 +19,14 @@
if (modal) { if (modal) {
modal.showModal(); modal.showModal();
} }
let res = await fetch(`/api/adventures/all/?include_collections=false`, { let res = await fetch(`/api/adventures/?include_collections=false`, {
method: 'GET' method: 'GET'
}); });
const newAdventures = await res.json(); const newAdventures = await res.json();
if (res.ok && adventures) { if (res.ok && adventures) {
adventures = newAdventures; adventures = newAdventures.results;
} }
isLoading = false; isLoading = false;
}); });

View file

@ -16,6 +16,7 @@
let places: OpenStreetMapPlace[] = []; let places: OpenStreetMapPlace[] = [];
let images: { id: string; image: string }[] = []; let images: { id: string; image: string }[] = [];
let warningMessage: string = ''; let warningMessage: string = '';
let constrainDates: boolean = false;
import ActivityComplete from './ActivityComplete.svelte'; import ActivityComplete from './ActivityComplete.svelte';
import { appVersion } from '$lib/config'; import { appVersion } from '$lib/config';
@ -638,16 +639,19 @@ it would also work to just use on:click on the MapLibre component itself. -->
</div> </div>
<div class="collapse-content"> <div class="collapse-content">
<label class="label cursor-pointer flex items-start space-x-2"> <label class="label cursor-pointer flex items-start space-x-2">
{#if adventure.collection && collection && collection.start_date && collection.end_date}
<span class="label-text">Constrain to collection dates</span> <span class="label-text">Constrain to collection dates</span>
<input <input
type="checkbox" type="checkbox"
class="toggle toggle-primary" class="toggle toggle-primary"
id="is_public" id="constrain_dates"
name="is_public" name="constrain_dates"
on:change={() => (constrainDates = !constrainDates)}
/> />
<!-- TODO: implement this constrain --> {/if}
</label> </label>
<div class="flex gap-2 mb-1"> <div class="flex gap-2 mb-1">
{#if !constrainDates}
<input <input
type="date" type="date"
class="input input-bordered w-full" class="input input-bordered w-full"
@ -672,6 +676,36 @@ it would also work to just use on:click on the MapLibre component itself. -->
} }
}} }}
/> />
{:else}
<input
type="date"
class="input input-bordered w-full"
placeholder="Start Date"
min={collection?.start_date}
max={collection?.end_date}
bind:value={new_start_date}
on:keydown={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
addNewVisit();
}
}}
/>
<input
type="date"
class="input input-bordered w-full"
placeholder="End Date"
bind:value={new_end_date}
min={collection?.start_date}
max={collection?.end_date}
on:keydown={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
addNewVisit();
}
}}
/>
{/if}
</div> </div>
<div class="flex gap-2 mb-1"> <div class="flex gap-2 mb-1">
<!-- textarea for notes --> <!-- textarea for notes -->
@ -695,6 +729,7 @@ it would also work to just use on:click on the MapLibre component itself. -->
{#if adventure.visits.length > 0} {#if adventure.visits.length > 0}
<h2 class=" font-bold text-xl mt-2">My Visits</h2> <h2 class=" font-bold text-xl mt-2">My Visits</h2>
{#each adventure.visits as visit} {#each adventure.visits as visit}
<div class="flex flex-col gap-2">
<div class="flex gap-2"> <div class="flex gap-2">
<p> <p>
{new Date(visit.start_date).toLocaleDateString(undefined, { {new Date(visit.start_date).toLocaleDateString(undefined, {
@ -702,13 +737,15 @@ it would also work to just use on:click on the MapLibre component itself. -->
})} })}
</p> </p>
<p> <p>
{new Date(visit.end_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} {new Date(visit.end_date).toLocaleDateString(undefined, {
timeZone: 'UTC'
})}
</p> </p>
<p>{visit.notes}</p>
<div> <div>
<button <button
type="button" type="button"
class="btn btn-sm btn-error mb-1" class="btn btn-sm btn-error"
on:click={() => { on:click={() => {
adventure.visits = adventure.visits.filter((v) => v !== visit); adventure.visits = adventure.visits.filter((v) => v !== visit);
}} }}
@ -717,6 +754,8 @@ it would also work to just use on:click on the MapLibre component itself. -->
</button> </button>
</div> </div>
</div> </div>
<p class="whitespace-pre-wrap -mt-2 mb-2">{visit.notes}</p>
</div>
{/each} {/each}
{/if} {/if}
</div> </div>

View file

@ -40,6 +40,7 @@
import EditAdventure from '$lib/components/AdventureModal.svelte'; import EditAdventure from '$lib/components/AdventureModal.svelte';
import AdventureModal from '$lib/components/AdventureModal.svelte'; import AdventureModal from '$lib/components/AdventureModal.svelte';
import ImageDisplayModal from '$lib/components/ImageDisplayModal.svelte'; import ImageDisplayModal from '$lib/components/ImageDisplayModal.svelte';
import { typeToString } from '$lib';
onMount(() => { onMount(() => {
if (data.props.adventure) { if (data.props.adventure) {
@ -310,7 +311,7 @@
<div> <div>
<p class="text-sm text-muted-foreground">Adventure Type</p> <p class="text-sm text-muted-foreground">Adventure Type</p>
<p class="text-base font-medium"> <p class="text-base font-medium">
{adventure.type[0].toLocaleUpperCase() + adventure.type.slice(1)} {typeToString(adventure.type)}
</p> </p>
</div> </div>
{#if data.props.collection} {#if data.props.collection}
@ -322,6 +323,34 @@
> >
</div> </div>
{/if} {/if}
{#if adventure.visits.length > 0}
<div>
<p class="text-sm text-muted-foreground">Visits</p>
<p class="text-base font-medium">
{adventure.visits.length}
{adventure.visits.length > 1 ? 'visits' : 'visit' + ':'}
</p>
<!-- show each visit start and end date as well as notes -->
{#each adventure.visits as visit}
<div class="grid gap-2">
<p class="text-sm text-muted-foreground">
{visit.start_date
? new Date(visit.start_date).toLocaleDateString(undefined, {
timeZone: 'UTC'
})
: ''}
{visit.end_date && visit.end_date !== ''
? ' - ' +
new Date(visit.end_date).toLocaleDateString(undefined, {
timeZone: 'UTC'
})
: ''}
</p>
<p class="text-sm text-muted-foreground -mt-2 mb-2">{visit.notes}</p>
</div>
{/each}
</div>
{/if}
</div> </div>
{#if adventure.longitude && adventure.latitude} {#if adventure.longitude && adventure.latitude}
<div class="grid md:grid-cols-2 gap-4"> <div class="grid md:grid-cols-2 gap-4">