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

[FE] 지출 액션 수정, 삭제 기능 구현 #204

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0e33513
chore: 역할 체인지 위한 저장
pakxe Aug 1, 2024
a9c6bc2
feat: 들어온 인원 삭제 기능 구현
jinhokim98 Aug 1, 2024
4b29905
feat: StepList에 사용되는 타입 파일 작성
pakxe Aug 1, 2024
d713c24
refactor: 전역 타입 선언을 types 디렉토리에서 import하는 형식으로 변경
jinhokim98 Aug 2, 2024
acca587
refactor: type 관리 변경으로 인한 import 추가
jinhokim98 Aug 2, 2024
1999f48
refactor: Step 내부를 Bill과 Member로 나눔
jinhokim98 Aug 2, 2024
adec4a0
fix: 타입 import types 디렉토리로 옮기면서 import 누락 수정
jinhokim98 Aug 2, 2024
ba1c9aa
refactor: member action 훅으로 분리
jinhokim98 Aug 2, 2024
6899870
chore: 충돌 해결
jinhokim98 Aug 5, 2024
bae729f
refactor: evenPageLayout 파일이름 오류 수정
jinhokim98 Aug 5, 2024
551c6ef
refactor: 머지 중 발생한 잔재 처리
jinhokim98 Aug 5, 2024
8ab8e9b
chore: dev dependency로 옮겨야 할 것 옮김
jinhokim98 Aug 5, 2024
a166c44
refactor: index.ts 정의 및 props 이름 변경
jinhokim98 Aug 5, 2024
2961965
remove: 사용하지 않는 파일 제거
jinhokim98 Aug 5, 2024
6089b52
refactor: index.ts를 통해 import문 줄임
jinhokim98 Aug 5, 2024
b4fb404
refactor: 사용하지 않는 타입 제거
jinhokim98 Aug 5, 2024
bc24ffc
remove: 사용하지 않는 action 함수 제거
jinhokim98 Aug 5, 2024
aee1056
refactor: get out member modal 사용하지 않는 파일로 인해 오류 터지는 현상 해결
jinhokim98 Aug 5, 2024
28c3e01
fix: 잘못된 import 수정 -> 새로 만들어진 멤버삭제 api로 연결
jinhokim98 Aug 5, 2024
bf380aa
Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha…
jinhokim98 Aug 5, 2024
6079db1
chore: HDesign v0.1.56 배포
Todari Aug 5, 2024
c30a387
chore: EditBillActionMoal 컴포넌트 생성 및 BillStepItem onClick 추가
soi-ha Aug 5, 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
4 changes: 2 additions & 2 deletions HDesign/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion HDesign/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haengdong-design",
"version": "0.1.55",
"version": "0.1.56",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
8 changes: 4 additions & 4 deletions HDesign/src/components/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ import {
const BottomSheet: React.FC<BottomSheetProps> = ({
isOpened = false,
children,
onChangeClose,
onChangeOpen,
onClose,
onOpen,
...props
}: BottomSheetProps) => {
const {theme} = useTheme();
const {opened, visible, handleClose, handleDragStart, handleDrag, handleDragEnd, isDragging, translateY} =
useBottomSheet({
isOpened,
onChangeClose,
onChangeOpen,
onClose,
onOpen,
});

// TODO: (@todari) : children 길이 길 때 overflow button에 안가리는 영역 처리
Expand Down
2 changes: 1 addition & 1 deletion HDesign/src/components/InOutItem/InOutItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const InOutItem: React.FC<InOutItemProps> = ({

// TODO: (@toari) : 사람 수 많을 때 UX writing 처리
return (
<DragHandleItem {...htmlProps} hasDragHandle={hasDragHandle}>
<DragHandleItem {...htmlProps} hasDragHandle={hasDragHandle} onClick={() => alert('안녕')}>
<Text css={textStyle(theme, hasDragHandle)} size="bodyBold">
{names.join(', ')} {IN_OUT_TEXT[inOutType]}
</Text>
Expand Down
229 changes: 149 additions & 80 deletions client/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"typescript-eslint": "^7.16.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
"webpack-dev-server": "^5.0.4",
"@types/dotenv-webpack": "^7.0.7",
"dotenv-webpack": "^8.1.0"
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@types/dotenv-webpack": "^7.0.7",
"dotenv-webpack": "^8.1.0",
"haengdong-design": "^0.1.53",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 2 additions & 0 deletions client/src/apis/request/bill.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {Bill} from 'types/serviceType';

import {BASE_URL} from '@apis/baseUrl';
import {TEMP_PREFIX} from '@apis/tempPrefix';
import {requestPost, requestDelete, requestPut} from '@apis/fetcher';
Expand Down
2 changes: 2 additions & 0 deletions client/src/apis/request/member.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {MemberType} from 'types/serviceType';

import {BASE_URL} from '@apis/baseUrl';
import {TEMP_PREFIX} from '@apis/tempPrefix';
import {requestPost, requestDelete} from '@apis/fetcher';
Expand Down
2 changes: 2 additions & 0 deletions client/src/apis/request/report.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {MemberReport} from 'types/serviceType';

import {BASE_URL} from '@apis/baseUrl';
import {TEMP_PREFIX} from '@apis/tempPrefix';
import {requestGet} from '@apis/fetcher';
Expand Down
2 changes: 2 additions & 0 deletions client/src/apis/request/stepList.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {StepList} from 'types/serviceType';

import {BASE_URL} from '@apis/baseUrl';
import {TEMP_PREFIX} from '@apis/tempPrefix';
import {requestGet} from '@apis/fetcher';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {BottomSheet, LabelGroupInput, FixedButton, Text} from 'haengdong-design';
import {useState} from 'react';

import {BillAction} from 'types/serviceType';

interface EditBillActionModalProps {
isOpened: boolean;
billAction: BillAction;
}

const EditBillActionModal = ({isOpened, billAction}: EditBillActionModalProps) => {
const [errorText, setErrorText] = useState('');

const [isEdited, setIsEdited] = useState(false);

return (
<BottomSheet isOpened={isOpened}>
<Text size="bodyBold">지출 내역 수정하기</Text>
<LabelGroupInput labelText="지출내역 / 금액" errorText={errorText}>
<LabelGroupInput.Element elementKey="name" value={billAction.name} />
<LabelGroupInput.Element elementKey="price" value={billAction.price} />
</LabelGroupInput>
<FixedButton />
</BottomSheet>
);
};

export default EditBillActionModal;
20 changes: 20 additions & 0 deletions client/src/components/Modal/InOut/ComeInMember.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {css} from '@emotion/react';

export const setInitialParticipantsStyle = () =>
css({
display: 'flex',
flexDirection: 'column',
gap: '1.5rem',
width: '100%',
height: '100%',
padding: '0 1.5rem',
});

export const setInitialParticipantsInputGroupStyle = () =>
css({
display: 'flex',
flexDirection: 'column',
gap: '1rem',
overflow: 'auto',
paddingBottom: '11rem',
});
41 changes: 41 additions & 0 deletions client/src/components/Modal/InOut/ComeInMember.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type {MemberAction} from 'types/serviceType';

import {Text, Input, BottomSheet, Button, Flex} from 'haengdong-design';

import {useStepList} from '@hooks/useStepList/useStepList';
import useMemberAction from '@hooks/useStepList/useMemberAction';

import {setInitialParticipantsInputGroupStyle, setInitialParticipantsStyle} from './ComeInMember.style';

interface SetInitialParticipantsProps {
openBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
actions: MemberAction[];
}

const ComeInMember = ({openBottomSheet, setOpenBottomSheet, actions}: SetInitialParticipantsProps) => {
const {refreshStepList, stepList} = useStepList();
const {deleteMember} = useMemberAction({stepList, refreshStepList});

return (
<BottomSheet isOpened={openBottomSheet} onChangeClose={() => setOpenBottomSheet(false)}>
<div css={setInitialParticipantsStyle}>
<Text size="bodyBold">들어온 인원 수정하기</Text>
<div css={setInitialParticipantsInputGroupStyle}>
{actions.map(action => (
<Flex flexDirection="row" width="100%">
<div style={{flexGrow: 1}}>
<Input disabled key={`${action.actionId}`} type="text" style={{flexGrow: 1}} value={action.name} />
</div>
<Button style={{width: '50px'}} onClick={() => deleteMember(action)}>
X
</Button>
</Flex>
))}
</div>
</div>
</BottomSheet>
);
};

export default ComeInMember;
20 changes: 20 additions & 0 deletions client/src/components/Modal/InOut/GetOutMember.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// import {css} from '@emotion/react';

// export const setInitialParticipantsStyle = () =>
// css({
// display: 'flex',
// flexDirection: 'column',
// gap: '1.5rem',
// width: '100%',
// height: '100%',
// padding: '0 1.5rem',
// });

// export const setInitialParticipantsInputGroupStyle = () =>
// css({
// display: 'flex',
// flexDirection: 'column',
// gap: '1rem',
// overflow: 'auto',
// paddingBottom: '11rem',
// });
17 changes: 17 additions & 0 deletions client/src/components/Modal/InOut/GetOutMember.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {BottomSheet, FixedButton} from 'haengdong-design';

interface SetInitialParticipantsProps {
openBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const GetOutMember = ({openBottomSheet, setOpenBottomSheet}: SetInitialParticipantsProps) => {
return (
<BottomSheet isOpened={openBottomSheet} onChangeClose={() => setOpenBottomSheet(false)}>
망쵸모달 나감 모달
<FixedButton onDeleteClick={() => alert('아아아앙')}>안녕</FixedButton>
</BottomSheet>
);
};

export default GetOutMember;
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import useDynamicBillActionInput from '@hooks/useDynamicBillActionInput';

import style from './AddBillActionListModalContent.style';

interface SetPurchaseProps {
interface AddBillActionListModalContentProps {
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setOrder: React.Dispatch<React.SetStateAction<number>>;
}

const AddBillActionListModalContent = ({setOpenBottomSheet, setOrder}: SetPurchaseProps) => {
const AddBillActionListModalContent = ({setOpenBottomSheet, setOrder}: AddBillActionListModalContentProps) => {
const {
inputPairList,
inputRefList,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as AddBillActionListModalContent} from './AddBillActionListModalContent';
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import type {MemberType} from 'types/serviceType';

import {FixedButton, LabelGroupInput} from 'haengdong-design';

import {useStepList} from '@hooks/useStepList/useStepList';
import validateMemberName from '@utils/validate/validateMemberName';
import {MemberType} from 'types/serviceType';

import useDynamicInput from '@hooks/useDynamicInput';

import style from './AddMemberActionListModalContent.style';

interface UpdateMembersProps {
interface AddMemberActionListModalContentProps {
inOutAction: MemberType;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const AddMemberActionListModalContent = ({inOutAction, setOpenBottomSheet}: UpdateMembersProps) => {
const AddMemberActionListModalContent = ({inOutAction, setOpenBottomSheet}: AddMemberActionListModalContentProps) => {
const {
inputList,
inputRefList,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as AddMemberActionListModalContent} from './AddMemberActionListModalContent';
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type {InOutType} from 'types/serviceType';

import {useState} from 'react';
import {BottomSheet, Switch} from 'haengdong-design';

import SetPurchase from './AddBillActionListModalContent/AddBillActionListModalContent';
import AddMemberActionListModalContent from './AddMemberActionListModalContent/AddMemberActionListModalContent';
import {AddBillActionListModalContent} from './AddBillActionListModalContent';
import {AddMemberActionListModalContent} from './AddMemberActionListModalContent';
import style from './SetActionListModal.style';

export type ActionType = '지출' | '인원';
Expand Down Expand Up @@ -35,7 +37,9 @@ const SetActionListModal = ({openBottomSheet, setOpenBottomSheet, setOrder}: Set
)}
</div>

{action === '지출' && <SetPurchase setOpenBottomSheet={setOpenBottomSheet} setOrder={setOrder} />}
{action === '지출' && (
<AddBillActionListModalContent setOpenBottomSheet={setOpenBottomSheet} setOrder={setOrder} />
)}
{action === '인원' && (
<AddMemberActionListModalContent
inOutAction={inOutAction === '탈주' ? 'OUT' : 'IN'}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Modal/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export {default as SetInitialMemberListModal} from './SetInitialMemberListModal/SetInitialMemberListModal';
export {default as SetActionListModal} from './SetActionModal/SetActionListModal';
export {default as SetInitialMemberListModal} from './SetInitialMemberListModal/SetInitialMemberListModal';
26 changes: 26 additions & 0 deletions client/src/components/StepList/BillStepItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type {BillStep} from 'types/serviceType';

import {StepItem} from 'haengdong-design';

import EditBillActionModal from '@components/Modal/EditBillActionModal/EditBillActionModal';
interface BillStepItemProps {
step: BillStep;
isOpenBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const BillStepItem: React.FC<BillStepItemProps> = ({step, isOpenBottomSheet, setOpenBottomSheet}) => {
return (
<>
<StepItem
name={step.stepName === null ? '행사' : step.stepName}
bills={step.actions}
personCount={step.members.length}
onClick={() => setOpenBottomSheet(true)}
/>
<EditBillActionModal isOpened={isOpenBottomSheet} />
</>
);
};

export default BillStepItem;
39 changes: 39 additions & 0 deletions client/src/components/StepList/MemberStepItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type {MemberStep} from 'types/serviceType';

import {InOutItem} from 'haengdong-design';

import ComeInMember from '@components/Modal/InOut/ComeInMember';
import GetOutMember from '@components/Modal/InOut/GetOutMember';

interface MemberStepItemProps {
step: MemberStep;
isOpenBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const MemberStepItem: React.FC<MemberStepItemProps> = ({step, isOpenBottomSheet, setOpenBottomSheet}) => {
return (
<>
<InOutItem
inOutType={step.type}
names={step.actions.map(({name}) => name)}
onClick={() => setOpenBottomSheet(prev => !prev)}
/>
{isOpenBottomSheet && step.type === 'IN' && (
<ComeInMember
actions={step.actions}
openBottomSheet={isOpenBottomSheet}
setOpenBottomSheet={() => setOpenBottomSheet(prev => !prev)}
/>
)}
{isOpenBottomSheet && step.type === 'OUT' && (
<GetOutMember
openBottomSheet={isOpenBottomSheet}
setOpenBottomSheet={() => setOpenBottomSheet(prev => !prev)}
/>
)}
</>
);
};

export default MemberStepItem;
24 changes: 24 additions & 0 deletions client/src/components/StepList/Step.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type {BillStep, MemberStep} from 'types/serviceType';

import {useState} from 'react';

import BillStepItem from './BillStepItem';
import MemberStepItem from './MemberStepItem';

interface StepProps {
step: BillStep | MemberStep;
}

const Step = ({step}: StepProps) => {
const [isOpenBottomSheet, setOpenBottomSheet] = useState<boolean>(false);

if (step.type === 'BILL') {
return <BillStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setOpenBottomSheet={setOpenBottomSheet} />;
} else if (step.type === 'IN' || step.type === 'OUT') {
return <MemberStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setOpenBottomSheet={setOpenBottomSheet} />;
} else {
return <></>;
}
};

export default Step;
Loading
Loading