Skip to content

Commit

Permalink
feat: revert notifications and audio list styles
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Feb 14, 2025
1 parent aff5486 commit 9fb0aff
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { FeedTitle } from "~/modules/feed/feed-title"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"

export function ArticleItem({ entryId, entryPreview, translation }: UniversalItemProps) {
return (
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} withDetails />
)
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
}

export function ArticleItemStateLess({ entry, feed }: EntryItemStatelessProps) {
Expand Down
4 changes: 1 addition & 3 deletions apps/renderer/src/modules/entry-column/Items/audio-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { FeedTitle } from "~/modules/feed/feed-title"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"

export function AudioItem({ entryId, entryPreview, translation }: UniversalItemProps) {
return (
<ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} withAudio />
)
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
}

export function AudioItemStateLess({ entry, feed }: EntryItemStatelessProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FeedTitle } from "~/modules/feed/feed-title"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"

export function NotificationItem({ entryId, entryPreview, translation }: UniversalItemProps) {
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} />
return <ListItem entryId={entryId} entryPreview={entryPreview} translation={translation} simple />
}

export function NotificationItemStateLess({ entry, feed }: EntryItemStatelessProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ export function ListItem({
entryId,
entryPreview,
translation,
withDetails,
withAudio,
simple,
}: UniversalItemProps & {
withDetails?: boolean
withAudio?: boolean
simple?: boolean
}) {
const isMobile = useMobile()
const entry = useEntry(entryId) || entryPreview
Expand Down Expand Up @@ -61,10 +59,10 @@ export function ListItem({
let lineClampTitle = settingWideMode ? 1 : 2
let lineClampDescription = settingWideMode ? 1 : 2

if (translation?.title) {
if (translation?.title && !simple) {
lineClampTitle += 1
}
if (translation?.description) {
if (translation?.description && !simple) {
lineClampDescription += 1
}

Expand All @@ -73,7 +71,9 @@ export function ListItem({

// FIXME: Safari bug, not support line-clamp cross elements
return {
global: !envIsSafari ? `line-clamp-[${lineClampTitle + lineClampDescription}]` : "",
global: !envIsSafari
? `line-clamp-[${simple ? lineClampTitle : lineClampTitle + lineClampDescription}]`
: "",
title: envIsSafari ? `line-clamp-[${lineClampTitle}]` : "",
description: envIsSafari ? `line-clamp-[${lineClampDescription}]` : "",
}
Expand All @@ -86,8 +86,8 @@ export function ListItem({

const related = feed || inbox

const hasAudio = entry.entries?.attachments?.[0]!.url
const hasMedia = entry.entries?.media?.[0]?.url
const hasAudio = simple ? false : !!entry.entries?.attachments?.[0]?.url
const hasMedia = simple ? false : !!entry.entries?.media?.[0]?.url

const marginWidth = 8 * (isMobile ? 1.125 : 1)
// calculate the max width to have a correct truncation
Expand All @@ -97,13 +97,13 @@ export function ListItem({
const mediaWidth = (settingWideMode ? 48 : 80) * (isMobile ? 1.125 : 1) + marginWidth

let savedWidth = 0
if (!withAudio) {
savedWidth += feedIconWidth
}
if (withAudio && hasAudio) {

savedWidth += feedIconWidth

if (hasAudio) {
savedWidth += audioCoverWidth
}
if (withDetails && hasMedia) {
if (hasMedia && !hasAudio) {
savedWidth += mediaWidth
}

Expand All @@ -116,7 +116,7 @@ export function ListItem({
settingWideMode ? "py-3" : "py-4",
)}
>
{!withAudio && <FeedIcon feed={related} fallback entry={entry.entries} />}
<FeedIcon feed={related} fallback entry={entry.entries} />
<div
className={cn("-mt-0.5 flex-1 text-sm leading-tight", lineClamp.global)}
style={{
Expand Down Expand Up @@ -144,7 +144,7 @@ export function ListItem({
className={cn(
"relative my-0.5 break-words",
!!entry.collections && "pr-5",
entry.entries.title ? (withDetails || withAudio) && "font-medium" : "text-[13px]",
entry.entries.title ? "font-medium" : "text-[13px]",
)}
>
{entry.entries.title ? (
Expand All @@ -162,7 +162,7 @@ export function ListItem({
)}
{!!entry.collections && <StarIcon className="absolute right-0 top-0" />}
</div>
{withDetails && (
{!simple && (
<div
className={cn(
"text-[13px]",
Expand All @@ -180,7 +180,7 @@ export function ListItem({
)}
</div>

{withAudio && !!hasAudio && (
{hasAudio && (
<AudioCover
entryId={entryId}
src={entry.entries!.attachments![0]!.url}
Expand Down Expand Up @@ -211,7 +211,7 @@ export function ListItem({
/>
)}

{withDetails && entry.entries.media?.[0] && (
{!simple && !hasAudio && entry.entries.media?.[0] && (
<Media
thumbnail
src={entry.entries.media[0].url}
Expand Down

0 comments on commit 9fb0aff

Please sign in to comment.