cleanup: remove list mode

This commit is contained in:
James Xylight committed 2025-02-03 20:25:48 -08:00
1 parent 6ce5dc86fb
commit 87672a667c
7 files changed
+15 -46

No files matched your search

@@ -31,11 +31,7 @@
<Material
class="flex flex-col flex-1 {view != 'card'
? '!bg-transparent !border-0 rounded-none'
: 'p-5'} {view == 'list'
? 'py-5'
: view == 'compact'
? 'py-4'
: 'py-5'} {clazz}"
: 'p-5'} {view == 'compact' ? 'py-4' : 'py-5'} {clazz}"
color="distinct"
padding="none"
>
@@ -34,9 +34,6 @@
<Option value="cozy" icon={RectangleGroup}>
{$t('filter.view.cozy')}
</Option>
<Option value="list" icon={QueueList}>
{$t('filter.view.list')}
</Option>
<Option value="compact" icon={Bars3}>
{$t('filter.view.compact')}
</Option>
+5 -16
View File
@@ -3,15 +3,13 @@
import { isImage, isVideo } from '$lib/ui/image.js'
import { getInstance } from '$lib/lemmy.js'
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
import { settings } from '$lib/settings.svelte.js'
import { settings, type View } from '$lib/settings.svelte.js'
import PostLink from '$lib/components/lemmy/post/link/PostLink.svelte'
import PostMeta, {
parseTags,
type Tag,
} from '$lib/components/lemmy/post/PostMeta.svelte'
import { Badge, Material, toast } from 'mono-svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
import {
bestImageURL,
mediaType,
@@ -19,12 +17,7 @@
} from '$lib/components/lemmy/post/helpers.js'
import Empty from '$lib/components/helper/Empty.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import {
ArrowUp,
ChatBubbleOvalLeft,
Icon,
VideoCamera,
} from 'svelte-hero-icons'
import { ArrowUp, ChatBubbleOvalLeft, Icon } from 'svelte-hero-icons'
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
import PostBody from './PostBody.svelte'
@@ -58,7 +51,7 @@
post: PostView
actions?: boolean
hideCommunity?: boolean
view?: any
view?: View
style?: string
class?: string
badges?: import('svelte').Snippet
@@ -105,7 +98,6 @@
group
{settings.leftAlign ? 'left-align' : ''}
{view == 'compact' ? 'py-3 list-type compact' : ''}
{view == 'list' ? 'py-5 list-type' : ''}
{view == 'cozy' ? 'py-5 flex flex-col gap-2' : ''}
{clazz ?? ''}"
id={post.post.id.toString()}
@@ -152,10 +144,7 @@
{/snippet}
</PostMeta>
{#key post.post.url}
<div
style="grid-area:embed;"
class={view == 'list' || view == 'compact' ? '' : 'contents'}
>
<div style="grid-area:embed;" class={view == 'compact' ? '' : 'contents'}>
{#if rule != 'hide'}
<PostMedia
post={post.post}
@@ -165,7 +154,7 @@
/>
{/if}
</div>
{#if view == 'list' || view == 'compact'}
{#if view == 'compact'}
<PostMediaCompact
post={post.post}
{type}
@@ -4,14 +4,14 @@
import { Button } from 'mono-svelte'
import { ChevronDown, Icon } from 'svelte-hero-icons'
const MAX_HEIGHT = 192
let element = $state<Element>()
function isOverflown(element: Element) {
if (!element) return false
return (
element.scrollHeight > element.clientHeight ||
element.scrollWidth > element.clientWidth
)
return element.scrollHeight > MAX_HEIGHT
}
interface Props {
@@ -34,7 +34,7 @@
let overflows = $derived(element ? isOverflown(element) : false)
let expanded = $state(true)
let expanded = $state(false)
$effect(() => {
expanded = !overflows
})
@@ -46,8 +46,7 @@
class="{!expanded
? ` overflow-hidden
bg-gradient-to-b text-transparent from-slate-600 via-slate-600
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0
${view == 'list' ? `max-h-24` : 'max-h-48'}`
dark:from-zinc-400 dark:via-zinc-400 bg-clip-text z-0 max-h-48`
: 'text-slate-600 dark:text-zinc-400 max-h-full'} text-base {clazz}"
class:pointer-events-none={!clickThrough}
bind:this={element}
@@ -349,14 +349,6 @@ export function getGroups(
handle: () =>
settings.view = 'cozy'
},
{
name: t.get('nav.commands.setViewTo', {
default: t.get('filter.view.list'),
}),
icon: ViewColumns,
handle: () =>
settings.view = 'list'
},
],
},
{
+2 -2
View File
@@ -8,7 +8,7 @@ import type { Link } from './components/ui/navbar/link'
console.log('Using the following default settings from the environment:')
console.log(env)
export type View = 'card' | 'cozy' | 'list' | 'compact'
export type View = 'cozy' | 'compact'
export const SSR_ENABLED = env.PUBLIC_SSR_ENABLED?.toLowerCase() == 'true'
@@ -148,7 +148,7 @@ export const defaultSettings: Settings = {
debugInfo: toBool(env.PUBLIC_DEBUG_INFO) ?? false,
expandImages: toBool(env.PUBLIC_EXPAND_IMAGES) ?? true,
// @ts-ignore
view: env.PUBLIC_VIEW ?? 'cozy',
view: env.PUBLIC_VIEW ?? 'compact',
// @ts-ignore
font: env.PUBLIC_FONT ?? 'inter',
leftAlign: toBool(env.PUBLIC_LEFT_ALIGN) ?? false,