diff --git a/src/renderer/src/modules/entry-column/date-item.tsx b/src/renderer/src/modules/entry-column/date-item.tsx
new file mode 100644
index 0000000000..deb8913743
--- /dev/null
+++ b/src/renderer/src/modules/entry-column/date-item.tsx
@@ -0,0 +1,39 @@
+import { FeedViewType } from "@renderer/lib/enum"
+import { cn } from "@renderer/lib/utils"
+
+import { MarkAllButton } from "./mark-all-button"
+import { SocialMediaDateItem } from "./social-media-item"
+
+export const DateItem = ({
+ date,
+ view,
+ isFirst,
+}: {
+ date: string
+ view: FeedViewType
+ isFirst: boolean
+}) => {
+ const dateObj = new Date(date)
+ const dateString = dateObj.toLocaleDateString("en-US", { weekday: "long", month: "short", day: "numeric" })
+ const startOfDay = new Date(dateObj.setHours(0, 0, 0, 0)).getTime()
+ const endOfDay = new Date(dateObj.setHours(23, 59, 59, 999)).getTime()
+
+ const className = cn(isFirst ? "pt-2" : "pt-8", "flex items-center gap-1 pl-2 text-sm font-bold text-zinc-800 dark:text-neutral-400")
+
+ if (view === FeedViewType.SocialMedia) {
+ return
+ )
+}
diff --git a/src/renderer/src/modules/entry-column/grid-item-template.tsx b/src/renderer/src/modules/entry-column/grid-item-template.tsx
index 691c3eda74..ee1f23aa96 100644
--- a/src/renderer/src/modules/entry-column/grid-item-template.tsx
+++ b/src/renderer/src/modules/entry-column/grid-item-template.tsx
@@ -32,7 +32,7 @@ export function GridItem({
className={cn(
"relative flex-1 px-2 py-1 text-sm",
!asRead &&
- "before:absolute before:-left-1 before:top-[13.5px] before:block before:size-2 before:rounded-full before:bg-theme-accent",
+ "before:absolute before:-left-0.5 before:top-[14.5px] before:block before:size-1.5 before:rounded-full before:bg-theme-accent",
)}
>
void }) => {
const { feedId, view, isAllFeeds, isCollection } = routeParams
- const folderIds = useFolderFeedsByFeedId(feedId)
+ const folderIds = useFolderFeedsByFeedId({
+ feedId,
+ view,
+ })
const entriesOptions = {
id: folderIds?.join(",") || feedId,
@@ -90,8 +93,8 @@ export const useEntriesByView = ({ onReset }: { onReset?: () => void }) => {
},
)
const hasUpdate = useMemo(
- () => !!(fetchedTime && hasNewQuery?.data?.data.has_new),
- [hasNewQuery?.data?.data.has_new, fetchedTime],
+ () => !!(fetchedTime && hasNewQuery?.data?.data?.has_new),
+ [hasNewQuery?.data?.data?.has_new, fetchedTime],
)
useEffect(() => {
@@ -107,7 +110,7 @@ export const useEntriesByView = ({ onReset }: { onReset?: () => void }) => {
)
const currentEntries = useEntryIdsByFeedIdOrView(
- isAllFeeds ? view : feedId!,
+ isAllFeeds ? view : folderIds || feedId!,
{
unread: unreadOnly,
view,
@@ -152,10 +155,30 @@ export const useEntriesByView = ({ onReset }: { onReset?: () => void }) => {
setMergedEntries(nextIds)
}, [entryIdsAsDeps])
- const sortEntries = () =>
- isCollection ?
- sortEntriesIdByStarAt(mergedEntries) :
- sortEntriesIdByEntryPublishedAt(mergedEntries)
+ const sortEntries = isCollection ?
+ sortEntriesIdByStarAt(mergedEntries) :
+ sortEntriesIdByEntryPublishedAt(mergedEntries)
+
+ const entriesWithDate = useMemo(() => {
+ if (views[view].gridMode) {
+ return sortEntries
+ }
+ const entriesId2Map = entryActions.getFlattenMapEntries()
+ let lastDate = ""
+ const entriesWithDate = [] as string[]
+ for (const id of sortEntries) {
+ const entry = entriesId2Map[id]
+ if (entry) {
+ const date = new Date(entry.entries.publishedAt).toDateString()
+ if (date !== lastDate) {
+ entriesWithDate.push(date)
+ lastDate = date
+ }
+ }
+ entriesWithDate.push(id)
+ }
+ return entriesWithDate
+ }, [sortEntries, view])
return {
...query,
@@ -164,7 +187,7 @@ export const useEntriesByView = ({ onReset }: { onReset?: () => void }) => {
refetch: useCallback(() => {
query.refetch()
}, [query]),
- entriesIds: sortEntries(),
+ entriesIds: entriesWithDate,
totalCount: query.data?.pages?.[0]?.total ?? mergedEntries.length,
}
}
diff --git a/src/renderer/src/modules/entry-column/index.tsx b/src/renderer/src/modules/entry-column/index.tsx
index 2648d4bdd8..36c6b0db8c 100644
--- a/src/renderer/src/modules/entry-column/index.tsx
+++ b/src/renderer/src/modules/entry-column/index.tsx
@@ -6,40 +6,28 @@ import { useMe } from "@renderer/atoms/user"
import { m } from "@renderer/components/common/Motion"
import { EmptyIcon } from "@renderer/components/icons/empty"
import { AutoResizeHeight } from "@renderer/components/ui/auto-resize-height"
-import { ActionButton, StyledButton } from "@renderer/components/ui/button"
+import { ActionButton } from "@renderer/components/ui/button"
import { DividerVertical } from "@renderer/components/ui/divider"
import { LoadingCircle } from "@renderer/components/ui/loading"
-import {
- Popover,
- PopoverClose,
- PopoverContent,
- PopoverTrigger,
-} from "@renderer/components/ui/popover"
import { ScrollArea } from "@renderer/components/ui/scroll-area"
import { EllipsisHorizontalTextWithTooltip } from "@renderer/components/ui/typography"
import {
FEED_COLLECTION_LIST,
ROUTE_ENTRY_PENDING,
- ROUTE_FEED_IN_FOLDER,
views,
} from "@renderer/constants"
import { shortcuts } from "@renderer/constants/shortcuts"
import { useNavigateEntry } from "@renderer/hooks/biz/useNavigateEntry"
import { useRouteParms } from "@renderer/hooks/biz/useRouteParams"
import { useIsOnline } from "@renderer/hooks/common/useIsOnline"
-import { apiClient } from "@renderer/lib/api-fetch"
-import { cn, getEntriesParams, getOS, isBizId } from "@renderer/lib/utils"
+import { cn, getOS, isBizId } from "@renderer/lib/utils"
import { EntryHeader } from "@renderer/modules/entry-content/header"
import { useRefreshFeedMutation } from "@renderer/queries/feed"
import { entryActions, useEntry } from "@renderer/store/entry"
import { useFeedById, useFeedHeaderTitle } from "@renderer/store/feed"
-import {
- subscriptionActions,
- useFolderFeedsByFeedId,
-} from "@renderer/store/subscription"
import type { HTMLMotionProps } from "framer-motion"
import type { FC } from "react"
-import { forwardRef, useCallback, useEffect, useRef, useState } from "react"
+import { forwardRef, useCallback, useEffect, useRef } from "react"
import type {
ScrollSeekConfiguration,
VirtuosoHandle,
@@ -47,6 +35,7 @@ import type {
} from "react-virtuoso"
import { Virtuoso, VirtuosoGrid } from "react-virtuoso"
+import { DateItem } from "./date-item"
import { EntryColumnShortcutHandler } from "./EntryColumnShortcutHandler"
import { useEntriesByView, useEntryMarkReadHandler } from "./hooks"
import {
@@ -54,6 +43,7 @@ import {
EntryItemSkeleton,
EntryItemSkeletonWithDelayShow,
} from "./item"
+import { MarkAllButton } from "./mark-all-button"
import { girdClassNames } from "./styles"
const scrollSeekConfiguration: ScrollSeekConfiguration = {
@@ -129,10 +119,14 @@ export function EntryColumn() {
}
},
itemContent: useCallback(
- (_, entryId: string) => {
+ (index, entryId) => {
if (!entryId) return null
- return
+ if (entryId.includes(" ")) {
+ return
+ } else {
+ return
+ }
},
[view],
),
@@ -171,11 +165,12 @@ export function EntryColumn() {
exit={{ opacity: 0.01, y: -100 }}
>
{virtuosoOptions.totalCount === 0 ? (
entries.isLoading ?
@@ -215,33 +210,6 @@ const ListHeader: FC<{
const unreadOnly = useGeneralSettingKey("unreadOnly")
const { feedId, entryId, view } = routerParams
- const folderIds = useFolderFeedsByFeedId(feedId)
-
- const [markPopoverOpen, setMarkPopoverOpen] = useState(false)
- const handleMarkAllAsRead = useCallback(async () => {
- if (!routerParams) return
- await apiClient.reads.all.$post({
- json: {
- ...getEntriesParams({
- id: folderIds?.join(",") || feedId,
- view: routerParams?.view,
- }),
- },
- })
-
- if (typeof routerParams.feedId === "number" || routerParams.isAllFeeds) {
- subscriptionActions.markReadByView(routerParams.view)
- } else if (routerParams.feedId?.startsWith(ROUTE_FEED_IN_FOLDER)) {
- subscriptionActions.markReadByFolder(
- routerParams.feedId.replace(ROUTE_FEED_IN_FOLDER, ""),
- )
- } else {
- routerParams.feedId?.split(",").forEach((feedId) => {
- entryActions.markReadByFeedId(feedId)
- })
- }
- setMarkPopoverOpen(false)
- }, [feedId, folderIds, routerParams])
const headerTitle = useFeedHeaderTitle()
const os = getOS()
@@ -275,12 +243,12 @@ const ListHeader: FC<{
const feed = useFeedById(routerParams.feedId)
const titleStyleBasedView = [
- "pl-11",
- "pl-4",
+ "pl-12",
+ "pl-7",
"pl-7",
"pl-7",
"px-5",
- "pl-11",
+ "pl-12",
]
return (
@@ -361,28 +329,7 @@ const ListHeader: FC<{
)}
-
-
-
-
-
-
-
- Mark all as read?
-
-
- Cancel
-
- {/* TODO */}
-
- Confirm
-
-
-
-
+