Commit 4a7a2303 authored by Lee Soobeom's avatar Lee Soobeom
Browse files

Merge remote-tracking branch 'origin/MK24' into develop

parents 0c762397 ab76f24e
...@@ -77,12 +77,12 @@ export default function Signup() { ...@@ -77,12 +77,12 @@ export default function Signup() {
<div className="flex flex-col "> <div className="flex flex-col ">
<div className="border-0 border-y-2 border-black"> <div className="border-0 border-y-2 border-black">
<div className="h-16 flex "> <div className="h-16 flex ">
<div className="whitespace-nowrap grid place-items-center basis-1/5 shrink-0 border-0 border-r-2"> <div className="whitespace-nowrap grid place-items-center w-32 lg:basis-1/5 shrink-0 border-0 border-r-2">
이름 이름
</div> </div>
<div className="grid place-items-center mx-5"> <div className="flex items-center mx-5">
<input <input
className="h-10 basis-1/5 border-2 focus:border-black" className="h-10 w-4/5 lg:w-60 border-2 focus:border-black"
type="text" type="text"
name="name" name="name"
onChange={handleChange} onChange={handleChange}
...@@ -90,12 +90,12 @@ export default function Signup() { ...@@ -90,12 +90,12 @@ export default function Signup() {
</div> </div>
</div> </div>
<div className="h-16 flex border-0 border-t-2"> <div className="h-16 flex border-0 border-t-2">
<div className="whitespace-nowrap grid place-items-center basis-1/5 shrink-0 border-0 border-r-2"> <div className="whitespace-nowrap grid place-items-center w-32 lg:basis-1/5 shrink-0 border-0 border-r-2">
이메일 이메일
</div> </div>
<div className="grid place-items-center mx-5"> <div className="flex items-center mx-5">
<input <input
className=" grid place-items-center h-10 basis-1/5 border-2 focus:border-black" className=" w-4/5 h-10 lg:w-60 border-2 focus:border-black"
type="email" type="email"
name="email" name="email"
onChange={handleChange} onChange={handleChange}
...@@ -103,12 +103,12 @@ export default function Signup() { ...@@ -103,12 +103,12 @@ export default function Signup() {
</div> </div>
</div> </div>
<div className="h-16 flex border-0 border-t-2"> <div className="h-16 flex border-0 border-t-2">
<div className="whitespace-nowrap grid place-items-center basis-1/5 shrink-0 border-0 border-r-2"> <div className="whitespace-nowrap grid place-items-center w-32 lg:basis-1/5 shrink-0 border-0 border-r-2">
비밀번호 비밀번호
</div> </div>
<div className="grid place-items-center mx-5"> <div className="flex items-center mx-5">
<input <input
className="grid place-items-center h-10 basis-1/5 border-2 focus:border-black" className="w-4/5 h-10 lg:w-60 border-2 focus:border-black"
type="password" type="password"
name="password" name="password"
onChange={handleChange} onChange={handleChange}
...@@ -117,13 +117,13 @@ export default function Signup() { ...@@ -117,13 +117,13 @@ export default function Signup() {
</div> </div>
<div className="h-16 flex border-0 border-t-2"> <div className="h-16 flex border-0 border-t-2">
<div className="whitespace-nowrap grid place-items-center basis-1/5 shrink-0 border-0 border-r-2"> <div className="whitespace-nowrap grid place-items-center w-32 lg:basis-1/5 shrink-0 border-0 border-r-2">
비밀번호 확인 비밀번호 확인
</div> </div>
<div className="grid place-items-center mx-5"> <div className="flex items-center mx-5">
<input <input
className="grid place-items-center h-10 basis-1/5 border-2 focus:border-black" className="w-4/5 h-10 lg:w-60 border-2 focus:border-black"
type="password" type="password"
name="password2" name="password2"
onChange={handleChange} onChange={handleChange}
......
import React, { useState, MouseEvent, useEffect } from "react"; import React, { useState, MouseEvent, useEffect } from "react";
import { Link, useLocation } from "react-router-dom"; import { Link, useLocation, useNavigate } from "react-router-dom";
import { PostType } from "../types"; import { PostType } from "../types";
import Post from "../post/post"; import Post from "../post/post";
import { postApi } from "../apis"; import { postApi } from "../apis";
import { useAuth } from "../auth/auth.context";
interface Posts { interface Posts {
posts: PostType[]; posts: PostType[];
...@@ -16,6 +17,8 @@ export default function BoardPage() { ...@@ -16,6 +17,8 @@ export default function BoardPage() {
const [posts, setPosts] = useState<PostType[]>(); const [posts, setPosts] = useState<PostType[]>();
const location = useLocation() as Newpost; const location = useLocation() as Newpost;
const newPost = location.state; const newPost = location.state;
const navigate = useNavigate();
const { user } = useAuth();
console.log("get newPost Info", newPost); console.log("get newPost Info", newPost);
...@@ -52,29 +55,37 @@ export default function BoardPage() { ...@@ -52,29 +55,37 @@ export default function BoardPage() {
} }
}; };
const GoLogin = async (event: React.MouseEvent) => {
if (!user.isLoggedIn) {
alert("로그인이 필요합니다.");
navigate("/login", { replace: true });
}
};
return ( return (
<div className="flex flex-col "> <div className="flex flex-col ">
<div className="flex flex-col mt-6"> <div className="flex flex-col mt-6">
<div className="text-2xl">자유 게시판</div> <div className="text-2xl whitespace-nowrap">자유 게시판</div>
<div className="text-sm mt-5">여행지 후기를 남겨주세요!</div> <div className="text-sm mt-5 whitespace-nowrap">
여행지 후기를 남겨주세요!
</div>
</div> </div>
<div className="flex flex-col w-full mt-16"> <div className="flex flex-col w-full mt-16">
<div className="flex justify-end"> <div className="flex justify-end">
<div className="border-2 border-blue-500 rounded mb-2"> <div className="border-2 border-blue-500 rounded mb-2 whitespace-nowrap">
<Link to="/posting"> <button onClick={GoLogin}>
<button>글쓰기</button> <Link to="/posting">글쓰기</Link>
</Link> </button>
</div>{" "} </div>
{/* Link */}
</div> </div>
<div className="sm:overflow-y-auto"> <div className="sm:overflow-y-auto">
<div className="flex place-items-center divide-x-2 border-2 border-solid border-y-2 h-10 bg-gradient-to-r from-cyan-500 to-blue-500 "> <div className="whitespace-nowrap flex place-items-center divide-x-2 border-2 border-solid border-y-2 h-10 bg-gradient-to-r from-cyan-500 to-blue-500 ">
<div className="basis-full">제목</div> <div className="basis-full">제목</div>
<div className="basis-3/12">게시 날짜</div> <div className="basis-3/12">게시 날짜</div>
<div className="basis-2/12">조회수</div> <div className="basis-2/12">조회수</div>
</div> </div>
<div className=""> <div className="whitespace-nowrap">
{posts?.map((post, i) => ( {posts?.map((post, i) => (
<Post key={i} post={post} handleClick={titleHandleClick} /> <Post key={i} post={post} handleClick={titleHandleClick} />
))} ))}
......
...@@ -21,10 +21,10 @@ export default function Body() { ...@@ -21,10 +21,10 @@ export default function Body() {
imgsData(); imgsData();
}, []); }, []);
useEffect(() => { // useEffect(() => {
console.log(searchParams.get("theme"), searchParams.get("city")); // console.log(searchParams.get("theme"), searchParams.get("city"));
setSearchParams(searchParams); // setSearchParams(searchParams);
}, []); // }, []);
const themeHandleClick = (event: MouseEvent<HTMLButtonElement>) => { const themeHandleClick = (event: MouseEvent<HTMLButtonElement>) => {
console.log(`theme id= ${event.currentTarget.id}`); console.log(`theme id= ${event.currentTarget.id}`);
......
...@@ -14,10 +14,10 @@ export default function Header() { ...@@ -14,10 +14,10 @@ export default function Header() {
}; };
return ( return (
<div className="flex flex-col lg:px-56 "> <div className="flex flex-col md:px-56 ">
<div className="flex flex-col-reverse pt-3 pb-12 border-b-2 border-sky-200 bg-gradient-to-t from-sky-200"> <div className="flex flex-col-reverse pt-3 pb-12 border-b-2 border-sky-200 bg-gradient-to-t from-sky-200">
<div className="flex mt-5 justify-between pr-3"> <div className="flex mt-5 justify-between pr-3">
<button className="ml-3 shrink-0 text-2xl"> <button className="ml-3 shrink-0 md:text-2xl">
<Link to="/" className="hover:text-sky-300 active:text-purple-500"> <Link to="/" className="hover:text-sky-300 active:text-purple-500">
Travel Report Travel Report
</Link> </Link>
......
import React, { MouseEventHandler } from "react"; import React, { MouseEventHandler, useState } from "react";
type ThemeProps = { type ThemeProps = {
handleClick: MouseEventHandler; handleClick: MouseEventHandler;
}; };
export default function Theme({ handleClick }: ThemeProps) { export default function Theme({ handleClick }: ThemeProps) {
const [active, setActive] = useState(0);
const onactive = "whitespace-nowrap px-5 text-sky-300 ";
const offactive = "whitespace-nowrap px-5 ";
const clickActive = (a: number) => {
setActive(a);
};
return ( return (
<div className="overflow-x-auto flex rounded md:justify-center py-2 border-b-2 divide-x-2"> <div className="overflow-x-auto flex rounded py-2 md:p-2 border-b-2 divide-x-2">
<div onClick={() => clickActive(1)}>
<button <button
id={"surfing"} id={"surfing"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300 " className={active === 1 ? onactive : offactive}
> >
서핑 서핑
</button> </button>
</div>
<div onClick={() => clickActive(2)}>
<button <button
id={"activity"} id={"activity"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 2 ? onactive : offactive}
> >
액티비티 액티비티
</button> </button>
</div>
<div onClick={() => clickActive(3)}>
<button <button
id={"camping"} id={"camping"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300 " className={active === 3 ? onactive : offactive}
> >
캠핑 캠핑
</button> </button>
</div>
<div onClick={() => clickActive(4)}>
<button <button
id={"skiing"} id={"skiing"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 4 ? onactive : offactive}
> >
스키 스키
</button> </button>
</div>
<div onClick={() => clickActive(5)}>
<button <button
id={"boat"} id={"boat"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 5 ? onactive : offactive}
> >
보트 보트
</button> </button>
</div>
<div onClick={() => clickActive(6)}>
<button <button
id={"desert"} id={"desert"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 6 ? onactive : offactive}
> >
사막 사막
</button> </button>
</div>
<div onClick={() => clickActive(7)}>
<button <button
id={"golf"} id={"golf"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 7 ? onactive : offactive}
> >
골프 골프
</button> </button>
</div>
<div onClick={() => clickActive(8)}>
<button <button
id={"cave"} id={"cave"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 8 ? onactive : offactive}
> >
동굴 동굴
</button> </button>
</div>
<div onClick={() => clickActive(9)}>
<button <button
id={"history"} id={"history"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 9 ? onactive : offactive}
> >
문화재 문화재
</button> </button>
</div>
<div onClick={() => clickActive(10)}>
<button <button
id={"zoo"} id={"zoo"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 10 ? onactive : offactive}
> >
동물원 동물원
</button> </button>
</div>
<div onClick={() => clickActive(11)}>
<button <button
id={"cycling"} id={"cycling"}
onClick={handleClick} onClick={handleClick}
className="shrink-0 px-5 hover:text-sky-300" className={active === 11 ? onactive : offactive}
> >
사이클링 사이클링
</button> </button>
</div> </div>
</div>
); );
} }
import React, { MouseEventHandler } from "react"; import React, { MouseEventHandler, useState } from "react";
type CityProps = { type CityProps = {
handleClick: MouseEventHandler; handleClick: MouseEventHandler;
}; };
export default function Citylist({ handleClick }: CityProps) { export default function Citylist({ handleClick }: CityProps) {
const [active, setActive] = useState(0);
const onactive = "text-start px-5 py-2 underline whitespace-nowrap";
const offactive = "text-start px-5 py-2 whitespace-nowrap";
const clickActive = (a: number) => {
setActive(a);
};
return ( return (
<div className="overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-sky-100"> <div className="overflow-auto w-full flex flex-row md:flex-col md:mr-24 bg-sky-100">
<div className="text-start px-5 py-2 bg-white whitespace-nowrap"> <div className="text-start px-5 py-2 bg-white whitespace-nowrap">
도시 도시
</div> </div>
<div onClick={() => clickActive(1)}>
<button <button
id={"Seoul"} id={"Seoul"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 1 ? onactive : offactive}
> >
서울 서울
</button> </button>
</div>
<div onClick={() => clickActive(2)}>
<button <button
id={"Busan"} id={"Busan"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 2 ? onactive : offactive}
> >
부산 부산
</button> </button>
</div>
<div onClick={() => clickActive(3)}>
<button <button
id={"Incheon"} id={"Incheon"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 3 ? onactive : offactive}
> >
인천 인천
</button> </button>
</div>
<div onClick={() => clickActive(4)}>
<button <button
id={"Daegoo"} id={"Daegoo"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 4 ? onactive : offactive}
> >
대구 대구
</button> </button>
</div>
<div onClick={() => clickActive(5)}>
<button <button
id={"Gwangjoo"} id={"Gwangjoo"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 5 ? onactive : offactive}
> >
광주 광주
</button> </button>
</div>
<div onClick={() => clickActive(6)}>
<button <button
id={"Daejeon"} id={"Daejeon"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 6 ? onactive : offactive}
> >
대전 대전
</button> </button>
</div>
<div onClick={() => clickActive(7)}>
<button <button
id={"Woolsan"} id={"Woolsan"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 7 ? onactive : offactive}
> >
울산 울산
</button> </button>
</div>
<div onClick={() => clickActive(8)}>
<button <button
id={"Sejong"} id={"Sejong"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 8 ? onactive : offactive}
> >
세종 세종
</button> </button>
</div>
<div onClick={() => clickActive(9)}>
<button <button
id={"Dokdo"} id={"Dokdo"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 9 ? onactive : offactive}
> >
독도 독도
</button> </button>
</div>
<div onClick={() => clickActive(10)}>
<button <button
id={"Jeju"} id={"Jeju"}
onClick={handleClick} onClick={handleClick}
className="text-start px-5 py-2 hover:underline whitespace-nowrap" className={active === 10 ? onactive : offactive}
> >
제주 제주
</button> </button>
{/* citylist */} </div>
</div> </div>
// Citylist Page // Citylist Page
); );
......
...@@ -4,7 +4,11 @@ import { TypedRequest } from "../types"; ...@@ -4,7 +4,11 @@ import { TypedRequest } from "../types";
export const uploadFile = asyncWrap(async (reqExp, res, next) => { export const uploadFile = asyncWrap(async (reqExp, res, next) => {
const req = reqExp as TypedRequest; const req = reqExp as TypedRequest;
const form = formidable({ multiples: false, uploadDir: "uploads",keepExtensions : true }); const form = formidable({
multiples: false,
uploadDir: "uploads",
keepExtensions: true,
});
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
form.parse(req, (err, fields, files) => { form.parse(req, (err, fields, files) => {
...@@ -25,7 +29,11 @@ export const uploadFile = asyncWrap(async (reqExp, res, next) => { ...@@ -25,7 +29,11 @@ export const uploadFile = asyncWrap(async (reqExp, res, next) => {
export const uploadFiles = asyncWrap(async (reqExp, res, next) => { export const uploadFiles = asyncWrap(async (reqExp, res, next) => {
const req = reqExp as TypedRequest; const req = reqExp as TypedRequest;
const form = formidable({ multiples: true, uploadDir: "uploads" }); const form = formidable({
multiples: true,
uploadDir: "uploads",
keepExtensions: true,
});
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
form.parse(req, (err, fields, files) => { form.parse(req, (err, fields, files) => {
......
export * as roleDb from "./role.db"; export * as roleDb from "./role.db";
export * as postDb from "./post.db"; export * as postDb from "./post.db";
export * as userDb from "./user.db"; export * as userDb from "./user.db";
export * as mainimgDb from "./mainimg.db" export * as mainimgDb from "./mainimg.db";
\ No newline at end of file
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