* initial commit federation * more federation * more federation * more federation * completes follow, accept, undo * add trail create activity * process trail create activity * more trail create activity * adds missing endpoints * adds update and delete activity * adds comment activities * adds activities back * adds summit logs activities * deletes follow counts table * fixes migrations * fixes migrations * fixes migrations * fixes migrations * adds remote profiles * ctd * ctd * we are getting closer... * adds public summit logs * fixes federated trails in lists * adds remote lists * adds list activites * fixes lists * adds notifications * adds iri redirect * fixes comments and summitlogs * fixes follows and profiles * adds asynchronous send * fixes list search * adds encryption key * bug fixes * fixes activity signing * removes custon activity object types * adds html editor * fixes html editor * fixes display issues on mastodon * adds federated sharing * finishes announcements * fixes small summit log issues * adds trail likes * finalizes likes * fixes images for komoot * add disable federation option * adds private profiles * updates docs * adds federated comments * adds trail and comments actvitiypub routes * adds mentions to editor * adds mentions to trails, comments, summit logs * updates theme * updates theme * update docs * update docs * updates docs * fixes various frontend problems * fixes activitypub follows api * updates docs * updates docs --------- Co-authored-by: Christian Beutel <>
92 lines
2.9 KiB
Svelte
92 lines
2.9 KiB
Svelte
<script lang="ts">
|
|
import Modal from "$lib/components/base/modal.svelte";
|
|
import TextField from "$lib/components/base/text_field.svelte";
|
|
import Toggle from "$lib/components/base/toggle.svelte";
|
|
import { StravaSchema } from "$lib/models/api/integration_schema";
|
|
import type {
|
|
Integration,
|
|
StravaIntegration,
|
|
} from "$lib/models/integration";
|
|
import { validator } from "@felte/validator-zod";
|
|
import { createForm } from "felte";
|
|
import { _ } from "svelte-i18n";
|
|
|
|
interface Props {
|
|
integration?: Integration;
|
|
onsave?: (stravaIntegration: StravaIntegration) => void;
|
|
}
|
|
|
|
let { integration, onsave }: Props = $props();
|
|
|
|
let modal: Modal;
|
|
|
|
export function openModal() {
|
|
errors.set({});
|
|
modal.openModal();
|
|
}
|
|
|
|
const { form, errors } = createForm({
|
|
initialValues: {
|
|
clientId: integration?.strava?.clientId ?? "",
|
|
clientSecret: integration?.strava?.clientSecret ?? "",
|
|
routes: integration?.strava?.routes ?? true,
|
|
activities: integration?.strava?.activities ?? true,
|
|
active: integration?.strava?.active ?? false,
|
|
},
|
|
extend: validator({
|
|
schema: StravaSchema,
|
|
}),
|
|
onSubmit: async (form) => {
|
|
form.active = integration?.strava?.active ?? form.active
|
|
onsave?.(form);
|
|
modal.closeModal();
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<Modal
|
|
id="strava-settings-modal"
|
|
size="md:min-w-lg"
|
|
title={"strava " + $_("settings")}
|
|
bind:this={modal}
|
|
>
|
|
{#snippet content()}
|
|
<form id="strava-settings-form" class="space-y-2" use:form>
|
|
<TextField
|
|
label="Client-ID"
|
|
placeholder="000000"
|
|
name="clientId"
|
|
error={$errors.clientId}
|
|
></TextField>
|
|
<TextField
|
|
label="Client Secret"
|
|
placeholder={integration?.strava ? `(${$_("unchanged")})` : "de8b3789bd7116d..."}
|
|
name="clientSecret"
|
|
type="password"
|
|
error={$errors.clientSecret}
|
|
></TextField>
|
|
<div class="flex gap-x-4">
|
|
<Toggle name="routes" label={$_("route", { values: { n: 2 } })}
|
|
></Toggle>
|
|
<Toggle
|
|
name="activities"
|
|
label={$_("activity", { values: { n: 2 } })}
|
|
></Toggle>
|
|
</div>
|
|
</form>
|
|
{/snippet}
|
|
{#snippet footer()}
|
|
<div class="flex items-center gap-4">
|
|
<button class="btn-secondary" onclick={() => modal.closeModal()}
|
|
>{$_("cancel")}</button
|
|
>
|
|
<button
|
|
class="btn-primary"
|
|
form="strava-settings-form"
|
|
type="submit"
|
|
name="save">{$_("save")}</button
|
|
>
|
|
</div>
|
|
{/snippet}</Modal
|
|
>
|