-
Notifications
You must be signed in to change notification settings - Fork 2
feat: 롤링페이퍼 기능 구현 (mock api) #35
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
fc23e5c
feat: Tanstack query를 이용한 데이터 가져오는 커스텀 훅 useFetchQuery 구현
AAminha a60519b
feat: NoticeRollingPaper에 데이터 패칭 적용
AAminha dd6a5dd
feat: 홈 페이지에 공용 컴포넌트 적용
AAminha f745ef9
rename: MessageDetailModal -> CommentDetailModal 컴포넌트 명 수정
AAminha e5a470b
rename: Message -> Comment 컴포넌트 명 수정
AAminha 9b27a12
feat: 롤링페이퍼 조회 기능 구현
AAminha f4b1b9f
refactor: 중복되는 배경 컴포넌트 적용 및 불필요한 에셋 제거
AAminha 60e4a5b
Merge branch 'develop' of https://github.com/prgrms-web-devcourse-fin…
AAminha af8375e
refactor: 중복되는 메모 배경 컴포넌트 적용 및 불필요한 에셋 제거
AAminha 5e69d75
remove: 중복 에셋 제거
AAminha f513809
refactor: 중복되는 모달 배경 컴포넌트 적용 및 불필요한 에셋 제거
AAminha c82077c
style: 커스텀 훅 제거 및 queryClient 기본값 설정
AAminha 2964a4c
feat: 삭제 모달 추가 및 삭제 mock api 연결
AAminha 880e54a
feat: 편지 추가 mock api 연결
AAminha 1332774
fix: 신고 ui 제거
AAminha 837201a
style: 사용하지 않는 코드 제거
AAminha b73b29e
Merge branch 'develop' of https://github.com/prgrms-web-devcourse-fin…
AAminha 04c48c8
style: 엔드포인트 오타 수정
AAminha 7c5b26b
style: 더미 제거
AAminha 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 hidden or 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,38 @@ | ||
| import client from './client'; | ||
|
|
||
| export const getCurrentRollingPaper = async (): Promise<RollingPaperInformation> => { | ||
| const { | ||
| data: { data }, | ||
| } = await client.get('/api/event-posts'); | ||
| return data; | ||
| }; | ||
|
|
||
| export const getRollingPaperDetail = async ( | ||
| rollingPaperId: string | number, | ||
| ): Promise<RollingPaper> => { | ||
| const { | ||
| data: { data }, | ||
| } = await client.get(`/api/event-posts/${rollingPaperId}`); | ||
| return data; | ||
| }; | ||
|
|
||
| export const postRollingPaperComment = async (rollingPaperId: string | number, content: string) => { | ||
| const { | ||
| data: { data }, | ||
| } = await client.post(`/api/event-posts/${rollingPaperId}/comments`, { | ||
| content, | ||
| }); | ||
| return data; | ||
| }; | ||
|
|
||
| export const deleteRollingPaperComment = async (commentId: string | number) => { | ||
| try { | ||
| const { | ||
| data: { data }, | ||
| } = await client.delete(`/api/event-posts/comments/${commentId}`); | ||
| return data; | ||
| } catch (error) { | ||
| console.error(error); | ||
| throw error; | ||
| } | ||
| }; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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 hidden or 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 hidden or 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,31 @@ | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| interface MemoWrapperProps { | ||
| isSender?: boolean; | ||
| className?: string; | ||
| children: React.ReactNode; | ||
| onClick?: (e: React.MouseEvent<HTMLElement>) => void; | ||
| } | ||
|
|
||
| const MemoWrapper = ({ isSender = false, className, children, onClick }: MemoWrapperProps) => { | ||
| return ( | ||
| <article | ||
| className={twMerge( | ||
| 'relative flex overflow-hidden p-4', | ||
| isSender ? 'memo-sender-bg' : 'letter-receiver-bg', | ||
| className, | ||
| )} | ||
| onClick={onClick} | ||
| > | ||
| <div className="z-10 w-full">{children}</div> | ||
| <div | ||
| className={twMerge( | ||
| 'absolute inset-0 z-0 blur-xl', | ||
| isSender ? 'bg-white/50' : 'bg-white/70', | ||
| )} | ||
| /> | ||
| </article> | ||
| ); | ||
| }; | ||
|
|
||
| export default MemoWrapper; |
This file contains hidden or 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 hidden or 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,17 @@ | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| interface ModalBackgroundWrapperProps { | ||
| className?: string; | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| const ModalBackgroundWrapper = ({ className, children }: ModalBackgroundWrapperProps) => { | ||
| return ( | ||
| <article className={twMerge('bg-primary-3 relative overflow-hidden', className)}> | ||
| <div className="relative z-1">{children}</div> | ||
| <div className="absolute inset-0 z-0 bg-white/70 blur-xl" /> | ||
| </article> | ||
| ); | ||
| }; | ||
|
|
||
| export default ModalBackgroundWrapper; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,34 @@ | ||
| import { useQuery } from '@tanstack/react-query'; | ||
| import { Link } from 'react-router'; | ||
| import { twMerge } from 'tailwind-merge'; | ||
|
|
||
| import { getCurrentRollingPaper } from '@/apis/rolling'; | ||
| import { NoticeIcon } from '@/assets/icons'; | ||
|
|
||
| const NoticeRollingPaper = () => { | ||
| const { data } = useQuery({ | ||
| queryKey: ['notice-rolling-paper'], | ||
| queryFn: () => getCurrentRollingPaper(), | ||
| }); | ||
|
|
||
| const noticeText = data?.title; | ||
|
|
||
| return ( | ||
| <Link to={`/board/rolling/${data?.eventPostId}`}> | ||
| <article | ||
| className={twMerge( | ||
| 'text-gray-60 flex w-full items-center gap-2.5 rounded-lg px-4 py-2', | ||
| 'bg-linear-[275deg,rgba(255,255,255,0.4)_13.74%,rgba(238,238,238,0.4)_67.61%]', | ||
| 'shadow-[0_1px_6px_rgba(218,189,74,0.8)]', | ||
| )} | ||
| > | ||
| <NoticeIcon className="h-6 w-6 shrink-0 text-gray-50" /> | ||
| <div className="w-full overflow-hidden"> | ||
| <p className="body-sb animate-marquee whitespace-nowrap">{noticeText}</p> | ||
| </div> | ||
| </article> | ||
| </Link> | ||
| ); | ||
| }; | ||
|
|
||
| export default NoticeRollingPaper; |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -7,6 +7,12 @@ import App from './App'; | |
| import './styles/index.css'; | ||
|
|
||
| const queryClient = new QueryClient(); | ||
| queryClient.setDefaultOptions({ | ||
| queries: { | ||
| staleTime: 1000 * 60 * 5, // 5분 | ||
| gcTime: 1000 * 60 * 60, // 1시간 | ||
| }, | ||
| }); | ||
|
Comment on lines
+10
to
+15
Collaborator
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. 쿼리클리이언트 생성✅ |
||
|
|
||
| createRoot(document.getElementById('root')!).render( | ||
| <StrictMode> | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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.
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.
BackgroundImageWrapper 대신 ModalBackgroundWrapper 를 사용하신 이유가 궁금해요!
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.
PR 내용에도 적혀있는데요! 기존에는 모달 뒷배경도 이미지로 띄우고 있었어요. 물론 이미지 하나 더 추가한다고 해서 엄청나게 성능이 개선된다는 둥 속도가 빨라진다는 둥 그런건 아닐테지만... 그래도 CSS로 할 수 있으니까 이미지보단 나을 것 같다고 생각해서!
이미지를 뒷배경으로 깔아주는 역할을 하는 BackgroundImageWrapper 대신 다양한 css 처리를 미리 해둔 ModalBackgroundWrapper로 교체하였습니다!