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: offer users a HaTS survey on the design page #8193
Conversation
* add stuff to localStorage * add stuff to localStorage * move logic and add more checks * Update constants.tsx
…tFramework-Composer into beyackle/hatsSurveyLink
* 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
* 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
Composer/packages/client/src/components/Notifications/NotificationCard.tsx
Outdated
Show resolved
Hide resolved
<Stack horizontal horizontalAlign="space-between"> | ||
<Stack {...stackProps}> | ||
{leftLinkList.map( | ||
(link) => link != null && <Stack.Item key={link.label}>{makeLinkLabel(link)}</Stack.Item> |
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.
When will link
be null
?
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'm not sure either, but it wouldn't typecheck without this and it's a harmless thing to check anyway.
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.
The type checker was probably complaining because you previously added null
and undefined
to the link properties in the Notification
type in Composer/packages/types/src/shell.ts. If you removed the check and restart your Typescript Server, the type warning would probably resolve.
But yes, you are correct, the check is harmless.
// ... and have either never taken the survey or it's been long enough since we did | ||
(lastTaken == null || Date.now() - lastTaken > SURVEY_PARAMETERS.timeUntilNextSurvey) | ||
) { | ||
// do we hit the probability of the survey appearing? |
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.
Leave a better comment explaining what is happening here. It's not clear, and the comment is only vaguely helpful.
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
return ( | ||
<div css={cardContent}> | ||
{type === 'error' && <Icon css={errorType} iconName="ErrorBadge" />} | ||
{type === 'success' && <Icon css={successType} iconName="Completed" />} | ||
{type === 'warning' && <Icon css={warningType} iconName="Warning" />} | ||
{type === 'question' && <Icon css={questionType} iconName="UnknownSolid" />} | ||
{type === 'congratulation' && <Icon css={congratulationType} iconName="Trophy2Solid" />} |
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.
A note here: this isn't used anywhere yet, so I'm all right leaving it out, but it makes a good indicator type for messages like "Congratulations, you've published your first bot to Azure!" or such.
@@ -196,7 +259,10 @@ export const NotificationCard = React.memo((props: NotificationProps) => { | |||
ariaLabel={formatMessage('Close')} | |||
css={cancelButton} | |||
iconProps={{ iconName: 'Cancel', styles: { root: { fontSize: '12px' } } }} | |||
onClick={() => onDismiss(id)} | |||
onClick={() => { | |||
cardProps?.onDismiss?.(id); |
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.
This is what lets us track dismissals using the close box (or any other custom action we want to perform when the user closes a notification, relayed via card props).
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.
You should leave that as a comment in the code
const version = process.env.COMPOSER_VERSION; | ||
|
||
const parameters = { | ||
Source: 'Composer', |
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.
The capital S is how this is in the spec and how it comes out in the query parameters.
@@ -33,6 +34,8 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st | |||
|
|||
const activeBot = skillId ?? projectId; | |||
|
|||
useSurveyNotification(); |
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.
If we ever decide the notification should be triggered elsewhere, this hook is all that will need to be moved there.
<Stack horizontal horizontalAlign="space-between"> | ||
<Stack {...stackProps}> | ||
{leftLinkList.map( | ||
(link) => link != null && <Stack.Item key={link.label}>{makeLinkLabel(link)}</Stack.Item> |
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'm not sure either, but it wouldn't typecheck without this and it's a harmless thing to check anyway.
@beyackle Apart from the minor comments this PR looks good. Lets get it merged today. |
Description
This is the completed feature branch for the HaTS survey feature. Please note that there is code in here that made it into the feature branch without being reviewed, as well as some late-entering bug fixes (I hadn't noticed that the card's own close box triggers the same Recoil dispatcher as I'd been calling manually, but also needed to insert a telemetry item there, so there are a few changes in that area), so this could still use a full review before it gets merged.
Task Item
closes #8029
Screenshots
(not shown in the screenshot is that the "Take the Survey" link routes to the correct URL with the query fields populated with OS, Composer version, machine ID, and Source)