diff --git a/src/app/components/SpaceEdit.svelte b/src/app/components/SpaceEdit.svelte index 439e8f5a..4eee32df 100644 --- a/src/app/components/SpaceEdit.svelte +++ b/src/app/components/SpaceEdit.svelte @@ -1,6 +1,5 @@ diff --git a/src/app/components/SpaceMenuActions.svelte b/src/app/components/SpaceMenuActions.svelte index e8823102..62662552 100644 --- a/src/app/components/SpaceMenuActions.svelte +++ b/src/app/components/SpaceMenuActions.svelte @@ -28,9 +28,10 @@ type Props = { url: string + sheet?: boolean } - const {url}: Props = $props() + const {url, sheet = false}: Props = $props() const relay = $relays.one(url) const permissions = deriveSpacePermissions(url) @@ -38,17 +39,17 @@ const actionItems = deriveSpaceActionItems(url) const shouldNotify = deriveShouldNotify(url) - const createInvite = () => pushModal(SpaceInvite, {url}) + const createInvite = () => pushModal(SpaceInvite, {url}, {replaceState: sheet}) - const startEdit = () => pushModal(SpaceEdit, {url, initialValues: $relay || {url}}) + const startEdit = () => pushModal(SpaceEdit, {url}, {replaceState: sheet}) - const leaveSpace = () => pushModal(SpaceExit, {url}) + const leaveSpace = () => pushModal(SpaceExit, {url}, {replaceState: sheet}) - const joinSpace = () => pushModal(SpaceJoin, {url}) + const joinSpace = () => pushModal(SpaceJoin, {url}, {replaceState: sheet}) - const showActionItems = () => pushModal(SpaceActionItems, {url}) + const showActionItems = () => pushModal(SpaceActionItems, {url}, {replaceState: sheet}) - const contactOwner = () => goToChat([$relay!.pubkey!]) + const contactOwner = () => goToChat([$relay!.pubkey!], {replaceState: sheet}) const toggleSpaceNotifications = () => { popModal() @@ -61,32 +62,66 @@ icon: string, label: string, variant?: "error" | "primary", + dot?: boolean, )} -
  • + {#if sheet} -
  • + {:else} +
  • + +
  • + {/if} +{/snippet} + +{#snippet actionLink(href: string, icon: string, label: string)} + {#if sheet} + + + {label} + + {:else} +
  • + + + {label} + +
  • + {/if} {/snippet} {@render actionButton(createInvite, LinkRound, "Create Invite")} {#if $permissions.review} -
  • - -
  • + {@render actionButton( + showActionItems, + Danger, + `Action Items (${$actionItems.length})`, + undefined, + $actionItems.length > 0, + )} {/if} {#if $relay?.pubkey && $relay.pubkey !== $user.pubkey} {@render actionButton(contactOwner, Letter, "Contact Owner")} @@ -98,20 +133,10 @@ `${$shouldNotify ? "Turn off" : "Turn on"} notifications`, )} {:else} -
  • - - - Enable notifications - -
  • + {@render actionLink("/settings/alerts", Bell, "Enable notifications")} {/if} {#if HOSTING_ENABLED && $hostedRelay.relay} -
  • - - - Hosting settings - -
  • + {@render actionLink(makeSpacePath(url, "admin"), ServerPath, "Hosting settings")} {:else if $permissions.editSpace} {@render actionButton(startEdit, Pen, "Edit Space")} {/if} diff --git a/src/app/components/SpaceMenuActionsMobile.svelte b/src/app/components/SpaceMenuActionsMobile.svelte deleted file mode 100644 index b4c3807d..00000000 --- a/src/app/components/SpaceMenuActionsMobile.svelte +++ /dev/null @@ -1,115 +0,0 @@ - - -{#snippet actionButton( - onclick: () => void, - icon: string, - label: string, - variant?: "error" | "primary", -)} - -{/snippet} - -{@render actionButton(createInvite, LinkRound, "Create Invite")} -{#if $permissions.review} - -{/if} -{#if $relay?.pubkey && $relay.pubkey !== $user.pubkey} - {@render actionButton(contactOwner, Letter, "Contact Owner")} -{/if} -{#if $notificationSettings.push} - {@render actionButton( - toggleSpaceNotifications, - $shouldNotify ? Bell : BellOff, - `${$shouldNotify ? "Turn off" : "Turn on"} notifications`, - )} -{:else} - - - Enable notifications - -{/if} -{#if HOSTING_ENABLED && $hostedRelay.relay} - - - Hosting settings - -{:else if $permissions.editSpace} - {@render actionButton(startEdit, Pen, "Edit Space")} -{/if} -{#if $userSpaceUrls.includes(url)} - {@render actionButton(leaveSpace, Exit, "Leave Space", "error")} -{:else} - {@render actionButton(joinSpace, Login, "Join Space", "primary")} -{/if} diff --git a/src/app/components/SpaceMenuMobile.svelte b/src/app/components/SpaceMenuMobile.svelte index 95a8ff52..5a70bafa 100644 --- a/src/app/components/SpaceMenuMobile.svelte +++ b/src/app/components/SpaceMenuMobile.svelte @@ -1,7 +1,7 @@