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

Feature/#182 출시이후 기능 안보이도록 수정 #183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/main/resources/config
10 changes: 5 additions & 5 deletions backend/src/main/resources/test-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ insert into student_member (id, member_id, major_id, minor_id, double_major_id,
values (202055558, 1, 1, null, null, 'EMPLOYMENT_COMPANY', 'IT 기업 개발자');

insert into member (email, name, password, phone_number, is_deleted)
values ( 'iddang@pusan.ac.kr', '이다은', '$2a$10$YyiOL/E5WjKrZPkB6eQSK.PwZtAO.z3JimFbq/Ky3u3rFf3XTGrWK', '010-0000-0000'
values ( 'ddang@pusan.ac.kr', '이다은', '$2a$10$YyiOL/E5WjKrZPkB6eQSK.PwZtAO.z3JimFbq/Ky3u3rFf3XTGrWK', '010-0000-0000'
, false);

insert into student_member (id, member_id, major_id, minor_id, double_major_id, career, career_detail)
Expand All @@ -32,7 +32,7 @@ INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description,
VALUES (3, 5, 202055558, 'TOPCIT 수준 2', null, 'APPROVED', null, 1, '2024-06-03', 0, '2024-07-01 18:35:47.563444');
INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description, file_url, status, reject_reason, count,
activated_at, is_deleted, created_at)
VALUES (4, 6, 202000000, 'PCC lv3', null, 'APPROVED', null, 1, '2024-06-04', 0, '2024-07-01 18:35:47.566673');
VALUES (4, 6, 202055555, 'PCC lv3', null, 'APPROVED', null, 1, '2024-06-04', 0, '2024-07-01 18:35:47.566673');
INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description, file_url, status, reject_reason, count,
activated_at, is_deleted, created_at)
VALUES (5, 7, 202055558, 'PCC lv2', null, 'APPROVED', null, 1, '2024-06-05', 0, '2024-07-01 18:35:47.569843');
Expand All @@ -50,12 +50,12 @@ INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description,
VALUES (9, 15, 202055558, '글로벌 행사 참여', null, 'PENDING', null, 1, '2024-06-08', 0, '2024-07-01 18:35:47.580376');
INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description, file_url, status, reject_reason, count,
activated_at, is_deleted, created_at)
VALUES (10, 7, 202000000, 'PCC lv2', null, 'PENDING', null, 1, '2024-06-11', 0, '2024-07-01 18:35:47.580376');
VALUES (10, 7, 202055555, 'PCC lv2', null, 'PENDING', null, 1, '2024-06-11', 0, '2024-07-01 18:35:47.580376');

INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description, file_url, status, reject_reason, count,
activated_at, is_deleted, created_at)
VALUES (11, 15, 202000000, '글로벌 행사 참여', null, 'APPROVED', null, 1, '2024-06-08', 0, '2024-07-01 18:35:47.580376');
VALUES (11, 15, 202055555, '글로벌 행사 참여', null, 'APPROVED', null, 1, '2024-06-08', 0, '2024-07-01 18:35:47.580376');

INSERT INTO sw_css.milestone_history (id, milestone_id, student_id, description, file_url, status, reject_reason, count,
activated_at, is_deleted, created_at)
VALUES (12, 3, 202000000, '비교과 SW 관련 창업', null, 'APPROVED', null, 2, '2024-06-08', 0, '2024-07-01 18:35:47.580376');
VALUES (12, 3, 202055555, '비교과 SW 관련 창업', null, 'APPROVED', null, 2, '2024-06-08', 0, '2024-07-01 18:35:47.580376');
14 changes: 11 additions & 3 deletions frontend/src/app/(withSidebar)/hackathon/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const Page = async ({ searchParams }: { searchParams?: { [key: string]: string |

const page = searchParams?.page ? parseInt(searchParams.page, 10) : 1;

const hackathons = await getHackathons(page, 6);
let hackathons;
try {
hackathons = await getHackathons(page, 6);
} catch (err) {
// TODO: server api error handling
}

const getHackathonState = (startDate: string, endDate: string) => {
const now = Date.now();
Expand Down Expand Up @@ -44,7 +49,10 @@ const Page = async ({ searchParams }: { searchParams?: { [key: string]: string |
description="소프트웨어융합교육원에서는 2018년부터 매년 창의융합 SW 해커톤을 개최해오고 있습니다."
/>
<div className="h-0 w-full border border-border" />
{hackathons?.content && hackathons.content.length > 0 ? (

<div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div>

{/* {hackathons?.content && hackathons.content.length > 0 ? (
<div className="grid grid-cols-1 gap-6 py-4 sm:grid-cols-2 md:grid-cols-3">
{hackathons.content.map((hackathon) => (
<Link
Expand Down Expand Up @@ -96,7 +104,7 @@ const Page = async ({ searchParams }: { searchParams?: { [key: string]: string |
<div className="flex h-40 w-full items-center justify-center text-comment">해커톤 정보가 없습니다.</div>
)}

<Pagination currentPage={page} totalItems={hackathons?.totalElements ?? 0} pathname={pathname} pageSize={6} />
<Pagination currentPage={page} totalItems={hackathons?.totalElements ?? 0} pathname={pathname} pageSize={6} /> */}
</div>
);
};
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/app/(withSidebar)/hackathon/sw-contest/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
const Page = () => <div>test</div>;
import Title from '@/components/Title';

const Page = () => {
return (
<div className="flex w-full flex-col gap-4 rounded-sm bg-white p-5">
<Title title="SW문제 해결 경진대회" description="구글 사이트에 게시된 학생들의 작품을 감상해보세요!" />
<div className="h-0 w-full border border-border" />

<div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div>
</div>
);
};

export default Page;
13 changes: 13 additions & 0 deletions frontend/src/app/(withSidebar)/team-building/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Title from '@/components/Title';

const Page = () => {
return (
<div className="flex w-full flex-col gap-4 rounded-sm bg-white p-5">
<Title title="팀 빌딩" />

<div className="flex h-40 w-full items-center justify-center text-comment">개발 중인 기능입니다.</div>
</div>
);
};

export default Page;
42 changes: 36 additions & 6 deletions frontend/src/app/components/Milestone/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,61 @@
import MilestoneChart from '@/components/MilestoneChart';
import MilestoneTable from '@/components/MilestoneTable';
import { getAuthFromCookie } from '@/lib/utils/auth';
import { milestoneSummaryInfo } from '@/mocks/milestone';
import { AuthSliceState } from '@/store/auth.slice';

import { MilestoneChartWrapper } from './styled';
import GoPageIcon from '../GoPageIcon';
import SignIn from '../SignIn';
import { Description, Title, TitleContent, TitleWrapper } from '../styled';
import { getMyMilestoneHistory } from '@/lib/api/server.api';
import { DateTime } from 'luxon';
import { MilestoneOverviewScore } from '@/types/milestone';
import { initialMilestoneOverview } from '@/data/milestone';

const Milestone = () => {
const getMilestoneScores = async (studentId: number) => {
const startDate = DateTime.now().minus({ years: 1 }).toFormat('yyyy-MM-dd');
const endDate = DateTime.now().toFormat('yyyy-MM-dd');
try {
const milestoneScores = await getMyMilestoneHistory(studentId, startDate, endDate);
return milestoneScores;
} catch (err) {
// TODO: server api error handling
}
return null;
};

const getMilestoneOverviewScore = async (studentId: number) => {
const milestoneScores = await getMilestoneScores(studentId);
const milestoneOverviewScore = milestoneScores?.reduce<MilestoneOverviewScore>(
(acc, cur) => {
const key = `${cur.group.toLowerCase()}Score` as keyof MilestoneOverviewScore;
acc[key] += cur.score;
acc.totalScore += cur.score;
return acc;
},
{ ...initialMilestoneOverview },
);
return milestoneOverviewScore || initialMilestoneOverview;
};

const Milestone = async () => {
const auth: AuthSliceState = getAuthFromCookie();

const milestoneOverviewScore = await getMilestoneOverviewScore(auth.id);

return (
<div style={{ display: 'flex', flexDirection: 'column' }}>
<TitleWrapper style={{ justifyContent: 'space-between' }}>
<TitleContent>
<Title>나의 마일스톤</Title>
<Description>나의 마일스톤 내역을 확인할 수 있어요.</Description>
</TitleContent>
{/* TODO: url 자신의 마일스톤으로 이동하도록 수정하기 */}
{auth.isAuth && <GoPageIcon name="전체보기" url="/" />}
{auth.isAuth && <GoPageIcon name="전체보기" url="/my-page/milestone" />}
</TitleWrapper>
{auth.isAuth && (
<MilestoneChartWrapper>
<MilestoneChart chartSize={120} fontSize="sm" milestoneOverviewScore={milestoneSummaryInfo} />
<MilestoneTable milestoneOverviewScore={milestoneSummaryInfo} />
<MilestoneChart chartSize={120} fontSize="sm" milestoneOverviewScore={milestoneOverviewScore} />
<MilestoneTable milestoneOverviewScore={milestoneOverviewScore} />
</MilestoneChartWrapper>
)}
{!auth.isAuth && <SignIn />}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const metadata: Metadata = {
const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => (
<html lang="kr">
<head>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:[email protected]&display=swap" rel="stylesheet" />
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const Page = () => (
<ContentWrapper>
<ExternalLink />
</ContentWrapper>
{/* TODO: 팀빌딩 구현 완료 되면 주석 풀기
<ContentWrapper>
<TeamBuildings />
</ContentWrapper>
<TeamBuildings />
</ContentWrapper> */}
<ContentWrapper>
<PnuLink />
</ContentWrapper>
Expand Down
24 changes: 19 additions & 5 deletions frontend/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

'use client';

import { VscSettingsGear } from '@react-icons/all-files/vsc/VscSettingsGear';
import { VscAccount } from '@react-icons/all-files/vsc/VscAccount';
import { VscSignIn } from '@react-icons/all-files/vsc/VscSignIn';
import { VscSignOut } from '@react-icons/all-files/vsc/VscSignOut';
Expand Down Expand Up @@ -49,12 +50,19 @@ const Header = () => {
),
)}
</div>
{auth.isAuth ? (
{auth.isAuth && auth.isModerator && (
<>
<IconButton icon={<VscSettingsGear />} title="관리" size="sm" link="/admin" />
<IconButton icon={<VscSignOut />} title="로그아웃" size="sm" link="/sign-out" />
</>
)}
{auth.isAuth && !auth.isModerator && (
<>
<IconButton icon={<VscAccount />} title="마이페이지" size="sm" link="/my-page" />
<IconButton icon={<VscSignOut />} title="로그아웃" size="sm" link="/sign-out" />
</>
) : (
)}
{!auth.isAuth && (
<S.SignButton>
<S.SignText>
<Link href="/sign-in">로그인</Link> /<Link href="/sign-up">회원가입</Link>
Expand All @@ -66,6 +74,7 @@ const Header = () => {
style={{ display: `${isSidebarOpen ? 'block' : 'none'}` }}
onClick={() => setIsSideBarOpen(false)}
/>

<S.HeaderTabletLayout>
<Link href="/" style={{ width: 'fit-content', height: '50px', padding: '5px 10px' }}>
<Image
Expand All @@ -77,14 +86,19 @@ const Header = () => {
/>
</Link>
<div style={{ display: 'flex' }}>
{auth.isAuth ? (
{auth.isAuth && auth.isModerator && (
<>
<IconButton icon={<VscSettingsGear />} title="관리" size="sm" link="/admin" />
<IconButton icon={<VscSignOut />} title="로그아웃" size="sm" link="/sign-out" />
</>
)}
{auth.isAuth && !auth.isModerator && (
<>
<IconButton icon={<VscAccount />} title="마이페이지" size="sm" link="/my-page" />
<IconButton icon={<VscSignOut />} title="로그아웃" size="sm" link="/sign-out" />
</>
) : (
<IconButton icon={<VscSignIn />} title="로그인" size="sm" link="/sign-in" />
)}
{!auth.isAuth && <IconButton icon={<VscSignIn />} title="로그인" size="sm" link="/sign-in" />}
<Sidebar open={isSidebarOpen} handleOpen={setIsSideBarOpen} headerInfos={headerInfos} />
</div>
</S.HeaderTabletLayout>
Expand Down
17 changes: 3 additions & 14 deletions frontend/src/components/Title/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
import Link from 'next/link';

export interface TitleProps {
title: string;
description?: string;
urlText?: string;
url?: string;
}

const Title = ({ title, description, urlText, url }: TitleProps) => (
<div className="flex flex-col gap-4">
<div className="flex flex-grow justify-between">
<p className="cursor-default text-xl font-semibold">{title}</p>
{urlText && url && (
<Link href={url} className="flex items-center gap-1 text-sm text-comment">
{urlText}
</Link>
)}
</div>
const Title = ({ title, description }: TitleProps) => (
<div className="flex flex-col gap-1">
<p className="cursor-default text-[28px] font-semibold">{title}</p>
{description && <div className="text-comment">{description}</div>}
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/data/externalLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const externalLinkInfos: { title: string; url: string; img: string }[] =
img: '/images/main/external_link_2_plato.png',
},
{
title: '온라인강좌<br/>(edwith)',
url: 'http://edwith.org/ptnr/pnuswedu',
title: '온라인강좌<br/>(Inflearn)',
url: 'https://www.inflearn.com/users/1370319',
img: '/images/main/external_link_3_edwith.png',
},
{ title: 'TOPCIT', url: 'http://topcit.or.kr/', img: '/images/main/external_link_4_topcit.png' },
Expand All @@ -20,7 +20,7 @@ export const externalLinkInfos: { title: string; url: string; img: string }[] =
url: 'http://bd.pusan.ac.kr/',
img: '/images/main/external_link_5_pnu_achieve.png',
},
{ title: 'PNU<br/>Online Judge', url: 'http://oj.pusan.ac.kr/', img: '/images/main/external_link_6_pnu_oj.png' },
{ title: 'PNU<br/>Code Place', url: 'http://code.pusan.ac.kr/', img: '/images/main/external_link_6_pnu_oj.png' },
];

export const pnuLinkInfos: { title: string; url: string; img: string }[] = [
Expand Down
28 changes: 18 additions & 10 deletions frontend/src/lib/api/server.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MilestoneHistoryDto,
MilestoneHistoryOfStudentPageableDto,
MilestoneHistoryPageableDto,
MilestoneScoreDto,
} from '@/types/common.dto';
import { MilestoneHistorySortCriteria, SortDirection } from '@/types/milestone';

Expand All @@ -23,7 +24,7 @@ export async function getMilestoneHistoriesOfStudent(
page: number = 0,
size: number = 10,
) {
const response = await server
return await server
.get<MilestoneHistoryOfStudentPageableDto>(`/milestones/histories/members/${memberId}`, {
params: removeEmptyField({
start_date: startDate,
Expand All @@ -37,11 +38,10 @@ export async function getMilestoneHistoriesOfStudent(
})
.then((res) => res.data)
.catch((err) => Promise.reject(err));
return response;
}

export async function getMilestoneHistories(field?: number, keyword?: string, page: number = 0, size: number = 10) {
const response = await server
return await server
.get<MilestoneHistoryPageableDto>('/admin/milestones/histories', {
params: removeEmptyField({
field,
Expand All @@ -52,28 +52,36 @@ export async function getMilestoneHistories(field?: number, keyword?: string, pa
})
.then((res) => res.data)
.catch((err) => Promise.reject(err));
return response;
}

export async function getMilestoneHistory(historyId: number) {
const response = await server
return await server
.get<MilestoneHistoryDto>(`/admin/milestones/histories/${historyId}`)
.then((res) => res.data)
.catch((err) => Promise.reject(err));
return response;
}

export async function getValidationStudentId(studentId: string) {
const response = await server
return await server
.get(`/sign-up/exists/student-id`, {
params: removeEmptyField({
student_id: studentId,
}),
})
.then((res) => res.data)
.catch((err) => {
return Promise.reject(err);
});
.catch((err) => Promise.reject(err));
}

export async function getMyMilestoneHistory(studentId: number, startDate: string, endDate: string) {
const response = await server
.get<MilestoneScoreDto[]>(`/milestones/histories/scores/members/${studentId}`, {
params: removeEmptyField({
start_date: startDate,
end_date: endDate,
}),
})
.then((res) => res.data)
.catch((err) => Promise.reject(err));

return response;
}
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/mocks/milestone.ts

This file was deleted.