-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FEAT] 공홈 어드민 QA용 매직버튼 만들었어요 #197
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { useToast } from '@sopt-makers/ui'; | ||
import { Button, useToast } from '@sopt-makers/ui'; | ||
import { useState } from 'react'; | ||
import { | ||
type FieldValues, | ||
|
@@ -8,7 +8,10 @@ import { | |
} from 'react-hook-form'; | ||
|
||
import { AddAdminRequestDto } from '@/__generated__/org-types/data-contracts'; | ||
import { StListHeader } from '@/components/attendanceAdmin/session/SessionList/style'; | ||
import { | ||
StDevHStack, | ||
StListHeader, | ||
} from '@/components/attendanceAdmin/session/SessionList/style'; | ||
import FilterButton from '@/components/common/FilterButton'; | ||
import { | ||
type EXEC_TYPE, | ||
|
@@ -49,7 +52,7 @@ function OrgAdmin() { | |
const [introPart, setIntroPart] = useState<PART_KO>('기획'); | ||
|
||
const methods = useForm({ mode: 'onBlur' }); | ||
const { handleSubmit, getValues, setError } = methods; | ||
const { handleSubmit, getValues, setError, reset, setValue } = methods; | ||
|
||
const { open } = useToast(); | ||
|
||
|
@@ -272,11 +275,79 @@ function OrgAdmin() { | |
], | ||
})), | ||
}; | ||
|
||
sendMutate(requestBody); | ||
}; | ||
|
||
const handleClickMagicButton = (type: 'SET' | 'GET' | 'IMAGE' | 'RESET') => { | ||
if (type === 'SET') { | ||
localStorage.setItem('org-admin', JSON.stringify(getValues())); | ||
alert('데이터 임시저장 성공!'); | ||
return; | ||
} | ||
if (type === 'GET') { | ||
const data = localStorage.getItem('org-admin'); | ||
if (!data) { | ||
alert('저장된 데이터가 없음ㅠ'); | ||
} else { | ||
reset(JSON.parse(data)); | ||
alert( | ||
'데이터 불러오기 성공! \n소개탭 헤더를 반드시 다시 첨부해주세요!', | ||
); | ||
} | ||
return; | ||
} | ||
|
||
if (type === 'IMAGE') { | ||
const headerImage = getValues('headerImageFileName'); | ||
if (!(headerImage?.file instanceof File)) { | ||
alert('소개탭 헤더 넣어주세용'); | ||
return; | ||
} | ||
setValue('coreValue1.imageFileName', headerImage); | ||
setValue('coreValue2.imageFileName', headerImage); | ||
setValue('coreValue3.imageFileName', headerImage); | ||
setValue('member.회장.profileImageFileName', headerImage); | ||
setValue('member.부회장.profileImageFileName', headerImage); | ||
setValue('member.총무.profileImageFileName', headerImage); | ||
setValue('member.운영 팀장.profileImageFileName', headerImage); | ||
setValue('member.미디어 팀장.profileImageFileName', headerImage); | ||
setValue('member.메이커스 팀장.profileImageFileName', headerImage); | ||
setValue('member.기획.profileImageFileName', headerImage); | ||
setValue('member.디자인.profileImageFileName', headerImage); | ||
setValue('member.안드로이드.profileImageFileName', headerImage); | ||
setValue('member.iOS.profileImageFileName', headerImage); | ||
setValue('member.웹.profileImageFileName', headerImage); | ||
setValue('member.서버.profileImageFileName', headerImage); | ||
setValue('recruitHeaderImage', headerImage); | ||
|
||
alert('소개탭 헤더로 이미지 밀기 성공!'); | ||
return; | ||
} | ||
localStorage.removeItem('org-admin'); | ||
|
||
alert('데이터 초기화 성공! 새로고침하세용'); | ||
}; | ||
return ( | ||
<> | ||
{process.env.NODE_ENV === 'development' && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 너무 괜찮은데용? 실제에 반영해도 좋을 거 같긴 합니다~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 인정합니당,, 일단 이정이 한번 경험시켜보고(?) 얘기해보도록 해여 |
||
<StDevHStack> | ||
<p>매직버튼</p> | ||
<Button size="sm" onClick={() => handleClickMagicButton('SET')}> | ||
임시저장 | ||
</Button> | ||
<Button size="sm" onClick={() => handleClickMagicButton('GET')}> | ||
불러오기 | ||
</Button> | ||
<Button size="sm" onClick={() => handleClickMagicButton('IMAGE')}> | ||
이미지 채우기 | ||
</Button> | ||
<Button size="sm" onClick={() => handleClickMagicButton('RESET')}> | ||
데이터삭제 | ||
</Button> | ||
</StDevHStack> | ||
)} | ||
|
||
<StListHeader> | ||
<h1>공홈 관리</h1> | ||
<FilterButton | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오홍 대박이네여