Skip to content

Commit

Permalink
DEVPROD-7662: Add image visibility guide cue (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt authored Sep 18, 2024
1 parent dee119d commit b84a004
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 57 deletions.
12 changes: 12 additions & 0 deletions apps/spruce/cypress/integration/image/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SEEN_IMAGE_VISIBILITY_GUIDE_CUE } from "constants/cookies";

describe("/image/imageId/random redirect route", () => {
it("should redirect to the build information page", () => {
cy.visit("/image/imageId/random");
Expand All @@ -23,6 +25,16 @@ describe("/image/imageId/random redirect route", () => {
});
});

it("shows the image visibility guide cue on task metadata", () => {
cy.setCookie(SEEN_IMAGE_VISIBILITY_GUIDE_CUE, "false");
cy.visit(
"/task/evergreen_ubuntu1604_test_annotations_b_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48",
);
cy.dataCy("image-visibility-guide-cue").should("be.visible");
cy.contains("button", "Got it").click();
cy.dataCy("image-visibility-guide-cue").should("not.exist");
});

it("navigates to the image page from the task page", () => {
cy.visit(
"/task/evergreen_ubuntu1604_test_annotations_b_5e4ff3abe3c3317e352062e4_20_02_21_15_13_48",
Expand Down
2 changes: 2 additions & 0 deletions apps/spruce/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
CY_DISABLE_COMMITS_WELCOME_MODAL,
CY_DISABLE_NEW_USER_WELCOME_MODAL,
SLACK_NOTIFICATION_BANNER,
SEEN_IMAGE_VISIBILITY_GUIDE_CUE,
} from "constants/cookies";
import { isMutation } from "../utils/graphql-test-utils";
// Alternatively you can use CommonJS syntax:
Expand Down Expand Up @@ -159,6 +160,7 @@ before(() => {
cy.setCookie(CY_DISABLE_COMMITS_WELCOME_MODAL, "true");
cy.setCookie(CY_DISABLE_NEW_USER_WELCOME_MODAL, "true");
cy.setCookie(SLACK_NOTIFICATION_BANNER, "true");
cy.setCookie(SEEN_IMAGE_VISIBILITY_GUIDE_CUE, "true");
mutationDispatched = false;
cy.intercept("POST", "/graphql/query", (req) => {
if (isMutation(req)) {
Expand Down
1 change: 1 addition & 0 deletions apps/spruce/src/components/MetadataCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const Item = styled(Body)<BodyProps>`
:not(:last-child) {
margin-bottom: 12px;
}
width: fit-content;
`;

export const MetadataLabel = styled.b<{ color?: string }>`
Expand Down
3 changes: 2 additions & 1 deletion apps/spruce/src/constants/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const HIDE_FEEDBACK = "HIDE_FEEDBACK";
export const INCLUDE_COMMIT_QUEUE_PROJECT_PATCHES =
"include-commit-queue-project-patches";
export const INCLUDE_HIDDEN_PATCHES = "include-hidden-patches";
export const SEEN_MIGRATE_GUIDE_CUE = "seen-migrate-guide-cue";
export const SLACK_NOTIFICATION_BANNER = "has-closed-slack-banner";
export const SUBSCRIPTION_METHOD = "subscription-method";
export const SEEN_IMAGE_VISIBILITY_GUIDE_CUE =
"seen-image-visibility-guide-cue";
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
/>
</div>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -105,7 +105,7 @@
mohamed.khelif
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -116,7 +116,7 @@
2020-08-28T15:00:17Z
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand Down
41 changes: 41 additions & 0 deletions apps/spruce/src/pages/task/metadata/ImageVisibilityGuideCue.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useState } from "react";
import {
GuideCue,
GuideCueProps,
TooltipAlign,
} from "@leafygreen-ui/guide-cue";
import Cookies from "js-cookie";
import { SEEN_IMAGE_VISIBILITY_GUIDE_CUE } from "constants/cookies";
import { showImageVisibilityPage } from "constants/featureFlags";

export const ImageVisibilityGuideCue: React.FC<{
refEl: GuideCueProps["refEl"];
}> = ({ refEl }) => {
const [open, setOpen] = useState(
Cookies.get(SEEN_IMAGE_VISIBILITY_GUIDE_CUE) !== "true",
);

const closeGuideCue = () => {
Cookies.set(SEEN_IMAGE_VISIBILITY_GUIDE_CUE, "true", { expires: 365 });
setOpen(false);
};

return (
<GuideCue
currentStep={1}
data-cy="image-visibility-guide-cue"
// TODO: Remove once the page is ready for release in DEVPROD-11433.
enabled={showImageVisibilityPage}
numberOfSteps={1}
onPrimaryButtonClick={closeGuideCue}
open={open}
refEl={refEl}
setOpen={setOpen}
title="Newly Introduced Image Page!"
tooltipAlign={TooltipAlign.Right}
>
Visit the Image page to view general information and package installations
for Evergreen distros.
</GuideCue>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/>
</div>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-build-variant"
>
<b
Expand All @@ -36,7 +36,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-project"
>
<b
Expand All @@ -56,7 +56,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -67,7 +67,7 @@
mohamed.khelif
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -82,7 +82,7 @@
</span>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -103,7 +103,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-description"
>
<b
Expand Down Expand Up @@ -141,7 +141,7 @@
</div>

<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/>
</div>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-build-variant"
>
<b
Expand All @@ -36,7 +36,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-project"
>
<b
Expand All @@ -56,7 +56,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -67,7 +67,7 @@
mohamed.khelif
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -82,7 +82,7 @@
</span>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -103,7 +103,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-description"
>
<b
Expand Down Expand Up @@ -141,7 +141,7 @@
</div>

<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -161,7 +161,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
Expand All @@ -180,8 +180,11 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<span
class="leafygreen-ui-1l0cwz5"
/>
<b
class="css-1xk67r-MetadataLabel e1ul56zb0"
>
Expand All @@ -199,7 +202,7 @@
</a>
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
data-cy="task-metadata-ami"
>
<b
Expand All @@ -211,7 +214,7 @@
ami-0c83bb0a9f48c15bf
</p>
<p
class="css-1spnncu-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
class="css-1xovdqa-Item-wordBreakCss e1ul56zb1 leafygreen-ui-1tb6tuo"
>
<a
class="lg-ui-0001 css-1gw3cuq-StyledLink leafygreen-ui-16e7rxl"
Expand Down
Loading

0 comments on commit b84a004

Please sign in to comment.