HomePage.js 2.62 KB
Newer Older
1
import React, { useState, useEffect } from 'react';
Kim, Subin's avatar
Kim, Subin committed
2
import Menu from '../Components/Menu';
Kim, Subin's avatar
Kim, Subin committed
3
import Schedule from '../Components/Schedule';
CHAERIN KIM's avatar
CHAERIN KIM committed
4
import { Redirect } from 'react-router-dom';
5
import Tabs from 'react-bootstrap/Tabs';
CHAERIN KIM's avatar
CHAERIN KIM committed
6
import axios from 'axios';
7
import Tab from 'react-bootstrap/Tab';
Kim, Subin's avatar
Kim, Subin committed
8
9

function Home() {
10
    const [key, setKey] = useState('9-116');
CHAERIN KIM's avatar
CHAERIN KIM committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    const [state, setState] = useState()

    useEffect(() => {
        tcheck();
    }, []);

    if (state) return <Redirect to="/" />;

    function tcheck() {
        axios.get(`/users/${localStorage.getItem('_id')}`, {
            headers: { authorization: localStorage.getItem('token') },
        })
            .then(res => {
                if (res.status !== 201) {
                    alert(res.data.error);
                    localStorage.clear();
                    setState(true);
                }
            }).catch(err => {
                alert(err.error)
            });
    }
Kim, Subin's avatar
Kim, Subin committed
33

Kim, Subin's avatar
Kim, Subin committed
34
35
36
    return (
        <div>
            <Menu />
Lee Jin Ju's avatar
Lee Jin Ju committed
37
            <div className="container mt-3">
Lee Jin Ju's avatar
Lee Jin Ju committed
38
39
40
41
42
43
44
45
                <h2>대관 현황</h2>
                <p>
                    <strong>대관 가능 시간</strong>
                    <ul>
                        <li>평일: 9 - 22/ 예약가능 시간 이후 폐쇄</li>
                        <li>주말: 이용 불가</li>
                    </ul>
                </p>
46
47
                <Tabs defaultActiveKey="9-116" id="uncontrolled-tab-example" onSelect={(k) => setKey(k)}>
                    <Tab eventKey="9-116" title="9-116">
CHAERIN KIM's avatar
CHAERIN KIM committed
48
                        <Schedule room={key} />
49
50
                    </Tab>
                    <Tab eventKey="7-234" title="7-234">
CHAERIN KIM's avatar
CHAERIN KIM committed
51
                        <Schedule room={key} />
52
53
                    </Tab>
                    <Tab eventKey="25-101" title="25-101">
CHAERIN KIM's avatar
CHAERIN KIM committed
54
                        <Schedule room={key} />
55
56
                    </Tab>
                </Tabs>
Kim, Subin's avatar
Kim, Subin committed
57
58
59
60
61
62
63
64
65
66
                <h3>유의사항</h3>
                <p>
                    <ul>
                        <li>강의실을 대관하는 대표자를 기준으로 최대  6시간까지 대관이 가능합니다.</li>
                        <li>1 대관시 최대 3시간까지 이용이 가능합니다. (1시간 단위로 대관 가능)</li>
                        <li><strong style={{ color: "red" }}>대관 시간 이외 강의실을 이용하다 적발될 경우 한달  강의실 이용이 불가합니다.</strong></li>
                    </ul>
                </p>
                <div className="bg-white">
                    <h6>고려대학교 대관시스템</h6>
Lee Jin Ju's avatar
Lee Jin Ju committed
67
                </div>
Kim, Subin's avatar
Kim, Subin committed
68
69
70
71
72
            </div>
        </div>
    )
}

Lee Jin Ju's avatar
Lee Jin Ju committed
73
export default Home;