Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #225

Merged
merged 11 commits into from
Oct 14, 2024
Binary file added .yarn/install-state.gz
Binary file not shown.
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"private": true,
"version": "0.0.0",
"type": "module",
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down Expand Up @@ -80,5 +76,6 @@
"tailwindcss": "^3.4.3",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
},
"packageManager": "[email protected]+sha512.837566d24eec14ec0f5f1411adb544e892b3454255e61fdef8fd05f3429480102806bac7446bc9daff3896b01ae4b62d00096c7e989f1596f2af10b927532f39"
}
4 changes: 2 additions & 2 deletions src/hooks/useCurrentPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';

export function useCurrentPage(initPage: number = 1) {
const [currentPage, setCurrentPage] = useState<number>(initPage);
export function useCurrentPage(initialPage: number = 1) {
const [currentPage, setCurrentPage] = useState<number>(initialPage);

const handlePageChange = (page: number) => {
setCurrentPage(page);
Expand Down
6 changes: 3 additions & 3 deletions src/pages/layout/headerLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export function Layout() {
};

return (
<>
<div className="flex min-h-screen flex-col">
<Header state={loginState ? State.Login : State.Logout} onLogout={handleLogout} />
<main>
<main className="flex-grow">
<Outlet />
</main>
<Footer />
</>
</div>
);
}
2 changes: 1 addition & 1 deletion src/pages/main/containers/LostArticleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const LostArticleSection = () => {
);

return (
<section className="w-full">
<section>
<div className="flex items-center">
<h1 className="text-[2rem] font-bold xs:text-[1.25rem]">분실물 현황</h1>
<ArrowUpRight
Expand Down
14 changes: 8 additions & 6 deletions src/pages/notice/hooks/useNoticeToday.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import { useEffect, useState } from 'react';
import { useGetBoardPosts } from '@/hooks/useGetBoardPosts';
import { useNoticeCategory } from './useNoticeCategory';
import { Post } from '@/types/apis/get';
import { useRecoilState } from 'recoil';
import { todayPostCountState } from '@/recoil/atoms/atom';
import { useMemo } from 'react';
import { NoticeResponse } from '../types';

export function useTodayPosts(boardCode: string, category: string, subCategory: string) {
export function useTodayPosts(boardCode: string) {
const { category, subCategory } = useNoticeCategory();

const [todayPostCount, setTodayPostCount] = useRecoilState(todayPostCountState(category));
const [page, setPage] = useState<number>(0);
const [stopFetching, setStopFetching] = useState<boolean>(false);
const { data, isLoading, isError } = useGetBoardPosts<NoticeResponse>({

const { data, isLoading, isError } = useGetBoardPosts<any>({
boardCode,
take: 10,
page,
groupCode: category === '중앙' ? '중앙기구' : '단과대학생회',
memberCode: subCategory === '전체' ? '' : subCategory,
});

const posts: Post[] = useMemo(() => data?.data?.postListResDto || [], [data]);
const posts: Post[] = data?.data?.postListResDto || [];

const isPostToday = (dateString: string): boolean => {
const today = new Date();
Expand Down Expand Up @@ -66,7 +68,7 @@ export function useTodayPosts(boardCode: string, category: string, subCategory:
} else {
setStopFetching(true);
}
}, [posts, category, subCategory, setTodayPostCount]);
}, [posts]);

return {
todayPostCount,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notice/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function NoticePage() {
category,
subCategory
);
const { todayPostCount, isLoading: isPostsLoading } = useTodayPosts(boardCode, category, subCategory);
const { todayPostCount, isLoading: isPostsLoading } = useTodayPosts(boardCode);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/partnership/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function PartnershipPage() {
}
}, [queryClient, refetch]);

const posts = data?.data.postListResDto || [];
const posts = data?.data.postListResDto || []; // 게시물 리스트
const partnershipCount = useMemo(() => {
if (isLoading) {
return 0;
Expand Down
3 changes: 1 addition & 2 deletions src/template/board/BoardContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import BoardContentLoading from './BoardContentLoading';
import { formatYYYYMMDD } from '@/utils/formatYYYYMMDD';
import { nameToUrl } from './boardData';

interface BoardContentProps {
boardName: string;
Expand Down Expand Up @@ -118,7 +117,7 @@ export function BoardContent({ boardName, data, isLoading }: BoardContentProps)
badgeType={status}
profileName={post.author}
className="cursor-pointer"
onClick={() => navigate(`/${nameToUrl.get(boardName)}/${post.postId}`, { state: { postId: post.postId } })}
onClick={() => navigate(`/${boardName}/${post.postId}`, { state: { postId: post.postId } })}
/>
</div>
);
Expand Down
5 changes: 0 additions & 5 deletions src/template/board/boardData.ts

This file was deleted.

Loading