adds trail edit

This commit is contained in:
Christian Beutel
2024-01-31 21:55:18 +01:00
parent efaf0d4e5c
commit 99f743ec94
15 changed files with 338 additions and 136 deletions

View File

@@ -0,0 +1,27 @@
<script lang="ts">
import { toast } from "$lib/stores/toast_store";
$: getBackgroundColor = () => {
if ($toast && $toast.type == "success") {
return "green-200";
}
return "";
};
$: getBorderColor = () => {
if ($toast && $toast.type == "success") {
return "green-500";
}
return "";
};
</script>
{#if $toast}
<div
class="fixed px-8 py-4 shadow-xl rounded-xl border bottom-4 right-4 bg-{getBackgroundColor()} border-{getBorderColor()}"
style="z-index: 1000;"
>
<i class="fa fa-{$toast.icon} mr-2"></i>
<span>{$toast.text}</span>
</div>
{/if}

View File

@@ -12,7 +12,7 @@
<a class="font-semibold" href="">Favorites</a>
</menu>
<div class="flex gap-6 items-center">
<a class="btn-primary btn-large" href="/new"><i class="fa fa-plus mr-2"></i>New Trail</a>
<a class="btn-primary btn-large" href="/trail/edit/new"><i class="fa fa-plus mr-2"></i>New Trail</a>
<Avatar></Avatar>
</div>
</nav>

View File

@@ -17,7 +17,7 @@
const { form, errors, handleChange, handleSubmit } = createForm<SummitLog>({
initialValues: $summitLog,
validationSchema: summitLogSchema,
onSubmit: async (submittedValues) => {
onSubmit: async (submittedValues) => {
dispatch("save", submittedValues);
closeModal!();
},

View File

@@ -1,6 +1,5 @@
<script lang="ts">
import type { Trail } from "$lib/models/trail";
import { getFileURL } from "$lib/util/file_util";
import { formatMeters, formatTimeHHMM } from "$lib/util/format_util";
import Dropdown from "../base/dropdown.svelte";
@@ -14,7 +13,7 @@
<div class="trail-card rounded-2xl shadow-md w-72 cursor-pointer">
<div class="w-full h-48 overflow-hidden rounded-t-2xl">
<img src={getFileURL(trail, trail.thumbnail)} alt="" />
<img src={trail.thumbnail} alt="" />
</div>
<div class="p-4">
<div>