1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 06:49:37 +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,40 +639,73 @@ 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">
<span class="label-text">Constrain to collection dates</span> {#if adventure.collection && collection && collection.start_date && collection.end_date}
<input <span class="label-text">Constrain to collection dates</span>
type="checkbox" <input
class="toggle toggle-primary" type="checkbox"
id="is_public" class="toggle toggle-primary"
name="is_public" id="constrain_dates"
/> name="constrain_dates"
<!-- TODO: implement this constrain --> on:change={() => (constrainDates = !constrainDates)}
/>
{/if}
</label> </label>
<div class="flex gap-2 mb-1"> <div class="flex gap-2 mb-1">
<input {#if !constrainDates}
type="date" <input
class="input input-bordered w-full" type="date"
placeholder="Start Date" class="input input-bordered w-full"
bind:value={new_start_date} placeholder="Start Date"
on:keydown={(e) => { bind:value={new_start_date}
if (e.key === 'Enter') { on:keydown={(e) => {
e.preventDefault(); if (e.key === 'Enter') {
addNewVisit(); e.preventDefault();
} addNewVisit();
}} }
/> }}
<input />
type="date" <input
class="input input-bordered w-full" type="date"
placeholder="End Date" class="input input-bordered w-full"
bind:value={new_end_date} placeholder="End Date"
on:keydown={(e) => { bind:value={new_end_date}
if (e.key === 'Enter') { on:keydown={(e) => {
e.preventDefault(); if (e.key === 'Enter') {
addNewVisit(); e.preventDefault();
} addNewVisit();
}} }
/> }}
/>
{: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,27 +729,32 @@ 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 gap-2"> <div class="flex flex-col gap-2">
<p> <div class="flex gap-2">
{new Date(visit.start_date).toLocaleDateString(undefined, { <p>
timeZone: 'UTC' {new Date(visit.start_date).toLocaleDateString(undefined, {
})} timeZone: 'UTC'
</p> })}
<p> </p>
{new Date(visit.end_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} <p>
</p> {new Date(visit.end_date).toLocaleDateString(undefined, {
<p>{visit.notes}</p> timeZone: 'UTC'
<div> })}
<button </p>
type="button"
class="btn btn-sm btn-error mb-1" <div>
on:click={() => { <button
adventure.visits = adventure.visits.filter((v) => v !== visit); type="button"
}} class="btn btn-sm btn-error"
> on:click={() => {
Remove adventure.visits = adventure.visits.filter((v) => v !== visit);
</button> }}
>
Remove
</button>
</div>
</div> </div>
<p class="whitespace-pre-wrap -mt-2 mb-2">{visit.notes}</p>
</div> </div>
{/each} {/each}
{/if} {/if}

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">