Skip to content

Commit

Permalink
Merge pull request #302 from GDSC-PKNU-Official/dev
Browse files Browse the repository at this point in the history
부림이 0.4.3v 배포
  • Loading branch information
hwinkr authored Dec 28, 2023
2 parents 84c4fc6 + 3ff3f68 commit 873092a
Show file tree
Hide file tree
Showing 133 changed files with 2,233 additions and 1,387 deletions.
Binary file removed public/assets/baekgyeong-speaker.png
Binary file not shown.
Binary file removed public/assets/baekgyeong-whalebe.png
Binary file not shown.
Binary file removed public/assets/pknu.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tipImages/png/baekgyeong_guide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tipImages/png/baekgyeong_hi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tipImages/png/baekgyeong_love.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tipImages/png/baekgyeong_teach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/tipImages/png/pknu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/assets/tipImages/webp/baekgyeong_hi.webp
Binary file not shown.
Binary file added public/assets/tipImages/webp/baekgyeong_love.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/assets/tipImages/webp/pknu.webp
Binary file not shown.
11 changes: 11 additions & 0 deletions src/@types/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import {
ANNOUNCEMENT_CATEGORY,
ANNOUNCEMENT_TYPE,
} from '@constants/announcement';

type AnnounceItemType = '고정' | '일반';

export interface AnnounceItem {
Expand All @@ -11,3 +16,9 @@ export interface AnnounceItem {
export type AnnounceItemList = {
[key in AnnounceItemType]: AnnounceItem[];
};

export type AnnouncementCategory =
(typeof ANNOUNCEMENT_CATEGORY)[keyof typeof ANNOUNCEMENT_CATEGORY];

export type AnnouncementType =
(typeof ANNOUNCEMENT_TYPE)[keyof typeof ANNOUNCEMENT_TYPE];
5 changes: 1 addition & 4 deletions src/@types/modals.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { modals } from '@hooks/useModals';

export type Modals =
| Array<{
Component: (typeof modals)[keyof typeof modals];
props: object;
Component: React.ReactElement<{ chidren: React.ReactNode }>;
}>
| [];
7 changes: 6 additions & 1 deletion src/@types/styles/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export type IconKind =
| 'menu'
| 'notification'
| 'school'
| 'schoolBuilding'
| 'arrowRight'
| 'arrowDown'
| 'arrowBack'
| 'plus'
| 'edit'
Expand All @@ -22,4 +25,6 @@ export type IconKind =
| 'checkedRadio'
| 'uncheckedRadio'
| 'location'
| 'warning';
| 'warning'
| 'account'
| 'language';
20 changes: 10 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import BodyLayout from '@components/BodyLayout';
import FooterTab from '@components/FooterTab';
import Header from '@components/Header';
import Announcement from '@pages/Announcement';
import BodyLayout from '@pages/BodyLayout';
import FAQPage from '@pages/FAQ';
import Home from '@pages/Home';
import MajorDecision from '@pages/MajorDecision';
import Map from '@pages/Map';
import MapProvider from '@pages/Map/Provider';
import MapPage from '@pages/Map';
import My from '@pages/My';
import SuggestionPage from '@pages/Suggestion';
import Tip from '@pages/Tip';
import RouteChangeTracker from '@utils/routeChangeTracker';
import { Routes, Route, useLocation } from 'react-router-dom';
import { Routes, Route } from 'react-router-dom';

const App = () => {
const location = useLocation();
RouteChangeTracker();

return (
<>
{location.pathname !== '/map' && <Header />}
<Header />
<Routes>
<Route element={<BodyLayout />}>
<Route path="/" element={<Home />} />
<Route path="/announcement/*" element={<Announcement />} />
<Route path="/major-decision/*" element={<MajorDecision />} />
<Route path="/my" element={<My />} />
<Route path="/tip" element={<Tip />} />
</Route>
<Route element={<MapProvider />}>
<Route path="/map" element={<Map />} />
<Route path="/tip/:type" element={<Tip />} />
<Route path="/FAQ" element={<FAQPage />} />
<Route path="/suggestion" element={<SuggestionPage />} />
</Route>
<Route path="/map" element={<MapPage />} />
</Routes>
<FooterTab />
</>
Expand Down
5 changes: 2 additions & 3 deletions src/apis/Suspense/fetch-announce-list.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Major from '@type/major';
import { AxiosResponse } from 'axios';

import wrapPromise from './wrap-promise';
import http from '../http';

const fetchAnnounceList = <T>(major: Major) => {
const fetchAnnounceList = <T>(endPoint: string) => {
const promise: Promise<AxiosResponse<T>> = http
.get(major ? `/api/announcement?major=${major}` : `/api/announcement`)
.get(`/api/announcement` + endPoint)
.then((res) => res.data);

return wrapPromise<T>(promise);
Expand Down
18 changes: 18 additions & 0 deletions src/apis/suggestion/post-suggestion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import http from '@apis/http';
import { SERVER_URL } from '@config/index';

const postSuggestion = async (value: string | undefined) => {
await http.post(
`${SERVER_URL}/api/suggestion`,
{
content: value,
},
{
headers: {
'Content-Type': 'application/json',
},
},
);
};

export default postSuggestion;
File renamed without changes.
42 changes: 0 additions & 42 deletions src/components/Card/AnnounceCard/AnnounceList/index.tsx

This file was deleted.

8 changes: 7 additions & 1 deletion src/components/Card/AnnounceCard/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import http from '@apis/http';
import MajorProvider from '@components/Providers/MajorProvider';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { AnnounceItemList } from '@type/announcement';
Expand Down Expand Up @@ -34,7 +35,12 @@ describe('공지사항 카드 컴포넌트 테스트', () => {
const { 고정, 일반 } = announceList;

일반.forEach(async (annouce) => {
render(<AnnounceCard {...annouce} />, { wrapper: MemoryRouter });
render(
<MajorProvider>
<AnnounceCard {...annouce} />
</MajorProvider>,
{ wrapper: MemoryRouter },
);
});

const annouceCards = screen.getAllByTestId('card');
Expand Down
93 changes: 48 additions & 45 deletions src/components/Card/AnnounceCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,93 +1,96 @@
import Icon from '@components/Icon';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
import useMajor from '@hooks/useMajor';
import { THEME } from '@styles/ThemeProvider/theme';
import { AnnounceItem } from '@type/announcement';
import openLink from '@utils/router/openLink';

interface AnnounceCardProps extends AnnounceItem {
pinned?: boolean;
author?: string;
}

const AnnounceCard = ({
title,
link,
uploadDate,
pinned = false,
author,
}: AnnounceCardProps) => {
const onClick = () => {
window.open(link, '_blank');
};
const { major } = useMajor();

uploadDate = uploadDate.slice(2);

return (
<Card onClick={onClick} data-testid="card">
<Card onClick={() => openLink(link)} data-testid="card">
<ContentContainer>
{pinned && <Icon kind="speaker" color={THEME.PRIMARY} />}
<AnnounceTitle pinned={pinned}>{title}</AnnounceTitle>
<VertialSeparator
css={css`
border-left: 1px solid gray;
height: 12px;
margin: 0 5px;
`}
/>
<AnnounceDate>{uploadDate}</AnnounceDate>
<AnnounceTitle>{title}</AnnounceTitle>
<SubContent>
<AnnounceDate>20{uploadDate}</AnnounceDate>
<VertialBoundaryLine />
<Source>{author ? author : major}</Source>
</SubContent>
</ContentContainer>
<HorizonBoundaryLine />
</Card>
);
};

export default AnnounceCard;

const Card = styled.div`
height: 28px;
padding: 10px;
min-height: 50px;
display: flex;
flex-direction: column;
justify-content: center;
color: ${THEME.TEXT.BLACK};
transition: 0.3s;
&:active {
transform: scale(0.95);
opacity: 0.6;
}
`;

const ContentContainer = styled.div`
padding: 20px 0 20px 0;
display: flex;
align-items: center;
line-height: 1.5;
flex-direction: column;
gap: 10px;
`;

const AnnounceTitle = styled.span<{ pinned: boolean }>`
const AnnounceTitle = styled.span`
display: flex;
align-items: center;
flex: 9;
font-size: 15px;
font-weight: ${({ pinned }) => (pinned ? 'bold' : 500)};
margin-left: ${({ pinned }) => (pinned ? '' : '28px')};
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&: hover {
cursor: pointer;
}
transition: 0.3s;
&:active {
transform: scale(0.95);
opacity: 0.6;
}
font-size: 16px;
font-weight: 500;
`;

const VertialSeparator = styled.div`
const VertialBoundaryLine = styled.div`
border-left: 1px solid gray;
height: 12px;
margin: 0 5px;
`;

const AnnounceDate = styled.span`
flex: 1;
font-size: 10px;
font-weight: bold;
text-align: end;
font-size: 13px;
white-space: nowrap;
color: ${THEME.TEXT.GRAY};
padding-right: 5px;
`;

const HorizonBoundaryLine = styled.div`
border-bottom: 1px solid ${THEME.BACKGROUND};
`;

const SubContent = styled.div`
display: flex;
align-items: center;
`;

const Source = styled.div`
font-size: 13px;
color: gray;
padding-left: 5px;
`;
Loading

0 comments on commit 873092a

Please sign in to comment.