Skip to content

Conversation

@Younique98
Copy link
Contributor

@Younique98 Younique98 commented Oct 13, 2025

  • Refactors Sandbox and tutorial cards
  • Implements requested changes and page updates from product team.
  • Updates error tracking logic to use the imported posthog instance instead of relying on window.posthog.
  • Added Posthog Tracking
  • This ensures that the PostHog instance is correctly referenced, improving the reliability of error tracking on the sandbox page.

🔗 Relevant links

🗒️ What

Updates error tracking logic to use the imported posthog instance instead of relying on window.posthog.

🤷 Why

This ensures that the PostHog instance is correctly referenced, improving the reliability of error tracking on the sandbox page.

🛠️ How

Updated import

📸 Design Screenshots

Screenshot 2025-10-16 at 11 24 36 PM Screenshot 2025-10-23 at 10 05 01 PM Screenshot 2025-10-23 at 10 05 07 PM Screenshot 2025-10-23 at 10 05 26 PM

🧪 Testing

None affected

💭 Anything else?


@vercel
Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
dev-portal Ready Ready Preview Comment Oct 27, 2025 2:47pm

@github-actions
Copy link

github-actions bot commented Oct 13, 2025

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 299.79 KB (🟡 +389 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

One Hundred Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/ 189.5 KB (🔴 +53.69 KB) 489.29 KB
/404 173.62 KB (🔴 +57.54 KB) 473.41 KB
/500 173.62 KB (🔴 +57.54 KB) 473.41 KB
/[productSlug]/docs 186.61 KB (🟢 -2.59 KB) 486.4 KB
/[productSlug]/integrations 184.39 KB (🔴 +37.42 KB) 484.18 KB
/[productSlug]/integrations/[organizationSlug]/[integrationSlug] 181.18 KB (🟡 +9.42 KB) 480.97 KB
/[productSlug]/integrations/[organizationSlug]/[integrationSlug]/[integrationVersion] 181.18 KB (🟡 +9.42 KB) 480.97 KB
/[productSlug]/integrations/[organizationSlug]/[integrationSlug]/[integrationVersion]/components/[componentType]/[componentSlug] 190.7 KB (🟡 +9.25 KB) 490.5 KB
/[productSlug]/sandbox 172.92 KB (🟢 -8.84 KB) 472.72 KB
/[productSlug]/tutorials 187.93 KB (🟡 +37.58 KB) 487.72 KB
/[productSlug]/tutorials/[...tutorialSlug] 230.74 KB (🟢 -1.56 KB) 530.53 KB
/[productSlug]/tutorials/[collectionSlug] 207.6 KB (🟡 +9.42 KB) 507.4 KB
/_error 173.65 KB (🔴 +57.54 KB) 473.44 KB
/boundary 191.46 KB (🟡 +30.93 KB) 491.25 KB
/boundary/api-docs/[[...page]] 180.39 KB (🟡 +16.7 KB) 480.18 KB
/boundary/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/boundary/install 208.65 KB (🟡 +28.96 KB) 508.44 KB
/certifications 205.12 KB (🟡 +27.15 KB) 504.91 KB
/certifications/[slug] 205.78 KB (🟡 +27.15 KB) 505.57 KB
/certifications/signin 205.03 KB (🟡 +27.16 KB) 504.82 KB
/consul 191.46 KB (🟡 +30.93 KB) 491.25 KB
/consul/api-docs/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/consul/commands/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/consul/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/consul/install 202.12 KB (🟡 +28.95 KB) 501.92 KB
/consul/install/enterprise 202.16 KB (🟡 +28.95 KB) 501.95 KB
/hcp 191.46 KB (🟡 +30.93 KB) 491.25 KB
/hcp/api-docs/consul/[[...page]] 184.85 KB (🟡 +23.79 KB) 484.64 KB
/hcp/api-docs/hvn/[[...page]] 184.85 KB (🟡 +23.79 KB) 484.64 KB
/hcp/api-docs/identity/[[...page]] 184.86 KB (🟡 +23.8 KB) 484.65 KB
/hcp/api-docs/operations/[[...page]] 184.86 KB (🟡 +23.8 KB) 484.65 KB
/hcp/api-docs/packer/[[...page]] 184.85 KB (🟡 +23.8 KB) 484.65 KB
/hcp/api-docs/rbac/[[...page]] 184.85 KB (🟡 +23.79 KB) 484.64 KB
/hcp/api-docs/vagrant-box-registry/[[...page]] 184.87 KB (🟡 +23.8 KB) 484.66 KB
/hcp/api-docs/vault-secrets/[[...page]] 185.56 KB (🟡 +26.19 KB) 485.35 KB
/hcp/api-docs/vault/[[...page]] 185.55 KB (🟡 +26.19 KB) 485.34 KB
/hcp/api-docs/waypoint/[[...page]] 184.86 KB (🟡 +23.8 KB) 484.65 KB
/hcp/api-docs/webhook/[[...page]] 184.86 KB (🟡 +23.8 KB) 484.65 KB
/hcp/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/nomad 191.46 KB (🟡 +30.93 KB) 491.25 KB
/nomad/api-docs/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.64 KB
/nomad/commands/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/nomad/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/nomad/install 201.6 KB (🟡 +28.95 KB) 501.4 KB
/nomad/install/enterprise 201.59 KB (🟡 +28.95 KB) 501.38 KB
/nomad/plugins/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.64 KB
/nomad/tools/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/open-api-docs-preview 188.66 KB (🟡 +23.51 KB) 488.45 KB
/open-api-docs-preview-v2/[[...page]] 189.84 KB (🟡 +25.9 KB) 489.63 KB
/packer 191.46 KB (🟡 +30.93 KB) 491.25 KB
/packer/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/packer/guides/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/packer/install 201.58 KB (🟡 +28.95 KB) 501.37 KB
/profile/account 176.25 KB (🔴 +39.85 KB) 476.04 KB
/profile/bookmarks 177.26 KB (🔴 +39.85 KB) 477.05 KB
/sentinel 191.46 KB (🟡 +30.93 KB) 491.25 KB
/sentinel/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/sentinel/install 201.58 KB (🟡 +28.95 KB) 501.37 KB
/terraform 191.46 KB (🟡 +30.93 KB) 491.25 KB
/terraform/cdktf/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/cli/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/terraform/cloud-docs/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/cloud-docs/agents/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/terraform/enterprise/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/install 201.58 KB (🟡 +28.95 KB) 501.37 KB
/terraform/internals/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/intro/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/terraform/language/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/mcp-server/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/migrate/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/framework/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/log/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/mux/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/sdkv2/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/plugin/testing/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/terraform/registry/[[...page]] 180.85 KB (🟢 -2.57 KB) 480.64 KB
/tutorials 185.04 KB (🔴 +57.54 KB) 484.83 KB
/tutorials/library 189.06 KB (🔴 +39.85 KB) 488.85 KB
/vagrant 191.46 KB (🟡 +30.93 KB) 491.25 KB
/vagrant/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/vagrant/install 202.09 KB (🟡 +28.95 KB) 501.88 KB
/vagrant/install/vmware 201.59 KB (🟡 +28.95 KB) 501.38 KB
/vagrant/intro/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/vagrant/vagrant-cloud/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/validated-designs 176.12 KB (🔴 +53.53 KB) 475.91 KB
/validated-designs/[...slug] 176.29 KB (🟢 -2.41 KB) 476.08 KB
/validated-patterns 186.85 KB (🟡 +33.72 KB) 486.65 KB
/validated-patterns/[...tutorialSlug] 190.3 KB (🟢 -1.68 KB) 490.09 KB
/validated-patterns/[collectionSlug] 177.57 KB (🔴 +39.85 KB) 477.36 KB
/vault 191.46 KB (🟡 +30.93 KB) 491.25 KB
/vault/api-docs/[[...page]] 180.84 KB (🟢 -2.57 KB) 480.64 KB
/vault/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/vault/install 201.58 KB (🟡 +28.95 KB) 501.37 KB
/vault/install/enterprise 201.59 KB (🟡 +28.95 KB) 501.38 KB
/waypoint 191.46 KB (🟡 +30.93 KB) 491.25 KB
/waypoint/docs/[...page] 180.84 KB (🟢 -2.57 KB) 480.63 KB
/well-architected-framework 188.26 KB (🟡 +11.65 KB) 488.05 KB
/well-architected-framework/[...page] 180.85 KB (🟢 -2.57 KB) 480.64 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

LeahMarieBush
LeahMarieBush previously approved these changes Oct 13, 2025
@Younique98 Younique98 force-pushed the et/sandbox-requested-posthog-import-change branch from 8845b5d to c04e64e Compare October 14, 2025 16:45
@Younique98 Younique98 marked this pull request as draft October 14, 2025 21:23
@Younique98 Younique98 force-pushed the et/sandbox-requested-posthog-import-change branch from e8809b2 to 8aaf5aa Compare October 16, 2025 22:55
@Younique98 Younique98 marked this pull request as ready for review October 16, 2025 22:57
@Younique98 Younique98 changed the title Improves PostHog error tracking on sandbox page Feature: sandbox page and tutorials Oct 17, 2025
Copy link
Contributor

@LeahMarieBush LeahMarieBush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! I checked prod and the preview and noticed a regression for the bookmark button on the tutorial cards.
Prod:
Screenshot 2025-10-17 at 2 54 28 PM
Preview:
Screenshot 2025-10-17 at 2 54 24 PM

@Younique98
Copy link
Contributor Author

Thank you! Pushing up.

@LeahMarieBush
Copy link
Contributor

Code looks good! I checked prod and the preview and noticed a regression for the bookmark button on the tutorial cards. Prod: Screenshot 2025-10-17 at 2 54 28 PM Preview: Screenshot 2025-10-17 at 2 54 24 PM

I'm still seeing this issue in the latest preview link

Copy link
Contributor

@LeahMarieBush LeahMarieBush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Just one small comment above that needs to be addressed

@Younique98
Copy link
Contributor Author

Thats weird @LeahMarieBush I fixed that and pushed up. Maybe I need to retrigger the preview build again. Because locally for me its fixed.

@Younique98 Younique98 marked this pull request as ready for review October 23, 2025 21:09
Copy link
Collaborator

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be using important, it makes overriding styles much harder if we ever inherit for the .tutorialCard class.

https://github.com/hashicorp/dev-portal/pull/2870/files#r2457415375

Updates error tracking logic to use the imported `posthog` instance instead of relying on `window.posthog`.

This ensures that the PostHog instance is correctly referenced, improving the reliability of error tracking on the sandbox page.
Allows tutorial cards to be displayed without a bookmark button.

This change provides the flexibility to display tutorial cards in contexts where bookmarking functionality is not desired or applicable.
Specifically, it disables the bookmark button within the tutorial cards grid list.
Corrects the type definition for the TutorialCardWithAuthElements component to properly handle optional properties.

Removes commented-out code in the instruqt-lab context test file, cleaning up the codebase and removing distractions.
Reduces padding and margins in cards and badges to create a more compact and information-dense user interface. This aims to improve content presentation by minimizing whitespace and making more content visible at a glance.
Updates tests for the Instruqt lab context to improve reliability and
reduce duplication.

- Mocks localStorage directly instead of creating a mock object.
- Uses vi.spyOn for getItem and setItem to improve test isolation.
- Adds mock for validateSandboxConfigWithDetailedErrors to isolate config validation.
- Updates mock for next/router to simplify it.
Simplifies PostHog event capture calls by directly importing the `posthog` instance.

This change improves code readability and reduces redundancy across multiple components and contexts.
Refactors card layouts for better spacing and responsiveness.

Introduces a new sandbox card component for displaying sandbox environments.

Updates tutorial card list to support compact cards.
Reduces the size of the product icon and intro text in the sandbox dropdown for a more visually appealing presentation.
Improves visual spacing within the sandbox card component
by increasing the padding and margins to create a more
balanced and appealing user interface.
Updates tests to use `waitFor` for asynchronous state updates,
ensuring accurate state validation and preventing race conditions.
Also, fixes a bug where the `active` state was not being set
correctly when a new lab is opened.
Removes !important overrides from tutorial card styles for better CSS specificity management.

Increases the grid gap in the sandbox view to improve visual spacing.
Implements event tracking for user interactions within the sandbox environment.

This change captures key interactions, such as clicks and hovers, to provide insights into user behavior and improve the sandbox experience. The data collected will inform decisions on sandbox discoverability, engagement, and overall user satisfaction.
Updates the sandbox event that is tracked when the iframe loads to `sandbox_open`.

This more accurately reflects the user's action of opening the sandbox and aligns with the new event naming conventions.
Adds tracking for sandbox events and interactions when a user clicks on a lab within the sandbox dropdown.
This provides insights into user engagement with sandboxes.
@Younique98 Younique98 marked this pull request as ready for review October 27, 2025 15:07
@Younique98 Younique98 requested review from a team and RubenSandwich October 27, 2025 15:07
Copy link
Collaborator

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@Younique98 Younique98 dismissed LeahMarieBush’s stale review October 27, 2025 15:31

This has been addressed and will be taken care of in the next pr. Foundation has been laid and a new SandboxCard has been created which will make this transition easier.

@Younique98 Younique98 merged commit 481fcbe into main Oct 27, 2025
12 checks passed
@Younique98 Younique98 deleted the et/sandbox-requested-posthog-import-change branch October 27, 2025 15:31
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.

3 participants