@@ -119,7 +119,7 @@ export const EntryItemWrapper: FC<
|
||||
)}
|
||||
onClick={handleClick}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={() => handleMouseEnter.cancel()}
|
||||
onMouseLeave={handleMouseEnter.cancel}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
onContextMenu={handleContextMenu}
|
||||
>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { AudioPlayer, useAudioPlayerAtomSelector } from "@renderer/atoms/player"
|
||||
import {
|
||||
AudioPlayer,
|
||||
useAudioPlayerAtomSelector,
|
||||
} from "@renderer/atoms/player"
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { RelativeTime } from "@renderer/components/ui/datetime"
|
||||
import { Media } from "@renderer/components/ui/media"
|
||||
@@ -10,7 +13,7 @@ import { EntryTranslation } from "@renderer/modules/entry-column/translation"
|
||||
import { Queries } from "@renderer/queries"
|
||||
import { useEntry } from "@renderer/store/entry/hooks"
|
||||
import { useFeedById } from "@renderer/store/feed"
|
||||
import { useCallback, useEffect, useRef } from "react"
|
||||
import { useDebounceCallback } from "usehooks-ts"
|
||||
|
||||
import { ReactVirtuosoItemPlaceholder } from "../../../components/ui/placeholder"
|
||||
import { StarIcon } from "../star-icon"
|
||||
@@ -35,15 +38,15 @@ export function ListItem({
|
||||
)
|
||||
|
||||
const feed = useFeedById(entry?.feedId) || entryPreview?.feeds
|
||||
const delayTimerRef = useRef<any>()
|
||||
const handlePrefetchEntry = useCallback(() => {
|
||||
delayTimerRef.current = setTimeout(() => {
|
||||
|
||||
const handlePrefetchEntry = useDebounceCallback(
|
||||
() => {
|
||||
Queries.entries.byId(entryId).prefetch()
|
||||
}, 300)
|
||||
}, [entryId])
|
||||
useEffect(() => () => {
|
||||
clearTimeout(delayTimerRef.current)
|
||||
}, [entryId])
|
||||
},
|
||||
300,
|
||||
{ leading: false },
|
||||
)
|
||||
|
||||
// NOTE: prevent 0 height element, react virtuoso will not stop render any more
|
||||
if (!entry || !feed) return <ReactVirtuosoItemPlaceholder />
|
||||
|
||||
@@ -54,7 +57,7 @@ export function ListItem({
|
||||
return (
|
||||
<div
|
||||
onMouseEnter={handlePrefetchEntry}
|
||||
onMouseLeave={() => clearTimeout(delayTimerRef.current)}
|
||||
onMouseLeave={handlePrefetchEntry.cancel}
|
||||
className={cn(
|
||||
"group relative flex py-4 pl-3 pr-2",
|
||||
!asRead &&
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* eslint-disable @eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect */
|
||||
import { getReadonlyRoute } from "@renderer/atoms/route"
|
||||
import {
|
||||
useUISettingKey,
|
||||
} from "@renderer/atoms/settings/ui"
|
||||
import { useUISettingKey } from "@renderer/atoms/settings/ui"
|
||||
import { useSidebarActiveView } from "@renderer/atoms/sidebar"
|
||||
import { ActionButton } from "@renderer/components/ui/button"
|
||||
import { HotKeyScopeMap, views } from "@renderer/constants"
|
||||
@@ -22,12 +20,7 @@ import { useWheel } from "@use-gesture/react"
|
||||
import { AnimatePresence, m } from "framer-motion"
|
||||
import { Lethargy } from "lethargy"
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import {
|
||||
useCallback,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react"
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from "react"
|
||||
import { isHotkeyPressed, useHotkeys } from "react-hotkeys-hook"
|
||||
|
||||
import { WindowUnderBlur } from "../../components/ui/background"
|
||||
@@ -184,19 +177,17 @@ export function FeedColumn({ children }: PropsWithChildren) {
|
||||
</ActionButton>
|
||||
))}
|
||||
</div>
|
||||
<div className="relative size-full overflow-hidden" ref={carouselRef}>
|
||||
<div className="relative flex size-full overflow-hidden" ref={carouselRef}>
|
||||
<SwipeWrapper active={active}>
|
||||
{views.map((item, index) => (
|
||||
<section
|
||||
key={item.name}
|
||||
className="h-full w-[var(--fo-feed-col-w)] shrink-0 snap-center"
|
||||
>
|
||||
{active === index && (
|
||||
<FeedList
|
||||
className="flex size-full flex-col text-sm"
|
||||
view={index}
|
||||
/>
|
||||
)}
|
||||
<FeedList
|
||||
className="flex size-full flex-col text-sm"
|
||||
view={index}
|
||||
/>
|
||||
</section>
|
||||
))}
|
||||
</SwipeWrapper>
|
||||
@@ -260,6 +251,7 @@ const SwipeWrapper: FC<{
|
||||
return (
|
||||
<AnimatePresence mode="popLayout">
|
||||
<m.div
|
||||
className="grow"
|
||||
key={currentAnimtedActive}
|
||||
initial={
|
||||
isReady ?
|
||||
|
||||
Reference in New Issue
Block a user