Skip to content

Commit 1038111

Browse files
committed
Chore: keyword api connection
1 parent 2a556f2 commit 1038111

File tree

2 files changed

+69
-37
lines changed

2 files changed

+69
-37
lines changed

src/views/meeting/components/MindMapComponent.tsx

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//수정
2-
31
import React, { useCallback } from "react";
42
import {
53
ReactFlow,
@@ -69,6 +67,9 @@ const MindMapComponent = ({
6967

7068
const [mode, setMode] = useState<string>("none");
7169

70+
const [mainKeyword, setMainKeyword] = useState([]);
71+
const [recommendKeyword, setRecommendKeyword] = useState([]);
72+
7273
const mindMapRef = useRef<HTMLDivElement>(null);
7374

7475
// const meetingStart = () => {
@@ -159,6 +160,13 @@ const MindMapComponent = ({
159160
}));
160161

161162
setInitialEdges(edges);
163+
setMainKeyword(JSON.parse(res.data.data.mainKeywords).map((x:any, i:number) => ({ id: i, value: x })));
164+
setRecommendKeyword(
165+
JSON.parse(res.data.data.recommendedScripts)
166+
.filter(Boolean)
167+
.map((x:any, i:number) => ({ id: i, value: x }))
168+
);
169+
162170
});
163171
}
164172

@@ -280,11 +288,11 @@ const MindMapComponent = ({
280288
</p>
281289
<button
282290
className="btn-mic"
283-
onClick={() =>
291+
onClick={() =>{
284292
toggleListening().then(() => {
285293
setMode("live");
286294
})
287-
}
295+
}}
288296
>
289297
녹음 시작하기
290298
</button>
@@ -351,50 +359,70 @@ const MindMapComponent = ({
351359
<>
352360
<div className="main-keyword-wrap">
353361
<h3>주요 키워드</h3>
354-
<div className="keyword-wrap">
355-
<div className="keyword">GPU</div>
356-
<div className="keyword">GPU</div>
357-
<div className="keyword">GPU</div>
358-
<div className="keyword">GPU</div>
359-
<div className="keyword">GPU</div>
360-
<div className="keyword">GPU</div>
361-
</div>
362+
{
363+
mainKeyword.length? (
364+
<div className="keyword-wrap">
365+
{mainKeyword.map((x:any) => (
366+
<div className="keyword" id={x.id.toString()} key={x.id}>
367+
{x.value}
368+
</div>
369+
))}
370+
</div>
371+
) : (
372+
<p>회의가 진행되면 주요 키워드가 자동 생성됩니다.</p>
373+
)
374+
}
362375
</div>
363376
<div className="recommend-keyword-wrap">
364377
<h3>추천 키워드</h3>
365-
<div className="keyword-wrap">
366-
<div className="keyword">GPU</div>
367-
<div className="keyword">GPU</div>
368-
<div className="keyword">GPU</div>
369-
<div className="keyword">GPU</div>
370-
<div className="keyword">GPU</div>
371-
<div className="keyword">GPU</div>
372-
</div>
378+
{
379+
recommendKeyword.length? (
380+
<div className="keyword-wrap">
381+
{recommendKeyword.map((x:any) => (
382+
<div className="keyword" id={x.id.toString()} key={x.id}>
383+
{x.value}
384+
</div>
385+
))}
386+
</div>
387+
) : (
388+
<p>회의가 진행되면 추천 키워드가 자동 생성됩니다.</p>
389+
)
390+
}
373391
</div>
374392
</>
375393
) : (
376394
<>
377395
<div className="main-keyword-wrap">
378396
<h3>주요 키워드</h3>
379-
<div className="keyword-wrap">
380-
<button className="keyword">GPU</button>
381-
<button className="keyword">GPU</button>
382-
<button className="keyword">GPU</button>
383-
<button className="keyword">GPU</button>
384-
<button className="keyword">GPU</button>
385-
<button className="keyword">GPU</button>
386-
</div>
397+
{
398+
mainKeyword.length? (
399+
<div className="keyword-wrap">
400+
{mainKeyword.map((x:any) => (
401+
<button className="keyword" id={x.id.toString()} key={x.id}>
402+
{x.value}
403+
</button>
404+
))}
405+
</div>
406+
) : (
407+
<p>회의가 진행되면 주요 키워드가 자동 생성됩니다.</p>
408+
)
409+
}
387410
</div>
388411
<div className="recommend-keyword-wrap">
389412
<h3>추천 키워드</h3>
390-
<div className="keyword-wrap">
391-
<button className="keyword">GPU</button>
392-
<button className="keyword">GPU</button>
393-
<button className="keyword">GPU</button>
394-
<button className="keyword">GPU</button>
395-
<button className="keyword">GPU</button>
396-
<button className="keyword">GPU</button>
397-
</div>
413+
{
414+
recommendKeyword.length? (
415+
<div className="keyword-wrap">
416+
{recommendKeyword.map((x:any) => (
417+
<button className="keyword" id={x.id.toString()} key={x.id}>
418+
{x.value}
419+
</button>
420+
))}
421+
</div>
422+
) : (
423+
<p>회의가 진행되면 주요 키워드가 자동 생성됩니다.</p>
424+
)
425+
}
398426
</div>
399427
</>
400428
)}

src/views/meeting/style/mind-map.sass

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,8 @@
213213
&:active
214214
color: $page-color
215215
background-color: #EEE8FD
216-
border: 1px solid $page-color
216+
border: 1px solid $page-color
217+
218+
p
219+
+margin(top 5px)
220+
font-size: 12px

0 commit comments

Comments
 (0)