David’s July Hackathon project!
Summary of project
- Make a new webpage that only admins can access
- useAdmin()
- add it as a tab on the notification page “send notif🔒”
- Fields to fill in:
- Notification text
- Optional: Category title
- eg. existing: activity on X market, Activity on Quests
- eg. new: Update, announcement, new dashboard, new newsletter
- prob just create one new category called “announcement” that all custom notifications fall under and not bother with a field input.
- Optional: Time it gets sent out
- could add some sort of scheduling, but prob better just to send it out immediately and not have it as an option
- Optional: Who receives it
- just start with everyone.
- Eventually could create targeted custom notifications.
- eg. if we want to send a custom notification only to people who follow a certain group, or only to trustworthyish users, or only to people in a certain league.
- Could even use it to send manalinks in the form of a notification to specific users
- Other things to do:
- What icon/avatar does the notification have? Whichever admin is sending it? Manifold logo?
- “David Chee announced:” but with the Manifold logo and a little announcement emoji 📢
- toggle setting to turn on and off - actually don’t think it should be an option to turn off.
- How does truncation work? Do we even truncate long announcements? Or set max length
- ADD A CONFIRMATION POPUP
Coding
notifications.tsx
- Add
SendCustomNotification
function
- [ ] Text box to enter text
- [ ]
onSubmit
to code logic of what happens once the submit button is clicked
- [ ] add
isAdmin()
check
- [ ] add check that editor is defined (actually contains text).
- [ ]
ConfirmationButton
(steal it from create-group-button.tsx)
- [ ] should be greyed out if the editor is undefined.
- Create new tab to
NotificationsContent
- [x] title: ‘Send Notif’
- [x] content:
SendCustomNotification
- [x] Return conditional on
isAdmin
Create-notification.ts
- This is responsible for creating the notification on the backend and adding it to the database
createCustomNotification
export const
Notification-types.tsx
- This is responsible for how the notification component looks when a user receives the notification (eg. icon, what info is shown etc)
- Add new type of notification
CustomNotification
New file: Create-announcement
- New type of thing(?) which stores the properties required by
createCustomNotification