feat: make subscribebd communities reflect instantly

This commit is contained in:
Xyphyn committed 2023-10-04 17:51:11 -07:00
1 parent 709aded3a8
commit 54e3431bc4
4 files changed
+14 -10

No files matched your search

@@ -14,6 +14,7 @@
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
import { isSubscribed } from '$lib/util.js' import { isSubscribed } from '$lib/util.js'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import { addSubscription } from '$lib/lemmy/user.js'
export let community: CommunityView export let community: CommunityView
</script> </script>
@@ -38,10 +39,16 @@
const res = await subscribe() const res = await subscribe()
if (res) { if (res) {
community.subscribed = const newSubscribed =
res.community_view.subscribed != 'NotSubscribed' res.community_view.subscribed != 'NotSubscribed'
? 'Subscribed' ? 'Subscribed'
: 'NotSubscribed' : 'NotSubscribed'
community.subscribed = newSubscribed
addSubscription(
community.community,
newSubscribed == 'Subscribed'
)
} }
}} }}
color={isSubscribed(community.subscribed) ? 'elevatedLow' : 'primary'} color={isSubscribed(community.subscribed) ? 'elevatedLow' : 'primary'}
+2 -2
View File
@@ -34,7 +34,7 @@
} }
if (!$navigating) { if (!$navigating) {
if (typeof document != 'undefined') { if (typeof document != 'undefined') {
nProgress.done() nProgress.done(true)
document?.documentElement?.classList?.toggle('wait', false) document?.documentElement?.classList?.toggle('wait', false)
} }
} }
@@ -122,7 +122,7 @@
version={$site.version} version={$site.version}
/> />
{:else} {:else}
<div class="h-64 grid place-items-center"> <div class="h-64 w-64 grid place-items-center">
<Spinner width={32} /> <Spinner width={32} />
</div> </div>
{/if} {/if}
+3 -7
View File
@@ -23,13 +23,9 @@
<Button on:click={() => (siteOpen = !siteOpen)}>Site</Button> <Button on:click={() => (siteOpen = !siteOpen)}>Site</Button>
</span> </span>
</h1> </h1>
<Markdown source={$site.site_view.local_site.legal_information} /> <Markdown
</div> source={$site.site_view.local_site.legal_information ??
<div class="max-lg:hidden"> 'This instance does not have any legal information.'}
<SiteCard
site={$site.site_view}
admins={$site.admins}
taglines={$site.taglines}
/> />
</div> </div>
{:else} {:else}
+1
View File
@@ -50,6 +50,7 @@ body {
#nprogress .bar { #nprogress .bar {
@apply bg-black dark:bg-white !important; @apply bg-black dark:bg-white !important;
z-index: 999 !important; z-index: 999 !important;
height: 1px !important;
} }
#nprogress .peg { #nprogress .peg {