NextJS 14 experimental upgrade

This commit is contained in:
Koper
2023-12-26 20:49:40 +07:00
parent ee3b4cb9f7
commit 9f42c4d8a7
12 changed files with 1243 additions and 146 deletions

View File

@@ -3,7 +3,6 @@ import { useError } from "../../(errors)/errorContext";
import { GetTranscript, CreateTranscript } from "../../api";
import useApi from "../../lib/useApi";
type UseTranscript = {
transcript: GetTranscript | null;
loading: boolean;
@@ -23,26 +22,16 @@ const useCreateTranscript = (): UseTranscript => {
setLoading(true);
console.debug(
console.log(
"POST - /v1/transcripts/ - Requesting new transcription creation",
transcriptCreationDetails,
api
api,
);
const aaa = async () => {
console.log("Calling API...");
console.log("START");
await new Promise((res) => setTimeout(res, 500));
console.log("500 ms elapsed - calling api");
const test = await api.v1TranscriptsCreate(transcriptCreationDetails);
console.log(test);
};
aaa();
api.v1TranscriptsCreate(transcriptCreationDetails)
api
.v1TranscriptsCreate(transcriptCreationDetails)
.then((transcript) => {
console.debug("New transcript created:", transcript);
setTranscript(transcript);
@@ -55,6 +44,9 @@ const useCreateTranscript = (): UseTranscript => {
);
setErrorState(err);
setLoading(false);
})
.finally(() => {
console.log("At least this should display?");
});
};

View File

@@ -4,7 +4,7 @@ import Markdown from "react-markdown";
import "../../styles/markdown.css";
import { featureEnabled } from "../domainContext";
import { UpdateTranscript } from "../../api";
import useApi from "../../lib/useApi";
import useApi from "../../lib/useApi";
type FinalSummaryProps = {
summary: string;

View File

@@ -89,29 +89,30 @@ const ShareLink = (props: ShareLinkProps) => {
<p>This transcript is public. Everyone can access it.</p>
)}
{isOwner && apiReady (
<div className="relative">
<SelectSearch
className="select-search--top select-search"
options={[
{ name: "Private", value: "private" },
{ name: "Secure", value: "semi-private" },
{ name: "Public", value: "public" },
]}
value={shareMode?.toString()}
onChange={updateShareMode}
closeOnSelect={true}
/>
{shareLoading && (
<div className="h-4 w-4 absolute top-1/3 right-3 z-10">
<FontAwesomeIcon
icon={faSpinner}
className="animate-spin-slow text-gray-600 flex-grow rounded-lg md:rounded-xl h-4 w-4"
/>
</div>
)}
</div>
)}
{isOwner &&
apiReady(
<div className="relative">
<SelectSearch
className="select-search--top select-search"
options={[
{ name: "Private", value: "private" },
{ name: "Secure", value: "semi-private" },
{ name: "Public", value: "public" },
]}
value={shareMode?.toString()}
onChange={updateShareMode}
closeOnSelect={true}
/>
{shareLoading && (
<div className="h-4 w-4 absolute top-1/3 right-3 z-10">
<FontAwesomeIcon
icon={faSpinner}
className="animate-spin-slow text-gray-600 flex-grow rounded-lg md:rounded-xl h-4 w-4"
/>
</div>
)}
</div>,
)}
</div>
)}
{!requireLogin && (

View File

@@ -21,7 +21,8 @@ const useTopics = (id: string): TranscriptTopics => {
if (!id || !api) return;
setLoading(true);
api.v1TranscriptGetTopics(id)
api
.v1TranscriptGetTopics(id)
.then((result) => {
setTopics(result);
setLoading(false);

View File

@@ -36,7 +36,8 @@ const useTranscript = (
setLoading(true);
api.v1TranscriptGet(id)
api
.v1TranscriptGet(id)
.then((result) => {
setResponse(result);
setLoading(false);

View File

@@ -19,10 +19,9 @@ const useTranscriptList = (page: number): TranscriptList => {
useEffect(() => {
setLoading(true);
if (!api)
return;
api.v1TranscriptsList(page)
if (!api) return;
api
.v1TranscriptsList(page)
.then((response) => {
setResponse(response);
setLoading(false);

View File

@@ -35,10 +35,10 @@ const useWebRTC = (
p.on("signal", (data: any) => {
if (!api) return;
if ("sdp" in data) {
const rtcOffer : RtcOffer = {
sdp: data.sdp,
type: data.type,
};
const rtcOffer: RtcOffer = {
sdp: data.sdp,
type: data.type,
};
api
.v1TranscriptRecordWebrtc(transcriptId, rtcOffer)

View File

@@ -19,14 +19,13 @@ export default function useApi(): DefaultService | null {
return;
}
if (!accessTokenInfo)
return;
if (!accessTokenInfo) return;
const openApi = new OpenApi({
BASE: api_url,
TOKEN: accessTokenInfo?.access_token
TOKEN: accessTokenInfo?.access_token,
});
setApi(openApi);
}, [!accessTokenInfo, hasAuthCookie]);

View File

@@ -20,10 +20,12 @@
"@vercel/edge-config": "^0.4.1",
"autoprefixer": "10.4.14",
"axios": "^1.6.2",
"eslint-config-next": "^14.0.4",
"fontawesome": "^5.6.3",
"jest-worker": "^29.6.2",
"next": "^13.4.9",
"next": "^14.0.4",
"postcss": "8.4.25",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropdown": "^1.11.0",

View File

@@ -19,7 +19,8 @@
}
],
"strictNullChecks": true,
"downlevelIteration": true
"downlevelIteration": true,
"target": "ES2020"
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]

File diff suppressed because it is too large Load Diff