Commit 2f8421dd authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

last

parent 4071c980
[{"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js":"1"},{"size":4208,"mtime":1612292675311,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1n20xnc","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js",[]]
\ No newline at end of file
[{"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js":"1","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js":"2","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js":"3","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js":"4","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js":"5","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Login.js":"6","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Signup.js":"7"},{"size":4208,"mtime":1612292675311,"results":"8","hashOfConfig":"9"},{"size":5518,"mtime":1612292988591,"results":"10","hashOfConfig":"9"},{"size":5990,"mtime":1612293001715,"results":"11","hashOfConfig":"9"},{"size":3367,"mtime":1612293099153,"results":"12","hashOfConfig":"9"},{"size":6637,"mtime":1612293100467,"results":"13","hashOfConfig":"9"},{"size":3523,"mtime":1612293531015,"results":"14","hashOfConfig":"9"},{"size":3174,"mtime":1612297063302,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1n20xnc",{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"22"},{"filePath":"23","messages":"24","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"25","messages":"26","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"27","messages":"28","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\App.js",[],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Bookmark.js",["31","32"],"import React, { useState, useEffect } from 'react'\r\nimport { Col, Card, Container, Row, Button, Image } from \"react-bootstrap\"\r\nimport axios from \"axios\"\r\nimport ohuh from '../ohuh-sm.PNG';\r\nimport catchErrors from '../utils/catchErrors.js'\r\nimport { isAuthenticated } from '../utils/auth'\r\nimport * as Icon from 'react-bootstrap-icons';\r\nimport { Link } from 'react-router-dom'\r\nimport Paginations from '../Components/Paginations';\r\nimport _ from 'lodash';\r\n\r\n\r\n\r\n\r\nfunction Bookmark() {\r\n const [error, setError] = useState('')\r\n const [bookmark, setBookmark] = useState([true, true, true, true])\r\n const [pagePlace, setpagePlace] = useState([])\r\n const [index, setIndex] = useState(1);\r\n const [endPage, setEndPage] = useState(1)\r\n const [bookmarkPlace, setBookmarkPlace] = useState([{ name: \" \", address: \" \", img: \" \" }])\r\n const user = isAuthenticated()\r\n\r\n async function getBookmark() {\r\n try {\r\n const bookmarkArr = [];\r\n const response = await axios.get(`/api/users/bookmark?ID=${user}`)\r\n setBookmarkPlace(response.data.bookmark)\r\n } catch (err) {\r\n catchErrors(err, setError(err))\r\n console.log(\"북마크에러\", error)\r\n }\r\n }\r\n\r\n\r\n async function handleBookmark(index) {\r\n if (!bookmark[index]) {\r\n console.log(bookmarkPlace[index])\r\n try {\r\n const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${bookmarkPlace[index]._id}`)\r\n alert(response.data, '북마크가 저장되었습니다.')\r\n const showArr = bookmark\r\n showArr[index] = true\r\n setBookmark(showArr)\r\n console.log(\"bookmark=\", bookmark)\r\n } catch (error) {\r\n catchErrors(error, setError)\r\n }\r\n } else {\r\n try {\r\n const response = await axios.delete(`/api/users/bookmark?ID=${user}&place=${bookmarkPlace[index]._id}`)\r\n alert(response.data, '저장된 북마크가 삭제되었습니다.')\r\n getBookmark()\r\n console.log(\"bookmark=\", bookmark)\r\n } catch (error) {\r\n catchErrors(error, setError)\r\n }\r\n }\r\n }\r\n\r\n const handlePage = (num) => {\r\n setIndex(num);\r\n }\r\n\r\n \r\n function paginate(items, pageNumber, itemNumber) {\r\n const startIndex = (pageNumber - 1) * itemNumber\r\n\r\n return _(items)\r\n .slice(startIndex)\r\n .take(itemNumber)\r\n .value();\r\n }\r\n\r\n useEffect(() => {\r\n getBookmark()\r\n }, [])\r\n\r\n\r\n useEffect(() => {\r\n setpagePlace(paginate(bookmarkPlace, index, 4))\r\n setEndPage(Math.ceil((bookmarkPlace.length / 4)))\r\n }, [bookmarkPlace, index])\r\n\r\n return (\r\n <Container>\r\n <Link to=\"/\"><Image style={{ margin: \"1%\" }} src={ohuh} /></Link>\r\n <div className=\"d-flex align-items-center p-3 text-white bg-info rounded shadow-sm\">\r\n <div >\r\n <h1 className=\"h6 mb-0 text-white\">북마크</h1>\r\n </div>\r\n </div>\r\n <Row className=\"d-flex flex-wrap\">\r\n {console.log(\"#####################33\", bookmarkPlace)}\r\n {pagePlace.map((place, index) => {\r\n return (\r\n <Col key={index} md={6} >\r\n <Card border=\"info\" style={{ margin: \"2%\" }}>\r\n\r\n <Card.Header style={{ margin: \"0\", fontSize: '200%', fontWeight: 'bold' }} >\r\n {user ?\r\n <Button\r\n style={{marginRight:\"3%\"}}\r\n variant={bookmark[index] ? \"info\" : \"light\"}\r\n onClick={() => handleBookmark(index, place)}>\r\n <Icon.BookmarkStarFill size={35} />\r\n {console.log(\"bookmark\", bookmark)}\r\n {console.log(\"bookmark[index]\", bookmark[index])}</Button> : null}\r\n {place.name}\r\n </Card.Header>\r\n <Card.Img variant=\"top\" style={{ padding: \"5%\", width: \"100%\", height: \"340px\" }} src={place.img} />\r\n <Card.Body >\r\n <Card.Text style={{ overflow: 'auto', fontSize: '150%', width: '100%', height: \"65px\" }} >\r\n {place.address} </Card.Text>\r\n <Link to={`/place?name=${place.name}&src=${place.img}&address=${place.address}`} >\r\n <Button variant=\"info\"> {place.name} 자세히 살펴보기</Button>\r\n </Link>\r\n </Card.Body>\r\n </Card>\r\n </Col>\r\n )\r\n })}\r\n </Row>\r\n <Row className=\"mt-2 d-flex justify-content-center\">\r\n <Paginations index={index} endPage={endPage} handlePage={handlePage}></Paginations>\r\n </Row>\r\n </Container >\r\n )\r\n}\r\n\r\nexport default Bookmark\r\n\r\n\r\n // async function handleSubmit(e){\r\n // setState(true); //버튼이 눌려서 handlesubmit이될때 setState값이 true로 바뀐다\r\n // try { //respons 서버에 post로 요청하여 데이터를 받아온다\r\n // const response = await axios.post('/api/users/bookmark', page)\r\n // setSuccess(true)\r\n // } catch (error) {\r\n // console.log(error)\r\n // catchErrors(error, setError)\r\n // }\r\n // }\r\n\r\n // useEffect(() => {\r\n // getBookmark(user)\r\n // }, [user])","C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Place.js",["33","34","35","36"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Search.js",["37","38"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Login.js",["39"],"C:\\Users\\sag06\\Desktop\\project\\search-page\\client\\src\\Pages\\Signup.js",[],{"ruleId":"40","severity":1,"message":"41","line":26,"column":19,"nodeType":"42","messageId":"43","endLine":26,"endColumn":30},{"ruleId":"44","severity":1,"message":"45","line":77,"column":8,"nodeType":"46","endLine":77,"endColumn":10,"suggestions":"47"},{"ruleId":"40","severity":1,"message":"48","line":1,"column":10,"nodeType":"49","messageId":"43","endLine":1,"endColumn":15},{"ruleId":"40","severity":1,"message":"50","line":11,"column":10,"nodeType":"42","messageId":"43","endLine":11,"endColumn":15},{"ruleId":"44","severity":1,"message":"51","line":30,"column":6,"nodeType":"46","endLine":30,"endColumn":8,"suggestions":"52"},{"ruleId":"53","severity":1,"message":"54","line":89,"column":11,"nodeType":"55","endLine":89,"endColumn":44},{"ruleId":"40","severity":1,"message":"50","line":22,"column":12,"nodeType":"42","messageId":"43","endLine":22,"endColumn":17},{"ruleId":"44","severity":1,"message":"56","line":57,"column":8,"nodeType":"46","endLine":57,"endColumn":15,"suggestions":"57"},{"ruleId":"40","severity":1,"message":"58","line":2,"column":68,"nodeType":"42","messageId":"43","endLine":2,"endColumn":71},"no-unused-vars","'bookmarkArr' is assigned a value but never used.","Identifier","unusedVar","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.","ArrayExpression",["59"],"'kakao' is defined but never used.","Program","'error' is assigned a value but never used.","React Hook useEffect has a missing dependency: 'getReview'. Either include it or remove the dependency array.",["60"],"jsx-a11y/anchor-is-valid","The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md","JSXOpeningElement","React Hook useEffect has missing dependencies: 'getAssociation', 'getBookmark', 'props.history', and 'search'. Either include them or remove the dependency array.",["61"],"'Nav' is defined but never used.",{"desc":"62","fix":"63"},{"desc":"64","fix":"65"},{"desc":"66","fix":"67"},"Update the dependencies array to be: [getBookmark]",{"range":"68","text":"69"},"Update the dependencies array to be: [getReview]",{"range":"70","text":"71"},"Update the dependencies array to be: [getAssociation, getBookmark, props.history, search, state]",{"range":"72","text":"73"},[2593,2595],"[getBookmark]",[1055,1057],"[getReview]",[2098,2105],"[getAssociation, getBookmark, props.history, search, state]"]
\ No newline at end of file
......@@ -102,7 +102,7 @@ function App() {
<Col md={6} xs={12}>
<Card border="info" style={{ margin: "2%" }}>
<Card.Title style={{ margin: "0", paddingTop: "3%", fontSize: '200%', fontWeight: 'bold' }} >
<Row style={{ fontSize: "60%", marginLeft: "7%" }}><strong class="border p-2 text-danger mb-2">인기관광지</strong></Row>
<Row style={{ fontSize: "60%", marginLeft: "7%" }}><strong className="border p-2 text-danger mb-2">인기관광지</strong></Row>
<Row style={{ fontSize: "100%", marginLeft: "8%" }}>{recommend.name}</Row></Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={recommend.img} />
<Card.Body style={{ paddingTop: "0" }} >
......@@ -118,7 +118,7 @@ function App() {
<Col md={6} xs={12}>
<Card border="info" style={{ margin: "2%" }} >
<Card.Title style={{ margin: "0", paddingTop: "3%", fontSize: '200%', fontWeight: 'bold' }} >
<Row style={{ fontSize: "60%", marginLeft: "7%" }}><strong class="border p-2 text-success mb-2">최근 검색 관광지</strong></Row>
<Row style={{ fontSize: "60%", marginLeft: "7%" }}><strong className="border p-2 text-success mb-2">최근 검색 관광지</strong></Row>
<Row style={{ fontSize: "100%", marginLeft: "8%" }}>{latest.name}</Row></Card.Title>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={latest.img} />
<Card.Body style={{ paddingTop: "0" }}>
......
......@@ -85,9 +85,9 @@ function Bookmark() {
return (
<Container>
<Link to="/"><Image style={{ margin: "1%" }} src={ohuh} /></Link>
<div class="d-flex align-items-center p-3 text-white bg-info rounded shadow-sm">
<div className="d-flex align-items-center p-3 text-white bg-info rounded shadow-sm">
<div >
<h1 class="h6 mb-0 text-white">북마크</h1>
<h1 className="h6 mb-0 text-white">북마크</h1>
</div>
</div>
<Row className="d-flex flex-wrap">
......
import React, { useState, useEffect } from 'react'
import { Alert, Col, Container, Form, Row, Button, Spinner } from "react-bootstrap"
import { Alert, Col, Container, Form, Row, Button, Spinner, Image, Nav, Navbar } from "react-bootstrap"
import axios from "axios"
import catchErrors from '../utils/catchErrors'
import { Redirect } from 'react-router-dom'
import { handleLogin } from '../utils/auth'
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
const INIT_USER = {
email: '',
......@@ -52,7 +53,10 @@ function Login() {
return (
<Container>
<Row className= 'vh-100 flex-column align-items-center justify-content-center'>
<Navbar bg="#fff" variant="light">
<Navbar.Brand href="/"><Image src={ohuh}/></Navbar.Brand>
</Navbar>
<Row className= 'mt-3 flex-column align-items-center justify-content-center'>
<h2>로그인</h2>
<Col md={6}>
{error && <Alert variant='danger'>
......@@ -67,10 +71,13 @@ function Login() {
<Form.Label>비밀번호</Form.Label>
<Form.Control name='password' type='password' value={user.password} onChange={handleChange}/>
</Form.Group>
<Button disabled={disabled || setLoading} type='submit'
<Button variant="info" disabled={disabled || setLoading} type='submit'
block>
{loading && <Spinner as= 'span' animation= 'border' size='sm'
role= 'status' aria-hidden= 'true' />}{' '}확인</Button>
<Link to='/signup'>
회원이 아니신가요?
</Link>
</Form>
</Col>
</Row>
......
......@@ -34,49 +34,49 @@ function Place(props) {
<Container>
<Link to="/"><Image style={{ margin: "1%" }} src={ohuh} /></Link>
<div class="d-flex align-items-center p-3 my-3 text-white bg-info rounded shadow-sm">
<h1 class="h6 mb-0 text-white">{name}</h1>
<div className="d-flex align-items-center p-3 my-3 text-white bg-info rounded shadow-sm">
<h1 className="h6 mb-0 text-white">{name}</h1>
</div>
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom pb-2 mb-0">관광지 정보</h6>
<div className="my-3 p-3 bg-white rounded shadow-sm">
<h6 className="border-bottom pb-2 mb-0">관광지 정보</h6>
<Row>
<Col>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "100%" }} src={src} />
</Col>
<Col>
<div class="d-flex text-muted pt-3">
<p class="pb-3 mb-0 lh-sm border-bottom">
<strong class="d-block text-gray-dark">관광지 이름</strong>
<div className="d-flex text-muted pt-3">
<p className="pb-3 mb-0 lh-sm border-bottom">
<strong className="d-block text-gray-dark">관광지 이름</strong>
{name}
</p>
</div>
<div class="d-flex text-muted pt-3">
<div className="d-flex text-muted pt-3">
<p class="pb-3 mb-0 lh-sm border-bottom">
<strong class="d-block text-gray-dark">관광지 주소</strong>
<p className="pb-3 mb-0 lh-sm border-bottom">
<strong className="d-block text-gray-dark">관광지 주소</strong>
{address}
</p>
</div>
</Col>
</Row>
<small class="d-block text-end mt-3">
<small className="d-block text-end mt-3">
<a href={`https://www.google.com/search?q=${name}&tbm=isch`}>사진 더보러가기</a>
</small>
</div>
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom pb-2 mb-0">관광지 후기</h6>
<div className="my-3 p-3 bg-white rounded shadow-sm">
<h6 className="border-bottom pb-2 mb-0">관광지 후기</h6>
{Array.isArray(review.reviews) ? review.reviews.map((review) => {
return (
<div class="d-flex text-muted pt-3">
<div class="pb-3 mb-0 small lh-sm border-bottom w-100">
<div class="d-flex justify-content-between">
<strong class="text-gray-dark">{review.title}</strong>
<div className="d-flex text-muted pt-3">
<div className="pb-3 mb-0 small lh-sm border-bottom w-100">
<div className="d-flex justify-content-between">
<strong className="text-gray-dark">{review.title}</strong>
<a href={review.link}>블로그로 이동</a>
</div>
<span class="d-block">{review.summary}</span>
<span className="d-block">{review.summary}</span>
</div>
</div>
)
......@@ -85,7 +85,7 @@ function Place(props) {
<small class="d-block text-end mt-3">
<small className="d-block text-end mt-3">
<a href="#" onClick={getReview} >리뷰 더보기</a>
</small>
</div>
......
......@@ -103,7 +103,7 @@ function Search(props) {
return (
<Container >
<Link to="/"><Image src={ohuh} /></Link>
<Row className="mb-2" className="d-flex justify-content-center">
<Row className="mb-2 d-flex justify-content-center">
<Form style={{ width: "90vw" }} onSubmit={handleSubmit}>
<InputGroup size="lg">
<FormControl
......
import React, { useState, useEffect } from 'react'
import { Col, Container, Form, Row, Button, Alert } from "react-bootstrap"
import { Col, Container, Form, Row, Button, Alert, Image, Navbar } from "react-bootstrap"
import axios from "axios"
import catchErrors from '../utils/catchErrors'
import { Redirect } from 'react-router-dom'
import ohuh from '../ohuh-sm.PNG';
const INIT_USER = {
name: '',
......@@ -47,7 +48,10 @@ function Signup() {
return (
<Container>
<Row className= 'vh-100 flex-column align-items-center justify-content-center'>
<Navbar bg="#fff" variant="light">
<Navbar.Brand href="/"><Image src={ohuh}/></Navbar.Brand>
</Navbar>
<Row className= 'mt-3 flex-column align-items-center justify-content-center'>
<h2>회원가입</h2>
<Col md={5}>
{error && <Alert variant='danger'>
......@@ -66,7 +70,7 @@ function Signup() {
<Form.Label>비밀번호</Form.Label>
<Form.Control name='password' type='password' value={user.password} onChange={handleChange}/>
</Form.Group>
<Button disabled={disabled} type='submit' block>확인</Button>
<Button variant="info" disabled={disabled} type='submit' block>확인</Button>
</Form>
</Col>
</Row>
......
......@@ -5,8 +5,8 @@ import 'bootstrap/dist/css/bootstrap.min.css';
import App from './Pages/App'
import Search from './Pages/Search';
import reportWebVitals from './reportWebVitals';
import Signup from './Components/Signup'
import Login from './Components/Login'
import Signup from './Pages/Signup'
import Login from './Pages/Login'
import PrivateRoute from "./Components/PrivateRoute";
import Bookmark from "./Pages/Bookmark"
import {
......@@ -24,9 +24,9 @@ ReactDOM.render(
<Route exact path="/" component={App} />
<Route path="/search" component={Search} />
<Route path="/place" component={Place} />
<Route path='/signup' component={Signup}/>
<Route path='/signup' component={Signup} />
<Route path='/login' component={Login} />
<PrivateRoute path='/bookmark'><Bookmark/></PrivateRoute>
<PrivateRoute path='/bookmark'><Bookmark /></PrivateRoute>
<Redirect path="/search" to="/search" />
</Switch>
</Router>
......
......@@ -19,10 +19,6 @@ const ReviewSchema = new mongoose.Schema({
type: Array,
// required: true,
},
time: {
type: Array,
// required: true,
},
}, {
timestamps: true
})
......
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