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

EDU-135: Product details for all the frameworks #3948

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

uttej-vsk
Copy link
Contributor

@uttej-vsk uttej-vsk commented Mar 5, 2025

Description

This PR adds the code for Product Details for all the frameworks.

@samijaber This is part 2 of our new strategy to use two PRs, one for a single framework to talk about changes and another to replicate the feedback and finish off the ticket.

Part 1 PR: #3946

Copy link

changeset-bot bot commented Mar 5, 2025

⚠️ No Changeset found

Latest commit: caf9dab

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@uttej-vsk uttej-vsk changed the title EDU-135: Product details for all the frameworks WIP - EDU-135: Product details for all the frameworks Mar 5, 2025
Copy link

gitguardian bot commented Mar 5, 2025

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link

nx-cloud bot commented Mar 5, 2025

View your CI Pipeline Execution ↗ for commit caf9dab.

Command Status Duration Result
nx test @e2e/qwik-city ✅ Succeeded 7m 52s View ↗
nx test @e2e/nextjs-sdk-next-app ✅ Succeeded 7m 37s View ↗
nx test @e2e/nuxt ✅ Succeeded 7m 15s View ↗
nx test @e2e/angular-16 ✅ Succeeded 7m 20s View ↗
nx test @e2e/solid-start ✅ Succeeded 5m 42s View ↗
nx test @e2e/react-sdk-next-14-app ✅ Succeeded 5m 32s View ↗
nx test @e2e/vue ✅ Succeeded 4m 49s View ↗
nx test @e2e/angular-16-ssr ✅ Succeeded 6m 22s View ↗
Additional runs (36) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-03-17 22:10:14 UTC

fetchOneEntry({
model: 'product-details',
apiKey: 'ee9f13b4981e489a9a1209887695ef2b',
query: { 'data.handle': 'jacket' },
Copy link
Contributor

Choose a reason for hiding this comment

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

you resolved this but it's still a static 'jacket'


<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { fetchOneEntry, typeBuilderContent } from '@builder.io/sdk-vue'
Copy link
Contributor

Choose a reason for hiding this comment

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

typeBuilderContent is a typo causing the snippet to crash and not build at all.

Suggested change
import { fetchOneEntry, typeBuilderContent } from '@builder.io/sdk-vue'
import { fetchOneEntry, type BuilderContent } from '@builder.io/sdk-vue'

Comment on lines 2 to 13
<div v-if="!productDetails">
<p>Loading product details...</p>
</div>
<div class="product-details-page" v-else>
<h1>{{ productDetails.data?.['name'] }}</h1>
<img
:src="productDetails.data?.['image']"
:alt="productDetails.data?.['name']"
/>
<p>{{ productDetails.data?.['collection'].value.data.copy }}</p>
<p>Price: {{ productDetails.data?.['collection'].value.data.price }}</p>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

productDetails.data?.['name'] syntax is only needed in Angular projects. It is rather ugly so let's not use it if we don't need to?

Also, if you have the v-if check on productDetails?.data, kinda like you did in packages/sdks/snippets/nuxt/pages/product/category/[handle].vue, you can remove all the ?.:

Suggested change
<div v-if="!productDetails">
<p>Loading product details...</p>
</div>
<div class="product-details-page" v-else>
<h1>{{ productDetails.data?.['name'] }}</h1>
<img
:src="productDetails.data?.['image']"
:alt="productDetails.data?.['name']"
/>
<p>{{ productDetails.data?.['collection'].value.data.copy }}</p>
<p>Price: {{ productDetails.data?.['collection'].value.data.price }}</p>
</div>
<div v-if="!productDetails?.data">
<p>Loading product details...</p>
</div>
<div class="product-details-page" v-else>
<h1>{{ productDetails.data.name }}</h1>
<img
:src="productDetails.data.image"
:alt="productDetails.data.name"
/>
<p>{{ productDetails.data.collection.value.data.copy }}</p>
<p>Price: {{ productDetails.data.collection.value.data.price }}</p>
</div>

this is much cleaner overall

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.

2 participants