Speed things up by removing animations

This commit is contained in:
Jonathan Staab 2023-10-17 10:56:55 -07:00
parent 320e8abd59
commit 7ce32fa56f
18 changed files with 240 additions and 251 deletions

View File

@ -30,6 +30,7 @@
- [x] Encode relays into urls when possible - [x] Encode relays into urls when possible
- [x] Opt-in to local relay when it's actually useful - [x] Opt-in to local relay when it's actually useful
- [x] Fix link overflow when media previews are off - [x] Fix link overflow when media previews are off
- [x] Speed things up by using animations more sparingly
# 0.3.10 # 0.3.10

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import {reverse} from "ramda" import {reverse} from "ramda"
import {fly} from "src/util/transition"
import type {HistoryItem} from "src/util/router" import type {HistoryItem} from "src/util/router"
import {decodeQueryString, decodeRouteParams} from "src/util/router" import {decodeQueryString, decodeRouteParams} from "src/util/router"
import Modal from "src/partials/Modal.svelte" import Modal from "src/partials/Modal.svelte"
@ -31,7 +32,9 @@
<div class="pt-16 text-gray-2 lg:ml-48" class:pointer-events-none={$menuIsOpen}> <div class="pt-16 text-gray-2 lg:ml-48" class:pointer-events-none={$menuIsOpen}>
{#if $page} {#if $page}
{#key $page.path} {#key $page.path}
<div in:fly={{y: 20}}>
<svelte:component this={$page.route.component} {...getProps($page)} /> <svelte:component this={$page.route.component} {...getProps($page)} />
</div>
{/key} {/key}
{/if} {/if}
</div> </div>

View File

@ -4,6 +4,7 @@
import {Storage} from "hurdak" import {Storage} from "hurdak"
import {FeedLoader} from "src/engine" import {FeedLoader} from "src/engine"
import {createScroller} from "src/util/misc" import {createScroller} from "src/util/misc"
import {fly} from "src/util/transition"
import {getModal} from "src/partials/state" import {getModal} from "src/partials/state"
import Spinner from "src/partials/Spinner.svelte" import Spinner from "src/partials/Spinner.svelte"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
@ -88,12 +89,14 @@
</FeedControls> </FeedControls>
{/if} {/if}
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
{#each $notes as note (note.id)} {#each $notes as note, i (note.id)}
<div in:fly={{y: 20, duration: i < 5 ? 100 : 0}}>
<Note <Note
depth={$hideReplies ? 0 : 2} depth={$hideReplies ? 0 : 2}
context={note.replies || []} context={note.replies || []}
filters={[compileFilter(filter)]} filters={[compileFilter(filter)]}
{note} /> {note} />
</div>
{/each} {/each}
</div> </div>
<Spinner /> <Spinner />

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import {pluck, not, find, propEq, prop, equals, omit, objOf} from "ramda" import {pluck, not, find, propEq, prop, equals, omit, objOf} from "ramda"
import {displayList} from "hurdak" import {displayList} from "hurdak"
import {debounce} from "throttle-debounce" import {debounce} from "throttle-debounce"
@ -204,7 +203,7 @@
} }
</script> </script>
<div in:fly={{y: 20}}> <div>
<div class="float-right flex justify-end gap-1"> <div class="float-right flex justify-end gap-1">
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<Toggle scale={0.6} value={!$hideReplies} on:change={toggleReplies} /> <Toggle scale={0.6} value={!$hideReplies} on:change={toggleReplies} />

View File

@ -2,8 +2,8 @@
import {partition, reject, propEq, uniqBy, prop} from "ramda" import {partition, reject, propEq, uniqBy, prop} from "ramda"
import {onMount, onDestroy} from "svelte" import {onMount, onDestroy} from "svelte"
import {quantify, batch} from "hurdak" import {quantify, batch} from "hurdak"
import {LOCAL_RELAY_URL, Tags, findRootId, isChildOf, findReplyId, isLike} from "src/util/nostr"
import {fly} from "src/util/transition" import {fly} from "src/util/transition"
import {LOCAL_RELAY_URL, Tags, findRootId, isChildOf, findReplyId, isLike} from "src/util/nostr"
import {formatTimestamp} from "src/util/misc" import {formatTimestamp} from "src/util/misc"
import Popover from "src/partials/Popover.svelte" import Popover from "src/partials/Popover.svelte"
import Spinner from "src/partials/Spinner.svelte" import Spinner from "src/partials/Spinner.svelte"
@ -57,7 +57,6 @@
let collapsed = depth === 0 let collapsed = depth === 0
let ctx = uniqBy(prop("id"), context) let ctx = uniqBy(prop("id"), context)
const {ENABLE_ZAPS} = $env
const showEntire = anchorId === event.id const showEntire = anchorId === event.id
const interactive = !anchorId || !showEntire const interactive = !anchorId || !showEntire
@ -128,7 +127,7 @@
onMount(async () => { onMount(async () => {
const zapAddress = Tags.from(note).getMeta("zap") const zapAddress = Tags.from(note).getMeta("zap")
if (zapAddress) { if (zapAddress && getLnUrl(zapAddress)) {
zapper = await getZapper(getLnUrl(zapAddress)) zapper = await getZapper(getLnUrl(zapAddress))
} else { } else {
unsubZapper = people.key(note.pubkey).subscribe($p => { unsubZapper = people.key(note.pubkey).subscribe($p => {
@ -148,7 +147,7 @@
const kinds = [1, 7] const kinds = [1, 7]
if (ENABLE_ZAPS) { if ($env.ENABLE_ZAPS) {
kinds.push(9735) kinds.push(9735)
} }
@ -284,16 +283,14 @@
{#if !showEntire && replies.length > visibleReplies.length} {#if !showEntire && replies.length > visibleReplies.length}
<button class="ml-5 cursor-pointer py-2 text-gray-1 outline-0" on:click={onClick}> <button class="ml-5 cursor-pointer py-2 text-gray-1 outline-0" on:click={onClick}>
<i class="fa fa-up-down pr-2 text-sm" /> <i class="fa fa-up-down pr-2 text-sm" />
Show {quantify( Show {quantify(replies.length - visibleReplies.length, "other reply", "more replies")}
replies.length - visibleReplies.length,
"other reply",
"more replies"
)}
</button> </button>
<div class="absolute -left-4 -top-2 h-14 w-px bg-gray-6" /> <div class="absolute -left-4 -top-2 h-14 w-px bg-gray-6" />
{:else if visibleReplies.length > 0 || showHiddenReplies} {:else if visibleReplies.length > 0 || showHiddenReplies}
<div class="absolute -left-4 -top-2 h-4 w-px bg-gray-6" /> <div class="absolute -left-4 -top-2 h-4 w-px bg-gray-6" />
{/if} {/if}
{#if visibleReplies.length}
<div in:fly={{y: 20}}>
{#each visibleReplies as r, i (r.id)} {#each visibleReplies as r, i (r.id)}
<svelte:self <svelte:self
isLastReply={!showMutedReplies && i === visibleReplies.length - 1} isLastReply={!showMutedReplies && i === visibleReplies.length - 1}
@ -304,7 +301,10 @@
context={ctx} context={ctx}
{anchorId} /> {anchorId} />
{/each} {/each}
</div>
{/if}
{#if showHiddenReplies} {#if showHiddenReplies}
<div in:fly={{y: 20}}>
{#each hiddenReplies as r, i (r.id)} {#each hiddenReplies as r, i (r.id)}
<svelte:self <svelte:self
isLastReply={i === hiddenReplies.length - 1} isLastReply={i === hiddenReplies.length - 1}
@ -315,10 +315,10 @@
context={ctx} context={ctx}
{anchorId} /> {anchorId} />
{/each} {/each}
</div>
{:else if showEntire && hiddenReplies.length > 0} {:else if showEntire && hiddenReplies.length > 0}
<button <button
class="ml-5 cursor-pointer py-2 text-gray-1 outline-0" class="ml-5 cursor-pointer py-2 text-gray-1 outline-0"
in:fly={{y: 20}}
on:click={() => { on:click={() => {
showMutedReplies = true showMutedReplies = true
}}> }}>

View File

@ -1,16 +1,14 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import RelayCard from "src/app/shared/RelayCard.svelte" import RelayCard from "src/app/shared/RelayCard.svelte"
export let relays export let relays
</script> </script>
<div in:fly={{y: 20}}>
<Content> <Content>
<p> <p>
Below are the relays this user publishes to. Join one or more to make sure you never miss Below are the relays this user publishes to. Join one or more to make sure you never miss their
their updates. updates.
</p> </p>
{#if relays.length === 0} {#if relays.length === 0}
<div class="pt-8 text-center">No relays found</div> <div class="pt-8 text-center">No relays found</div>
@ -22,4 +20,3 @@
</div> </div>
{/if} {/if}
</Content> </Content>
</div>

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import {stringToHue, hsl} from "src/util/misc" import {stringToHue, hsl} from "src/util/misc"
import Toggle from "src/partials/Toggle.svelte" import Toggle from "src/partials/Toggle.svelte"
import Rating from "src/partials/Rating.svelte" import Rating from "src/partials/Rating.svelte"
@ -18,8 +17,7 @@
<div <div
class="flex flex-col justify-between gap-3 rounded-xl border border-l-2 border-solid border-gray-6 bg-gray-8 px-6 py-3 shadow" class="flex flex-col justify-between gap-3 rounded-xl border border-l-2 border-solid border-gray-6 bg-gray-8 px-6 py-3 shadow"
style={`border-left-color: ${hsl(stringToHue(relay.url))}`} style={`border-left-color: ${hsl(stringToHue(relay.url))}`}>
in:fly={{y: 20}}>
<div class="flex items-center justify-between gap-2"> <div class="flex items-center justify-between gap-2">
<div class="flex min-w-0 items-center gap-2 text-xl"> <div class="flex min-w-0 items-center gap-2 text-xl">
<i class={relay.url.startsWith("ws://") ? "fa fa-unlock" : "fa fa-lock"} /> <i class={relay.url.startsWith("ws://") ? "fa fa-unlock" : "fa fa-lock"} />
@ -32,7 +30,7 @@
<RelayStatus {relay} /> <RelayStatus {relay} />
{/if} {/if}
{#if rating} {#if rating}
<div class="px-4 text-sm" in:fly={{y: 20}}> <div class="px-4 text-sm">
<Rating inert value={rating} /> <Rating inert value={rating} />
</div> </div>
{/if} {/if}

View File

@ -5,7 +5,6 @@
import {tryJson, displayDomain, pushToKey} from "src/util/misc" import {tryJson, displayDomain, pushToKey} from "src/util/misc"
import {copyToClipboard} from "src/util/html" import {copyToClipboard} from "src/util/html"
import {Tags} from "src/util/nostr" import {Tags} from "src/util/nostr"
import {fly} from "src/util/transition"
import {toast} from "src/partials/state" import {toast} from "src/partials/state"
import Image from "src/partials/Image.svelte" import Image from "src/partials/Image.svelte"
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
@ -102,7 +101,6 @@
document.title = "Apps" document.title = "Apps"
</script> </script>
<div in:fly={{y: 20}}>
<div class="flex flex-col gap-12 p-4"> <div class="flex flex-col gap-12 p-4">
<div class="flex flex-col items-center justify-center"> <div class="flex flex-col items-center justify-center">
<Heading>Recommended micro-apps</Heading> <Heading>Recommended micro-apps</Heading>
@ -128,14 +126,18 @@
</Anchor> </Anchor>
{/if} {/if}
{#if app.profile.lud16} {#if app.profile.lud16}
<Anchor class="mb-2 mr-2 inline-block cursor-pointer" on:click={() => copy("Address", app.profile.lud16)}> <Anchor
class="mb-2 mr-2 inline-block cursor-pointer"
on:click={() => copy("Address", app.profile.lud16)}>
<Chip> <Chip>
<i class="fa fa-bolt" />{app.profile.lud16} <i class="fa fa-bolt" />{app.profile.lud16}
</Chip> </Chip>
</Anchor> </Anchor>
{/if} {/if}
{#if app.profile.nip05} {#if app.profile.nip05}
<Anchor class="mb-2 mr-2 inline-block cursor-pointer" on:click={() => goToNip05(app.profile.nip05)}> <Anchor
class="mb-2 mr-2 inline-block cursor-pointer"
on:click={() => goToNip05(app.profile.nip05)}>
<Chip> <Chip>
<i class="fa fa-at" />{app.profile.nip05} <i class="fa fa-at" />{app.profile.nip05}
</Chip> </Chip>
@ -154,4 +156,3 @@
{/each} {/each}
</div> </div>
</div> </div>
</div>

View File

@ -26,7 +26,7 @@
{#if confirmed} {#if confirmed}
<div in:fly={{y: 20}}>Clearing your local database...</div> <div in:fly={{y: 20}}>Clearing your local database...</div>
{:else} {:else}
<div class="flex flex-col items-center gap-8" in:fly={{y: 20}}> <div class="flex flex-col items-center gap-8">
<div>Are you sure you want to log out? All data will be cleared.</div> <div>Are you sure you want to log out? All data will be cleared.</div>
<Anchor theme="button" on:click={confirm}>Log out</Anchor> <Anchor theme="button" on:click={confirm}>Log out</Anchor>
</div> </div>

View File

@ -2,6 +2,7 @@
import {onMount} from "svelte" import {onMount} from "svelte"
import {defer} from "hurdak" import {defer} from "hurdak"
import {isMobile} from "src/util/html" import {isMobile} from "src/util/html"
import {fly} from "src/util/transition"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import Spinner from "src/partials/Spinner.svelte" import Spinner from "src/partials/Spinner.svelte"
import Note from "src/app/shared/Note.svelte" import Note from "src/app/shared/Note.svelte"
@ -23,6 +24,8 @@
{#await promise} {#await promise}
<Spinner /> <Spinner />
{:then note} {:then note}
<div in:fly={{y: 20}}>
<Note showLoading anchorId={note.id} {note} {depth} {relays} {context} /> <Note showLoading anchorId={note.id} {note} {depth} {relays} {context} />
</div>
{/await} {/await}
</Content> </Content>

View File

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import {find, assocPath} from "ramda" import {find, assocPath} from "ramda"
import {onMount} from "svelte" import {onMount} from "svelte"
import {fly} from "src/util/transition"
import {now, createScroller, formatTimestampAsDate} from "src/util/misc" import {now, createScroller, formatTimestampAsDate} from "src/util/misc"
import {noteKinds, reactionKinds} from "src/util/nostr" import {noteKinds, reactionKinds} from "src/util/nostr"
import Tabs from "src/partials/Tabs.svelte" import Tabs from "src/partials/Tabs.svelte"
@ -30,7 +29,7 @@
export let activeTab = tabs[0] export let activeTab = tabs[0]
let limit = 5 let limit = 4
$: tabKinds = activeTab === tabs[0] ? noteKinds : reactionKinds.concat(9734) $: tabKinds = activeTab === tabs[0] ? noteKinds : reactionKinds.concat(9734)
@ -55,7 +54,7 @@
}) })
const scroller = createScroller(async () => { const scroller = createScroller(async () => {
limit += 5 limit += 4
}) })
return () => { return () => {
@ -65,7 +64,6 @@
}) })
</script> </script>
<div in:fly={{y: 20, delay: 500}}>
<Content> <Content>
<Tabs {tabs} {activeTab} {setActiveTab} /> <Tabs {tabs} {activeTab} {setActiveTab} />
{#each tabNotifications as notification, i (notification.key)} {#each tabNotifications as notification, i (notification.key)}
@ -87,4 +85,3 @@
<Content size="lg" class="text-center">No notifications found - check back later!</Content> <Content size="lg" class="text-center">No notifications found - check back later!</Content>
{/each} {/each}
</Content> </Content>
</div>

View File

@ -2,7 +2,6 @@
import {onMount} from "svelte" import {onMount} from "svelte"
import {generatePrivateKey} from "nostr-tools" import {generatePrivateKey} from "nostr-tools"
import {closure, sleep} from "hurdak" import {closure, sleep} from "hurdak"
import {fly} from "src/util/transition"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import OnboardingIntro from "src/app/views/OnboardingIntro.svelte" import OnboardingIntro from "src/app/views/OnboardingIntro.svelte"
import OnboardingProfile from "src/app/views/OnboardingProfile.svelte" import OnboardingProfile from "src/app/views/OnboardingProfile.svelte"
@ -95,7 +94,6 @@
</script> </script>
{#key stage} {#key stage}
<div in:fly={{y: 20}}>
<Content size="lg"> <Content size="lg">
{#if stage === "intro"} {#if stage === "intro"}
<OnboardingIntro {setStage} /> <OnboardingIntro {setStage} />
@ -111,5 +109,4 @@
<OnboardingNote {setStage} {signup} /> <OnboardingNote {setStage} {signup} />
{/if} {/if}
</Content> </Content>
</div>
{/key} {/key}

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import RelayCard from "src/app/shared/RelayCard.svelte" import RelayCard from "src/app/shared/RelayCard.svelte"
@ -11,7 +10,6 @@
document.title = "Relays" document.title = "Relays"
</script> </script>
<div in:fly={{y: 20}}>
<Content> <Content>
<div class="flex justify-between"> <div class="flex justify-between">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@ -23,8 +21,8 @@
</Anchor> </Anchor>
</div> </div>
<p> <p>
Relays are hubs for your content and connections. At least one is required to interact with Relays are hubs for your content and connections. At least one is required to interact with the
the network, but you can join as many as you like. network, but you can join as many as you like.
</p> </p>
{#if $relayPolicies.length === 0} {#if $relayPolicies.length === 0}
<div class="mt-8 flex items-center justify-center gap-2 text-center"> <div class="mt-8 flex items-center justify-center gap-2 text-center">
@ -38,4 +36,3 @@
{/each} {/each}
</div> </div>
</Content> </Content>
</div>

View File

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import {onMount} from "svelte" import {onMount} from "svelte"
import {pluck, identity} from "ramda" import {pluck, identity} from "ramda"
import {fly} from "src/util/transition"
import {Tags} from "src/util/nostr" import {Tags} from "src/util/nostr"
import {toast, appName} from "src/partials/state" import {toast, appName} from "src/partials/state"
import Input from "src/partials/Input.svelte" import Input from "src/partials/Input.svelte"
@ -49,7 +48,7 @@
document.title = "Content Preferences" document.title = "Content Preferences"
</script> </script>
<form on:submit|preventDefault={submit} in:fly={{y: 20}}> <form on:submit|preventDefault={submit}>
<Content> <Content>
<div class="mb-4 flex flex-col items-center justify-center"> <div class="mb-4 flex flex-col items-center justify-center">
<Heading>Content Settings</Heading> <Heading>Content Settings</Heading>
@ -75,7 +74,8 @@
</div> </div>
<Input type="range" bind:value={settings.min_wot_score} min={0} max={100} /> <Input type="range" bind:value={settings.min_wot_score} min={0} max={100} />
<p slot="info"> <p slot="info">
Select a minimum <Anchor theme="anchor" modal href="/help/web-of-trust">web-of-trust</Anchor> Select a minimum <Anchor theme="anchor" modal href="/help/web-of-trust"
>web-of-trust</Anchor>
score. Notes from accounts with a lower score will be automatically hidden. score. Notes from accounts with a lower score will be automatically hidden.
</p> </p>
</Field> </Field>

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import {nip19} from "nostr-tools" import {nip19} from "nostr-tools"
import {copyToClipboard} from "src/util/html" import {copyToClipboard} from "src/util/html"
import Input from "src/partials/Input.svelte" import Input from "src/partials/Input.svelte"
@ -27,7 +26,6 @@
document.title = "Keys" document.title = "Keys"
</script> </script>
<div in:fly={{y: 20}}>
<Content> <Content>
<div class="flex flex-col items-center justify-center"> <div class="flex flex-col items-center justify-center">
<Heading>Your Keys</Heading> <Heading>Your Keys</Heading>
@ -89,11 +87,10 @@
on:click={() => copyKey("bunker", $session.bunkerKey)} /> on:click={() => copyKey("bunker", $session.bunkerKey)} />
</Input> </Input>
<p class="text-sm text-gray-1"> <p class="text-sm text-gray-1">
Your bunker key is used to authorize Coracle with your nsec bunker to sign events on Your bunker key is used to authorize Coracle with your nsec bunker to sign events on your
your behalf. Save this if you would like to log in elsewhere without re-authorizing. behalf. Save this if you would like to log in elsewhere without re-authorizing.
</p> </p>
</div> </div>
{/if} {/if}
</div> </div>
</Content> </Content>
</div>

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import Input from "src/partials/Input.svelte" import Input from "src/partials/Input.svelte"
import ImageInput from "src/partials/ImageInput.svelte" import ImageInput from "src/partials/ImageInput.svelte"
import Textarea from "src/partials/Textarea.svelte" import Textarea from "src/partials/Textarea.svelte"
@ -29,7 +28,7 @@
document.title = "Profile" document.title = "Profile"
</script> </script>
<form on:submit|preventDefault={submit} in:fly={{y: 20}}> <form on:submit|preventDefault={submit}>
<Content> <Content>
<div class="mb-4 flex flex-col items-center justify-center"> <div class="mb-4 flex flex-col items-center justify-center">
<Heading>About You</Heading> <Heading>About You</Heading>

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import {fly} from "src/util/transition"
import {toast, appName} from "src/partials/state" import {toast, appName} from "src/partials/state"
import Field from "src/partials/Field.svelte" import Field from "src/partials/Field.svelte"
import FieldInline from "src/partials/FieldInline.svelte" import FieldInline from "src/partials/FieldInline.svelte"
@ -21,7 +20,7 @@
document.title = "Settings" document.title = "Settings"
</script> </script>
<form on:submit|preventDefault={submit} in:fly={{y: 20}}> <form on:submit|preventDefault={submit}>
<Content> <Content>
<div class="mb-4 flex flex-col items-center justify-center"> <div class="mb-4 flex flex-col items-center justify-center">
<Heading>App Settings</Heading> <Heading>App Settings</Heading>

View File

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import cx from "classnames" import cx from "classnames"
import {createEventDispatcher} from "svelte" import {createEventDispatcher} from "svelte"
import {fly} from "src/util/transition"
export let interactive = false export let interactive = false
export let stopPropagation = false export let stopPropagation = false
@ -35,7 +34,6 @@
</script> </script>
<div <div
in:fly={{y: 20}}
on:mousedown={startClick} on:mousedown={startClick}
on:touchstart={startClick} on:touchstart={startClick}
on:click={onClick} on:click={onClick}