resolve svelte-check warnings (#819)
Co-authored-by: Jonas Plum <cugu@users.noreply.github.com>
This commit is contained in:
@@ -210,8 +210,10 @@
|
||||
: title,
|
||||
);
|
||||
|
||||
let robotsParams = $state("");
|
||||
if (additionalRobotsProps) {
|
||||
let robotsParams = $derived.by(() => {
|
||||
if (!additionalRobotsProps) {
|
||||
return "";
|
||||
}
|
||||
const {
|
||||
nosnippet,
|
||||
maxSnippet,
|
||||
@@ -223,12 +225,12 @@
|
||||
unavailableAfter,
|
||||
} = additionalRobotsProps;
|
||||
|
||||
robotsParams = `${nosnippet ? ",nosnippet" : ""}${maxSnippet ? `,max-snippet:${maxSnippet}` : ""}${
|
||||
return `${nosnippet ? ",nosnippet" : ""}${maxSnippet ? `,max-snippet:${maxSnippet}` : ""}${
|
||||
maxImagePreview ? `,max-image-preview:${maxImagePreview}` : ""
|
||||
}${noarchive ? ",noarchive" : ""}${unavailableAfter ? `,unavailable_after:${unavailableAfter}` : ""}${
|
||||
noimageindex ? ",noimageindex" : ""
|
||||
}${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ""}${notranslate ? ",notranslate" : ""}`;
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (!robots && additionalRobotsProps) {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import type { Comment } from "$lib/models/comment";
|
||||
import { formatTimeSince } from "$lib/util/format_util";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { untrack } from "svelte";
|
||||
import { fade } from "svelte/transition";
|
||||
import TextField from "../base/text_field.svelte";
|
||||
import { handleFromRecordWithIRI } from "$lib/util/activitypub_util";
|
||||
import Editor from "../base/editor.svelte";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
let editing: boolean = $state(false);
|
||||
|
||||
let editedComment = $state(comment.text);
|
||||
let editedComment = $state(untrack(() => comment.text));
|
||||
|
||||
$effect(() => {
|
||||
editedComment = comment.text;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { _ } from "svelte-i18n";
|
||||
import RadioGroup, { type RadioItem } from "../base/radio_group.svelte";
|
||||
import { defaultMapState } from "$lib/vendor/maplibre-layer-manager/layers";
|
||||
import { untrack } from "svelte";
|
||||
|
||||
interface Props {
|
||||
settings: StyleSwitcherControlOptions;
|
||||
@@ -10,7 +11,7 @@
|
||||
|
||||
let { settings }: Props = $props();
|
||||
|
||||
let mapState = $state(settings.state);
|
||||
let mapState = $state(untrack(() => settings.state));
|
||||
|
||||
let container: HTMLDivElement;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
type Notification,
|
||||
} from "$lib/models/notification";
|
||||
import { formatTimeSince } from "$lib/util/format_util";
|
||||
import { untrack } from "svelte";
|
||||
import { _ } from "svelte-i18n";
|
||||
|
||||
interface Props {
|
||||
@@ -16,11 +17,15 @@
|
||||
|
||||
let { notification, onclick }: Props = $props();
|
||||
|
||||
const avatarSrc = notification.expand?.author.icon
|
||||
? notification.expand.author.icon
|
||||
: `https://api.dicebear.com/7.x/initials/svg?seed=${notification.expand?.author.preferred_username ?? ""}&backgroundType=gradientLinear`;
|
||||
const avatarSrc = untrack(() =>
|
||||
notification.expand?.author.icon
|
||||
? notification.expand.author.icon
|
||||
: `https://api.dicebear.com/7.x/initials/svg?seed=${notification.expand?.author.preferred_username ?? ""}&backgroundType=gradientLinear`,
|
||||
);
|
||||
|
||||
const timeSince = formatTimeSince(new Date(notification.created ?? ""));
|
||||
const timeSince = untrack(() =>
|
||||
formatTimeSince(new Date(notification.created ?? "")),
|
||||
);
|
||||
|
||||
function getTitle(n: Notification) {
|
||||
switch (n.type) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import Modal from "$lib/components/base/modal.svelte";
|
||||
import { validator } from "@felte/validator-zod";
|
||||
import { createForm } from "felte";
|
||||
import { untrack } from "svelte";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { z } from "zod";
|
||||
import TextField from "../base/text_field.svelte";
|
||||
@@ -24,7 +25,7 @@
|
||||
const { form, errors, setFields, setErrors } = createForm<{
|
||||
email: string;
|
||||
}>({
|
||||
initialValues: { email: email },
|
||||
initialValues: { email: untrack(() => email) },
|
||||
extend: validator({
|
||||
schema: z.object({
|
||||
email: z
|
||||
|
||||
@@ -36,19 +36,21 @@
|
||||
modal.openModal();
|
||||
}
|
||||
|
||||
const getInitialFormValues = () => ({
|
||||
email: integration?.komoot?.email ?? "",
|
||||
password: integration?.komoot?.password ?? "",
|
||||
completed: integration?.komoot?.completed ?? true,
|
||||
planned: integration?.komoot?.planned ?? true,
|
||||
active: integration?.komoot?.active ?? false,
|
||||
privacy: integration?.komoot?.privacy ?? "original",
|
||||
});
|
||||
|
||||
const {
|
||||
form,
|
||||
errors,
|
||||
data: d,
|
||||
} = createForm({
|
||||
initialValues: {
|
||||
email: integration?.komoot?.email ?? "",
|
||||
password: integration?.komoot?.password ?? "",
|
||||
completed: integration?.komoot?.completed ?? true,
|
||||
planned: integration?.komoot?.planned ?? true,
|
||||
active: integration?.komoot?.active ?? false,
|
||||
privacy: integration?.komoot?.privacy ?? "original",
|
||||
},
|
||||
initialValues: getInitialFormValues(),
|
||||
extend: validator({
|
||||
schema: KomootSchema,
|
||||
}),
|
||||
|
||||
@@ -36,20 +36,22 @@
|
||||
modal.openModal();
|
||||
}
|
||||
|
||||
const getInitialFormValues = () => ({
|
||||
clientId: integration?.strava?.clientId ?? "",
|
||||
clientSecret: integration?.strava?.clientSecret ?? "",
|
||||
routes: integration?.strava?.routes ?? true,
|
||||
activities: integration?.strava?.activities ?? true,
|
||||
active: integration?.strava?.active ?? false,
|
||||
after: integration?.strava?.after,
|
||||
privacy: integration?.komoot?.privacy ?? "original",
|
||||
});
|
||||
|
||||
const {
|
||||
form,
|
||||
errors,
|
||||
data: formData,
|
||||
} = 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,
|
||||
after: integration?.strava?.after,
|
||||
privacy: integration?.komoot?.privacy ?? "original",
|
||||
},
|
||||
initialValues: getInitialFormValues(),
|
||||
extend: validator({
|
||||
schema: StravaSchema,
|
||||
}),
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
<script lang="ts">
|
||||
import type { Actor } from "$lib/models/activitypub/actor";
|
||||
import type { List } from "$lib/models/list";
|
||||
import type { Trail } from "$lib/models/trail";
|
||||
import type { UserAnonymous } from "$lib/models/user";
|
||||
import { currentUser, users_show } from "$lib/stores/user_store";
|
||||
import { currentUser } from "$lib/stores/user_store";
|
||||
import { handleFromRecordWithIRI } from "$lib/util/activitypub_util";
|
||||
import { getFileURL } from "$lib/util/file_util";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { fly } from "svelte/transition";
|
||||
|
||||
@@ -17,14 +14,15 @@
|
||||
|
||||
let { subject, large = false, type }: Props = $props();
|
||||
|
||||
const shareData =
|
||||
let shareData = $derived.by(() =>
|
||||
type == "trail"
|
||||
? (subject as Trail).expand?.trail_share_via_trail
|
||||
: (subject as List).expand?.list_share_via_list;
|
||||
: (subject as List).expand?.list_share_via_list,
|
||||
);
|
||||
|
||||
let showInfo: boolean = $state(false);
|
||||
let loading: boolean = $state(false);
|
||||
let subjectIsOwned: boolean = subject.author == $currentUser?.actor;
|
||||
let subjectIsOwned: boolean = $derived(subject.author == $currentUser?.actor);
|
||||
</script>
|
||||
|
||||
<div class="relative trail-share-info">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
} from "$lib/stores/trail_like_store";
|
||||
import { currentUser } from "$lib/stores/user_store";
|
||||
import confetti from "canvas-confetti";
|
||||
import { untrack } from "svelte";
|
||||
import { _ } from "svelte-i18n";
|
||||
|
||||
interface Props {
|
||||
@@ -18,7 +19,7 @@
|
||||
|
||||
let { trail }: Props = $props();
|
||||
|
||||
let likeCount = $state(trail.like_count);
|
||||
let likeCount = $state(untrack(() => trail.like_count));
|
||||
|
||||
let loading = $state(false);
|
||||
|
||||
@@ -66,8 +67,10 @@
|
||||
}
|
||||
|
||||
let trailLike = $state(
|
||||
trail.expand?.trail_like_via_trail?.find(
|
||||
(l) => l.actor === $currentUser?.actor,
|
||||
untrack(() =>
|
||||
trail.expand?.trail_like_via_trail?.find(
|
||||
(l) => l.actor === $currentUser?.actor,
|
||||
),
|
||||
),
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
? 'outline-dashed outline-input-border'
|
||||
: ''}"
|
||||
role="dialog"
|
||||
tabindex="0"
|
||||
ondragover={handlePhotoDragOver}
|
||||
ondragleave={handlePhotoDragLeave}
|
||||
ondrop={handlePhotoDrop}
|
||||
|
||||
@@ -27,12 +27,11 @@
|
||||
import { show_toast } from "$lib/stores/toast_store.svelte";
|
||||
import * as M from "maplibre-gl";
|
||||
import "photoswipe/style.css";
|
||||
import { onMount } from "svelte";
|
||||
import { onMount, untrack } from "svelte";
|
||||
import { _ } from "svelte-i18n";
|
||||
import Button from "../base/button.svelte";
|
||||
import Chip from "../base/chip.svelte";
|
||||
import SkeletonNotificationCard from "../base/skeleton_notification_card.svelte";
|
||||
import Textarea from "../base/textarea.svelte";
|
||||
import CommentCard from "../comment/comment_card.svelte";
|
||||
import EmptyStateComment from "../empty_states/empty_state_comment.svelte";
|
||||
import EmptyStateDescription from "../empty_states/empty_state_description.svelte";
|
||||
@@ -77,7 +76,7 @@
|
||||
let summitLogModal: SummitLogModal;
|
||||
let confirmModal: ConfirmModal;
|
||||
|
||||
let trail = $state(initTrail);
|
||||
let trail = $state(untrack(() => initTrail));
|
||||
|
||||
const tabs = [
|
||||
$_("summit-book"),
|
||||
@@ -93,14 +92,14 @@
|
||||
let newComment: Comment = $state({
|
||||
text: "",
|
||||
author: "",
|
||||
trail: handle + "/" + (trail.id ?? ""),
|
||||
trail: untrack(() => handle) + "/" + (trail.id ?? ""),
|
||||
});
|
||||
|
||||
let commentsLoading: boolean = $state(activeTab == 2);
|
||||
let commentsLoading: boolean = $state(untrack(() => activeTab == 2));
|
||||
let commentCreateLoading: boolean = $state(false);
|
||||
let commentDeleteLoading: boolean = false;
|
||||
|
||||
let summitLogsLoading: boolean = $state(activeTab == 0);
|
||||
let summitLogsLoading: boolean = $state(untrack(() => activeTab == 0));
|
||||
let summitLogCreateLoading: boolean = $state(false);
|
||||
|
||||
let fullDescription: boolean = $state(false);
|
||||
|
||||
Reference in New Issue
Block a user