-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(member, time): 관리자 페이지 계정 추가 기능 (#232)
* refactor(member): minify layout shifting at `TimeTableModal` * refactor(member): save `major` data in `TimeTableModal` * refactor(member): normalize lecture remove modal size * feat(member): implementing additional member request logic * chore(member): install `@suspensive/react` * feat(member): implementing member add-ons * refactor(member): type `SelectOptions` temporarily disabled for intellisense * Create tender-tables-compete.md * refactor(member): change `invalidateQueries` queryKey when member addition success * refactor(member): change certain keys to optional at `AddMemberRequestType` * refactor(member): remove unnecessary query key * refactor(member): reduce states by change states to object * fix(time): fix type error at `useEditableSearchParams` --------- Co-authored-by: GwanSik Kim <[email protected]>
- Loading branch information
Showing
15 changed files
with
443 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@clab-platforms/member": minor | ||
"@clab-platforms/time": minor | ||
--- | ||
|
||
feat(member, time): 관리자 페이지 계정 추가 기능 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
apps/member/src/components/manage/ManageLevelSection/AddMemberForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import { ChangeEvent, FormEvent, useState } from 'react'; | ||
|
||
import { Button, Input } from '@clab-platforms/design-system'; | ||
|
||
import Select from '@components/common/Select/Select.tsx'; | ||
|
||
import { SELECT_OPTIONS } from '@constants/select.ts'; | ||
import { useMemberAddMutation } from '@hooks/queries/member/useMemberAddMutation.ts'; | ||
|
||
import { AddMemberRequestType } from '@type/manage.ts'; | ||
|
||
const defaultMemberInfo: AddMemberRequestType = { | ||
id: '', | ||
password: '', | ||
name: '', | ||
address: '', | ||
email: '', | ||
contact: '', | ||
department: '', | ||
grade: 1, | ||
birth: '', | ||
interests: '', | ||
githubUrl: '', | ||
imageUrl: '', | ||
studentStatus: 'CURRENT', | ||
}; | ||
|
||
const AddMemberForm = () => { | ||
const [userInput, setUserInput] = | ||
useState<AddMemberRequestType>(defaultMemberInfo); | ||
const { memberAddMutation } = useMemberAddMutation(); | ||
|
||
const onSubmit = (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
memberAddMutation(userInput); | ||
}; | ||
|
||
const handleInputChange = ( | ||
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>, | ||
) => { | ||
setUserInput((prev) => ({ | ||
...prev, | ||
[e.target.name]: | ||
e.target.name !== 'grade' | ||
? e.target.value | ||
: SELECT_OPTIONS.GRADE[+e.target.value - 1].value, | ||
})); | ||
}; | ||
|
||
return ( | ||
<form className="flex flex-col gap-y-2" onSubmit={onSubmit}> | ||
<Input | ||
label="학번" | ||
id="학번" | ||
name="id" | ||
placeholder="학번을 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Input | ||
label="이름" | ||
id="이름" | ||
name="name" | ||
placeholder="이름을 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Input | ||
label="전화번호" | ||
id="전화번호" | ||
name="contact" | ||
type="tel" | ||
placeholder="전화번호를 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Input | ||
label="이메일" | ||
id="이메일" | ||
name="email" | ||
type="email" | ||
placeholder="이메일을 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Input | ||
label="학과" | ||
id="학과" | ||
name="department" | ||
placeholder="학과를 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Select | ||
label="구분" | ||
options={SELECT_OPTIONS.GRADE} | ||
name="studentStatus" | ||
onChange={handleInputChange} | ||
/> | ||
<Input | ||
label="생년월일" | ||
id="생년월일" | ||
name="birth" | ||
type="date" | ||
placeholder="생년월일을 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Input | ||
label="주소" | ||
id="주소" | ||
name="address" | ||
placeholder="주소를 입력해주세요." | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
<Select | ||
label="분야" | ||
options={SELECT_OPTIONS.MY_FIELD} | ||
name="interests" | ||
onChange={handleInputChange} | ||
/> | ||
<Input | ||
label="깃허브 주소" | ||
id="깃허브 주소" | ||
name="githubUrl" | ||
placeholder="깃허브 주소를 입력해주세요." | ||
onChange={handleInputChange} | ||
/> | ||
<Select | ||
label="구분" | ||
options={SELECT_OPTIONS.STUDENT_STATUS} | ||
name="studentStatus" | ||
onChange={handleInputChange} | ||
/> | ||
<Button type="submit" className="mt-2 w-full"> | ||
멤버 추가하기 | ||
</Button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default AddMemberForm; |
170 changes: 35 additions & 135 deletions
170
apps/member/src/components/manage/ManageLevelSection/ManageLevelSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.