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

fix-fe: 공고 마감일을 시작일과 같은 날짜로 설정하면 공고가 바로 마감되는 이슈 수정 #597

Merged
merged 7 commits into from
Aug 22, 2024
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
21 changes: 21 additions & 0 deletions frontend/src/pages/Landing/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useNavigate } from 'react-router-dom';
import Logo from '@assets/images/logo.svg';
import { useEffect } from 'react';
import S from './style';

export default function Landing() {
const navigate = useNavigate();

useEffect(() => {
setTimeout(() => navigate('/sign-in'), 2000);
}, [navigate]);

return (
<S.Container>
<S.Logo
src={Logo}
alt="크루루 로고"
/>
</S.Container>
);
}
31 changes: 31 additions & 0 deletions frontend/src/pages/Landing/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { keyframes } from '@emotion/react';
import styled from '@emotion/styled';

const fadeIn = keyframes`
from {
opacity: 0;
}
to {
opacity: 1;
}
`;

const Container = styled.div`
width: 100vw;
height: 100vh;

display: flex;
justify-content: center;
align-items: center;
`;
const Logo = styled.img`
height: 6rem;
animation: ${fadeIn} 1.5s ease-out;
`;

const S = {
Container,
Logo,
};

export default S;
5 changes: 5 additions & 0 deletions frontend/src/router/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ConfirmApply from '@pages/ConfirmApply';
import DashboardLayout from '@pages/DashboardLayout';
import DashboardList from '@pages/DashBoardList';
import DashboardCreate from '@pages/DashboardCreate';
import Landing from '@pages/Landing';
import { useToast } from '@contexts/ToastContext';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import App from '../App';
Expand All @@ -21,6 +22,10 @@ const router = createBrowserRouter(
element: <App />,
errorElement: <ErrorPage />,
children: [
{
index: true,
element: <Landing />,
},
{
path: '/sign-in',
element: <SignIn />,
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/utils/compareTime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,16 @@ describe('getTimeStatus 테스트', () => {
expect(result.isOngoing).toBe(false);
expect(result.isClosed).toBe(true);
});

it('현재 날짜가 종료 날짜 이후이면 Closed를 반환해야 한다', () => {
const result = getTimeStatus({
startDate: '2024-08-21T00:00:00Z',
endDate: '2024-08-21T00:00:00Z',
});

expect(result.status).toBe('Ongoing');
expect(result.isPending).toBe(false);
expect(result.isOngoing).toBe(true);
expect(result.isClosed).toBe(false);
});
});
2 changes: 1 addition & 1 deletion frontend/src/utils/formatDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function formatDate(dateString: ISO8601 | string) {

export function getCleanDateString(dateString?: ISO8601 | string) {
const date = dateString ? new Date(dateString) : new Date();
date.setHours(date.getHours() + 9);
date.setHours(date.getHours());
return new Date(date.toDateString());
}

Expand Down
Loading