Skip to content

Commit 85e5dec

Browse files
committed
docs: toast notification spec, not yet implemented tho
1 parent afc62f6 commit 85e5dec

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

docs/appNotifications/readme.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ You should merge the pull request if release is valid update, and then merge the
88
`update-notifications branch` to trigger the updates across the installation base.
99

1010
## banner notifications - `banner.json`
11+
12+
![image](https://github.com/phcode-dev/phoenix/assets/5336369/0094d4fa-fb63-4884-90dc-13b025b2de5e)
13+
1114
Banner notifications are shown at the bottom of brackets as seen in picture. Only use this in case of
1215
emergencies to push security updates or other critical updates that needs user attention. Atmost one
1316
banner notification will be shown at a time on screen. If there are multiple, the next notification will only be shown
@@ -43,5 +46,53 @@ A sample json is as follows:
4346
If such a class is not present, then the notification is shown only once ever.
4447
4. `FOR_VERSIONS` : [Semver compatible version filter](https://www.npmjs.com/package/semver).
4548
The notification will be shown to all versions satisfying this.
46-
5. `PLATFORM`: A comma seperated list of all platforms in which the message will be shown.
47-
allowed values are: `mac,win,linux,allDesktop,firefox,chrome,safari,allBrowser,all`
49+
5. `PLATFORM`: A comma seperated list(no spaces) of all platforms in which the message will be shown.
50+
allowed values are: `mac,win,linux,allDesktop,firefox,chrome,safari,allBrowser,all`
51+
52+
53+
## toast notifications - `toast.json`
54+
55+
Toast notifications are shown at the side on the general notification area. Multiple toast notifications
56+
can be shown at the same time. Format is similar to banner notification.
57+
58+
By default, a notification is shown only once and auto close after 25 seconds.
59+
If there is an html element with class `notification_ack` it must be clicked to be dismissed,
60+
else it will come up after every boot till it is acknowledged or the close button clicked.
61+
62+
### Format of `<stage>/root/toast.json`
63+
64+
> <Not yet implemented. Just use the spec below.>
65+
66+
`<stage>` can be `staging` or `prod`. (`dev` stage is directly in phoenix codebase for ease of development.)
67+
68+
A sample json is as follows:
69+
```json
70+
{
71+
"SAMPLE_NOTIFICATION_NAME": {
72+
"TRIGGER" : "MENU_CLICK:file.newFolder,HTML_ELEMENT:#project-files-container",
73+
"TYPE": "ERROR/WARN/INFO/SUCCESS",
74+
"HTML_CONTENT": "<div>hello world <a class='notification_ack'>Click to acknowledge.</a></div>",
75+
"FOR_VERSIONS": "1.x || >=2.5.0 || 5.0.0 - 7.2.3",
76+
"PLATFORM" : "allDesktop",
77+
"autoCloseTimeS": 25
78+
},
79+
"ANOTHER_SAMPLE_NOTIFICATION_NAME": {...}
80+
}
81+
```
82+
83+
1. `SAMPLE_NOTIFICATION_NAME` : This is a unique ID. It is used to check if the notification was shown to user.
84+
2. `TRIGGER` : The trigger to show the notification. Can be a comma seperated list of one of the following
85+
`APP_START/MENU_CLICK:<commandID>/KEYBOARD_SHORTCUT:<commandID>/OTHER:<commandID>/HTML_ELEMENT:<.class/#id>`
86+
1. `APP_START` : notification will be shown on app start.
87+
2. `MENU_CLICK:<commandID>` : When a command is executed by clicking on a ui menu item.
88+
3. `KEYBOARD_SHORTCUT:<commandID>` : When a command is executed by keyboard shortcut.
89+
4. `HTML_ELEMENT:<jquery selector>` : On click on the given html element with jquery selector.
90+
3. `HTML_CONTENT`: The actual html content to show to the user. It can have an optional `notification_ack` class.
91+
Setting this class in any child html node will cause the notification to be shown once a day until the user explicitly clicks
92+
on any html element with class `notification_ack` or explicitly click the close button.
93+
If such a class is not present, then the notification is shown only once ever.
94+
4. `FOR_VERSIONS` : [Semver compatible version filter](https://www.npmjs.com/package/semver).
95+
The notification will be shown to all versions satisfying this.
96+
5. `PLATFORM`: A comma seperated list(no spaces) of all platforms in which the message will be shown.
97+
allowed values are: `mac,win,linux,allDesktop,firefox,chrome,safari,allBrowser,all`
98+
6. `autoCloseTimeS`: Time to auto close the popup in seconds

0 commit comments

Comments
 (0)