diff --git a/package.json b/package.json index e0de93e..b9f89f9 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "linkify-react": "^3.0.4", "linkifyjs": "^3.0.5", "lodash-es": "^4.17.21", - "maa-copilot-client": "https://github.com/MaaAssistantArknights/maa-copilot-client-ts.git#0.1.0-SNAPSHOT.758.dbc2eb1", + "maa-copilot-client": "https://github.com/MaaAssistantArknights/maa-copilot-client-ts.git#0.1.0-SNAPSHOT.784.58f96e5", "normalize.css": "^8.0.1", "prettier": "^3.2.5", "react": "^18.0.0", diff --git a/src/apis/operation-set.ts b/src/apis/operation-set.ts index 573ae81..59ffaa8 100644 --- a/src/apis/operation-set.ts +++ b/src/apis/operation-set.ts @@ -4,6 +4,7 @@ import { CopilotSetPageRes, CopilotSetQuery, CopilotSetStatus, + CopilotSetUpdateReq, } from 'maa-copilot-client' import useSWR from 'swr' import useSWRInfinite from 'swr/infinite' @@ -184,12 +185,7 @@ export async function createOperationSet(req: { }) } -export async function updateOperationSet(req: { - id: number - name: string - description: string - status: CopilotSetStatus -}) { +export async function updateOperationSet(req: CopilotSetUpdateReq) { await new OperationSetApi().updateCopilotSet({ copilotSetUpdateReq: req }) } diff --git a/src/apis/operation.ts b/src/apis/operation.ts index 2e127cf..2e81602 100644 --- a/src/apis/operation.ts +++ b/src/apis/operation.ts @@ -114,7 +114,14 @@ export function useOperations({ const isReachingEnd = !!pages?.some((page) => !page.hasNext) - const operations = pages?.map((page) => page.data).flat() + const _operations = pages?.map((page) => page.data).flat() ?? [] + + // 按 operationIds 的顺序排序 + const operations = operationIds?.length + ? operationIds + ?.map((id) => _operations?.find((v) => v.id === id)) + .filter((v) => !!v) + : _operations return { error, diff --git a/src/components/operation-set/AddToOperationSet.tsx b/src/components/operation-set/AddToOperationSet.tsx index 0eeb202..4a2a42d 100644 --- a/src/components/operation-set/AddToOperationSet.tsx +++ b/src/components/operation-set/AddToOperationSet.tsx @@ -142,7 +142,7 @@ export function AddToOperationSet({ return ( <> -