fix: allow collect entry from list
This commit is contained in:
@@ -20,7 +20,8 @@ import { COMMAND_ID } from "./id"
|
||||
const useCollect = () => {
|
||||
const { t } = useTranslation()
|
||||
return useMutation({
|
||||
mutationFn: async (entryId: string) => entryActions.markStar(entryId, true),
|
||||
mutationFn: async ({ entryId, view }: { entryId: string; view?: FeedViewType }) =>
|
||||
entryActions.markStar(entryId, true, view),
|
||||
|
||||
onSuccess: () => {
|
||||
toast.success(t("entry_actions.starred"), {
|
||||
@@ -109,7 +110,7 @@ export const useRegisterEntryCommands = () => {
|
||||
id: COMMAND_ID.entry.star,
|
||||
label: t("entry_actions.star"),
|
||||
icon: <i className="i-mgc-star-cute-re" />,
|
||||
run: ({ entryId }) => {
|
||||
run: ({ entryId, view }) => {
|
||||
const entry = useEntryStore.getState().flatMapEntries[entryId]
|
||||
if (!entry) {
|
||||
toast.error("Failed to star: entry is not available", { duration: 3000 })
|
||||
@@ -124,7 +125,7 @@ export const useRegisterEntryCommands = () => {
|
||||
// width: 252,
|
||||
// })
|
||||
// }
|
||||
collect.mutate(entry.entries.id)
|
||||
collect.mutate({ entryId, view })
|
||||
},
|
||||
}),
|
||||
defineFollowCommand({
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// Entry commands
|
||||
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
|
||||
import type { Command } from "../types"
|
||||
import type { COMMAND_ID } from "./id"
|
||||
|
||||
@@ -10,7 +12,7 @@ export type TipCommand = Command<{
|
||||
|
||||
export type StarCommand = Command<{
|
||||
id: typeof COMMAND_ID.entry.star
|
||||
fn: (data: { entryId: string }) => void
|
||||
fn: (data: { entryId: string; view?: FeedViewType }) => void
|
||||
}>
|
||||
export type UnStarCommand = Command<{
|
||||
id: typeof COMMAND_ID.entry.unstar
|
||||
|
||||
Reference in New Issue
Block a user