Revert "perf: improve efficiency and performance"
This commit is contained in:
1 parent
7e188f218a
commit
4177b42fc2
32 files changed
+470
-248
No files matched your search
@@ -38,10 +38,9 @@
|
||||
src={open ? Minus : Plus}
|
||||
size="16"
|
||||
micro
|
||||
class={[
|
||||
open && 'rotate-180',
|
||||
'transition-transform duration-300 ease-out',
|
||||
]}
|
||||
class="{open
|
||||
? ''
|
||||
: 'rotate-90'} transition-transform duration-300 ease-out"
|
||||
/>
|
||||
{/if}
|
||||
<div
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { fly } from 'svelte/transition'
|
||||
import { page as pageData } from '$app/state'
|
||||
import { invalidate } from '$app/navigation'
|
||||
import { SvelteURLSearchParams } from 'svelte/reactivity'
|
||||
|
||||
interface Props {
|
||||
page?: number
|
||||
@@ -28,8 +27,8 @@
|
||||
|
||||
let customHref = (href?: string) => {
|
||||
if (href?.startsWith('?')) {
|
||||
const current = new SvelteURLSearchParams(pageData.url.searchParams)
|
||||
const newParams = new SvelteURLSearchParams(href)
|
||||
const current = new URLSearchParams(pageData.url.searchParams)
|
||||
const newParams = new URLSearchParams(href)
|
||||
|
||||
current.delete(Array.from(newParams.keys())[0])
|
||||
current.append(
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<script lang="ts">
|
||||
let progress = $state(0)
|
||||
|
||||
let increaseInterval: number = -1
|
||||
let startTimeout: number = -1
|
||||
let stopTimeout: number = -1
|
||||
|
||||
export function start() {
|
||||
clearTimeout(stopTimeout)
|
||||
progress = 0
|
||||
startTimeout = setTimeout(() => {
|
||||
progress = 1
|
||||
// schedule a setInterval and run the code immediately
|
||||
;(function i() {
|
||||
if (progress < 100 && progress > 0)
|
||||
// slowly get closer and closer to 90% -- 100% doesnt look very good to be stuck on
|
||||
progress += (100 - (progress - 10)) / 4
|
||||
increaseInterval = setInterval(i, 400) as unknown as number
|
||||
})()
|
||||
}, 100) as unknown as number
|
||||
}
|
||||
|
||||
export function stop() {
|
||||
if (progress != 0) progress = 100
|
||||
// reset progress to 0 after bar disappears
|
||||
setTimeout(() => (progress = 0), 500)
|
||||
clearInterval(increaseInterval)
|
||||
clearTimeout(startTimeout)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class={[
|
||||
'fixed top-0 left-0 h-px z-[400] bg-primary-900 dark:bg-primary-100',
|
||||
progress == 100 && 'opacity-0',
|
||||
progress > 0 && 'use-transition',
|
||||
]}
|
||||
style="width: {progress}%;"
|
||||
id="progress-bar"
|
||||
></div>
|
||||
|
||||
<style>
|
||||
#progress-bar.use-transition {
|
||||
transition:
|
||||
width 0.7s cubic-bezier(0, 0, 0.22, 0.76),
|
||||
opacity 0.5s linear;
|
||||
}
|
||||
</style>
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 80rem) {
|
||||
@media (min-width: 1280px) {
|
||||
.content {
|
||||
grid-template-columns: 20% 60% 20%;
|
||||
justify-items: end center start;
|
||||
|
||||
@@ -45,7 +45,6 @@ import {
|
||||
ViewColumns,
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import { SvelteURL } from 'svelte/reactivity'
|
||||
|
||||
export interface Group {
|
||||
name: string
|
||||
@@ -412,7 +411,7 @@ export function getGroups(
|
||||
f.community.name,
|
||||
f.community.actor_id,
|
||||
)}`,
|
||||
detail: new SvelteURL(f.community.actor_id).hostname,
|
||||
detail: new URL(f.community.actor_id).hostname,
|
||||
})) ?? [],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
</script>
|
||||
|
||||
<SidebarButton
|
||||
alignment="left"
|
||||
loading={switching}
|
||||
rounding="lg"
|
||||
loaderWidth={22}
|
||||
selected={profile.current?.id == prof.id}
|
||||
onclick={async () => {
|
||||
@@ -45,10 +47,9 @@
|
||||
/>
|
||||
{/snippet}
|
||||
<span
|
||||
class={[
|
||||
'inline-flex flex-col gap-0',
|
||||
profile.current?.id == prof.id && 'font-semibold',
|
||||
]}
|
||||
class="inline-flex flex-col gap-0 {profile.current?.id == prof.id
|
||||
? 'font-semibold'
|
||||
: ''}"
|
||||
>
|
||||
{prof.username ?? prof.user?.local_user_view.person.name}
|
||||
{#if !guest && !LINKED_INSTANCE_URL}
|
||||
|
||||
@@ -34,25 +34,29 @@
|
||||
{#if profile.current?.jwt}
|
||||
<SidebarButton icon={UserCircle} href="/profile">
|
||||
{#snippet label()}
|
||||
{$t('profile.profile')}
|
||||
<span>
|
||||
{$t('profile.profile')}
|
||||
</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Inbox} href="/inbox">
|
||||
{#snippet label()}
|
||||
{$t('profile.inbox')}
|
||||
{#if $notifications.inbox}
|
||||
<Badge
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
color="red-subtle"
|
||||
>
|
||||
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
|
||||
</Badge>
|
||||
{/if}
|
||||
<span class="flex items-center gap-2">
|
||||
{$t('profile.inbox')}
|
||||
{#if $notifications.inbox}
|
||||
<Badge
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
color="red-subtle"
|
||||
>
|
||||
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
|
||||
</Badge>
|
||||
{/if}
|
||||
</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Bookmark} href="/saved">
|
||||
{#snippet label()}
|
||||
{$t('profile.saved')}
|
||||
<span>{$t('profile.saved')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{:else}
|
||||
@@ -62,7 +66,7 @@
|
||||
icon={ArrowLeftOnRectangle}
|
||||
>
|
||||
{#snippet label()}
|
||||
{$t('account.login')}
|
||||
<span>{$t('account.login')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton
|
||||
@@ -71,7 +75,7 @@
|
||||
icon={Identification}
|
||||
>
|
||||
{#snippet label()}
|
||||
{$t('account.signup')}
|
||||
<span>{$t('account.signup')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton
|
||||
@@ -80,7 +84,7 @@
|
||||
icon={Cog6Tooth}
|
||||
>
|
||||
{#snippet label()}
|
||||
{$t('nav.menu.settings')}
|
||||
<span>{$t('nav.menu.settings')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/if}
|
||||
@@ -105,7 +109,9 @@
|
||||
{/snippet}
|
||||
<div class="w-full flex gap-px flex-col">
|
||||
{#each [...profile.meta.profiles] as prof, index}
|
||||
<ProfileButton {index} {prof} />
|
||||
<div class="w-full">
|
||||
<ProfileButton {index} {prof} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<SidebarButton href="/accounts" icon={UserGroup}>
|
||||
|
||||
Reference in new issue
Block a user