misc: Fix overflow (hopefully)

This commit is contained in:
Xyphyn committed 2023-07-01 11:47:34 -07:00
1 parent 38d387e2c2
commit d6ed6fbab1
8 files changed
+70 -32

No files matched your search

+1 -1
View File
@@ -22,6 +22,6 @@
</script>
<Navbar routes={$page.url.pathname.split('/').slice(1)} />
<div class="mx-auto max-w-5xl p-4">
<div class="mx-auto max-w-5xl p-4 overflow-hidden">
<slot />
</div>
+9 -3
View File
@@ -1,12 +1,18 @@
import { lemmy } from '$lib/lemmy.js'
import type { ListingType, SortType } from 'lemmy-js-client'
export function load(req) {
const page = Number(req.url.searchParams.get('page') || 1) || 1
console.log(page)
const sort: SortType =
(req.url.searchParams.get('sort') as SortType) || 'Active'
const listingType: ListingType =
(req.url.searchParams.get('type') as ListingType) || 'Local'
return lemmy.getPosts({
limit: 40,
page: page,
sort: 'Active',
type_: 'Local',
sort: sort,
type_: listingType,
})
}
+39 -9
View File
@@ -9,25 +9,55 @@
export let data
</script>
<div class="flex flex-row max-w-full">
<div class="flex flex-row max-w-full w-full">
<div class="flex flex-col gap-2">
<MultiSelect options={['Subscribed', 'Local', 'All']} selected="Local" />
<div class="flex flex-col sm:flex-row gap-4">
<MultiSelect
options={['Subscribed', 'Local', 'All']}
selected={$page.url.searchParams.get('type') ?? 'Local'}
on:select={(e) => {
const url = $page.url
url.searchParams.set('type', e.detail)
url.searchParams.delete('page')
goto(url, {
invalidateAll: true,
})
}}
/>
<MultiSelect
options={['Active', 'TopDay', 'New']}
optionNames={['Active', 'Top (Day)', 'New']}
selected={$page.url.searchParams.get('sort') ?? 'Active'}
on:select={(e) => {
const url = $page.url
url.searchParams.set('sort', e.detail)
url.searchParams.delete('page')
goto(url, {
invalidateAll: true,
})
}}
/>
</div>
<div class="flex flex-col gap-4">
<div class="flex flex-col gap-4 w-full">
{#each data.posts as post}
<Post {post} />
{/each}
</div>
<div>
<Button
on:click={() =>
goto(
`/?page=${(Number($page.url.searchParams.get('page')) || 1) + 1}`
)}
<Link
href={(function () {
$page.url.searchParams.set(
'page',
((Number($page.url.searchParams.get('page')) || 1) + 1).toString()
)
return $page.url.toString()
})()}
>
Next
</Button>
</Link>
</div>
</div>
</div>
+10 -7
View File
@@ -8,6 +8,7 @@
} from 'lemmy-js-client'
import type { CommentNodeI } from './comments.js'
import Comments from './Comments.svelte'
import SvelteMarkdown from 'svelte-markdown'
export let data: { post: GetPostResponse; comments: GetCommentsResponse }
@@ -81,12 +82,9 @@
return tree
}
let newComment = ''
async function comment() {}
</script>
<title>{data.post.post_view.post.name}</title>
<div class="flex flex-col gap-2">
<span class="flex flex-row gap-2 text-sm opacity-70">
<a href="/">c/{postData.community.name}</a>
@@ -94,13 +92,18 @@
</span>
<h1 class="font-bold text-lg">{post.name}</h1>
{#if post.thumbnail_url}
<img src={post.thumbnail_url} alt={post.name} />
<img
src={post.thumbnail_url}
alt={post.name}
class="rounded-md max-w-xl mx-auto"
/>
{/if}
{#if post.body}
<p
class="bg-slate-100 border border-slate-200 dark:border-zinc-800 dark:bg-zinc-900 p-2 text-sm rounded-md"
class="bg-slate-100 border border-slate-200 dark:border-zinc-800
dark:bg-zinc-900 p-2 text-sm rounded-md"
>
{post.body}
<SvelteMarkdown source={post.body} />
</p>
{/if}
</div>
+1 -1
View File
@@ -5,4 +5,4 @@
export let width: number
</script>
<img src={url} {alt} {width} class="rounded-full" />
<img src={url} {alt} {width} class="rounded-full aspect-square object-cover" />
+2 -1
View File
@@ -6,10 +6,11 @@
import RelativeDate from '$lib/components/RelativeDate.svelte'
export let node: CommentNodeI
export let open = true
</script>
<li class="py-2">
<details open class="flex flex-col gap-1">
<details {open} class="flex flex-col gap-1">
<summary class="flex flex-row cursor-pointer arrow gap-2 items-center">
<Avatar
url={node.comment_view.creator.avatar ??
+1 -1
View File
@@ -14,7 +14,7 @@
: 'ml-2 mx-2.5 px-2.5 border-l-2 border-black/10 dark:border-white/10'}
>
{#each nodes.slice(0, maxComments) as node}
<Comment {node} />
<Comment {node} open={true} />
{#if node.children?.length > 0}
<svelte:self nodes={node.children} isParent={false} />
{/if}
+7 -9
View File
@@ -18,8 +18,6 @@
let postRes: PostView
export { postRes as post }
const post = postRes.post
</script>
<div
@@ -34,19 +32,19 @@
<RelativeDate date={new Date(postRes.post.published)} />
</span>
</span>
<h1 class="font-bold text-lg">{post.name}</h1>
{#if post.url}
<h1 class="font-bold text-lg">{postRes.post.name}</h1>
{#if postRes.post.url}
<a
href={post.url}
href={postRes.post.url}
class="text-sky-400 max-w-[24ch] overflow-hidden
whitespace-nowrap text-ellipsis text-xs hover:underline"
>
{post.url}
{postRes.post.url}
</a>
{/if}
{#if post.body}
{#if postRes.post.body}
<p class="text-sm max-h-24 line-clamp-3">
{post.body}
{postRes.post.body}
</p>
{/if}
</div>
@@ -67,7 +65,7 @@
<a
class="flex flex-row items-center gap-2.5 p-1 px-2 rounded-md
bg-slate-100 dark:bg-zinc-800"
href="/post/{post.id}"
href="/post/{postRes.post.id}"
>
<Icon src={ChatBubbleLeft} width={16} height={16} />
<span class="text-sm">{postRes.counts.comments}</span>