misc: improve inbox tabs

This commit is contained in:
Xylight committed 2024-09-21 11:41:22 -07:00
1 parent 5e45191565
commit 98767a41f5
4 files changed
+70 -45

No files matched your search

@@ -38,8 +38,6 @@
import InfiniteScroll from 'svelte-infinite-scroll'
import type { Readable } from 'svelte/motion'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import { postLink } from '../helpers'
import { writable } from 'svelte/store'
export let posts: PostView[]
export let community: boolean = false
@@ -53,16 +51,7 @@
estimateSize: () => 150,
overscan: 5,
measureElement: (element, entry, instance) => {
const direction = instance.scrollDirection
if (direction === 'forward' || direction === null) {
return element.scrollHeight
} else {
const indexKey = Number(element.getAttribute('data-index'))
// didnt ask
// @ts-ignore
let cacheMeasurement = instance.itemSizeCache.get(indexKey)
return cacheMeasurement
}
return element.scrollHeight
},
})
@@ -20,7 +20,7 @@
"
>
<h1
class="text-3xl font-medium flex items-center gap-2 w-full
class="text-3xl font-medium flex gap-2 w-full
{$userSettings.font == 'satoshi/nunito'
? 'font-display'
: ''} {$$props.class ?? ''}"
@@ -11,9 +11,15 @@
export let isSelected: (
url: URL,
currentRoute: string | undefined,
route: string
route: string,
defaultRoute?: string
) => boolean = (url, currentRoute, route) =>
(currentRoute ?? url.pathname) == route
export let buildUrl: (
currentRoute: string | undefined,
href: string
) => string = (route, href) => href
export let defaultRoute: string | undefined
</script>
<nav
@@ -25,12 +31,12 @@
{#each routes as route}
<a
on:click={() => invalidate(route.href)}
href={route.href}
href={buildUrl(currentRoute, route.href)}
class="font-medium rounded-full px-4 py-1 hover:bg-slate-200/40 hover:dark:bg-zinc-700/40
transition-colors duration-100 relative z-0 flex-shrink-0"
>
{route.name}
{#if isSelected($page.url, currentRoute, route.href)}
{#if isSelected($page.url, currentRoute, route.href, defaultRoute)}
<div
class="rounded-full bg-slate-100/60 dark:bg-zinc-700/60
absolute inset-0 w-full h-full -z-10"