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