Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
85ac1f6
added react section chunking
prashant-fynd Sep 3, 2024
62fb8be
createSectionsIndexFile rewritten for vue
prashant-fynd Sep 4, 2024
5cfe5d7
Merge branch 'master' into theme-sections-chunking
prashant-fynd Sep 4, 2024
506eae2
Merge branch 'master' into theme-sections-chunking
prashant-fynd Sep 23, 2024
efb52dc
added non chunking support for react themes
prashant-fynd Oct 1, 2024
1d2b1bd
Section chunking by default true
prashant-fynd Oct 7, 2024
2740e96
publishing beta version
prashant-fynd Oct 15, 2024
6faa487
Merge branch 'master' into theme-sections-chunking
prashant-fynd Oct 15, 2024
5f607fe
Merge branch 'master' into theme-sections-chunking
prashant-fynd Oct 21, 2024
c8c9613
PR review changes
prashant-fynd Oct 21, 2024
10b8d31
added beta version
prashant-fynd Oct 21, 2024
9c8fa6b
version updated
prashant-fynd Oct 22, 2024
a317e1f
version updated
prashant-fynd Nov 7, 2024
bbeb557
Merge branch 'master' into theme-sections-chunking
prashant-fynd Jan 3, 2025
2096af8
6.2.6-beta.2
ZaidRehman Jan 6, 2025
1758132
version bump
ZaidRehman Jan 6, 2025
a4a7f58
6.2.8-beta.0
ZaidRehman Jan 6, 2025
36a174a
version bump
ZaidRehman Jan 6, 2025
d693871
6.2.7-beta.0
ZaidRehman Jan 6, 2025
22cf7b1
6.2.7-beta.1
ZaidRehman Jan 6, 2025
3480157
Updates React binding boilerplate code
ZaidRehman Feb 14, 2025
6b8da2e
6.2.8-beta.0
ZaidRehman Feb 14, 2025
bb69bb5
6.2.8-beta.1
ZaidRehman Feb 14, 2025
8752c42
React bindings updated
ZaidRehman Feb 14, 2025
f2add35
6.2.8-beta.2
ZaidRehman Feb 14, 2025
6f4d2f8
retrigger pipeline
ZaidRehman Feb 17, 2025
117506a
test case fix for ubuntu
ZaidRehman Feb 17, 2025
af79f0e
Merge branch 'master' of github.com:gofynd/fdk-cli into theme-section…
ZaidRehman Mar 5, 2025
ae33202
7.0.1-beta.0
ZaidRehman Mar 5, 2025
5d37db1
7.0.1-beta.1
ZaidRehman Mar 5, 2025
63f05aa
rebased with master
ZaidRehman Mar 6, 2025
81029fe
7.0.1-beta.0
ZaidRehman Mar 6, 2025
d934589
version update
ZaidRehman Mar 6, 2025
1a08ac9
7.0.1-beta.2
ZaidRehman Mar 6, 2025
298ecc9
Local support of locales serve for theme
KunalFynd Apr 2, 2025
5b6441c
chunking changes
HardikPacholi25 Apr 2, 2025
d5298c4
removed commented code
HardikPacholi25 Apr 3, 2025
f9909ed
Comments resolved
HardikPacholi25 Apr 3, 2025
62af3b9
Used Logger instead of console for logging
KunalFynd Apr 3, 2025
652c19c
Merge pull request #396 from gofynd/section-new-config
prashant-fynd Apr 4, 2025
e32a1b1
7.0.1-beta.3
prashant-fynd Apr 4, 2025
f9cb1b0
Validation added for theme package and sync command
vivek-singh-ext Apr 7, 2025
c388727
Temporary branch added for react
vivek-singh-ext Apr 7, 2025
c9d709b
theme static resource code merged
vivek-singh-ext Apr 10, 2025
c458825
Temp fix try
prashant-fynd Apr 11, 2025
b85ecc5
Bug fix : No sections visibal at editor
prashant-fynd Apr 11, 2025
7dd290f
Merge branch 'theme-sections-chunking' into feature/multilang
vivek-singh-ext Apr 11, 2025
bd1e4cf
resource key issue resolved
vivek-singh-ext Apr 11, 2025
a2060e2
new file command fixed
prashant-fynd Apr 11, 2025
f948faa
Merge branch 'theme-sections-chunking' into feature/multilang
vivek-singh-ext Apr 11, 2025
853a36f
theme serve resource issue resolved
vivek-singh-ext Apr 11, 2025
db65703
nesting of resource removed
vivek-singh-ext Apr 11, 2025
b9d4cf3
removed the .schema.json from local theme serve
vivek-singh-ext Apr 11, 2025
ecaf2e9
Changes default theme for React from Luxe to Turbo
ZaidRehman Apr 14, 2025
85b1e61
Merge branch 'bindings-update' of github.com:gofynd/fdk-cli into them…
ZaidRehman Apr 14, 2025
2316815
7.0.1
ZaidRehman Apr 14, 2025
2807fba
version Bump
ZaidRehman Apr 14, 2025
fd5e43c
new theme and theme init changes for locales
vivek-singh-ext Apr 14, 2025
6528337
validate the json of locale folders
vivek-singh-ext Apr 15, 2025
8be1250
Error handling when locales api failed
vivek-singh-ext Apr 15, 2025
73244aa
Multilang test cases
vivek-singh-ext Apr 21, 2025
e6b5ece
test cased for multilang
vivek-singh-ext Apr 21, 2025
f070745
Hard check for locales in the react theme folder removed
vivek-singh-ext Apr 21, 2025
8de486a
Merge conflict resolved
vivek-singh-ext Apr 21, 2025
6cd6421
Unwanted code removed
vivek-singh-ext Apr 22, 2025
d0c7e3a
React Clone repo modified
vivek-singh-ext Apr 28, 2025
af80407
Test cases modified
vivek-singh-ext May 6, 2025
6003efb
Test case check
vivek-singh-ext May 7, 2025
e54e3ab
Theme fetch logic modified
vivek-singh-ext May 7, 2025
e2ace1e
Test
vivek-singh-ext May 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion extension-section/src/components/ProductCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from '../styles/style.css';
export function ProductCard({ product }) {
return (
<div className={styles.product}>
{product.medias.map((media) => (
{product.media?.map((media) => (
<img src={media.url} alt={media.alt} />
))}
<h1>{product.name}</h1>
Expand Down
110 changes: 86 additions & 24 deletions extension-section/src/sections/product-list.jsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,107 @@
import React, { useEffect } from "react";
import { useGlobalStore, useFPI } from "fdk-core/utils"; // Importing hooks from fdk-core utilities
import { Helmet } from "react-helmet-async"; // Importing Helmet for managing changes to the document head
import styles from "../styles/style.css"; // Importing CSS styles
import { ProductCard } from "../components/ProductCard"; // Importing the ProductCard component

import { useGlobalStore, useFPI } from "fdk-core/utils";
import { Helmet } from "react-helmet-async";
import styles from "../styles/style.css";
import { ProductCard } from "../components/ProductCard";
// GraphQL query as a template literal string to fetch products with dynamic variables
const PLP_PRODUCTS = `query products(
$first: Int
$pageNo: Int
$after: String
$pageType: String
) {
products(
first: $first
pageNo: $pageNo
after: $after
pageType: $pageType
) {
page {
current
next_id
has_previous
has_next
item_total
type
size
}
items {
price {
effective {
currency_code
currency_symbol
max
min
}
}
media {
alt
type
url
}
slug
name
}
}
}
`;

export function Component({ props }) {
const fpi = useFPI();
const products = useGlobalStore(fpi.getters.PRODUCTS);
// Functional component definition using destructuring to access props
export function Component({ title = 'Extension Title Default' }) {
const fpi = useFPI(); // Using a custom hook to access functional programming interface
const products = useGlobalStore(fpi.getters.PRODUCTS); // Accessing global store to retrieve products
const productItems = products?.items ?? []; // Nullish coalescing operator to handle undefined products

const productItems = products?.data?.items ?? [];
// useEffect to perform side effects, in this case, data fetching
useEffect(() => {
// Checking if productItems is empty and then executing GraphQL query
if (!productItems.length) {
fpi.catalog.getProducts({});
const payload = {
enableFilter: true, // Enabling filter option in the query
first: 12, // Number of products to fetch
pageNo: 1, // Initial page number
pageType: "number", // Type of pagination
};
fpi.executeGQL(PLP_PRODUCTS, payload);
}
}, []);
}, [productItems.length, fpi]); // Dependency array to limit the execution of useEffect

const title = props?.title?.value ?? 'Extension Title Default'
// Conditionally rendering based on the availability of product items
if (!productItems.length) {
return <h2>No Products Found</h2>; // Display message when no products are found
}

return (
<div>
<Helmet>
<title>{ title }</title>
<title>{title}</title> // Setting the title of the page using Helmet
</Helmet>
<h1>Products List</h1>

{!productItems.length ? (
<h2>No Products</h2>
) : (
<div class={styles.container}>
{productItems.map((product) => (
<ProductCard product={product} key={product.slug} />
))}
</div>
)}
<div className={styles.container}>
{productItems.map((product) => (
<ProductCard product={product} key={product.slug} /> // Rendering ProductCard components for each product
))}
</div>
</div>
);
}

Component.serverFetch = ({ fpi }) => fpi.catalog.getProducts({});
// Server-side fetching logic for server-side rendering (SSR)
Component.serverFetch = ({ fpi }) => {
const payload = {
enableFilter: true,
first: 12,
pageNo: 1,
pageType: "number",
};

fpi.custom.setValue("test-extension", true); // Custom settings for the server-side execution context

return fpi.executeGQL(PLP_PRODUCTS, payload); // Executing GraphQL query on the server
};

// Exporting component settings for potential dynamic UI management or configuration panels
export const settings = {
label: "Product List",
name: "product-list",
Expand All @@ -49,7 +111,7 @@ export const settings = {
label: "Page Title",
type: "text",
default: "Extension Title",
info: "Page Title",
info: "Set the page title for the product list." // Description for the property
},
],
blocks: [],
Expand Down
46 changes: 44 additions & 2 deletions extension-section/src/styles/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,49 @@
/* General styles for the product grid */
.product {
color: red;
border: 1px solid red
display: flex;
flex-direction: column;
align-items: center;
width: 300px; /* Adjust width as necessary */
padding: 20px;
margin: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 10px;
background-color: #fff;
transition: transform 0.3s ease-in-out;
}

.product img {
width: 100%; /* Makes images responsive */
height: auto;
border-radius: 5px;
margin-bottom: 10px;
}

.product h1 {
font-size: 18px;
color: #333;
margin: 10px 0;
}

.product h2 {
font-size: 14px;
color: #666;
margin-bottom: 10px;
}

/* Hover effect for product card */
.product:hover {
transform: translateY(-5px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Container for horizontal product layout */
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}
1 change: 1 addition & 0 deletions extension.context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gofynd/fdk-cli",
"version": "7.0.0",
"version": "7.0.1-beta.4",
"main": "index.js",
"license": "MIT",
"bin": {
Expand All @@ -27,7 +27,7 @@
"build": "npm run clean && tsc && npm run copy-files",
"copy-files": "copyfiles -u 1 src/**/*.html dist/",
"watch": "tsc --watch",
"test": "jest --runInBand",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest --runInBand",
"pretty": "prettier --config ./.prettierrc --write './src/**/*.*'",
"localInstall": "sh scripts/localInstall.sh"
},
Expand Down
Binary file added src/__tests__/fixtures/Locale_Turbo.zip
Binary file not shown.
Loading
Loading