Commit dce7cd4e authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

Merge remote-tracking branch 'origin/BAE' into lsy

parents 63cc51a1 b11c4c5d
import React, { useState, useEffect } from 'react'
import { Alert, Col, Card, Container, Form, Row, Button, Nav, Navbar } from "react-bootstrap"
import { Col, Card, Container, Row, Button, Nav, Navbar, Image } from "react-bootstrap"
import axios from "axios"
import catchErrors from './utils/catchErrors.js'
import { isAuthenticated } from './utils/auth'
import * as Icon from 'react-bootstrap-icons';
import Place from './Pages/Place.js'
import { Link } from 'react-router-dom'
import ohuh from './ohuh-sm.PNG';
const INIT_PAGE = {
......@@ -66,6 +68,9 @@ function Bookmark() {
return (
<Container>
<Link to="/" className="d-flex justify-content-center">
<Image style={{margin:"1%"}} src={ohuh} />
</Link>
<Navbar bg="info" variant="dark">
<Navbar.Brand href="/">북마크</Navbar.Brand>
<Nav className="mr-auto">
......@@ -106,7 +111,7 @@ function Bookmark() {
</Row>
</Container>
</Container >
)
}
......
......@@ -46,7 +46,7 @@ function Login() {
}
if (success) {
console.log('success', success)
alert("로그인되었습니다.")
return <Redirect to= '/'/> //성공하면 홈화면으로 간다
}
......
import React, { useState, useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import { Link, Redirect } from 'react-router-dom';
import ohuh from '../ohuh.PNG';
import { Container, Row, Form, Image, InputGroup, Button, Col, Card, Nav } from 'react-bootstrap';
import axios from 'axios';
import Place from '../Pages/Place.js';
import { handleLogout, isAuthenticated } from '../utils/auth.js'
import Place from '../Pages/Place.js';
function App() {
const [state, setState] = useState(false);
const [search, setSearch] = useState("");
const [show, setShow] = useState(false);
const [recommend, setRecommend] = useState([{ name: " ", address: " ", img: " " }]);
const [latest, setLatest] = useState([{ name: " ", address: " ", img: " " }]);
const user = isAuthenticated()
......@@ -19,6 +18,7 @@ function App() {
getLatest()
}, []);
if (state !== false) {
return <Redirect to={`/search?keyword=${search}`} />;
}
......@@ -55,9 +55,15 @@ function App() {
return (
<Container className="vh-100 d-flex justify-content-md-center\">
// <Container className="vh-100 ">
// <Col md={12} >
// <Row className="justify-content-center" >
// <Image src={ohuh} style={{ margin: "5%", marginTop : "3%" }} />
// </Row>
// <Row style={{ marginBottom: "5%" }}>
<Container className="vh-100 ">
<Col md={12} >
<Nav className="justify-content-end" bg="#fff" variant="light" >
<Nav className="justify-content-end" bg="#fff" variant="light" style={{}} >
{user ? <Nav.Link onClick={() => handleLogout()}>로그아웃</Nav.Link>
: (
<>
......@@ -67,8 +73,8 @@ function App() {
)}
<Nav.Link href='/bookmark'>북마크</Nav.Link>
</Nav>
<Row className="justify-content-center" >
<Image src={ohuh} style={{ margin: "5%", marginTop : "3%" }} />
<Row className="justify-content-center">
<Image src={ohuh} style={{ margin: "3%", marginTop : "3%" }} />
</Row>
<Row style={{ marginBottom: "5%" }}>
<Form className="vw-100" onSubmit={handleSubmit}>
......@@ -88,33 +94,31 @@ function App() {
</Row>
<Row >
<Col md={6} >
<h1 className=" d-flex justify-content-center" style={{marginBottom:"7%"}}>인기관광지</h1>
<h1 className=" d-flex justify-content-center" style={{ marginBottom: "7%" }}>인기관광지</h1>
<Card align="center" border="info" style={{ margin: "3%" }}>
<Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{recommend.name}</Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={recommend.img} />
<Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{recommend.address} </Card.Text>
<Button variant="info" onClick={() => {
setShow(true)
}}>{recommend.name} 자세히 살펴보기</Button>
<Place place={recommend} show={show} onHide={() => setShow(false)} />
<Link to={`/place?id=${1}&place=${recommend.name}`} >
<Button variant="info"> {recommend.name} 자세히 살펴보기</Button>
</Link>
</Card.Body>
</Card>
</Col>
<Col md={6} >
<h1 className=" d-flex justify-content-center" style={{marginBottom:"7%"}}>최근 검색관광지</h1>
<h1 className=" d-flex justify-content-center" style={{ marginBottom: "7%" }}>최근 검색관광지</h1>
<Card align="center" border="info" style={{ margin: "3%" }}>
<Card.Title style={{ margin: "3%", fontSize: '200%', fontWeight: 'bold' }} >{latest.name}</Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={latest.img} />
<Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{latest.address} </Card.Text>
<Button variant="info" onClick={() => {
setShow(true)
}}>{latest.name} 자세히 살펴보기</Button>
<Place place={latest} show={show} onHide={() => setShow(false)} />
<Link to={`/place?id=${1}&place=${latest.name}`} >
<Button variant="info"> {latest.name} 자세히 살펴보기</Button>
</Link>
</Card.Body>
</Card>
</Col>
......
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Container, Row, Button, Col, ListGroup} from 'react-bootstrap';
import { Container, Row, Image, ListGroup } from 'react-bootstrap';
import queryString from 'query-string'
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
function Place(props) {
console.log(props)
......@@ -54,6 +56,9 @@ function Place(props) {
return (
<Container {...props}>
<Row>
<Link to="/" className="d-flex justify-content-center">
<Image style={{ margin: "1%" }} src={ohuh} />
</Link>
{place}
{Array.isArray(reviews) ? reviews.map((review, index) => {
return (
......
......@@ -18,7 +18,6 @@ function Search(props) {
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
const [bookmark, setBookmark] = useState([false, false, false, false])
const user = isAuthenticated()
const [mobile, setMobile] = useState();
const [association, setAssociation] = useState([{ name: " ", address: " ", img: " " }])
const [pagePlace, setPagePlace] = useState([{ name: " ", address: " ", img: " " }, { name: " ", address: " ", img: " " }])
const [endPage, setEndPage] = useState(1)
......@@ -58,7 +57,6 @@ function Search(props) {
setPagePlace(paginate(association, index, 4))
}
setEndPage(Math.floor((association.length / 4)))
console.log("7489309484839", endPage)
}, [association, index])
......@@ -89,18 +87,6 @@ function Search(props) {
console.log(scrollHeight, scrollTop, clientHeight)
}
if (state !== false) {
// console.log(queryString.parse(props.location.search))
// = {keyword:search}
// return <Redirect to={{
// pathname: `/search?keyword=${search}`,
// state: { id: search },
// }} />;
// history.pushState(null, null, "?"+queryParams.toString());
// return <Redirect to={`/search?keyword=${search}`} />;
}
const handlePage = (num) => {
setIndex(num);
console.log("pagenation num", num)
......
......@@ -5,6 +5,7 @@ export function handleLogin(userId) { //로그인할때 로컬스토리지에
}
export async function handleLogout() {
alert("로그아웃되었습니다.")
localStorage.removeItem('loginStatus') //로컬스토리지에서 로그인상태를 지운다
await axios.get('/api/auth/logout')
window.location.href='/' //경로 지정
......
......@@ -2,6 +2,7 @@ import Places from '../models/Place.js'
import cheerio from 'cheerio'
import fs from 'fs'
import axios from 'axios';
import { nextTick } from 'process';
const searchPlace = async (req, res, next,) => {
......
......@@ -14,9 +14,10 @@ app.use(express.json())
app.use(placeRouter)
app.use(reviewRouter)
app.use(appRouter)
app.use(userRouter)
app.use(authRouter)
app.use(appRouter)
app.get('/', (req, res) => {
console.log("/ req.body", req.body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment