Skip to content
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

Web notifications #49

Merged
merged 15 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
1) edit README
2) add some comments
3) clean up toggle switch styling some more
  • Loading branch information
dryu99 committed Oct 21, 2020
commit 7b761d79550c8ca3aeca86ea94bcd261fdfbfb6d
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ We hope for the Live Site to

## 💯 epic features

- [ ] Web notifications/announcements
- [x] Web notifications/announcements
- [ ] Ability to filter what types of announcements one may wish to receive (e.g. only notify me about workshops)
- [x] Countdown
- [ ] Event schedule
Expand Down
4 changes: 1 addition & 3 deletions src/components/ToggleSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ const ToggleSwitchContainer = styled.div`
display: inline-block;
`

// TODO maybe put background colour in ThemeProvider?
const ToggleSwitchGraphic = styled.div`
width: 35px;
height: 30px;
background: #4F4A59;
background: ${p => p.theme.colors.foreground};
z-index: 0;
cursor: pointer;
position: relative;
Expand All @@ -18,7 +17,6 @@ const ToggleSwitchGraphic = styled.div`
text-align: right;
padding: 0 10px;
bottom: 10px;
color: rgba(0,0,0,.5);
transition: all 250ms;

&:before {
Expand Down
3 changes: 2 additions & 1 deletion src/containers/NotificationToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export default () => {

useEffect(() => {
setToggled(notifications.areEnabled())
}, [])
}, [setToggled])

const handleToggle = (e) => {
// if user's first time on site, request notification permissions from browser
if (notifications.isCurrentPermission(N_PERMISSIONS.DEFAULT)) {
notifications.requestPermission(permission => {
toggleNotifications(permission === N_PERMISSIONS.GRANTED)
Expand Down