-
Notifications
You must be signed in to change notification settings - Fork 367
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
feature: add HaTS stuff to localStorage #8040
Conversation
Composer/packages/client/src/App.tsx
Outdated
@@ -38,6 +45,19 @@ export const App: React.FC = () => { | |||
ipcRenderer?.on('cleanup', (_event) => { | |||
performAppCleanupOnQuit(); | |||
}); | |||
|
|||
let days = surveyStorage.get('days', 0); |
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.
All of this logic should be handled in the setSurveyEligibility
dispatcher. You should just call the dispatcher on mount and let it determine how and if it should update the value.
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.
Good idea. I'll fix that.
Composer/package.json
Outdated
@@ -20,7 +20,9 @@ | |||
"url-parse": "^1.5.1", | |||
"underscore": "^1.12.1", | |||
"dns-packet": "^1.3.4", | |||
"json-ptr": "^2.1" | |||
"json-ptr": "^2.1", |
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.
Are these dependencies necessary? They seem out of scope for this PR.
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.
They were causing a security alert, but I've now handled that in a separate PR which has merged already (so these can/will go away on a rebase).
@@ -525,3 +525,11 @@ export const defaultTeamsManifest: TeamsManifest = { | |||
|
|||
export const defaultBotPort = 3979; | |||
export const defaultBotEndpoint = `http://localhost:${defaultBotPort}/api/messages`; | |||
|
|||
const DAYS = 1000 * 60 * 60 * 24; // ms per day |
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.
const DAYS = 1000 * 60 * 60 * 24; // ms per day | |
const MS_PER_DAY = 1000 * 60 * 60 * 24; |
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.
I thought about that, but I like the way it makes "90 * DAYS" legible a few lines farther down.
* add stuff to localStorage * add stuff to localStorage * move logic and add more checks * Update constants.tsx
* feature: add HaTS stuff to localStorage (#8040) * add stuff to localStorage * add stuff to localStorage * move logic and add more checks * Update constants.tsx * create prototype card * add congratulation notification * feature: show survey card on Home page (#8078) * add custom style * Update Publish.tsx * display card on Home page * Update constants.tsx * Update shell.ts * Update Home.tsx * move survey into separate component * get more info automatically * move URL into constant * move more props around * Update constants.tsx * turn non-rendering component into hook * move card to design page * start adding ipcRenderer stuff * update card design * get machineID and stash in Recoil * read OS and place in URL * add spacer to notification card * better notification styling * fix constants and typercheck error * Revert "feature: show survey card on Home page (#8078)" (#8149) This reverts commit 5b9f164. * feature: add new survey notification to design page (#8155) * add custom style * Update Publish.tsx * display card on Home page * Update constants.tsx * Update shell.ts * Update Home.tsx * move survey into separate component * get more info automatically * move URL into constant * move more props around * Update constants.tsx * turn non-rendering component into hook * move card to design page * start adding ipcRenderer stuff * update card design * get machineID and stash in Recoil * read OS and place in URL * add spacer to notification card * better notification styling * fix constants and typercheck error * fixes from PR * fix card alignment and make aka.ms URL * remove redundant prop * use query-string package to generate link * move MAC truncation to electron server * add fixes from CR and machineID truncation * fix typechecking * Update ToolbarButtonMenu.test.tsx * Update App.tsx * add custom onDismiss to cards * restore delete-on-click for links * Update NotificationCard.tsx * add comments from PR * revert ToolbarButtonMenu test * Update NotificationCard.tsx * add comment about truncation
Description
This addresses the issue of storing things on the client so we know when to display the HaTS survey; it will keep track, in local storage, of the number of unique calendar days that a user uses Composer. If this exceeds 5, it sets a flag in the Recoil store that can be read in a later step (to be written) to see if we should display the survey. Once the survey has been taken, we can use a similar mechanism to store the latest date the survey was taken and make sure we aren't showing the link to a user who's taken it in the last 90 days.
Task Item
refs #8029
Screenshots
Not really a UI change, but here are the (currently) two new values in localStorage.
![image](https://user-images.githubusercontent.com/61990921/121436975-5d8ef900-c936-11eb-9722-2c958a2f8386.png)