Skip to content

Commit

Permalink
Feat: 마일리지 조회 게시판 enum 설정(#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinhyuk committed Aug 22, 2023
1 parent 4167ceb commit 07b9317
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/assets/data/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const ISVISIBLE = 'isVisible';
export const REGISTERED_DATE = 'registeredDate';
// export const TITLE = 'title';
export const ITEM = 'item';
export const NAME = 'name';
// export const NAME = 'name';
export const STUDENT_NAME = 'studentName';
export const POINT = 'point';
export const DESCRIPTION = 'description';
export const STUDENT_ID = 'studentId';
Expand Down
146 changes: 146 additions & 0 deletions src/components/board/MileageView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { StarIcon } from 'src/theme/overrides/CustomIcons';
import EnhancedTable from '../common/CustomTable';
import {
NUM,
CATEGORY,
SEMESTER,
ITEM,
STUDENT_ID,
STUDENT_NAME,
POINT,
REGISTERED_DATE,
} from 'src/assets/data/fields';

/**
* @component [마일리지 조회] 게시판
*/

/**
* @kind [마일리지 조회]
* @breif enum
*/

export enum MileageViewBoard {
'NUM' = NUM,
'CATEGORY' = CATEGORY,
'SEMESTER' = SEMESTER,
'ITEM' = ITEM,
'STUDENT_ID' = STUDENT_ID,
'STUDENT_NAME' = STUDENT_NAME,
'POINT' = POINT,
'REGISTERED_DATE' = REGISTERED_DATE,
}

/**
* @kind [마일리지 항목]
* @breif 데이터 인터페이스
*/
interface Data {
[MileageItemBoard.CATEGORY]: string;
[MileageItemBoard.SEMESTER]: number;
[MileageItemBoard.ITEM]: string;
[MileageItemBoard.MILEAGE]: number;
[MileageItemBoard.ISVISIBLE]: boolean;
[MileageItemBoard.REGISTERED_DATE]: string;
[MileageItemBoard.MANAGE]: string;
}

export default function MileageItem() {
/**
* @kind [마일리지 항목]
* @brief 데이터 생성 함수
*
* */
function createData(
num: number,
category: string,
semester: number,
item: string,
mileage: number,
isVisible: boolean,
registeredDate: string,
manage: string
): Data {
return {
[MileageItemBoard.NUM]: num,
[MileageItemBoard.CATEGORY]: category,
[MileageItemBoard.SEMESTER]: semester,
[MileageItemBoard.ITEM]: item,
[MileageItemBoard.MILEAGE]: mileage,
[MileageItemBoard.ISVISIBLE]: isVisible,
[MileageItemBoard.REGISTERED_DATE]: registeredDate,
[MileageItemBoard.MANAGE]: manage,
};
}

/**
* @kind [마일리지 항목]
* @brief 테이블 헤더
*/
const headCells = [
{
id: [MileageItemBoard.NUM],
numeric: false,
disablePadding: true,
label: '번호',
},
{
id: [MileageItemBoard.CATEGORY],
numeric: true,
disablePadding: false,
label: '카테고리명',
},
{
id: [MileageItemBoard.SEMESTER],
numeric: true,
disablePadding: false,
label: '학기',
},
{
id: [MileageItemBoard.ITEM],
numeric: true,
disablePadding: false,
label: '항목명',
},
{
id: [MileageItemBoard.MILEAGE],
numeric: true,
disablePadding: false,
label: '마일리지',
},
{
id: [MileageItemBoard.ISVISIBLE],
numeric: true,
disablePadding: false,
label: '보이기',
},
{
id: [MileageItemBoard.REGISTERED_DATE],
numeric: true,
disablePadding: false,
label: '등록일',
},
{
id: [MileageItemBoard.MANAGE],
numeric: true,
disablePadding: false,
label: '관리',
},
];

/**
* @number 1번 목록
* @description 마일리지 항목 리스트
*/

const rows = [
createData(1, '전공 마일리지', 7, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
createData(2, '비교과 - 연구활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
createData(3, '비교과 - 전공활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
createData(4, '비교과 - 특강참여', 7, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
createData(5, '비교과 - 학회활동', 6, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
createData(6, '비교과 - 행사참여', 8, '웹 서비스 캠프', 30, 'y', '2023-08-21', <StarIcon />),
];

return <EnhancedTable type="마일리지 항목" rows={rows} headCells={headCells} />;
}

0 comments on commit 07b9317

Please sign in to comment.