optimize: denest post
This commit is contained in:
1 parent
53318d2e5b
commit
725bce893c
2 files changed
+10
-32
No files matched your search
@@ -29,14 +29,12 @@
|
|||||||
export let view = $userSettings.view
|
export let view = $userSettings.view
|
||||||
|
|
||||||
$: type = mediaType(post.post.url, view)
|
$: type = mediaType(post.post.url, view)
|
||||||
|
|
||||||
let loaded = false
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Material
|
<Material
|
||||||
color={view != 'card' ? 'none' : 'distinct'}
|
color={view != 'card' ? 'none' : 'distinct'}
|
||||||
padding="none"
|
padding="none"
|
||||||
class="relative max-w-full min-w-0 w-full group z-10 isolation-auto
|
class="relative max-w-full min-w-0 w-full group z-10 flex flex-col gap-2
|
||||||
{view != 'card' ? 'bg-transparent !border-0' : 'p-5'} {view == 'compact'
|
{view != 'card' ? 'bg-transparent !border-0' : 'p-5'} {view == 'compact'
|
||||||
? 'py-4'
|
? 'py-4'
|
||||||
: view == 'list'
|
: view == 'list'
|
||||||
@@ -52,13 +50,6 @@
|
|||||||
"
|
"
|
||||||
></button>
|
></button>
|
||||||
{/if}
|
{/if}
|
||||||
<div
|
|
||||||
class="flex {$userSettings.leftAlign
|
|
||||||
? 'flex-row-reverse'
|
|
||||||
: 'flex-row'} gap-4 max-w-full w-full min-w-0"
|
|
||||||
>
|
|
||||||
<div class="flex flex-col w-full gap-2 flex-1 max-w-full min-w-0">
|
|
||||||
<div class="flex flex-col w-full gap-2 z-10">
|
|
||||||
<PostMeta
|
<PostMeta
|
||||||
community={hideCommunity ? undefined : post.community}
|
community={hideCommunity ? undefined : post.community}
|
||||||
user={post.creator}
|
user={post.creator}
|
||||||
@@ -74,35 +65,19 @@
|
|||||||
.includes(post.community.id)
|
.includes(post.community.id)
|
||||||
? 'Subscribed'
|
? 'Subscribed'
|
||||||
: 'NotSubscribed'}
|
: 'NotSubscribed'}
|
||||||
|
id={post.post.id}
|
||||||
|
title={post.post.name}
|
||||||
>
|
>
|
||||||
<slot name="badges" slot="badges" />
|
<slot name="badges" slot="badges" />
|
||||||
</PostMeta>
|
</PostMeta>
|
||||||
{#if !(post.post.embed_title == post.post.name && type == 'embed') || view == 'compact'}
|
|
||||||
<a
|
|
||||||
target={$userSettings.openLinksInNewTab ? '_blank' : ''}
|
|
||||||
href="/post/{getInstance()}/{post.post.id}"
|
|
||||||
class="font-medium max-w-full w-full break-words text-base"
|
|
||||||
style="word-break: break-word;"
|
|
||||||
class:text-slate-500={post.read && $userSettings.markReadPosts}
|
|
||||||
class:dark:text-zinc-400={post.read && $userSettings.markReadPosts}
|
|
||||||
>
|
|
||||||
<Markdown source={post.post.name} inline />
|
|
||||||
</a>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="contents z-50 isolate">
|
|
||||||
<PostMedia bind:post={post.post} {view} {type} />
|
<PostMedia bind:post={post.post} {view} {type} />
|
||||||
</div>
|
|
||||||
{#if post.post.body && !post.post.nsfw && view != 'compact'}
|
{#if post.post.body && !post.post.nsfw && view != 'compact'}
|
||||||
<PostBody body={post.post.body} {view} />
|
<PostBody body={post.post.body} {view} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
{#if view == 'list' || view == 'compact'}
|
{#if view == 'list' || view == 'compact'}
|
||||||
<PostMediaCompact {view} bind:post={post.post} />
|
<PostMediaCompact {view} bind:post={post.post} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
{#if actions}
|
{#if actions}
|
||||||
<div class="w-full mt-2">
|
|
||||||
<PostActions
|
<PostActions
|
||||||
bind:post
|
bind:post
|
||||||
on:edit={(e) => {
|
on:edit={(e) => {
|
||||||
@@ -112,6 +87,5 @@
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</Material>
|
</Material>
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
<CommunityLink {community} style="grid-area: community;" />
|
<CommunityLink {community} style="grid-area: community;" />
|
||||||
{/if}
|
{/if}
|
||||||
<span
|
<span
|
||||||
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 flex-wrap items-center row-span-2"
|
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 flex-wrap items-center row-span-1"
|
||||||
style="grid-area: stats;"
|
style="grid-area: stats;"
|
||||||
>
|
>
|
||||||
{#if user}
|
{#if user}
|
||||||
@@ -127,12 +127,16 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<slot name="badges" />
|
<slot name="badges" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{#if title && id}
|
{#if title && id}
|
||||||
<a href="/post/{getInstance()}/{id}" class="font-medium">
|
<a
|
||||||
|
href="/post/{getInstance()}/{id}"
|
||||||
|
class="font-medium row-span-1 text-base"
|
||||||
|
style="grid-area: title;"
|
||||||
|
>
|
||||||
{title}
|
{title}
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.meta {
|
.meta {
|
||||||
|
|||||||
Reference in new issue
Block a user