Skip to content

Commit

Permalink
Merge pull request #93 from EveryUniv/feat/90(백수연)
Browse files Browse the repository at this point in the history
feat: 캐러셀 통일 및 쿼리 추가
  • Loading branch information
sy-paik authored Apr 8, 2024
2 parents 9bc8978 + 032e3b0 commit e67511f
Show file tree
Hide file tree
Showing 146 changed files with 1,970 additions and 1,865 deletions.
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"@tanstack/react-query": "^5.28.6",
"@tanstack/react-query-devtools": "^5.28.10",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
Expand All @@ -23,17 +25,16 @@
"chartjs-plugin-datalabels": "^2.2.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"framer-motion": "^11.0.5",
"lucide-react": "^0.356.0",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.12.0",
"react-query": "^3.39.3",
"react-quill": "^2.0.0",
"react-router-dom": "^6.15.0",
"react-router-dom": "^6.22.3",
"react-scripts": "^5.0.1",
"swiper": "^10.3.0",
"tailwind-merge": "^2.2.1",
"ts-node": "^10.9.1",
"typescript": "*",
Expand All @@ -56,15 +57,18 @@
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write",
"git add"
]
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"react-app/jest",
"prettier"
],
"rules": {
"indent": ["error", 2,{ "SwitchCase": 1 }]
}
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/modules/navigation.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/modules/pagination.min.css" />
<title>단국대학교 총학생회 - 단국대 학우를 위한 소통의 장</title>
<base href="/" />
<!-- <base href="/" /> -->
</head>

<body>
Expand Down
19 changes: 15 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import ModalProvider from '@components/ui/modal/modal-provider';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import { QueryClient, QueryClientProvider } from 'react-query';
import { BrowserRouter } from 'react-router-dom';

import Router from '@/Router';
import Router from './Router';

const queryClient = new QueryClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 0,
refetchOnWindowFocus: false,
throwOnError: true,
},
},
});

export default function App() {
return (
<QueryClientProvider client={queryClient}>
<ModalProvider>
<Router />
<BrowserRouter>
<Router />
</BrowserRouter>
</ModalProvider>
</QueryClientProvider>
);
Expand Down
7 changes: 3 additions & 4 deletions src/PrivateRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ROUTES } from '@constants/route';
import { useAuth } from '@hooks/useAuth';
import { IWithReactChildren } from '@shared/interfaces/default-interfaces';
import { isLoggedIn } from '@utils/token';
import React from 'react';
import { Navigate } from 'react-router-dom';

export default function PrivateRoute({ children }: IWithReactChildren) {
const { isLoggedIn } = useAuth();
import { WithReactChildren } from '@/types/default-interfaces';

export default function PrivateRoute({ children }: WithReactChildren) {
return isLoggedIn ? <>{children}</> : <Navigate to={ROUTES.LOGIN} replace={true} />;
}
120 changes: 35 additions & 85 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DefaultLayout from '@components/layouts/DefaultLayout';
import { ROUTES } from '@constants/route';
import DefaultLayout from '@layouts/DefaultLayout';
import NotFound from '@pages/404';
import BusinessBoard from '@pages/business';
import BusinessDetail from '@pages/business/[id]';
Expand Down Expand Up @@ -30,93 +30,43 @@ import SignupInfo from '@pages/signup/info';
import SignupSuccess from '@pages/signup/success';
import SignupTerms from '@pages/signup/terms';
import React from 'react';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { Routes, Route } from 'react-router-dom';

import PrivateRoute from '@/PrivateRoute';

/**
* @description 라우터
* @author 이호연
*/
export default function Router() {
return (
<BrowserRouter>
{/* TODO: 로딩 컴포넌트 만들어 넣기 */}
<DefaultLayout>
<Routes>
<Route path={ROUTES.MAIN} element={<Main />} />
<Route path={ROUTES.LOGIN} element={<Login />} />
<Route path={ROUTES.RESET.INDEX} element={<ResetIdPw />} />
<Route path={ROUTES.RESET.ID} element={<ResetId />} />
<Route path={ROUTES.RESET.PW_VERIFY} element={<VerifyPw />} />
<Route path={ROUTES.RESET.PW} element={<ResetPw />} />
<Route
path={ROUTES.MYPAGE.INDEX}
element={
<PrivateRoute>
<MyPage />
</PrivateRoute>
}
/>
<Route
path={ROUTES.MYPAGE.PASSWORD}
element={
<PrivateRoute>
<MyPagePassword />
</PrivateRoute>
}
/>
<Route
path={ROUTES.MYPAGE.EDIT}
element={
<PrivateRoute>
<MyPageEdit />
</PrivateRoute>
}
/>
<Route
path={ROUTES.MYPAGE.UPDATE}
element={
<PrivateRoute>
<MyPageUpdate />
</PrivateRoute>
}
/>
<Route index path={ROUTES.SIGNUP.ROOT} element={<SignupVerify />} />
<Route path={ROUTES.SIGNUP.TERMS} element={<SignupTerms />} />
<Route path={ROUTES.SIGNUP.INFO} element={<SignupInfo />} />
<Route path={ROUTES.SIGNUP.SUCCESS} element={<SignupSuccess />} />
<Route path={ROUTES.COUNCIL.GREETING} element={<Greeting />} />
<Route path={ROUTES.COUNCIL.ORGANIZATION} element={<Organization />} />
<Route path={ROUTES.COUNCIL.LOCATION} element={<Location />} />
<Route path={ROUTES.COUNCIL.RECRUITMENT} element={<Recruitment />} />
<Route path={ROUTES.PETITION.ROOT} element={<PetitionBoard />} />
<Route path={ROUTES.PETITION.ID} element={<PetitionDetail />} />
<Route path={ROUTES.NOTICE.ROOT} element={<NoticeBoard />} />
<Route path={ROUTES.NOTICE.ID} element={<NoticeDetail />} />
<Route
path={ROUTES.PETITION.POST}
element={
<PrivateRoute>
<PetitionForm />
</PrivateRoute>
}
/>
<Route path={ROUTES.NOT_FOUND} element={<NotFound />} />
<Route
path={ROUTES.NOTICE.POST}
element={
<PrivateRoute>
<NoticePost />
</PrivateRoute>
}
/>
<Route path={ROUTES.CONFERENCE.ROOT} element={<ConferenceBoard />} />
<Route path={ROUTES.RULE.ROOT} element={<RuleBoard />} />
<Route path={ROUTES.BUSINESS.CATEGORY} element={<BusinessBoard />} />
<Route path={ROUTES.BUSINESS.DETAIL} element={<BusinessDetail />} />
</Routes>
</DefaultLayout>
</BrowserRouter>
<DefaultLayout>
<Routes>
<Route path={ROUTES.MAIN} element={<Main />} />
<Route path={ROUTES.LOGIN} element={<Login />} />
<Route path={ROUTES.RESET.INDEX} element={<ResetIdPw />} />
<Route path={ROUTES.RESET.ID} element={<ResetId />} />
<Route path={ROUTES.RESET.PW_VERIFY} element={<VerifyPw />} />
<Route path={ROUTES.RESET.PW} element={<ResetPw />} />
<Route path={ROUTES.MYPAGE.INDEX} element={<MyPage />} />
<Route path={ROUTES.MYPAGE.PASSWORD} element={<MyPagePassword />} />
<Route path={ROUTES.MYPAGE.EDIT} element={<MyPageEdit />} />
<Route path={ROUTES.MYPAGE.UPDATE} element={<MyPageUpdate />} />
<Route index path={ROUTES.SIGNUP.ROOT} element={<SignupVerify />} />
<Route path={ROUTES.SIGNUP.TERMS} element={<SignupTerms />} />
<Route path={ROUTES.SIGNUP.INFO} element={<SignupInfo />} />
<Route path={ROUTES.SIGNUP.SUCCESS} element={<SignupSuccess />} />
<Route path={ROUTES.COUNCIL.GREETING} element={<Greeting />} />
<Route path={ROUTES.COUNCIL.ORGANIZATION} element={<Organization />} />
<Route path={ROUTES.COUNCIL.LOCATION} element={<Location />} />
<Route path={ROUTES.COUNCIL.RECRUITMENT} element={<Recruitment />} />
<Route path={ROUTES.PETITION.ROOT} element={<PetitionBoard />} />
<Route path={ROUTES.PETITION.ID(':id')} element={<PetitionDetail />} />
<Route path={ROUTES.NOTICE.ROOT} element={<NoticeBoard />} />
<Route path={ROUTES.NOTICE.ID(':id')} element={<NoticeDetail />} />
<Route path={ROUTES.PETITION.POST} element={<PetitionForm />} />
<Route path={ROUTES.NOT_FOUND} element={<NotFound />} />
<Route path={ROUTES.NOTICE.POST} element={<NoticePost />} />
<Route path={ROUTES.CONFERENCE.ROOT} element={<ConferenceBoard />} />
<Route path={ROUTES.RULE.ROOT} element={<RuleBoard />} />
<Route path={ROUTES.BUSINESS.CATEGORY(':category')} element={<BusinessBoard />} />
<Route path={ROUTES.BUSINESS.DETAIL(':id', ':category')} element={<BusinessDetail />} />
</Routes>
</DefaultLayout>
);
}
35 changes: 0 additions & 35 deletions src/api/axios-interface.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/api/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/api/main/main.ts

This file was deleted.

44 changes: 0 additions & 44 deletions src/api/main/types/main.ts

This file was deleted.

Loading

0 comments on commit e67511f

Please sign in to comment.