Skip to content

Commit e0ee033

Browse files
committed
Feedback on refresh.
1 parent b184fda commit e0ee033

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

src/lib/EditableText.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/>{:else}<span class="text"
5656
>{#if text.length === 0}&mdash;{:else}{text}{/if}</span
5757
>{/if}
58-
{#if saving}<Loading text="" />{:else}<Button tip="Save this edit" action={save}
58+
{#if saving}<Loading />{:else}<Button tip="Save this edit" action={save}
5959
>{#if editing}&checkmark;{:else}✎{/if}</Button
6060
>{/if}
6161
</form>

src/lib/Loading.svelte

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
text?: string;
77
}
88
9-
let { inline = true, text = 'Loading...' }: Props = $props();
9+
let { inline = true }: Props = $props();
1010
</script>
1111

12-
<div class:inline>
13-
{text} <span class="dots">{Logo}</span>
14-
</div>
12+
<div class:inline><span class="dots">{Logo}</span></div>
1513

1614
<style>
1715
div {
@@ -30,17 +28,20 @@
3028
3129
.dots {
3230
display: inline-block;
33-
text-align: center;
31+
text-align: baseline;
3432
transform-origin: center;
35-
animation: spin 1s infinite linear;
33+
animation: spin 1s infinite ease-in-out;
3634
}
3735
3836
@keyframes spin {
39-
from {
40-
transform: rotate(0deg);
37+
0% {
38+
transform: translateX(-0.5em);
4139
}
42-
to {
43-
transform: rotate(360deg);
40+
50% {
41+
transform: translateX(0.5em);
42+
}
43+
100% {
44+
transform: translateX(-0.5em);
4445
}
4546
}
4647
</style>

src/lib/MarkupView.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
</div>
119119
{/if}
120120
{#if edit}<div class="control">
121-
{#if saving}<Loading text="" />
121+
{#if saving}<Loading />
122122
{:else}
123123
<Button
124124
tip={editing ? 'Save your edits.' : 'Start editing this markup.'}

src/routes/org/[orgid]/+layout.svelte

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
import { invalidateAll } from '$app/navigation';
2525
import { type OrganizationRow } from '$database/Organization';
2626
import { navigating } from '$app/state';
27+
import Loading from '$lib/Loading.svelte';
2728
2829
let { data, children } = $props();
2930
31+
let loading = $state(false);
32+
3033
const db = getDB();
3134
3235
// Create a state to store the current organization. We'll store this as context.
@@ -55,7 +58,8 @@
5558
// When realtime reports revised data, and we aren't navigating, reload all data and render accordingly.
5659
function updateOrg() {
5760
if (navigating.to === null) {
58-
invalidateAll();
61+
loading = true;
62+
invalidateAll().then(() => (loading = false));
5963
}
6064
}
6165
@@ -74,3 +78,21 @@
7478
</script>
7579

7680
{@render children()}
81+
{#if loading}
82+
<div class="banner">
83+
<Loading />
84+
</div>
85+
{/if}
86+
87+
<style>
88+
.banner {
89+
position: fixed;
90+
left: 0;
91+
right: 0;
92+
top: var(--spacing);
93+
display: flex;
94+
flex-direction: row;
95+
align-items: center;
96+
justify-content: center;
97+
}
98+
</style>

0 commit comments

Comments
 (0)