Skip to content

Commit

Permalink
misc: restore <0.19.4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyphyn committed Jul 20, 2024
1 parent 7305ee6 commit 8785172
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
6 changes: 4 additions & 2 deletions src/lib/components/lemmy/post/feed/VirtualFeed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
})
afterNavigate(() => {
$virtualizer.scrollToIndex($postFeeds[feedId].lastSeen ?? 0)
$virtualizer.scrollToIndex($postFeeds[feedId]?.lastSeen ?? 0)
})
export let feedData: PostFeed['data']
Expand Down Expand Up @@ -122,7 +122,9 @@
if (!id) return
$postFeeds[feedId].lastSeen = Number(id)
postFeeds.updateFeed(feedId, {
lastSeen: Number(id),
})
observer.unobserve(element)
})
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const FEATURES = {
hidePosts: '0.19.4',
altText: '0.19.4',
customThumbnail: '0.19.4',
mediaAndVotes: '0.19.4',
distinguishComments: '0.19.4',
}

type Feature = keyof typeof FEATURES
Expand All @@ -19,7 +21,7 @@ type Feature = keyof typeof FEATURES
export const feature = (feature: Feature, version: string = '0.0.0'): boolean =>
versionIsSupported(version, FEATURES[feature])

export const MINIMUM_VERSION = '0.19.4'
export const MINIMUM_VERSION = '0.19.0'
export const MAXIMUM_VERSION = '0.999'

export const versionIsSupported = (v: string, minimum: string) => {
Expand Down
52 changes: 28 additions & 24 deletions src/routes/profile/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import MultiSelect from '$lib/components/input/Switch.svelte'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
import { site } from '$lib/lemmy'
import { t } from '$lib/translations'
import { feature } from '$lib/version'
import { Button, Menu, MenuButton } from 'mono-svelte'
import {
ArrowDown,
Expand Down Expand Up @@ -49,33 +51,35 @@
},
]}
/>
<Menu class="flex-1" placement="bottom-end">
<Button
title={$t('post.actions.more.label')}
slot="target"
size="square-lg"
rounding="pill"
color="none"
class="bg-[#fff]/60 dark:bg-neutral-800/60
{#if feature('mediaAndVotes', $site?.version)}
<Menu class="flex-1" placement="bottom-end">
<Button
title={$t('post.actions.more.label')}
slot="target"
size="square-lg"
rounding="pill"
color="none"
class="bg-[#fff]/60 dark:bg-neutral-800/60
border border-gray-200/60 dark:border-neutral-800
backdrop-blur-xl shadow-xl hover:bg-slate-100 hover:dark:bg-zinc-800
flex-shrink-0"
>
<Icon src={EllipsisHorizontal} size="16" mini />
</Button>
<MenuButton href="/profile/media">
<Icon src={Photo} size="16" mini slot="prefix" />
{$t('routes.profile.media.title')}
</MenuButton>
<MenuButton href="/profile/voted/up">
<Icon src={ArrowUp} size="16" micro slot="prefix" />
{$t('routes.profile.upvoted')}
</MenuButton>
<MenuButton href="/profile/voted/down">
<Icon src={ArrowDown} size="16" micro slot="prefix" />
{$t('routes.profile.downvoted')}
</MenuButton>
</Menu>
>
<Icon src={EllipsisHorizontal} size="16" mini />
</Button>
<MenuButton href="/profile/media">
<Icon src={Photo} size="16" mini slot="prefix" />
{$t('routes.profile.media.title')}
</MenuButton>
<MenuButton href="/profile/voted/up">
<Icon src={ArrowUp} size="16" micro slot="prefix" />
{$t('routes.profile.upvoted')}
</MenuButton>
<MenuButton href="/profile/voted/down">
<Icon src={ArrowDown} size="16" micro slot="prefix" />
{$t('routes.profile.downvoted')}
</MenuButton>
</Menu>
{/if}
</div>
<slot />
</div>

0 comments on commit 8785172

Please sign in to comment.