1 | import {Button, Modal} from "react-bootstrap";
|
---|
2 | import React, {useState} from "react";
|
---|
3 | import { Container, Image, Navbar } from "react-bootstrap";
|
---|
4 | import { Nav } from "react-bootstrap";
|
---|
5 | import { BsFillPersonFill } from "react-icons/bs";
|
---|
6 | import { useNavigate } from "react-router-dom";
|
---|
7 | import useGet from "../../Hooks/useGet";
|
---|
8 | import axios from "../../../axios.js";
|
---|
9 | <<<<<<< HEAD
|
---|
10 | import {useAuth} from "../../Context/AuthContext";
|
---|
11 | import ImageUpload from "../../ImageUpload/ImageUpload";
|
---|
12 | =======
|
---|
13 | >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
|
---|
14 | //import logo from 'assets/images/logo.png';
|
---|
15 | //src="https://upload.wikimedia.org/wikipedia/commons/0/08/Vergina_Sun_-_Golden_Larnax.png"
|
---|
16 |
|
---|
17 | function Navigation(props) {
|
---|
18 | const navigator = useNavigate();
|
---|
19 | <<<<<<< HEAD
|
---|
20 | const Auth = useAuth();
|
---|
21 | const isLoggedIn = Auth.userIsAuthenticated();
|
---|
22 |
|
---|
23 | const [show, setShow] = useState(false);
|
---|
24 |
|
---|
25 | const handleClose = () => setShow(false);
|
---|
26 | const handleShow = () => setShow(true);
|
---|
27 |
|
---|
28 | =======
|
---|
29 |
|
---|
30 | const { data, setData, isLoading, getData } = useGet("/username");
|
---|
31 |
|
---|
32 | >>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
|
---|
33 | return (
|
---|
34 | <>
|
---|
35 | <Navbar
|
---|
36 | bg="white"
|
---|
37 | variant="white"
|
---|
38 | expand="md"
|
---|
39 | className={props.mt == "0" ? "px-5 m-4" : ""}
|
---|
40 | >
|
---|
41 | <Container>
|
---|
42 | <Navbar.Brand href="#home">
|
---|
43 | <span className="ikona">
|
---|
44 | <Image
|
---|
45 | id="background-img"
|
---|
46 | src="https://i.ibb.co/BwtmZqX/logo.png"
|
---|
47 | width={60}
|
---|
48 | height={60}
|
---|
49 | ></Image>
|
---|
50 | </span>
|
---|
51 | <span className="mx-3 ikona">
|
---|
52 | <span className="svetlo">Tour</span>
|
---|
53 | <span className="temno">Mate</span>
|
---|
54 | </span>
|
---|
55 | </Navbar.Brand>
|
---|
56 | <Navbar.Toggle aria-controls="navbarScroll" />
|
---|
57 | <Navbar.Collapse id="navbarScroll">
|
---|
58 | <Nav className="ms-auto" navbarScroll>
|
---|
59 | <Nav.Link className="m-2" href="/home">
|
---|
60 | Home
|
---|
61 | </Nav.Link>
|
---|
62 | <Nav.Link className="m-2" href="#features">
|
---|
63 | Features
|
---|
64 | </Nav.Link>
|
---|
65 | <Nav.Link className="m-2" href="#pricing">
|
---|
66 | <Button onClick={handleShow}></Button>
|
---|
67 | </Nav.Link>
|
---|
68 | {!isLoading && !data && (
|
---|
69 | <Button
|
---|
70 | className="m-2"
|
---|
71 | size="md"
|
---|
72 | style={{ backgroundColor: "#159895" }}
|
---|
73 | onClick={() => {
|
---|
74 | navigator("/login");
|
---|
75 | }}
|
---|
76 | >
|
---|
77 | <BsFillPersonFill size={"1.5em"}></BsFillPersonFill> Најави се
|
---|
78 | </Button>
|
---|
79 | )}
|
---|
80 | {!isLoading && data && (
|
---|
81 | <>
|
---|
82 | <Nav.Link className="m-2" href="/profile">
|
---|
83 | {data}
|
---|
84 | </Nav.Link>
|
---|
85 | <Button
|
---|
86 | className="m-2"
|
---|
87 | size="md"
|
---|
88 | style={{ backgroundColor: "#159895" }}
|
---|
89 | onClick={async () => {
|
---|
90 | await axios.get("/logout")
|
---|
91 | .then((res) => {
|
---|
92 | console.log(res)
|
---|
93 | })
|
---|
94 | .catch((err) => {
|
---|
95 | console.log(err)
|
---|
96 | window.location.href="/login"
|
---|
97 | })
|
---|
98 | }}
|
---|
99 | >
|
---|
100 | <BsFillPersonFill size={"1.5em"}></BsFillPersonFill>
|
---|
101 | Одјави се
|
---|
102 | </Button>
|
---|
103 | </>
|
---|
104 | )}
|
---|
105 | </Nav>
|
---|
106 | </Navbar.Collapse>
|
---|
107 | </Container>
|
---|
108 | </Navbar>
|
---|
109 | <br />
|
---|
110 |
|
---|
111 | <Modal show={show} onHide={handleClose}>
|
---|
112 | <Modal.Header closeButton>
|
---|
113 | <Modal.Title>Modal heading</Modal.Title>
|
---|
114 | </Modal.Header>
|
---|
115 | <Modal.Body><ImageUpload/></Modal.Body>
|
---|
116 | <Modal.Footer>
|
---|
117 | <Button variant="secondary" onClick={handleClose}>
|
---|
118 | Close
|
---|
119 | </Button>
|
---|
120 | <Button variant="primary" onClick={handleClose}>
|
---|
121 | Save Changes
|
---|
122 | </Button>
|
---|
123 | </Modal.Footer>
|
---|
124 | </Modal>
|
---|
125 | </>
|
---|
126 | );
|
---|
127 | }
|
---|
128 |
|
---|
129 | export default Navigation;
|
---|