유저 제재 권한화면 모듈화

This commit is contained in:
2025-02-20 11:16:04 +09:00
parent f2369773a0
commit 6760219734

View File

@@ -9,7 +9,7 @@ import { Title, BtnWrapper, TextInput, SelectInput, DatePickerWrapper, ButtonClo
import Modal from '../../components/common/modal/Modal';
import DatePickerComponent from '../../components/common/Date/DatePickerComponent';
import { blockPeriod, blockSanctions, blockType, HourList, MinuteList } from '../../assets/data';
import { authType, blockPeriod, blockSanctions, blockType, HourList, MinuteList } from '../../assets/data';
import DatePicker, { registerLocale } from 'react-datepicker';
import { ko } from 'date-fns/esm/locale';
import 'react-datepicker/dist/react-datepicker.css';
@@ -21,6 +21,7 @@ import { BlackListRegist, BlackListMultipleUpload } from '../../apis';
import { authList } from '../../store/authList';
import { useRecoilValue } from 'recoil';
import AuthModal from '../../components/common/modal/AuthModal';
registerLocale('ko', ko);
@@ -50,7 +51,7 @@ const UserBlockRegist = () => {
const [guidList, setGuidList] = useState([]);
const [typeError, setTypeError] = useState(true);
const [resultData, setResultData] = useState({
list: { guid: '' },
list: [{ guid: '' }],
type: '',
sanctions: '',
period: '',
@@ -66,7 +67,7 @@ const UserBlockRegist = () => {
const handleReset = () => {
setResultData({
list: { guid: '' },
list: [{ guid: '' }],
type: '',
sanctions: '',
period: '',
@@ -124,7 +125,7 @@ const UserBlockRegist = () => {
const result = new Date(sendDate.getFullYear(), sendDate.getMonth(), sendDate.getDate(), e.target.id === 'hour' ? e.target.value : sendHour, e.target.id === 'min' ? e.target.value : sendMin);
const blockDay = resultData.period.slice(1) > 0 ? Number(resultData.period.slice(1)) + 1 : 0;
const blockDay = resultData.period.slice(1) > 0 ? Number(resultData.period.slice(1)) : 0;
const permanentDay = 2999 - sendDate.getFullYear();
if (e.target.id === 'hour') setSendHour(e.target.value);
@@ -264,20 +265,8 @@ const UserBlockRegist = () => {
return (
<>
{userInfo.auth_list && !userInfo.auth_list.some(auth => auth.id === 25) ? (
<Modal min="440px" $padding="40px" $bgcolor="transparent" $view={'view'}>
<BtnWrapper $justify="flex-end">
<ButtonClose onClick={() => navigate(-1)} />
</BtnWrapper>
<ModalText $align="center">
해당 메뉴에 대한 등록 권한이 없습니다.
<br />
권한 등급을 변경 다시 이용해주세요.
</ModalText>
<BtnWrapper $gap="10px">
<Button text="확인" theme="primary" type="submit" size="large" width="100%" handleClick={() => navigate(-1)} />
</BtnWrapper>
</Modal>
{userInfo.auth_list && !userInfo.auth_list.some(auth => auth.id === authType.blackListUpdate) ? (
<AuthModal/>
) : (
<>
<Title>이용자 제재 등록</Title>
@@ -291,7 +280,7 @@ const UserBlockRegist = () => {
placeholder="GUID 입력"
width="400px"
disabled={selectSingle}
value={resultData.list.guid}
value={resultData.list[0]?.guid || ''}
onChange={e => {
let list = [];
list.push({ guid: e.target.value });