-
Notifications
You must be signed in to change notification settings - Fork 1
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/#161: 알림 받을 수 있도록 기능 추가 & 마이페이지 디자인 개선 #164
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0df2238
Fix: 일시적으로 vite-plugin-pwa 사용 중지
pp449 dffc090
Feat: 서비스워커가 push 알림을 받을 수 있도록 추가
pp449 0e8ac3f
Feat: 인코딩하는 함수 추가
pp449 26344da
Feat: 구독버튼 클릭 시 서버에 정보가 가도록 추가
pp449 e512aa1
Fix: 드래그 못하도록 수정
pp449 854c558
Feat: 토글 버튼 추가
pp449 34491b8
Style: 마이페이지 디자인 추가
pp449 9106b73
Test: MSW로 subscribe 요청 처리 추가
pp449 bdfdc5b
학과 선택 안한경우, 알림 거부한 경우 에러핸들링 추가
pp449 c2ce7b7
Feat: 토글 클릭 시 모달창 띄우기 추가 & 구독 내용을 로컬 스토리지에 추가
pp449 4027706
Feat: 렌더링 시 구독 내용이 있다면 토글을 on 으로 설정하도록 추가
pp449 8aa0a13
Style: 첫 렌더링 시에는 토글 on 애니메이션이 없고 클릭 시 애니메이션 적용되도록 디자인 변경
pp449 81c3272
Fix: 구독하는 학과도 같이 서버에 post 하도록 수정
pp449 ba8d205
Feat: 구독 취소는 POST 서 DELETE 메소드로 변경
pp449 110515b
Feat: 학과 새로 선택 시 구독 취소하도록 설정
pp449 2b894ab
Feat: 선택된 학과가 없는경우 처리
pp449 cc61415
Fix: 애니메이션 적용 에러 수정
pp449 1530327
Fix: 테스트 통과하도록 수정
pp449 8a23145
Refactor: 학교 알림과 학과 알림을 구분하기 위해 URI에 /major 추가
pp449 755b8b8
Fix: 구독 취소시 로컬스토리지에서 제거되도록 수정
pp449 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "부림이", | ||
"short_name": "부림이", | ||
"start_url": "/", | ||
"display": "fullscreen", | ||
"background_color": "#ffffff", | ||
"lang": "en", | ||
"scope": "/", | ||
"orientation": "portrait", | ||
"theme_color": "#ffffff", | ||
"icons": [ | ||
{ | ||
"src": "icons/icon-48x48.png", | ||
"sizes": "48x48", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-72x72.png", | ||
"sizes": "72x72", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-96x96.png", | ||
"sizes": "96x96", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-128x128.png", | ||
"sizes": "128x128", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-144x144.png", | ||
"sizes": "144x144", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-152x152.png", | ||
"sizes": "152x152", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "icons/icon-384x384.png", | ||
"sizes": "384x384", | ||
"type": "image/png" | ||
}, | ||
{ "src": "icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" } | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import styled from '@emotion/styled'; | ||
import { THEME } from '@styles/ThemeProvider/theme'; | ||
import { MouseEventHandler } from 'react'; | ||
|
||
interface Props { | ||
isOn: boolean; | ||
changeState: MouseEventHandler<HTMLElement>; | ||
animation: boolean; | ||
} | ||
|
||
interface Circle { | ||
isOn: boolean; | ||
animation: boolean; | ||
} | ||
|
||
const ToggleButton = (props: Props) => { | ||
const { isOn, changeState, animation } = props; | ||
|
||
return ( | ||
<Button onClick={changeState} isOn={isOn} animation={animation}> | ||
<Circle isOn={isOn} animation={animation} /> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default ToggleButton; | ||
|
||
const Button = styled.button<Circle>` | ||
position: relative; | ||
border: none; | ||
width: 3.2rem; | ||
height: 1.8rem; | ||
|
||
transition: ${(prop) => (prop.animation ? 'all 0.3s ease-in-out' : 'none')}; | ||
|
||
background-color: ${(prop) => (prop.isOn ? THEME.PRIMARY : THEME.BACKGROUND)}; | ||
border-radius: 1rem; | ||
`; | ||
|
||
const Circle = styled.div<Circle>` | ||
position: absolute; | ||
border-radius: 50%; | ||
width: 1.2rem; | ||
height: 1.2rem; | ||
transition: ${(prop) => (prop.animation ? 'all 0.3s ease-in-out' : 'none')}; | ||
|
||
background-color: #f5f5f5; | ||
top: 0.3rem; | ||
left: ${(prop) => (prop.isOn ? '1.7rem' : '0.4rem')}; | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const urlBase64ToUint8Array = (base64String: string) => { | ||
const padding = '='.repeat((4 - (base64String.length % 4)) % 4); | ||
const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/'); | ||
|
||
const rawData = window.atob(base64); | ||
const outputArray = new Uint8Array(rawData.length); | ||
|
||
for (let i = 0; i < rawData.length; ++i) { | ||
outputArray[i] = rawData.charCodeAt(i); | ||
} | ||
return outputArray; | ||
}; | ||
|
||
export default urlBase64ToUint8Array; |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SERVER_URL } from '@config/index'; | ||
import { RequestHandler, rest } from 'msw'; | ||
|
||
export const subscribeHandler: RequestHandler[] = [ | ||
rest.post(SERVER_URL + '/api/subscription', (req, res, ctx) => { | ||
return res(ctx.status(200)); | ||
}), | ||
rest.delete(SERVER_URL + '/api/subscription', (req, res, ctx) => { | ||
return res(ctx.status(200)); | ||
}), | ||
]; |
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
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.
이 함수는 이미 선택된 전공이 있고, 수정할 경우를 처리하기 위한 함수가 맞나요~?
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.
네 만약 전공을 새로 바꾼다면 바뀐 전공을 구독하는게 아닌 이전 전공 구독을 취소하게 만들었어요