fix: add missing commit file
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
f420e78ca9
commit
cf897d74db
|
|
@ -50,7 +50,7 @@ import {
|
|||
useFeedById,
|
||||
useRemoveFeedFromFeedList,
|
||||
} from "~/store/feed"
|
||||
import { useSubscriptionStore } from "~/store/subscription"
|
||||
import { subscriptionActions, useSubscriptionStore } from "~/store/subscription"
|
||||
|
||||
export const SettingLists = () => {
|
||||
const t = useI18n()
|
||||
|
|
@ -123,7 +123,7 @@ export const SettingLists = () => {
|
|||
</TableCell>
|
||||
<TableCell size="sm">
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
|
|
@ -141,7 +141,7 @@ export const SettingLists = () => {
|
|||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
|
|
@ -223,10 +223,12 @@ const ListCreationModalContent = ({ dismiss, id }: { dismiss: () => void; id?: s
|
|||
})
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
onSuccess: (_, values) => {
|
||||
toast.success(t(id ? "lists.edit.success" : "lists.created.success"))
|
||||
Queries.lists.list().invalidate()
|
||||
dismiss()
|
||||
|
||||
if (id) subscriptionActions.changeListView(id, views[list.view].view, views[values.view].view)
|
||||
},
|
||||
async onError() {
|
||||
toast.error(t(id ? "lists.edit.error" : "lists.created.error"))
|
||||
|
|
@ -252,7 +254,7 @@ const ListCreationModalContent = ({ dismiss, id }: { dismiss: () => void; id?: s
|
|||
</FormLabel>
|
||||
</div>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
<Input autoFocus {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
|
|
@ -377,6 +379,7 @@ export const ListFeedsModalContent = ({ id }: { id: string }) => {
|
|||
<div className="flex items-center gap-2">
|
||||
<Autocomplete
|
||||
maxHeight={window.innerHeight < 600 ? 120 : 240}
|
||||
autoFocus
|
||||
value={feedSearchFor}
|
||||
searchKeys={["name"]}
|
||||
onSuggestionSelected={(e) => {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class FeedActions {
|
|||
const optionalFields = ["owner", "tipUsers"] as const
|
||||
optionalFields.forEach((field) => {
|
||||
if (state.feeds[feed.id!]?.[field] && !(field in feed)) {
|
||||
;(feed as any)[field] = state.feeds[feed.id!]?.[field]
|
||||
;(feed as any)[field] = { ...state.feeds[feed.id!]?.[field] }
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ class FeedActions {
|
|||
|
||||
async fetchOwnedLists() {
|
||||
const res = await apiClient.lists.list.$get()
|
||||
this.upsertMany(res.data.concat())
|
||||
this.upsertMany(res.data)
|
||||
|
||||
return res.data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import { createZustandStore, doMutationAndTransaction } from "../utils/helper"
|
|||
|
||||
export type SubscriptionFlatModel = Omit<SubscriptionModel, "feeds"> & {
|
||||
defaultCategory?: string
|
||||
|
||||
listId?: string
|
||||
}
|
||||
interface SubscriptionState {
|
||||
/**
|
||||
|
|
@ -310,6 +312,20 @@ class SubscriptionActions {
|
|||
)
|
||||
}
|
||||
|
||||
async changeListView(listId: string, currentView: FeedViewType, toView: FeedViewType) {
|
||||
const state = get()
|
||||
|
||||
const inCurrentViewIdx = state.feedIdByView[currentView].indexOf(listId)
|
||||
|
||||
if (inCurrentViewIdx === -1) return
|
||||
set((state) =>
|
||||
produce(state, (state) => {
|
||||
state.feedIdByView[currentView].splice(inCurrentViewIdx, 1)
|
||||
state.feedIdByView[toView].push(listId)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
async renameCategory(lastCategory: string, newCategory: string) {
|
||||
const subscriptionIds = [] as string[]
|
||||
const state = get()
|
||||
|
|
|
|||
Loading…
Reference in New Issue