Commit 4eb8170c authored by baesangjune's avatar baesangjune
Browse files

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

parents f66c99af d8de9050
[{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js":"2","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js":"3","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js":"4","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js":"5","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js":"6","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js":"7","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js":"8","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js":"9","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js":"10","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Bookmark.js":"11"},{"size":1345,"mtime":1612156521448,"results":"12","hashOfConfig":"13"},{"size":375,"mtime":1611254909401,"results":"14","hashOfConfig":"13"},{"size":3725,"mtime":1612133560393,"results":"15","hashOfConfig":"13"},{"size":8402,"mtime":1612273942838,"results":"16","hashOfConfig":"13"},{"size":4731,"mtime":1612156511931,"results":"17","hashOfConfig":"13"},{"size":438,"mtime":1612133560394,"results":"18","hashOfConfig":"13"},{"size":3150,"mtime":1612140232971,"results":"19","hashOfConfig":"13"},{"size":2959,"mtime":1612133560395,"results":"20","hashOfConfig":"13"},{"size":6289,"mtime":1612273230443,"results":"21","hashOfConfig":"13"},{"size":766,"mtime":1612140214129,"results":"22","hashOfConfig":"13"},{"size":5351,"mtime":1612273874666,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},"13y9yvi",{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":7,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"26"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"43","messages":"44","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"45","messages":"46","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\index.js",[],["47","48"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\reportWebVitals.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Paginations.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Search.js",["49","50","51","52","53","54","55"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\App.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\PrivateRoute.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Login.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Components\\Signup.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js",["56","57","58"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\utils\\auth.js",[],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Bookmark.js",["59"],{"ruleId":"60","replacedBy":"61"},{"ruleId":"62","replacedBy":"63"},{"ruleId":"64","severity":1,"message":"65","line":4,"column":83,"nodeType":"66","messageId":"67","endLine":4,"endColumn":86},{"ruleId":"64","severity":1,"message":"68","line":21,"column":12,"nodeType":"66","messageId":"67","endLine":21,"endColumn":17},{"ruleId":"64","severity":1,"message":"69","line":25,"column":20,"nodeType":"66","messageId":"67","endLine":25,"endColumn":31},{"ruleId":"64","severity":1,"message":"70","line":27,"column":19,"nodeType":"66","messageId":"67","endLine":27,"endColumn":27},{"ruleId":"71","severity":1,"message":"72","line":49,"column":8,"nodeType":"73","endLine":49,"endColumn":10,"suggestions":"74"},{"ruleId":"71","severity":1,"message":"75","line":75,"column":8,"nodeType":"73","endLine":75,"endColumn":15,"suggestions":"76"},{"ruleId":"77","severity":1,"message":"78","line":147,"column":35,"nodeType":"79","endLine":147,"endColumn":76},{"ruleId":"64","severity":1,"message":"80","line":1,"column":10,"nodeType":"81","messageId":"67","endLine":1,"endColumn":15},{"ruleId":"71","severity":1,"message":"82","line":54,"column":6,"nodeType":"73","endLine":54,"endColumn":8,"suggestions":"83"},{"ruleId":"84","severity":1,"message":"85","line":133,"column":11,"nodeType":"86","endLine":133,"endColumn":23},{"ruleId":"71","severity":1,"message":"87","line":66,"column":8,"nodeType":"73","endLine":66,"endColumn":18,"suggestions":"88"},"no-native-reassign",["89"],"no-negated-in-lhs",["90"],"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'error' is assigned a value but never used.","'getBookmark' is defined but never used.","'response' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getAssociation'. Either include it or remove the dependency array.","ArrayExpression",["91"],"React Hook useEffect has missing dependencies: 'getAssociation', 'props.history', and 'search'. Either include them or remove the dependency array.",["92"],"react/jsx-no-duplicate-props","No duplicate props allowed","JSXAttribute","'kakao' is defined but never used.","Program","React Hook useEffect has missing dependencies: 'getReview' and 'infiniteScroll'. Either include them or remove the dependency array.",["93"],"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 a missing dependency: 'getBookmark'. Either include it or remove the dependency array.",["94"],"no-global-assign","no-unsafe-negation",{"desc":"95","fix":"96"},{"desc":"97","fix":"98"},{"desc":"99","fix":"100"},{"desc":"101","fix":"102"},"Update the dependencies array to be: [getAssociation]",{"range":"103","text":"104"},"Update the dependencies array to be: [getAssociation, props.history, search, state]",{"range":"105","text":"106"},"Update the dependencies array to be: [getReview, infiniteScroll]",{"range":"107","text":"108"},"Update the dependencies array to be: [bookmark, getBookmark]",{"range":"109","text":"110"},[1863,1865],"[getAssociation]",[2772,2779],"[getAssociation, props.history, search, state]",[1808,1810],"[getReview, infiniteScroll]",[2333,2343],"[bookmark, getBookmark]"]
\ No newline at end of file
[{"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Bookmark.js":"1","C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js":"2"},{"size":5770,"mtime":1612274308433,"results":"3","hashOfConfig":"4"},{"size":6513,"mtime":1612273971390,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"13y9yvi",{"filePath":"8","messages":"9","errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Bookmark.js",["10","11","12"],"C:\\Users\\노트북펜\\Desktop\\2021YDK\\search-page\\client\\src\\Pages\\Place.js",["13"],{"ruleId":"14","severity":1,"message":"15","line":2,"column":45,"nodeType":"16","messageId":"17","endLine":2,"endColumn":48},{"ruleId":"14","severity":1,"message":"18","line":2,"column":50,"nodeType":"16","messageId":"17","endLine":2,"endColumn":56},{"ruleId":"19","severity":1,"message":"20","line":66,"column":8,"nodeType":"21","endLine":66,"endColumn":18,"suggestions":"22"},{"ruleId":null,"fatal":true,"severity":2,"message":"23","line":4,"column":2},"no-unused-vars","'Nav' is defined but never used.","Identifier","unusedVar","'Navbar' is defined but never used.","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'getBookmark'. Either include it or remove the dependency array.","ArrayExpression",["24"],"Parsing error: Unexpected token\n\n 2 | import axios from 'axios';\n 3 | import React, { useEffect, useState } from 'react';\n> 4 | <<<<<<< HEAD\n | ^\n 5 | import { Container, Image } from 'react-bootstrap';\n 6 | import queryString from 'query-string'\n 7 | import ohuh from '../ohuh-sm.PNG';",{"desc":"25","fix":"26"},"Update the dependencies array to be: [bookmark, getBookmark]",{"range":"27","text":"28"},[2332,2342],"[bookmark, getBookmark]"]
\ No newline at end of file
......@@ -56,17 +56,21 @@ function App() {
<Container className="vh-100 ">
<Col xs={12} >
<Nav className="justify-content-end" bg="#fff" variant="light" style={{}} >
{user ? <Nav.Link onClick={() => handleLogout()}>로그아웃</Nav.Link>
{user ? <>
<Nav.Link onClick={() => handleLogout()}>로그아웃</Nav.Link>
<Nav.Link href='/bookmark'>북마크</Nav.Link>
</>
: (
<>
<Nav.Link href="/signup">회원가입</Nav.Link>
<Nav.Link href="/login">로그인</Nav.Link>
</>
)}
<Nav.Link href='/bookmark'>북마크</Nav.Link>
</Nav>
<Row className="justify-content-center" md={2}>
<Image src={ohuh} style={{ margin: "3%", marginTop : "5%" }} fluid />
<Col className="d-flex justify-content-center">
<Image src={ohuh} style={{ margin: "3%", marginTop: "3%" }} fluid />
</Col>
</Row>
<Row style={{ marginBottom: "5%" }}>
<Form className="vw-100" onSubmit={handleSubmit}>
......@@ -84,7 +88,43 @@ function App() {
</InputGroup>
</Form>
</Row>
<Row xs={6}>
<div class="row mb-2">
<div class="col-md-6">
<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative">
<div class="col p-4 d-flex flex-column position-static">
<strong class="d-inline-block mb-2 text-info">인기관광지</strong>
<h3 class="mb-0">{recommend.name}</h3>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={recommend.img} />
<p class="card-text mb-auto">{recommend.address}</p>
<Link to={`/place?id=${1}&place=${recommend.name}`} >
<Button variant="info"> {recommend.name} 자세히 살펴보기</Button>
</Link>
</div>
<div class="col-auto d-none d-lg-block">
</div>
</div>
</div>
<div class="col-md-6">
<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative">
<div class="col p-4 d-flex flex-column position-static">
<strong class="d-inline-block mb-2 text-success">최근검색 관광지</strong>
<h3 class="mb-0">{latest.name}</h3>
<Image variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={latest.img} />
<p class="mb-auto">{latest.address}</p>
<Link to={`/place?id=${1}&place=${latest.name}`} >
<Button variant="info"> {latest.name} 자세히 살펴보기</Button>
</Link>
</div>
<div class="col-auto d-none d-lg-block">
</div>
</div>
</div>
</div>
{/* <Row xs={6}>
<Col md={6} xs={12}>
<h1 className=" d-flex justify-content-center" style={{ marginBottom: "7%" ,marginTop:"30%" }}>인기관광지</h1>
<Card align="center" border="info" style={{ margin: "3%" }}>
......@@ -114,7 +154,7 @@ function App() {
</Card.Body>
</Card>
</Col>
</Row>
</Row> */}
</Col>
</Container>
......
......@@ -5,7 +5,7 @@ import ohuh from '../ohuh-sm.PNG';
import catchErrors from '../utils/catchErrors.js'
import { isAuthenticated } from '../utils/auth'
import * as Icon from 'react-bootstrap-icons';
import { Link } from 'react-router-dom';
import { Link } from 'react-router-dom'
......@@ -68,7 +68,7 @@ function Bookmark() {
return (
<Container>
<Link to="/" >
{/* <Link to="/" >
<Image style={{ margin: "1%" }} src={ohuh} />
</Link>
<Navbar bg="info" variant="dark">
......@@ -76,7 +76,13 @@ function Bookmark() {
<Nav className="mr-auto">
<Nav.Link href="/">Home</Nav.Link>
</Nav>
</Navbar>
</Navbar> */}
<Link to="/" className="d-flex justify-content-center"><Image style={{ margin: "1%" }} src={ohuh} /></Link>
<div class="d-flex align-items-center p-3 text-white bg-info rounded shadow-sm">
<div >
<h1 class="h6 mb-0 text-white">북마크</h1>
</div>
</div>
<Row className="d-flex flex-wrap">
{console.log("#####################33", pagePlace)}
{pagePlace.map((place, index) => {
......@@ -87,6 +93,7 @@ function Bookmark() {
<Card.Header className="d-flex justify-content-center" style={{ margin: "0", fontSize: '200%', fontWeight: 'bold' }} >{place.name}
{user ?
<Button
className="float-right"
variant={bookmark[index] ? "info" : "light"}
onClick={() => handleBookmark(index, place)}>
<Icon.BookmarkStarFill size={35} />
......@@ -97,7 +104,7 @@ function Bookmark() {
<Card.Body >
<Card.Text style={{ overflow: 'auto', fontSize: '25px', width: '100%', height: "80px" }} >
{place.address} </Card.Text>
<Link to={`/place?id=${1}&place=${place.name}`} >
<Link to={`/place?&place=${place.name}`} >
<Button variant="info"> {place.name} 자세히 살펴보기</Button>
</Link>
</Card.Body>
......
/*global kakao*/
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { Container, Image } from 'react-bootstrap';
import { Container, Row, Image } from 'react-bootstrap';
import queryString from 'query-string'
import ohuh from '../ohuh-sm.PNG';
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
function Place(props) {
console.log(props)
......
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import ohuh from '../ohuh-sm.PNG';
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button, Nav } from 'react-bootstrap';
import { Container, Form, Row, Col, Card, Image, InputGroup, FormControl, Button } from 'react-bootstrap';
import Paginations from '../Components/Paginations';
import axios from 'axios';
import queryString from 'query-string'
......@@ -14,7 +14,7 @@ function Search(props) {
const [state, setState] = useState(false);
const [index, setIndex] = useState(1);
const [search, setSearch] = useState(queryString.parse(props.location.search).keyword);
const [bookmark, setBookmark] = useState([false, false, false, false])
const [bookmark, setBookmark] = useState([])
const [association, setAssociation] = useState([{ name: " ", address: " ", img: " " }])
const [pagePlace, setPagePlace] = useState([{ name: " ", address: " ", img: " " }, { name: " ", address: " ", img: " " }])
const [endPage, setEndPage] = useState(1)
......@@ -25,7 +25,7 @@ function Search(props) {
async function getBookmark() {
try {
const response = await axios.get(`/api/users/bookmark?ID=${user}`)
// setBookmark(response.data.bookmark)
setBookmark(response.data.bookmark)
} catch (error) {
catchErrors(error, setError(error))
}
......@@ -42,12 +42,6 @@ function Search(props) {
})
}
useEffect(() => {
getAssociation()
}, []);
useEffect(() => {
if (association.length < 3) {
setPagePlace(paginate(association, index, association.length))
......@@ -61,15 +55,10 @@ function Search(props) {
useEffect(() => {
getAssociation()
getBookmark()
if (state) {
// window.location.reload()
// return <Redirect to={{
// pathname: `/search?keyword=${search}`,
// state: { id: search },
// }} />;
props.history.push('/search?keyword=' + search)
setState(false)
// console.log("search야", search)
} window.addEventListener("scroll", infiniteScroll);
return () => { window.removeEventListener("scroll", infiniteScroll); }
}, [state]);
......@@ -115,8 +104,8 @@ function Search(props) {
return page
}
async function handlebookmark(index) {
if (!bookmark[index]) {
async function handlebookmark(index, place) {
if (!bookmark.includes(place.name)) {
console.log(pagePlace[index])
try {
const response = await axios.put(`/api/users/bookmark?ID=${user}&place=${pagePlace[index]._id}`)
......@@ -166,17 +155,16 @@ function Search(props) {
{pagePlace.map((place, index) => {
return (
<Col key={index} md={6} >
<Card align="center" border="info" style={{ margin: "2%" }}>
<Row>
<Card align="right" border="info" style={{ margin: "2%" }}>
<Row className="d-flex justify-content-between">
<Card.Header style={{ margin: "0", marginLeft: "3%", marginRight: "3%", fontSize: '200%', fontWeight: 'bold', width: "100vw" }} >{place.name}
{console.log(bookmark.findIndex(i => i.name === place.name))}
{user ?
<Button
variant={bookmark[index] ? "info" : "light"}
variant={bookmark.findIndex(i => i.name === place.name) !== -1 ? "info" : "light"}
onClick={() => handlebookmark(index, place)}>
<Icon.BookmarkStarFill size={35} />
{console.log("bookmark", bookmark)}
{console.log("bookmark[index]", bookmark[index])}</Button>
: null}
</Button> : null}
</Card.Header>
</Row>
<Card.Img variant="top" style={{ padding: "5%", width: "100%", height: "340px" }} src={place.img} />
......
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