-
Notifications
You must be signed in to change notification settings - Fork 4
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/CK-149] 골룸 인증피드 내부 전체 인증피드 도출 로직을 구현한다 #102
Merged
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,19 @@ import InputField from '@components/roadmapCreatePage/input/inputField/InputFiel | |
import { useValidateInput } from '@hooks/_common/useValidateInput'; | ||
import { CERTIFICATION_FEED } from '@constants/goalRoom/regex'; | ||
import TextCount from '@components/roadmapCreatePage/input/textCount/TextCount'; | ||
import { useCreateCertificationFeed } from '@hooks/queries/goalRoom'; | ||
import { | ||
useCertificationFeeds, | ||
useCreateCertificationFeed, | ||
} from '@hooks/queries/goalRoom'; | ||
import { useGoalRoomDashboardContext } from '@/context/goalRoomDashboardContext'; | ||
import { BASE_URL } from '@apis/axios/client'; | ||
|
||
const CertificationFeedModal = () => { | ||
const { goalroomId } = useGoalRoomDashboardContext(); | ||
const { certificationFeeds } = useCertificationFeeds(goalroomId); | ||
|
||
const [imagePreview, setImagePreview] = useState<string | null>(''); | ||
const [imageFile, setImageFile] = useState<File | null>(null); // add this state for file | ||
const [imageFile, setImageFile] = useState<File | null>(null); | ||
const { handleInputChange, validateInput, errorMessage, resetErrorMessage, value } = | ||
useValidateInput(CERTIFICATION_FEED); | ||
|
||
|
@@ -52,42 +57,68 @@ const CertificationFeedModal = () => { | |
<S.CertificationModalWrapper> | ||
<S.CertificationHeader>인증피드</S.CertificationHeader> | ||
<S.CertificationText>새로운 인증피드 등록</S.CertificationText> | ||
{imagePreview && ( | ||
<S.PreviewWrapper> | ||
<S.PreviewImage src={imagePreview} alt='업로드한 인증 피드 이미지' /> | ||
<S.PreviewDeleteButton onClick={handleRemoveImage}>X</S.PreviewDeleteButton> | ||
</S.PreviewWrapper> | ||
)} | ||
|
||
<form action='' onSubmit={handleFormSubmit}> | ||
{!imagePreview && ( | ||
<S.FileUploadCard htmlFor='fileInput'> | ||
<S.PlusButton>인증피드 사진 업로드</S.PlusButton> | ||
<input | ||
id='fileInput' | ||
type='file' | ||
onChange={handleImageChange} | ||
style={{ display: 'none' }} | ||
<S.CertificationFeedsWrapper> | ||
<form onSubmit={handleFormSubmit}> | ||
{imagePreview && ( | ||
<S.PreviewWrapper> | ||
<S.PreviewImage src={imagePreview} alt='업로드한 인증 피드 이미지' /> | ||
<S.PreviewDeleteButton onClick={handleRemoveImage}>X</S.PreviewDeleteButton> | ||
</S.PreviewWrapper> | ||
)} | ||
{!imagePreview && ( | ||
<S.FileUploadCard htmlFor='fileInput'> | ||
<S.PlusButton>인증피드 사진 업로드</S.PlusButton> | ||
<input | ||
id='fileInput' | ||
type='file' | ||
onChange={handleImageChange} | ||
style={{ display: 'none' }} | ||
/> | ||
</S.FileUploadCard> | ||
)} | ||
<S.InputFieldWrapper> | ||
<InputField | ||
placeholder='컨텐츠를 소개하는 문장을 작성해주세요' | ||
handleInputChange={handleInputChange} | ||
maxLength={250} | ||
validateInput={validateInput} | ||
resetErrorMessage={resetErrorMessage} | ||
name='introduction' | ||
data-valid={validateInput} | ||
/> | ||
</S.FileUploadCard> | ||
)} | ||
<S.InputFieldWrapper> | ||
<InputField | ||
placeholder='컨텐츠를 소개하는 문장을 작성해주세요' | ||
handleInputChange={handleInputChange} | ||
maxLength={250} | ||
validateInput={validateInput} | ||
resetErrorMessage={resetErrorMessage} | ||
name='introduction' | ||
data-valid={validateInput} | ||
/> | ||
</S.InputFieldWrapper> | ||
<TextCount maxCount={250} currentCount={value.length} /> | ||
<S.ErrorMessage>{errorMessage}</S.ErrorMessage> | ||
<S.CertificationSubmitButton type='submit'> | ||
인증피드 등록 | ||
</S.CertificationSubmitButton> | ||
</form> | ||
</S.InputFieldWrapper> | ||
<TextCount maxCount={250} currentCount={value.length} /> | ||
<S.ErrorMessage>{errorMessage}</S.ErrorMessage> | ||
<S.CertificationSubmitButton type='submit'> | ||
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. type='submit'은 없어도 무방할 것 같아요🤩 |
||
인증피드 등록 | ||
</S.CertificationSubmitButton> | ||
</form> | ||
|
||
{certificationFeeds.map((feed) => { | ||
return ( | ||
<S.CertificationFeedCard key={feed.checkFeed.id}> | ||
<S.CertificationFeedImage | ||
src={BASE_URL + feed.checkFeed.imageUrl} | ||
alt='인증피드 이미지' | ||
/> | ||
<S.CertificationFeedDescription> | ||
{feed.checkFeed.description} | ||
</S.CertificationFeedDescription> | ||
<S.CertificationFeedsUserInfo> | ||
<S.CertificationFeedsUserImage | ||
src={BASE_URL + feed.member.imageUrl} | ||
alt='유저 이미지' | ||
/> | ||
<S.CertificationFeedsUserName> | ||
{feed.member.nickname} | ||
</S.CertificationFeedsUserName> | ||
</S.CertificationFeedsUserInfo> | ||
<S.CreatedAtText>{feed.checkFeed.createdAt}</S.CreatedAtText> | ||
</S.CertificationFeedCard> | ||
); | ||
})} | ||
</S.CertificationFeedsWrapper> | ||
</S.CertificationModalWrapper> | ||
); | ||
}; | ||
|
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
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
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.
으으 이거 진짜진짜 어떤 느낌인지 아는데ㅠㅠ
그래도 스타일은 styled component에서 주는걸로 통일시키는 것은 어떨까요?