Skip to content

Commit 88f31af

Browse files
Merge pull request #8 from gustabcc/main
Que Deus abençoe e que o pau tore.
2 parents 1d3fbb8 + b94df19 commit 88f31af

File tree

7 files changed

+203
-40
lines changed

7 files changed

+203
-40
lines changed

eslint.config.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import tseslint from "typescript-eslint";
66

77
export default tseslint.config(
8-
{ ignores: ['dist'] },
8+
{ ignores: ["dist"] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
11+
files: ["**/*.{ts,tsx}"],
1212
languageOptions: {
1313
ecmaVersion: 2020,
1414
globals: globals.browser,
1515
},
1616
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
17+
"react-hooks": reactHooks,
18+
"react-refresh": reactRefresh,
1919
},
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
22+
"react-refresh/only-export-components": [
23+
"warn",
2424
{ allowConstantExport: true },
2525
],
2626
},
27-
},
28-
)
27+
}
28+
);

src/App.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ function App() {
2020
<Button
2121
onClick={() => {
2222
window.location.href = `/interviewReport/index.html?roomId=${roomID}`;
23-
}}>
23+
}}
24+
>
2425
Go to /interviewReport/index.html?roomId={roomID}
2526
</Button>
2627
<UserInput setUserID={setUserID} setRoomID={setRoomID} />
@@ -31,7 +32,8 @@ function App() {
3132
developerKey={DEVELOPER_API_KEY}
3233
group={{ id: roomID, name: "Your Group Name" }}
3334
participant={{ id: userID, name: userID }}
34-
roomId={roomID}>
35+
roomId={roomID}
36+
>
3537
<CodeEditor roomId={roomID} />
3638
<VideoRoom />
3739
</SuperVizRoomProvider>
@@ -45,13 +47,15 @@ function App() {
4547
zIndex="1000"
4648
borderRadius="full"
4749
p={4}
48-
boxShadow="lg">
50+
boxShadow="lg"
51+
>
4952
<Button
5053
colorScheme="teal"
5154
onClick={() => {
5255
const roomURL = `${window.location.origin}/index.html?roomId=${roomID}`;
5356
navigator.clipboard.writeText(roomURL);
54-
}}>
57+
}}
58+
>
5559
Copy Room ID
5660
</Button>
5761
</Box>
@@ -61,7 +65,8 @@ function App() {
6165
navigator.clipboard.writeText(
6266
`${window.location.origin}/interviewReport/index.html?roomId=${roomID}`
6367
);
64-
}}>
68+
}}
69+
>
6570
Get Link for Later Report
6671
</Button>
6772
</>

src/components/CodeEditor.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ const CodeEditor = (props: { roomId: string }) => {
6666
<HStack spacing={4}>
6767
<Box w="50%">
6868
<LanguageSelector language={language} onSelect={onSelect} />
69-
{/* <button onClick={saveCode}>Save this code</button> */}
69+
<button
70+
onClick={() => {
71+
postCode(props.roomId, value);
72+
}}
73+
>
74+
Save this code
75+
</button>
7076
<Editor
7177
options={{
7278
minimap: {

src/components/CollapsibleText.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const getStatusIcon = (status?: string) => {
2626
return null;
2727
}
2828
};
29-
3029
const CollapsibleText: React.FC<CollapsibleTextProps> = ({
3130
title,
3231
log,

src/components/UserInput.tsx

+15-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ const UserInput = ({ setUserID, setRoomID }: any) => {
1313
}, []);
1414

1515
const generateSimpleId = () => {
16-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
16+
const characters =
17+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1718
let result = "";
1819
const length = 4;
1920
for (let i = 0; i < length; i++) {
20-
result += characters.charAt(Math.floor(Math.random() * characters.length));
21+
result += characters.charAt(
22+
Math.floor(Math.random() * characters.length)
23+
);
2124
}
2225
return result;
2326
};
@@ -54,10 +57,18 @@ const UserInput = ({ setUserID, setRoomID }: any) => {
5457
/>
5558
</div>
5659
<div className={styles.groupButtons}>
57-
<Button colorScheme="gray" className={styles.defaultButtons} onClick={handleSubmit}>
60+
<Button
61+
colorScheme="gray"
62+
className={styles.defaultButtons}
63+
onClick={handleSubmit}
64+
>
5865
Iniciar
5966
</Button>
60-
<Button colorScheme="gray" className={styles.defaultButtons} onClick={handleGenerateRoomID}>
67+
<Button
68+
colorScheme="gray"
69+
className={styles.defaultButtons}
70+
onClick={handleGenerateRoomID}
71+
>
6172
Gerar Room ID
6273
</Button>
6374
</div>

src/interviewReport/InterviewReportComponent.tsx

+153-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,25 @@ const InterviewReportComponent = () => {
1414
const [recordId, setRecordId] = useState<string | null>(null);
1515
const [roomId, setRoomId] = useState<string | null>(null);
1616

17-
const [interviewsDataList, setInterviewsDataList] = useState<any | null>(null);
18-
const [selectedInterviewData, setSelectedInterviewData] = useState<any | null>(null);
17+
// Data of the interviews
18+
const [interviewsDataList, setInterviewsDataList] = useState<any | null>(
19+
null
20+
);
21+
const [selectedInterviewData, setSelectedInterviewData] = useState<
22+
any | null
23+
>(null);
1924

2025
const [videoURL, setVideoURL] = useState<string | null>(null);
26+
const [meetingTranscript, setMeetingTranscript] = useState<string>(
27+
"Waiting for transcription...(if it's the first time here, it could take up to 20 minutes). Try again later, reload the page or check the debug section."
28+
);
29+
const [actionItens, setActionItens] = useState([{ text: "Loading..." }]);
30+
const [followUps, setFollowUps] = useState([{ text: "Loading..." }]);
31+
const [questionsReport, setQuestionsReport] = useState([
32+
{ text: "Loading..." },
33+
]);
34+
const [topics, setTopics] = useState([{ text: "Loading..." }]);
35+
const [summary, setSummary] = useState([{ text: "Loading..." }]);
2136

2237
// Estados de carregamento
2338
const [videoStatus, setVideoStatus] = useState<string>("loading");
@@ -36,7 +51,9 @@ const InterviewReportComponent = () => {
3651
console.log("Requesting interviews data list...");
3752
try {
3853
const request = await getRecordings();
39-
const filteredData = request.data.filter((recording: any) => recording.roomId == room_id);
54+
const filteredData = request.data.filter(
55+
(recording: any) => recording.roomId == room_id
56+
);
4057
setInterviewsDataList(filteredData);
4158
} catch (error) {
4259
console.error("Error getting interviews data list: ", error);
@@ -79,7 +96,121 @@ const InterviewReportComponent = () => {
7996
} else {
8097
setVideoStatus("failed");
8198
}
82-
}, [videoURL]);
99+
100+
// First it tries to get the transcript for all the interviews, if it fails, it requests all the transcripts
101+
interviewsDataList.forEach((interview: any) => {
102+
getTranscript(interview.uuid)
103+
.then((transcript) => {
104+
console.log("Transcript for interview ", interview.uuid, ": VALID!");
105+
106+
// but shows only the selected interview transcript
107+
if (interview.uuid == recordId) {
108+
setMeetingTranscript(
109+
transformTranscriptIntoHumanFormat(transcript)
110+
);
111+
}
112+
})
113+
.catch((error) => {
114+
console.error(
115+
"Error getting transcript for interview ",
116+
interview.uuid,
117+
": ",
118+
error
119+
);
120+
console.log("Requesting transcript for interview ", interview.uuid);
121+
requestGenerateTranscript(interview.uuid)
122+
.then(() =>
123+
console.log(
124+
"TRANSCRIPT REQUESTED FOR SUPERVIZ, U HAVE TO WAIT. UUID: ",
125+
interview.uuid
126+
)
127+
)
128+
.catch((error) =>
129+
console.error(
130+
"Error generating transcript request for interview ",
131+
interview.uuid,
132+
": ",
133+
error
134+
)
135+
);
136+
});
137+
});
138+
139+
// Get the action itens
140+
getActionItems(recordId)
141+
.then((actionItens) => {
142+
console.log("Action itens for interview", recordId, ": VALID!");
143+
setActionItens(actionItens);
144+
})
145+
.catch((error) => {
146+
console.error(
147+
"Error getting action itens for interview ",
148+
recordId,
149+
": ",
150+
error
151+
);
152+
});
153+
154+
// Get the follow-ups
155+
getFollowUps(recordId)
156+
.then((followUps) => {
157+
console.log("Follow-ups for interview", recordId, ": VALID!");
158+
setFollowUps(followUps);
159+
})
160+
.catch((error) => {
161+
console.error(
162+
"Error getting follow-ups for interview ",
163+
recordId,
164+
": ",
165+
error
166+
);
167+
});
168+
169+
// Get the questions
170+
getQuestions(recordId)
171+
.then((questions) => {
172+
console.log("Questions for interview", recordId, ": VALID!");
173+
setQuestionsReport(questions);
174+
})
175+
.catch((error) => {
176+
console.error(
177+
"Error getting questions for interview ",
178+
recordId,
179+
": ",
180+
error
181+
);
182+
});
183+
184+
// Get the topics
185+
getTopics(recordId)
186+
.then((topics) => {
187+
console.log("Topics for interview", recordId, ": VALID!");
188+
setTopics(topics);
189+
})
190+
.catch((error) => {
191+
console.error(
192+
"Error getting topics for interview ",
193+
recordId,
194+
": ",
195+
error
196+
);
197+
});
198+
199+
// Get the summary
200+
getSummary(recordId)
201+
.then((summary) => {
202+
console.log("Summary for interview", recordId, ": VALID!");
203+
setSummary(summary);
204+
})
205+
.catch((error) => {
206+
console.error(
207+
"Error getting summary for interview ",
208+
recordId,
209+
": ",
210+
error
211+
);
212+
});
213+
}, [recordId]);
83214

84215
return (
85216
<>
@@ -92,15 +223,24 @@ const InterviewReportComponent = () => {
92223
onChange={(e) => {
93224
console.log("selectedInterviewData", e.target.value);
94225
setSelectedInterviewData(
95-
interviewsDataList.find((interview: any) => interview.uuid === e.target.value)
226+
interviewsDataList.find(
227+
(interview: any) => interview.uuid === e.target.value
228+
)
96229
);
97230
}}
98-
value={recordId || ""}>
231+
value={recordId || ""}
232+
>
99233
<option value="" disabled>
100234
Select an interview
101235
</option>
102-
))}
103-
</select>
236+
{interviewsDataList.map((interview: any) => (
237+
<option key={interview.uuid} value={interview.uuid}>
238+
{new Date(interview.createdAt).toUTCString()} -{" "}
239+
{interview.uuid}
240+
</option>
241+
))}
242+
</select>
243+
</>
104244
)}
105245
</div>
106246
{/* Interview Video */}
@@ -119,7 +259,11 @@ const InterviewReportComponent = () => {
119259

120260
{/* Meeting Transcript */}
121261
<CollapsibleText title="Meeting transcript">
122-
<textarea value={meetingTranscript} readOnly={true} style={{ width: 1000, height: 200 }} />
262+
<textarea
263+
value={meetingTranscript}
264+
readOnly={true}
265+
style={{ width: 1000, height: 200 }}
266+
/>
123267
</CollapsibleText>
124268

125269
{/* Action itens */}

src/interviewReport/index.html

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<!doctype html>
22
<html lang="en">
3-
4-
<head>
3+
<head>
54
<meta charset="UTF-8" />
65
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
76
<title>Interview Report</title>
8-
</head>
7+
</head>
98

10-
<body>
9+
<body>
1110
<div id="root"></div>
1211
<script type="module" src="./interviewReport.tsx"></script>
13-
</body>
14-
15-
</html>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)