Skip to content

Commit

Permalink
다연
Browse files Browse the repository at this point in the history
  • Loading branch information
parkrocket committed Jul 3, 2023
1 parent cf07f30 commit 3f48ea9
Show file tree
Hide file tree
Showing 14 changed files with 1,631 additions and 26 deletions.
446 changes: 442 additions & 4 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
"dependencies": {
"@chakra-ui/icons": "^2.0.19",
"@chakra-ui/react": "^2.6.1",
"@emotion/react": "^11.11.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^4.5.8",
"@fullcalendar/core": "^6.1.8",
"@fullcalendar/daygrid": "^6.1.8",
"@fullcalendar/react": "^6.1.8",
"@iconify/react": "^4.1.0",
"@mobiscroll/cli": "^1.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/lab": "^5.0.0-alpha.132",
"@mui/material": "^5.13.3",
Expand All @@ -23,6 +28,7 @@
"@types/react-dom": "^18.0.11",
"axios": "^1.4.0",
"classnames": "^2.3.2",
"date-fns": "^2.30.0",
"framer-motion": "^10.12.10",
"moment": "^2.29.4",
"node-sass": "^8.0.0",
Expand All @@ -37,6 +43,7 @@
"react-redux": "^8.0.5",
"react-router-dom": "^6.11.1",
"react-scripts": "^5.0.1",
"react-spinners": "^0.13.8",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.4.2",
"sass": "^1.62.1",
Expand Down
31 changes: 31 additions & 0 deletions src/components/Loading.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { css } from "@emotion/react";
import { PacmanLoader } from "react-spinners";

const override = css`
display: block;
margin: 0 auto;
border-color: red;
`;

const Loading = () => {
return (
<div
style={{
position: "fixed",
top: 0,
left: 0,
right: 0,
bottom: 0,
background: "rgba(0, 0, 0, 0.5)",
display: "flex",
justifyContent: "center",
alignItems: "center",
zIndex: 9999,
}}>
<PacmanLoader color="white" css={override} size={25} />
</div>
);
};

export default Loading;
17 changes: 14 additions & 3 deletions src/pages/Introduce.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from "react";
import React, { useEffect } from "react";
import { Box, Center, Badge, Image } from "@chakra-ui/react";

import Gora from "../img/gora.jpg";
import Lija from "../img/lija.jpg";
import Dos from "../img/dos.png";
import Head from "../components/Head";
import { SERVER_URL } from "./Config";
import axios from "axios";

function Introduce(props) {
/*
Expand All @@ -14,6 +16,8 @@ function Introduce(props) {
}
}
*/

useEffect(() => {}, []);
const img = { Gora, Lija, Dos };

const property = {
Expand Down Expand Up @@ -41,18 +45,25 @@ function Introduce(props) {
const property_dy = {
imageUrl: img.Lija,
imageAlt: "매직샵",
name: "최다연",
name: "다연",
age: 28,
sex: "여자",
title: "우앙",
reviewCount: 34,
rating: 4,
};

function Handler() {
axios.post(`${SERVER_URL}/api/test/law`).then((response) => {
console.log(response);
});
}

return (
<>
<Head></Head>
<Center mt={100}>
<button onClick={Handler}>버튼</button>
{[property, property_ino, property_dy].map((el, index) => (
<Box
maxW="sm"
Expand Down Expand Up @@ -81,7 +92,7 @@ function Introduce(props) {
fontSize="xs"
textTransform="uppercase"
ml="2">
{el.age} &bull; {el.sex}
{el.age} age &bull; {el.sex}
</Box>
</Box>
<Box
Expand Down
10 changes: 8 additions & 2 deletions src/pages/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ import ConfigList from './admin/Config/ConfigList';
import MenuEdit from './admin/Config/MenuEdit'
import UserUpdate from './admin/User/UserUpdate';
import NaverLogin from '../pages/user/Social/NaverLogin'
import Calendar from '../pages/calendar/Calendar'
import Calendar2 from '../pages/calendar/Calendar2'
import LawTest from './law/lawTest';

export const Routes = () => {
return (
<ReactRouterRoutes>

<Route path="/" element={Auth(Main,null)} />
<Route path="/introduce" element={Auth(Introduce,true)} />
<Route path="/introduce" element={Auth(Introduce, true)} />
<Route path="/law" element={Auth(LawTest,true)} />
<Route path="/login" element={Auth(Login, false)} />
<Route path="/naver" element={Auth(NaverLogin, false)} />
<Route path="/register" element={Auth(Register,false)} />
Expand All @@ -38,7 +42,9 @@ export const Routes = () => {
<Route path="/board/:boardId/:wrNo" element={Auth(BoardView,true)} />
<Route path="/board/:boardId/write" element={Auth(BoardWrite,true)} />
<Route path="/board/:boardId/page/:page" element={Auth(BoardList,true)} />
<Route path="/board/update/:boardId/:wrNo" element={Auth(BoardWrite,true)} />
<Route path="/board/update/:boardId/:wrNo" element={Auth(BoardWrite, true)} />
<Route path="/calendar" element={Auth(Calendar, false)} />
<Route path="/calendar2" element={Auth(Calendar2,false)} />
<Route path="/dblook" element={<DbLook />} />
<Route path="/passwordcheck" element={Auth(PasswordCheck,true)} />
<Route path="/test" element={<Test value={'테스트 컴포넌트 :)😁'} />} />
Expand Down
6 changes: 5 additions & 1 deletion src/pages/admin/AdminLnb.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function AdminLnb(props) {
</li>
</ul>
</li>
{/**
<li>
<NavLink to="/admin" className="menu1">
<ContentCopyIcon className={`${adminStyle.cate_ico}`} />
Expand All @@ -135,10 +136,11 @@ function AdminLnb(props) {
<span>브랜드 비교분석</span>
</NavLink>
</li>
**/}
<li>
<NavLink to="/admin" className="menu1">
<ControlPointDuplicateIcon className={`${adminStyle.cate_ico}`} />
<span>포인트 충전</span>
<span>포인트</span>
</NavLink>
</li>
<li>
Expand All @@ -148,9 +150,11 @@ function AdminLnb(props) {
<ExpandMoreIcon className={`${adminStyle.arrow_ico}`} />
</NavLink>
<ul className={`${adminStyle.gnb_sub}`}>
{/**
<li>
<NavLink to="">구매내역(견적서)</NavLink>
</li>
**/}
<li>
<NavLink to="">공지사항</NavLink>
</li>
Expand Down
18 changes: 11 additions & 7 deletions src/pages/board/SingleComment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ function SingleComment(props) {
<ul style={{ paddingLeft: props.depth }} className={`${boardCommentStyle.list}`}>
<li className={`${boardCommentStyle.nickname}`}>{props.comment.user_nickname}</li>
<li className={`${boardCommentStyle.cont}`}>
{props.comment.content.split("\n").map((line, index) => {
return (
<React.Fragment key={index}>
{line} <br />
</React.Fragment>
);
})}
{props.comment.option === "secret" &&
user.user.auth.isAdmin === false &&
props.comment.user_id !== user.user.auth._id
? "비밀댓글입니다."
: props.comment.content.split("\n").map((line, index) => {
return (
<React.Fragment key={index}>
{line} <br />
</React.Fragment>
);
})}
</li>
<li className={`${boardCommentStyle.time}`}>{listDateTime}</li>
<li className={`${boardCommentStyle.action}`}>
Expand Down
157 changes: 157 additions & 0 deletions src/pages/calendar/Calendar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import React, { useEffect, useState } from "react";
import { Icon } from "@iconify/react";
import { format, addMonths, subMonths } from "date-fns";
import { startOfMonth, endOfMonth, startOfWeek, endOfWeek } from "date-fns";
import { isSameMonth, isSameDay, addDays, parse } from "date-fns";
import Head from "../../components/Head";
import mement from "moment";
import "./calendar.scss";
import moment from "moment";

const RenderHeader = ({ currentMonth, prevMonth, nextMonth }) => {
return (
<div className="header row">
<div className="col col-start">
<span className="text">
<span className="text month">{format(currentMonth, "M")}</span>
{format(currentMonth, "yyyy")}
</span>
</div>
<div className="col col-end">
<Icon icon="bi:arrow-left-circle-fill" onClick={prevMonth} />
<Icon icon="bi:arrow-right-circle-fill" onClick={nextMonth} />
</div>
</div>
);
};

const RenderDays = () => {
const days = [];
const date = ["일", "월", "화", "수", "목", "금", "토"];

for (let i = 0; i < 7; i++) {
days.push(
<div className="col" key={i}>
{date[i]}
</div>
);
}

return <div className="days row">{days}</div>;
};

const RenderCells = ({ currentMonth, selectedDate, event, onDateClick }) => {
const monthStart = startOfMonth(currentMonth);
const monthEnd = endOfMonth(monthStart);
const startDate = startOfWeek(monthStart);
const endDate = endOfWeek(monthEnd);

const cYear = mement(monthStart).year();
const cMonth = mement(monthStart).format("MM");
let eArray = [];

const ppp = event.filter((events) => events.date.substr(0, 7) === `${cYear}-${cMonth}`);

console.log(ppp);

const rows = [];
let days = [];
let day = startDate;
let formattedDate = "";
let mformattedDate = "";
let tEvent = [];

while (day <= endDate) {
for (let i = 0; i < 7; i++) {
formattedDate = format(day, "d");
mformattedDate = moment(day).format("DD");
const cloneDay = day;

tEvent = ppp.filter((events) => events.date === `${cYear}-${cMonth}-${mformattedDate}`);
console.log(tEvent[0]);
days.push(
<div
className={`col cell ${
!isSameMonth(day, monthStart)
? "disabled"
: isSameDay(day, selectedDate)
? "selected"
: format(currentMonth, "M") !== format(day, "M")
? "not-valid"
: "valid"
}`}
key={day}
onClick={() => onDateClick(parse(cloneDay))}>
<span
className={
format(currentMonth, "M") !== format(day, "M") ? "text not-valid" : ""
}>
{formattedDate}

{tEvent[0] !== undefined ? (
<div className="event">{tEvent[0].name}</div>
) : (
""
)}
</span>
</div>
);
day = addDays(day, 1);
}
rows.push(
<div className="row" key={day}>
{days}
</div>
);
days = [];
}
return <div className="body">{rows}</div>;
};

function Calendar() {
const [currentMonth, setCurrentMonth] = useState(new Date());
const [selectedDate, setSelectedDate] = useState(new Date());
const [event, setEvent] = useState([]);

useEffect(() => {
setEvent([
{ date: "2023-05-01", name: "5월첫날" },
{ date: "2023-06-10", name: "박성현탄생일" },
{ date: "2023-06-22", name: "오늘" },
{ date: "2023-07-11", name: "다음달" },
]);
}, []);

const prevMonth = () => {
setCurrentMonth(subMonths(currentMonth, 1));
};
const nextMonth = () => {
setCurrentMonth(addMonths(currentMonth, 1));
};
const onDateClick = (day) => {
setSelectedDate(day);
};
return (
<div>
<Head></Head>
<div className="container_wrap">
<div className="calendar">
<RenderHeader
currentMonth={currentMonth}
prevMonth={prevMonth}
nextMonth={nextMonth}
/>
<RenderDays />
<RenderCells
currentMonth={currentMonth}
selectedDate={selectedDate}
event={event}
onDateClick={onDateClick}
/>
</div>
</div>
</div>
);
}

export default Calendar;
24 changes: 24 additions & 0 deletions src/pages/calendar/Calendar2.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { Component } from "react";
import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import Head from "../../components/Head";

function Calendar2() {
return (
<div>
<Head></Head>
<div className="container_wrap">
<FullCalendar
defaultView="dayGridMonth"
plugins={[dayGridPlugin]}
events={[
{ title: "happy birthday1", start: "2023-06-10", end: "2023-06-16" },
{ title: "소리질러", start: "2023-06-07", end: "2023-06-13" },
]}
/>
</div>
</div>
);
}

export default Calendar2;
Loading

0 comments on commit 3f48ea9

Please sign in to comment.