From c603e279dfedacf687a7d5d783d7e7ce0475a17a Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 1 Jan 2024 10:31:43 +0700 Subject: [PATCH] Implemented suggestions by Matthieu --- www/app/[domain]/layout.tsx | 4 +- .../[transcriptId]/record/page.tsx | 3 +- .../[domain]/transcripts/createTranscript.ts | 2 +- .../[domain]/transcripts/fileUploadButton.tsx | 9 ++- www/app/[domain]/transcripts/shareLink.tsx | 45 +++++++------ www/app/[domain]/transcripts/useWebSockets.ts | 65 +++++++++---------- www/package.json | 4 +- www/tsconfig.json | 3 +- www/yarn.lock | 36 +--------- 9 files changed, 65 insertions(+), 106 deletions(-) diff --git a/www/app/[domain]/layout.tsx b/www/app/[domain]/layout.tsx index 6027429c..ebdfbe5d 100644 --- a/www/app/[domain]/layout.tsx +++ b/www/app/[domain]/layout.tsx @@ -18,11 +18,11 @@ import { SESSION_COOKIE_NAME } from "../lib/fief"; const poppins = Poppins({ subsets: ["latin"], weight: ["200", "400", "600"] }); export const viewport: Viewport = { - themeColor: 'black', + themeColor: "black", width: "device-width", initialScale: 1, maximumScale: 1, -} +}; export const metadata: Metadata = { metadataBase: new URL(process.env.DEV_URL || "https://reflector.media"), diff --git a/www/app/[domain]/transcripts/[transcriptId]/record/page.tsx b/www/app/[domain]/transcripts/[transcriptId]/record/page.tsx index 478946a3..d4bb6b3e 100644 --- a/www/app/[domain]/transcripts/[transcriptId]/record/page.tsx +++ b/www/app/[domain]/transcripts/[transcriptId]/record/page.tsx @@ -75,8 +75,7 @@ const TranscriptRecord = (details: TranscriptDetails) => { }, [webSockets.status.value, transcript.response?.status]); useEffect(() => { - if (transcript.response?.status === "ended") - mp3.getNow(); + if (transcript.response?.status === "ended") mp3.getNow(); }, [transcript.response]); useEffect(() => { diff --git a/www/app/[domain]/transcripts/createTranscript.ts b/www/app/[domain]/transcripts/createTranscript.ts index e8dedbce..8435e6c2 100644 --- a/www/app/[domain]/transcripts/createTranscript.ts +++ b/www/app/[domain]/transcripts/createTranscript.ts @@ -35,7 +35,7 @@ const useCreateTranscript = (): UseTranscript => { ); setErrorState(err); setLoading(false); - }) + }); }; return { transcript, loading, error, create }; diff --git a/www/app/[domain]/transcripts/fileUploadButton.tsx b/www/app/[domain]/transcripts/fileUploadButton.tsx index 112ea6eb..7cfaf19e 100644 --- a/www/app/[domain]/transcripts/fileUploadButton.tsx +++ b/www/app/[domain]/transcripts/fileUploadButton.tsx @@ -21,11 +21,10 @@ export default function FileUploadButton(props: FileUploadButton) { console.log("Calling api.v1TranscriptRecordUpload()..."); // Create an object of the expected type - const uploadData: Body_transcript_record_upload_v1_transcripts__transcript_id__record_upload_post = - { - file: file, - // Add other properties if required by the type definition - }; + const uploadData = { + file: file, + // Add other properties if required by the type definition + }; api?.v1TranscriptRecordUpload(props.transcriptId, uploadData); } diff --git a/www/app/[domain]/transcripts/shareLink.tsx b/www/app/[domain]/transcripts/shareLink.tsx index 8d14d034..7e0d592d 100644 --- a/www/app/[domain]/transcripts/shareLink.tsx +++ b/www/app/[domain]/transcripts/shareLink.tsx @@ -86,29 +86,28 @@ const ShareLink = (props: ShareLinkProps) => { )} {isOwner && api && ( - -
- - {shareLoading && ( -
- -
- )} -
- )} +
+ + {shareLoading && ( +
+ +
+ )} +
+ )} )} {!requireLogin && ( diff --git a/www/app/[domain]/transcripts/useWebSockets.ts b/www/app/[domain]/transcripts/useWebSockets.ts index bb05137a..585f383c 100644 --- a/www/app/[domain]/transcripts/useWebSockets.ts +++ b/www/app/[domain]/transcripts/useWebSockets.ts @@ -59,37 +59,37 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { useEffect(() => { document.onkeyup = (e) => { if (e.key === "a" && process.env.NEXT_PUBLIC_ENV === "development") { - const segments : GetTranscriptSegmentTopic[] = [ - { - speaker: 1, - start: 0, - text: "This is the transcription of an example title", - }, - { - speaker: 2, - start: 10, - text: "This is the second speaker", - }, - { - speaker: 3, - start: 90, - text: "This is the third speaker", - }, - { - speaker: 4, - start: 90, - text: "This is the fourth speaker", - }, - { - speaker: 5, - start: 123, - text: "This is the fifth speaker", - }, - { - speaker: 6, - start: 300, - text: "This is the sixth speaker", - } + const segments: GetTranscriptSegmentTopic[] = [ + { + speaker: 1, + start: 0, + text: "This is the transcription of an example title", + }, + { + speaker: 2, + start: 10, + text: "This is the second speaker", + }, + { + speaker: 3, + start: 90, + text: "This is the third speaker", + }, + { + speaker: 4, + start: 90, + text: "This is the fourth speaker", + }, + { + speaker: 5, + start: 123, + text: "This is the fifth speaker", + }, + { + speaker: 6, + start: 300, + text: "This is the sixth speaker", + }, ]; setTranscriptText("Lorem Ipsum"); @@ -310,8 +310,7 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => { if (!transcriptId || !api) return; - api?.v1TranscriptGetWebsocketEvents(transcriptId).then((result) => { - }); + api?.v1TranscriptGetWebsocketEvents(transcriptId).then((result) => {}); const url = `${websocket_url}/v1/transcripts/${transcriptId}/events`; let ws = new WebSocket(url); diff --git a/www/package.json b/www/package.json index 50afc874..6736a874 100644 --- a/www/package.json +++ b/www/package.json @@ -8,8 +8,7 @@ "start": "next start", "lint": "next lint", "format": "prettier --write .", - "openapi": "openapi --input http://127.0.0.1:1250/openapi.json --name OpenApi --output app/api && yarn format", - "openapi-old": "openapi-generator-cli generate -i http://localhost:1250/openapi.json -g typescript-fetch -o app/api && yarn format" + "openapi": "openapi --input http://127.0.0.1:1250/openapi.json --name OpenApi --output app/api && yarn format" }, "dependencies": { "@fief/fief": "^0.13.5", @@ -47,7 +46,6 @@ "devDependencies": { "@openapitools/openapi-generator-cli": "^2.7.0", "@types/react": "18.2.20", - "openapi-typescript": "^6.7.3", "openapi-typescript-codegen": "^0.25.0", "prettier": "^3.0.0" } diff --git a/www/tsconfig.json b/www/tsconfig.json index e799d9da..0e1b89ae 100644 --- a/www/tsconfig.json +++ b/www/tsconfig.json @@ -19,8 +19,7 @@ } ], "strictNullChecks": true, - "downlevelIteration": true, - "target": "ES2020" + "downlevelIteration": true }, "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"] diff --git a/www/yarn.lock b/www/yarn.lock index 574925db..38f8383f 100644 --- a/www/yarn.lock +++ b/www/yarn.lock @@ -31,11 +31,6 @@ dependencies: regenerator-runtime "^0.14.0" -"@fastify/busboy@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.0.tgz#0709e9f4cb252351c609c6e6d8d6779a8d25edff" - integrity sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA== - "@fief/fief@^0.13.5": version "0.13.5" resolved "https://registry.yarnpkg.com/@fief/fief/-/fief-0.13.5.tgz#01ac833ddff0b84f2e1737cc168721568b0e7a39" @@ -613,11 +608,6 @@ agent-base@6: dependencies: debug "4" -ansi-colors@^4.1.3: - version "4.1.3" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" - integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== - ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -1532,7 +1522,7 @@ fast-glob@^3.2.12: merge2 "^1.3.0" micromatch "^4.0.4" -fast-glob@^3.2.9, fast-glob@^3.3.1, fast-glob@^3.3.2: +fast-glob@^3.2.9, fast-glob@^3.3.1: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -2844,18 +2834,6 @@ openapi-typescript-codegen@^0.25.0: handlebars "^4.7.7" json-schema-ref-parser "^9.0.9" -openapi-typescript@^6.7.3: - version "6.7.3" - resolved "https://registry.yarnpkg.com/openapi-typescript/-/openapi-typescript-6.7.3.tgz#7fe131a28551c8996e4a680e4698d0e1206635ba" - integrity sha512-es3mGcDXV6TKPo6n3aohzHm0qxhLyR39MhF6mkD1FwFGjhxnqMqfSIgM0eCpInZvqatve4CxmXcMZw3jnnsaXw== - dependencies: - ansi-colors "^4.1.3" - fast-glob "^3.3.2" - js-yaml "^4.1.0" - supports-color "^9.4.0" - undici "^5.28.2" - yargs-parser "^21.1.1" - ora@^5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" @@ -3734,13 +3712,6 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici@^5.28.2: - version "5.28.2" - resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.2.tgz#fea200eac65fc7ecaff80a023d1a0543423b4c91" - integrity sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w== - dependencies: - "@fastify/busboy" "^2.0.0" - unified@^11.0.0: version "11.0.3" resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.3.tgz#e141be0fe466a2d28b2160f62712bc9cbc08fdd4" @@ -3961,11 +3932,6 @@ yargs-parser@^20.2.2: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"