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

feature: offer users a HaTS survey on the design page #8193

Merged
merged 19 commits into from Jun 29, 2021

Conversation

beyackle
Copy link
Contributor

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

image
(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)

* add stuff to localStorage

* add stuff to localStorage

* move logic and add more checks

* Update constants.tsx
* 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
<Stack horizontal horizontalAlign="space-between">
<Stack {...stackProps}>
{leftLinkList.map(
(link) => link != null && <Stack.Item key={link.label}>{makeLinkLabel(link)}</Stack.Item>
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

@tdurnford tdurnford Jun 24, 2021

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?
Copy link
Collaborator

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.

@cypress
Copy link

cypress bot commented Jun 24, 2021



Test summary

16 0 1 0Flakiness 0


Run details

Project Composer
Status Passed
Commit cc2808c
Started Jun 28, 2021 5:44 PM
Ended Jun 28, 2021 5:50 PM
Duration 06:23 💡
OS Linux Ubuntu - 20.04
Browser Electron 89

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" />}
Copy link
Contributor Author

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);
Copy link
Contributor Author

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).

Copy link
Collaborator

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',
Copy link
Contributor Author

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();
Copy link
Contributor Author

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>
Copy link
Contributor Author

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.

@coveralls
Copy link

coveralls commented Jun 24, 2021

Coverage Status

Coverage decreased (-0.03%) to 54.628% when pulling cc2808c on feature/hats-survey into 9986da5 on main.

@srinaath
Copy link
Contributor

@beyackle Apart from the minor comments this PR looks good. Lets get it merged today.
CC @garypretty

@beyackle beyackle merged commit 2e4b716 into main Jun 29, 2021
@beyackle beyackle deleted the feature/hats-survey branch June 29, 2021 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HaTs telemetry items
4 participants