Skip to content

Commit

Permalink
[FE] FEAT: 일정 관리 모달에서 카테고리가 DUMMY인 경우 status를 DUMMY로 고정 #1691
Browse files Browse the repository at this point in the history
  • Loading branch information
wet6123 committed Oct 29, 2024
1 parent 2bccca5 commit f871765
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
15 changes: 10 additions & 5 deletions frontend/src/Cabinet/components/Common/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface IDropdownProps {
isOpen: boolean;
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
closeOtherDropdown?: () => void;
isDisabledOption: boolean;
}

const Dropdown = ({
Expand All @@ -30,6 +31,7 @@ const Dropdown = ({
isOpen,
setIsOpen,
closeOtherDropdown,
isDisabledOption,
}: IDropdownProps) => {
const [currentName, setCurrentName] = useState(defaultValue);
const idx: number = options.findIndex((op) => op.name === currentName);
Expand All @@ -41,14 +43,16 @@ const Dropdown = ({
useEffect(() => {
setCurrentName(defaultValue);
}, [defaultValue]);

return (
<DropdownContainerStyled>
<DropdownContainerStyled isDisabled={isDisabledOption}>
<DropdownSelectionBoxStyled
onClick={() => {
if (options[selectedIdx].isDisabled) return;
setIsOpen(!isOpen);
closeOtherDropdown && closeOtherDropdown();
}}
isDisabled={isDisabledOption}
>
{DefaultOptionIcon && (
<OptionsImgStyled>
Expand Down Expand Up @@ -94,15 +98,15 @@ const Dropdown = ({
);
};

const DropdownContainerStyled = styled.div`
const DropdownContainerStyled = styled.div<{ isDisabled: boolean }>`
display: flex;
flex-direction: column;
width: 100%;
position: relative;
cursor: pointer;
cursor: ${({ isDisabled }) => (isDisabled ? "" : "pointer")};
`;

const DropdownSelectionBoxStyled = styled.div`
const DropdownSelectionBoxStyled = styled.div<{ isDisabled: boolean }>`
position: relative;
display: flex;
align-items: center;
Expand All @@ -113,7 +117,8 @@ const DropdownSelectionBoxStyled = styled.div`
text-align: start;
padding-left: 20px;
font-size: 1.125rem;
color: var(--sys-main-color);
color: ${({ isDisabled }) =>
isDisabled ? "var(--capsule-btn-border-color)" : "var(--sys-main-color)"};
`;

const DropdownItemContainerStyled = styled.div<{ isVisible: boolean }>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ const EditStatusModal = ({ list, closeModal }: EditStatusModalProps) => {
const statusDropdownProps = {
options: statusOptions.map((option) => ({
...option,
isDisabled:
currentPresentation?.category === "DUMMY" &&
option.value === PresentationStatusType.CANCEL
? true
: false,
isDisabled: currentPresentation?.category === "DUMMY" ? true : false,
})),
defaultValue:
statusOptions.find(
Expand All @@ -98,6 +94,7 @@ const EditStatusModal = ({ list, closeModal }: EditStatusModalProps) => {
setIsDatesDropdownOpen(false);
setIsLocationDropdownOpen(false);
},
isDisabledOption: currentPresentation?.category === "DUMMY",
};

const datesDropdownProps = {
Expand All @@ -115,6 +112,7 @@ const EditStatusModal = ({ list, closeModal }: EditStatusModalProps) => {
setIsStatusDropdownOpen(false);
setIsLocationDropdownOpen(false);
},
isDisabledOption: false,
};

const locationDropdownProps = {
Expand All @@ -133,6 +131,7 @@ const EditStatusModal = ({ list, closeModal }: EditStatusModalProps) => {
setIsStatusDropdownOpen(false);
setIsDatesDropdownOpen(false);
},
isDisabledOption: false,
};

const tryEditPresentationStatus = async (e: React.MouseEvent) => {
Expand Down Expand Up @@ -188,6 +187,9 @@ const EditStatusModal = ({ list, closeModal }: EditStatusModalProps) => {

useEffect(() => {
getInvalidDates();
if (currentPresentation?.category === "DUMMY") {
setPresentationStatus(PresentationStatusType.DUMMY);
}
}, []);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export enum PresentationStatusType {
EXPECTED = "EXPECTED",
DONE = "DONE",
CANCEL = "CANCEL",
DUMMY = "DUMMY",
}

export enum PresentationPeriodType {
Expand Down

0 comments on commit f871765

Please sign in to comment.