feat: seprate listIds and inboxIds with feedIds in subscription store

This commit is contained in:
DIYgod
2025-02-10 17:10:17 +08:00
parent b7fce0e640
commit 5f2cf8f20e
5 changed files with 50 additions and 95 deletions
@@ -11,18 +11,10 @@ export const TimelineTabs = () => {
const { view, listId, inboxId, folderName } = routerParams
const listsData = useSubscriptionStore(
useCallback(
(state) =>
state.feedIdByView[view].map((id) => state.data[id]).filter((s) => s && "listId" in s),
[view],
),
useCallback((state) => Array.from(state.listIds).map((id) => state.data[id]), []),
)
const inboxData = useSubscriptionStore(
useCallback(
(state) =>
state.feedIdByView[view].map((id) => state.data[id]).filter((s) => s && "inboxId" in s),
[view],
),
useCallback((state) => Array.from(state.inboxIds).map((id) => state.data[id]), []),
)
const categoriesData = useSubscriptionStore(
useCallback(
@@ -25,7 +25,7 @@ import {
useInboxesGroupedData,
useListsGroupedData,
} from "./list.shared"
import { SortableFeedList, SortByAlphabeticalInbox, SortByAlphabeticalList } from "./sort-by"
import { SortableFeedList } from "./sort-by"
const FeedListImpl = forwardRef<HTMLDivElement, { className?: string; view: number }>(
({ className, view }, ref) => {
@@ -214,23 +214,6 @@ const FeedListImpl = forwardRef<HTMLDivElement, { className?: string; view: numb
rootClassName={cn("h-full", shouldFreeUpSpace && "overflow-visible")}
>
<StarredItem view={view} />
{hasListData && (
<>
<div className="mt-1 flex h-6 w-full shrink-0 items-center rounded-md px-2.5 text-xs font-semibold text-theme-vibrancyFg transition-colors">
{t("words.lists")}
</div>
<SortByAlphabeticalList view={view} data={listsData} />
</>
)}
{hasInboxData && (
<>
<div className="mt-1 flex h-6 w-full shrink-0 items-center rounded-md px-2.5 text-xs font-semibold text-theme-vibrancyFg transition-colors">
{t("words.inbox")}
</div>
<SortByAlphabeticalInbox view={view} data={inboxesData} />
</>
)}
<DraggableContext.Provider value={draggableContextValue}>
<div className="space-y-px" id="feeds-area" ref={setNodeRef}>
{(hasListData || hasInboxData) && (