mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-23 05:39:05 +00:00
feat: complete migration from @hey-api/openapi-ts to openapi-react-query
- Migrated all components from useApi compatibility layer to direct React Query hooks - Added new hooks for participant operations, room meetings, and speaker operations - Updated all imports from old api module to api-types - Fixed TypeScript types and API endpoint signatures - Removed deprecated useApi.ts compatibility layer - Fixed SourceKind enum values to match OpenAPI spec - Added @ts-ignore for Zulip endpoints not in OpenAPI spec yet - Fixed all compilation errors and type issues
This commit is contained in:
@@ -2,12 +2,8 @@ import { useEffect, useRef, useState } from "react";
|
||||
import React from "react";
|
||||
import Markdown from "react-markdown";
|
||||
import "../../../styles/markdown.css";
|
||||
import {
|
||||
GetTranscript,
|
||||
GetTranscriptTopic,
|
||||
UpdateTranscript,
|
||||
} from "../../../lib/api-types";
|
||||
import useApi from "../../../lib/useApi";
|
||||
import { GetTranscript, GetTranscriptTopic } from "../../../lib/api-types";
|
||||
import { useTranscriptUpdate } from "../../../lib/api-hooks";
|
||||
import {
|
||||
Flex,
|
||||
Heading,
|
||||
@@ -33,9 +29,8 @@ export default function FinalSummary(props: FinalSummaryProps) {
|
||||
const [preEditSummary, setPreEditSummary] = useState("");
|
||||
const [editedSummary, setEditedSummary] = useState("");
|
||||
|
||||
const api = useApi();
|
||||
|
||||
const { setError } = useError();
|
||||
const updateTranscriptMutation = useTranscriptUpdate();
|
||||
|
||||
useEffect(() => {
|
||||
setEditedSummary(props.transcriptResponse?.long_summary || "");
|
||||
@@ -47,12 +42,15 @@ export default function FinalSummary(props: FinalSummaryProps) {
|
||||
|
||||
const updateSummary = async (newSummary: string, transcriptId: string) => {
|
||||
try {
|
||||
const requestBody: UpdateTranscript = {
|
||||
long_summary: newSummary,
|
||||
};
|
||||
const updatedTranscript = await api?.v1TranscriptUpdate({
|
||||
transcriptId,
|
||||
requestBody,
|
||||
const updatedTranscript = await updateTranscriptMutation.mutateAsync({
|
||||
params: {
|
||||
path: {
|
||||
transcript_id: transcriptId,
|
||||
},
|
||||
},
|
||||
body: {
|
||||
long_summary: newSummary,
|
||||
},
|
||||
});
|
||||
if (props.onUpdate) {
|
||||
props.onUpdate(newSummary);
|
||||
@@ -60,7 +58,7 @@ export default function FinalSummary(props: FinalSummaryProps) {
|
||||
console.log("Updated long summary:", updatedTranscript);
|
||||
} catch (err) {
|
||||
console.error("Failed to update long summary:", err);
|
||||
setError(err, "Failed to update long summary.");
|
||||
setError(err as Error, "Failed to update long summary.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -114,7 +112,12 @@ export default function FinalSummary(props: FinalSummaryProps) {
|
||||
<Button onClick={onDiscardClick} variant="ghost">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={onSaveClick}>Save</Button>
|
||||
<Button
|
||||
onClick={onSaveClick}
|
||||
disabled={updateTranscriptMutation.isPending}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</Flex>
|
||||
)}
|
||||
{!isEditMode && (
|
||||
|
||||
Reference in New Issue
Block a user