Skip to content

Commit

Permalink
계정정보에 따른 변경사항 처리 1차 완료 (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
minjoon97 authored Nov 4, 2024
1 parent 9d3e8b3 commit 86ad7b5
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 15 deletions.
6 changes: 4 additions & 2 deletions src/features/calendar/calendar-logic/calendarDataFetch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const calendarDataFetch = async (activeMonth: string) => {
const userEmail = 'annawa6@naver.com.com';
export const calendarDataFetch = async (
activeMonth: string,
userEmail: string
) => {
const split = activeMonth.split('-');
try {
const response = await fetch(
Expand Down
4 changes: 3 additions & 1 deletion src/features/calendar/calendar-ui/CalendarUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '../calendar-logic/calendarLogic';
import { getEmoticonPath } from '@/shared/model/getEmotionPath';
import moment from 'moment';
import { useAuthStore } from '@/features/login/hooks/useAuthStore';

const CalendarUi: React.FC = () => {
const curDate = new Date();
Expand All @@ -17,10 +18,11 @@ const CalendarUi: React.FC = () => {
{ id: number; title_date: string; emotion: string | null }[]
>([]);
const weekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const { email, userName, isLoggedin, setUserInfo } = useAuthStore();

// fetchedData에 데이터를 저장
const loadDates = async () => {
const data = await calendarDataFetch(activeMonth);
const data = await calendarDataFetch(activeMonth, email);
if (data) {
const dates = data.diaries.map(
(entry: {
Expand Down
2 changes: 1 addition & 1 deletion src/features/calendar/calendar-ui/calendarUiCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const StyledCalendar = styled(Calendar).attrs({
height: 20px;
background-size: contain;
background-repeat: no-repeat;
background-image: url('calendar_plus.svg');
background-image: url('@/shared/assets/calendar_plus.svg');
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/MainPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import CalendarContainer from '../../widgets/calendar-container/CalendarContaine
import TimelineContainer from '../../widgets/timeline-container/TimelineContainer';
import MoveTopButton from '@/shared/ui/MoveTopButton/MoveTopButton';
import { TimeLineListWrapper } from './indexCss';
import { useAuthStore } from '@/features/login/hooks/useAuthStore';

const MainPage = () => {
const { email, userName, isLoggedin, setUserInfo } = useAuthStore();
return (
<>
<CalendarContainer />
{isLoggedin && <CalendarContainer />}
<TimeLineListWrapper>
<TimelineContainer
titleTarget="다른 사용자들"
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/calendar-container/CalendarContainerCss.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';

export const Container = styled.div`
padding: 150px 0;
padding-top: 150px;
max-width: 960px;
width: 90%;
margin: 0 auto;
Expand Down
22 changes: 15 additions & 7 deletions src/widgets/header/ui/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import React from 'react';
import { Container, Logo, Nav, NavItem, LoginButton } from './Header.styled';
import LogoImage from '@/shared/assets/logo.svg';

import { useAuthStore } from '@/features/login/hooks/useAuthStore';
import { Link, useNavigate } from 'react-router-dom';

const Header = () => {
const navigate = useNavigate();
const { email, userName, isLoggedin, setUserInfo } = useAuthStore();
return (
<Container>
<Logo>
<img src={LogoImage} alt="logo" />
</Logo>
<Nav>
<Link to="/"></Link>
<NavItem>타임라인</NavItem>
<Link to="/diary">
<NavItem>내 일기</NavItem>
<Link to="/">
<NavItem></NavItem>
</Link>
<NavItem>마이페이지</NavItem>
<Link to="/login">로그인</Link>
{isLoggedin && (
<Link to="/diary">
<NavItem>내 일기</NavItem>
</Link>
)}
{isLoggedin && <NavItem>마이페이지</NavItem>}
{!isLoggedin && (
<Link to="/login">
<NavItem>로그인</NavItem>
</Link>
)}
</Nav>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/timeline-container/TimelineContainerCss.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';

export const Container = styled.div`
padding-bottom: 150px;
padding: 150px 0;
`;

export const DiaryList = styled.ul`
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/write-diary/ui/WriteDiaryContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const WriteDiaryContainer: React.FC<WriteDiaryContainerProps> = ({
onDiarySubmit,
initialDate = new Date(), // 초기 날짜가 없으면 오늘 날짜 사용
isActive,
disabled
disabled,
initialTitle = '',
initialContent = '',
initialIsPublic = true,
Expand Down

0 comments on commit 86ad7b5

Please sign in to comment.