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