From 9530c63c1def8b5d122a0ffb5c8bdbdbda698be7 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Wed, 13 Dec 2023 13:20:32 -0500 Subject: [PATCH] Update RevisionsDialog to user Loader wrapper --- src/common/dialog/RevisionsDialog.svelte | 127 ++++++++++-------- .../stories/RevisionsDialog.stories.svelte | 7 + 2 files changed, 77 insertions(+), 57 deletions(-) diff --git a/src/common/dialog/RevisionsDialog.svelte b/src/common/dialog/RevisionsDialog.svelte index ae610fa11..716490ec3 100644 --- a/src/common/dialog/RevisionsDialog.svelte +++ b/src/common/dialog/RevisionsDialog.svelte @@ -14,6 +14,7 @@ import type { Revision } from "../RevisionIcon.svelte"; import RelativeTime from "../RelativeTime.svelte"; import { Sync16 } from "svelte-octicons"; + import Loader from "../Loader.svelte"; export let enabled: boolean; export let documentId: string; @@ -35,70 +36,82 @@ } -
-

{$_("dialogRevisionsDialog.heading")}

- -
-{#await getMePromise then user} - {#if isPremiumOrg(user.organization)} -
- -
- {#if enabled} -
- - {#each sortedRevisions as revision} - - -
{revision.version} -

{revision.comment}

- +{:then user} + +
+

{$_("dialogRevisionsDialog.heading")}

+ +
+ + {#if isPremiumOrg(user.organization)} +
+ +
+ {#if enabled} +
+ + {#each sortedRevisions as revision} + + + + - - + {:else} + - - {:else} - - {/each} -
{revision.version} +

{revision.comment}

+ +
{$_("dialogRevisionsDialog.empty")}
{$_("dialogRevisionsDialog.empty")}
-
- {#if revisions.length > 0}

- {$_("dialogRevisionsDialog.total", { - values: { n: revisions.length }, - })} -

{/if} + {/each} +
+
+ {#if revisions.length > 0}

+ {$_("dialogRevisionsDialog.total", { + values: { n: revisions.length }, + })} +

{/if} + {/if} + {:else if isOrgAdmin(user)} + triggerPremiumUpgradeFlow(user?.organization)} + /> + {:else} + {/if} - {:else if isOrgAdmin(user)} - triggerPremiumUpgradeFlow(user?.organization)} - /> - {:else} - - {/if} + {:catch} - + + + {/await}