Skip to content

Commit

Permalink
Merge pull request #99 from sopt-makers/dev
Browse files Browse the repository at this point in the history
[ver.2.0.0] SOPT WEB Admin dev -> main 배포
  • Loading branch information
Brokyeom authored Dec 1, 2023
2 parents 56fa19d + 38dfe91 commit 0bf98d5
Show file tree
Hide file tree
Showing 97 changed files with 3,445 additions and 1,455 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"dependencies": {
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@sopt-makers/colors": "^2.2.0",
"@sopt-makers/colors": "^3.0.0",
"@sopt-makers/fonts": "^1.0.0",
"@types/axios": "^0.14.0",
"@types/node": "18.15.3",
"@types/react": "18.0.28",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions src/assets/icons/IcAlarmMenu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/IcAttendanceMenu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/IcDate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/IcDeleteFile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/IcDropdownCheck.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/assets/icons/IcModalClose.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/assets/icons/IcMore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 0 additions & 14 deletions src/assets/icons/IcNavMenu.svg

This file was deleted.

3 changes: 3 additions & 0 deletions src/assets/icons/IcNewDropdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/IcOrgMenu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/IcPlace.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/icons/IcUpload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/assets/icons/SoptLogos/DoSoptLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/assets/icons/SoptLogos/GoSoptLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/icons/SoptLogos/SoptMainLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/SoptLogos/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as DoSoptLogo } from './DoSoptLogo.svg';
export { default as GoSoptLogo } from './GoSoptLogo.svg';
export { default as SoptMainLogo } from './SoptMainLogo.svg';
7 changes: 6 additions & 1 deletion src/assets/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export { default as IcAlarmMenu } from './IcAlarmMenu.svg';
export { default as IcAttendanceMenu } from './IcAttendanceMenu.svg';
export { default as IcCheckBox } from './IcCheckBox';
export { default as IcDeleteFile } from './IcDeleteFile.svg';
export { default as IcGoPrev } from './IcGoPrev.svg';
export { default as IcModalClose } from './IcModalClose.svg';
export { default as IcNavMenu } from './IcNavMenu.svg';
export { default as IcNewDropdown } from './IcNewDropdown.svg';
export { default as IcOrgMenu } from './IcOrgMenu.svg';
export { default as IcUpload } from './IcUpload.svg';
160 changes: 160 additions & 0 deletions src/components/alarmAdmin/AlarmList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import dayjs from 'dayjs';
import { useState } from 'react';
import { UseQueryResult } from 'react-query';

import IcMore from '@/assets/icons/IcMore.svg';
import { StActionButton } from '@/components/attendanceAdmin/session/SessionList/style';
import Chip from '@/components/common/Chip';
import FilterButton from '@/components/common/FilterButton';
import ListActionButton from '@/components/common/ListActionButton';
import ListWrapper from '@/components/common/ListWrapper';
import Loading from '@/components/common/Loading';
import Modal from '@/components/common/modal';
import { deleteAlarm, sendAlarm } from '@/services/api/alarm';

import ShowAlarmModal from '../ShowAlarmModal';
import { StListItem, StPageHeader } from './style';

const sendStatusList: ALARM_STATUS[] = ['전체', '발송 전', '발송 후'];

interface Props {
data: Alarm[];
refetch: () => void;
}

function AlarmList(props: Props) {
const { data, refetch } = props;

const [tab, setTab] = useState<ALARM_STATUS>('전체');
const [activeDropdownId, setActiveDropdownId] = useState<number | null>(null);
const [showAlarmDetail, setShowAlarmDetail] = useState<number | null>(null);
const [isSending, setIsSending] = useState(false);

const onChangeTab = (value: ALARM_STATUS) => {
setTab(value);
};

const toggleDropdown = (e: React.MouseEvent, alarmId: number): void => {
e.stopPropagation();
if (activeDropdownId === alarmId) {
setActiveDropdownId(null);
} else {
setActiveDropdownId(alarmId);
}
};

const onSendAlarm = async (alarmId: number, title: string) => {
const response = window.confirm(`${title} 알림을 전송하시겠습니까?`);
if (response) {
setIsSending(true);
const result = await sendAlarm(alarmId);
setIsSending(false);
window.alert(result ? '전송에 성공했습니다' : '전송에 실패했습니다');
refetch();
}
};

const onShowAlarmDetail = (alarmId: number) => {
setShowAlarmDetail(alarmId);
};

const onCloseAlarmDetail = () => {
setShowAlarmDetail(null);
};

const handleDeleteAlarm = async (
e: React.MouseEvent<HTMLDivElement>,
alarmId: number,
) => {
e.stopPropagation();
const response = window.confirm('알림을 삭제하시겠습니까?');
if (response) {
const result = await deleteAlarm(alarmId);
result && refetch();
}
};

const alarmList = data
? data.filter((item) => (tab === '전체' ? true : item.status === tab))
: [];

return (
<>
<StPageHeader>
<h1>알림 관리</h1>
<FilterButton<ALARM_STATUS>
list={sendStatusList}
selected={tab}
onChange={onChangeTab}
/>
<p>{alarmList.length}</p>
</StPageHeader>

<ListWrapper>
{alarmList.map((alarm) => (
<StListItem
key={alarm.alarmId}
onClick={() => onShowAlarmDetail(alarm.alarmId)}>
<p
className={
alarm.status === '발송 전'
? 'alarm-status before'
: 'alarm-status after'
}>
{alarm.status}
</p>
<div className="alarm-info-wrap">
<div>
<p className="alarm-title">{alarm.title}</p>
<Chip text={alarm.part ?? '전체'} />
<Chip text={alarm.attribute} />
</div>
<p className="alarm-sent-at">
발송 일자:{' '}
{alarm.sendAt
? dayjs(alarm.sendAt).format('YYYY/MM/DD HH:mm')
: ''}
</p>
</div>
<p className="alarm-content">{alarm.content}</p>
<div className="alarm-send">
<ListActionButton
text="전송"
onClick={(e) => {
e.stopPropagation();
onSendAlarm(alarm.alarmId, alarm.title);
}}
disabled={alarm.status === '발송 후'}
/>
</div>
<div>
<StActionButton onClick={(e) => toggleDropdown(e, alarm.alarmId)}>
<IcMore />
</StActionButton>
{activeDropdownId === alarm.alarmId && (
<div
className="delete_dropdown"
onClick={(e) => handleDeleteAlarm(e, alarm.alarmId)}>
<p>삭제하기</p>
</div>
)}
</div>
</StListItem>
))}
</ListWrapper>

{showAlarmDetail && (
<Modal>
<ShowAlarmModal
onClose={onCloseAlarmDetail}
alarmId={showAlarmDetail}
/>
</Modal>
)}

{isSending && <Loading />}
</>
);
}

export default AlarmList;
Loading

1 comment on commit 0bf98d5

@vercel
Copy link

@vercel vercel bot commented on 0bf98d5 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sopt-operation – ./

sopt-operation-melting.vercel.app
sopt-operation-git-main-melting.vercel.app
sopt-operation.vercel.app

Please sign in to comment.