1- import React , { useState } from 'react' ;
1+ import React , { useContext , useState } from 'react' ;
22
3- import { MainProvider } from 'contexts/MainContext' ;
3+ import { MainContext , MainProvider } from 'contexts/MainContext' ;
44
55import Header from 'components/Header/Header' ;
66import Initial from './components/Initial/Initial' ;
@@ -17,31 +17,22 @@ import ScheduleModal from './components/ScheduleModal';
1717import Container from './styles' ;
1818
1919import {
20- IProjectInfo ,
21- ISubject ,
22- ITopic ,
23- IAddressAndHour ,
2420 IMinute ,
2521} from './components/MinuteViewer/components/Minute/DTOs' ;
2622
2723const Main = ( ) => {
24+ const {
25+ topics,
26+ showSchedule,
27+ addressAndHour,
28+ projectInfo,
29+ subjects,
30+ distributions,
31+ } = useContext ( MainContext ) ;
32+
2833 const [ showMinute , setShowMinute ] = useState ( false ) ;
29- const [ showSchedule , setShowSchedule ] = useState ( false ) ;
3034
3135 const [ minute , setMinute ] = useState < IMinute > ( ) ;
32- const [ addressAndHour , setAddressAndHour ] = useState < IAddressAndHour > ( {
33- local : '' ,
34- startDate : '' ,
35- startHour : '' ,
36- } ) ;
37- const [ projectInfo , setProjectInfo ] = useState < IProjectInfo > ( {
38- projectName : '' ,
39- members : [ ] ,
40- } ) ;
41-
42- const [ topics , setTopics ] = useState < ITopic [ ] > ( [ ] ) ;
43- const [ subjects , setSubjects ] = useState < ISubject [ ] > ( [ ] ) ;
44- const [ distributions , setDistributions ] = useState < string [ ] > ( [ ] ) ;
4536
4637 const handleGenerateMinute = ( ) => {
4738 setMinute ( {
@@ -61,22 +52,19 @@ const Main = () => {
6152 < MinuteViewer setShowMinute = { setShowMinute } minute = { minute } />
6253 ) }
6354
64- { showSchedule && < ScheduleModal setShowSchedule = { setShowSchedule } /> }
55+ { showSchedule && < ScheduleModal /> }
6556
6657 < Container >
67- < Initial setAddressAndHour = { setAddressAndHour } />
68- < ProjectInformation setProjectInfo = { setProjectInfo } />
69- < Topics setTopics = { setTopics } topics = { topics } />
58+ < Initial />
59+ < ProjectInformation />
7060
71- < Subjects subjects = { subjects } setSubjects = { setSubjects } />
72- < Distributions
73- setDistributions = { setDistributions }
74- distributions = { distributions }
75- />
61+ < Topics />
62+
63+ < Subjects />
64+ < Distributions />
7665 < OptionButtons
7766 setShowMinute = { setShowMinute }
7867 handleGenerateMinute = { handleGenerateMinute }
79- setShowSchedule = { setShowSchedule }
8068 />
8169 </ Container >
8270 </ MainProvider >
0 commit comments