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

feat: 수강신청 관련 modal, 연결 #37

Merged
merged 24 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
70eab25
Merge pull request #16 from tutorial-sejong/develop
Anhye0n Jul 10, 2024
686ba9e
Merge pull request #24 from tutorial-sejong/develop
Anhye0n Jul 29, 2024
d8a4ba8
Merge branch 'develop' into feat/22-modal
Anhye0n Jul 30, 2024
b3eef40
feat: .gitignore 수정, .env 제거
Anhye0n Jul 30, 2024
d851a4e
chore: env ignore
zhy2on Jul 30, 2024
1508128
feat: 관심과목 페이지 레이아웃, 강좌조회 구현 #19
zhy2on Jul 30, 2024
4da2055
feat: 신청, 삭제 버튼 레이아웃 구현 #19
zhy2on Jul 30, 2024
d67807b
feat: 관심과목 담기 api 연동 #19
zhy2on Jul 30, 2024
ed3931a
feat: 관심과목 등록 내역 조회 기능 구현, api 연동 #19
zhy2on Jul 31, 2024
38b6bad
feat: 강의 삭제 api 연동 #19
zhy2on Jul 31, 2024
023ee59
feat: 등록과목수, 학점 동적 업데이트 #19
zhy2on Jul 31, 2024
ed01e92
feat: 검색 버튼 로고 추가 #19
zhy2on Jul 31, 2024
8bd3d8c
feat: 접속 대기시간 모달 추가
Anhye0n Jul 31, 2024
335f94f
Merge 19-wish-list
Anhye0n Jul 31, 2024
58ca69d
Merge develop
Anhye0n Jul 31, 2024
9bdd29c
feat: 매크로 방지 코드 modal 추가
Anhye0n Jul 31, 2024
6d06945
feat: 수강 신청 안내 모달
Anhye0n Jul 31, 2024
0ef6864
Merge develop
Anhye0n Aug 1, 2024
ca433cd
feat: 수강 인원 정보, 데이터 처리 로딩바 추가
Anhye0n Aug 1, 2024
49bfdb0
feat: 백엔드 연결 완료
Anhye0n Aug 1, 2024
96b8454
Merge Develop
Anhye0n Aug 1, 2024
67b09ff
fix: modal 안나오는 문제 해결
Anhye0n Aug 1, 2024
e54e857
Merge develop
Anhye0n Aug 2, 2024
586ca81
refactor: 타입 수정
Anhye0n Aug 2, 2024
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 index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>수강신청</title>
</head>
Expand Down
Binary file added public/favicon.ico
Binary file not shown.
10 changes: 10 additions & 0 deletions src/apis/api/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,13 @@ export const deleteCourse = async (id: number) => {
console.error('delete course fail: ', error);
}
};

export const getMacroCode = async () => {
try {
const {data} = await baseAPI.get('/api/auth/macro');
return data;
} catch (error) {
console.error('Get macro code fail', error);
throw error;
}
};
Binary file added src/assets/img/check.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 src/assets/img/logo.webp
Binary file not shown.
Binary file added src/assets/img/warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/CourseRegister/RegisterFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function RegisterFilters({setList}: FiltersProps) {
</CuriNoWrap>
);
} else {
return <FilterInput sizes='l' onChange={value => handleInput(value)} />;
return <FilterInput disabled={searchOption === '관심과목'} sizes='l' onChange={value => handleInput(value)} />;
}
};

Expand Down Expand Up @@ -121,7 +121,7 @@ function RegisterFilters({setList}: FiltersProps) {
</SearchWrap>
</SearchBox>
</FilterBox>
<FilterButton label='검색' filter={filter} setList={setList} />
<FilterButton label='검색' page='수강신청' filter={filter} setList={setList} />
</RegisterFilterContainer>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/CourseRegister/RegisteredList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ function RegisteredList() {
await getRegisterdList().then(res => {
if (res) {
setList(res);
return;
}

setList([]);
});
};

Expand All @@ -37,7 +40,6 @@ function RegisteredList() {
}, []);

const handleAction = async (
action: string,
scheduleId: number | undefined,
) => {
if (scheduleId) {
Expand Down
25 changes: 9 additions & 16 deletions src/components/CourseRegister/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {useEffect, useState} from 'react';
import {useAppSelector} from '@/store/hooks';
import {useState} from 'react';
import {CourseTypes} from '@/assets/types/tableType';
import RegisterFilters from './RegisterFilters';
import Table from '../common/Table';
import {TableTitle, TableTitleWrap} from '../LectureList';
import {getWishlist, postCourse} from '@/apis/api/course';
import RegisteredList from './RegisteredList';
import {useDispatch} from 'react-redux';
import {setCourseName, setModalName, setScheduleId} from '@store/modalSlice.ts';

const colData = [
{name: 'action', value: '신청', initialWidth: 30, enableFilters: false},
Expand All @@ -24,27 +24,20 @@ const colData = [
];

function CourseRegister() {
const studentId = useAppSelector(state => state.userInfo.username);
const [list, setList] = useState<CourseTypes[]>([]);

useEffect(() => {
const getList = async () => {
await getWishlist(studentId).then(res => {
setList(res);
});
};

getList();
}, []);
const dispatch = useDispatch();

const handleAction = async (
action: string,
scheduleId: number | undefined,
curiNm: string | undefined,
) => {
if (scheduleId) {
await postCourse(scheduleId).then(() => {
console.log('register success');
});
// 접속 대기 띄우기
dispatch(setScheduleId(scheduleId));
dispatch(setCourseName(curiNm));
dispatch(setModalName('macro'));
}
};

Expand Down
22 changes: 21 additions & 1 deletion src/components/common/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,37 @@ import search from '@assets/img/search.png';
import {CourseTypes} from '@/assets/types/tableType';
import {getCourseList, getWishlist} from '@/apis/api/course';
import {useAppSelector} from '@/store/hooks';
import {openModalHandler} from '@components/common/Modal/handlers/handler.tsx';
import {useDispatch} from 'react-redux';

interface ButtonProps {
label: string;
page?: string;
filter?: CourseTypes;
setList: React.Dispatch<React.SetStateAction<CourseTypes[]>>;
}

function FilterButton({label, filter = {}, setList}: ButtonProps) {
function FilterButton({label, page, filter = {}, setList}: ButtonProps) {
const studentId = useAppSelector(state => state.userInfo.username);

const dispatch = useDispatch();
const handleClick = async () => {

if (page === '수강신청') {
if (!confirm('수강신청 연습 시작하시겠습니까?')) return;

openModalHandler(dispatch, 'waiting');

const getList = async () => {
await getWishlist(studentId).then(res => {
setList(res);
});
};

getList();
return;
}

if (filter.curiNm === 'wish') {
await getWishlist(studentId).then(res => {
setList(res);
Expand Down
8 changes: 7 additions & 1 deletion src/components/common/FilterInput.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import styled, { css } from 'styled-components';

interface InputInterface {
disabled?: boolean;
sizes: string;
onChange: (value: string) => void;
}

function FilterInput({ sizes, onChange }: InputInterface) {
function FilterInput({ disabled, sizes, onChange }: InputInterface) {
return (
<>
<InputWrap
disabled={disabled}
sizes={sizes}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
onChange(e.target.value)
Expand Down Expand Up @@ -50,6 +52,10 @@ const InputWrap = styled.input<{ sizes: string }>`
height: 2.4rem;
border: 1px solid ${props => props.theme.colors.neutral5};
padding-left: 0.8rem;
&:disabled {
background: ${props => props.theme.colors.neutral5};
}
`;

export default FilterInput;
Loading