Skip to content

Commit fb5f659

Browse files
authored
Merge pull request #118 from SnowCait/loading-timeline-animation
Loading timeline animation
2 parents 3f642b8 + c6a119f commit fb5f659

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

web/src/routes/TimelineView.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import Reaction from './timeline/Reaction.svelte';
99
import { pubkey } from '../stores/Author';
1010
import { Author } from '$lib/Author';
11+
import Loading from './Loading.svelte';
1112
1213
export let events: Event[] = [];
1314
export let readonly = false;
1415
export let focusEventId: string | undefined = undefined;
1516
export let load: () => Promise<void>;
17+
export let showLoading = true;
1618
export let createdAtFormat: 'auto' | 'time' = 'auto';
1719
1820
let loading = false;
@@ -55,6 +57,9 @@
5557
</li>
5658
{/each}
5759
</ul>
60+
{#if showLoading}
61+
<div class="loading"><Loading /></div>
62+
{/if}
5863

5964
<style>
6065
ul {
@@ -79,6 +84,11 @@
7984
border-left: 2px solid lightcoral;
8085
}
8186
87+
.loading {
88+
width: 24px;
89+
margin: 0 auto;
90+
}
91+
8292
@keyframes add {
8393
0% {
8494
opacity: 0;

web/src/routes/[note=note]/+page.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,10 @@
137137

138138
<h1>note</h1>
139139

140-
<TimelineView {events} readonly={false} focusEventId={eventId} load={async () => console.debug()} />
140+
<TimelineView
141+
{events}
142+
readonly={false}
143+
focusEventId={eventId}
144+
load={async () => console.debug()}
145+
showLoading={false}
146+
/>

web/src/routes/[npub=npub]/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
events={notes}
293293
readonly={!$authorPubkey}
294294
load={async () => {
295-
console.warn('load', pubkey);
296295
const oldestCreatedAt = notes.at(notes.length - 1)?.created_at;
297296
const events = await fetchPastNotes(
298297
pubkey,

web/src/routes/search/+page.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@
117117

118118
<NoteIdsView />
119119

120-
<TimelineView events={$searchEvents} readonly={true} load={async () => console.debug()} />
120+
<TimelineView
121+
events={$searchEvents}
122+
readonly={true}
123+
load={async () => console.debug()}
124+
showLoading={false}
125+
/>
121126

122127
<style>
123128
h1 a {

0 commit comments

Comments
 (0)