Skip to content

Commit

Permalink
Merge pull request #364 from newfold-labs/fix/react-warnings-fix-for-…
Browse files Browse the repository at this point in the history
…homepage

Fix react console warnings for Home page
  • Loading branch information
wpscholar authored Oct 16, 2024
2 parents 8225de4 + a463e88 commit 270f9d5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 56 deletions.
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '2e99252879dbc96cca15');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'fdecf6eb6c16f87153bc');
18 changes: 9 additions & 9 deletions includes/Data/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,29 @@ final class Plugins {
'file' => 'sensei-lms/sensei-lms.php'
),
//Add An Affiliate Program
'yith-woocommerce-affiliates' => array(
'yith-woocommerce-affiliates-premium' => array(
'url' => 'admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general',
'file' => 'yith-woocommerce-affiliates-premium/init.php'
),
//Setup Bookings
'yith-woocommerce-booking' => array(
'yith-woocommerce-booking-premium' => array(
'url' => 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1',
'file' => 'yith-woocommerce-booking/init.php'
'file' => 'yith-woocommerce-booking-premium/init.php'
),
//Setup A Loyalty Program
'yith-woocommerce-points-and-rewards' => array(
'yith-woocommerce-points-and-rewards-premium' => array(
'url' => 'admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard',
'file' => 'yith-woocommerce-points-and-rewards/init.php'
'file' => 'yith-woocommerce-points-and-rewards-premium/init.php'
),
//Setup WishList
'yith-woocommerce-wishlist' => array(
'yith-woocommerce-wishlist-premium' => array(
'url' => 'admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general',
'file' => 'yith-woocommerce-wishlist/init.php'
'file' => 'yith-woocommerce-wishlist-premium/init.php'
),
//Enable Product Reviews
'yith-woocommerce-advanced-reviews' => array(
'yith-woocommerce-advanced-reviews-premium' => array(
'url' => 'admin.php?page=yith_ywar_panel',
'file' => 'yith-woocommerce-advanced-reviews/init.php'
'file' => 'yith-woocommerce-advanced-reviews-premium/init.php'
),
//Create a Sales Campaign
'yith-woocommerce-dynamic-pricing-and-discounts' => array(
Expand Down
26 changes: 14 additions & 12 deletions src/components/WPSolutionsBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export function WPSolutionsBanner() {
const [ availableSolutions, setAvailableSolutions] = useState([]);
const [ pluginActiveStatusArray, setPluginActiveStatusArray] = useState([]);
let currentSolution = [];
const hasSolution = NewfoldRuntime.hasCapability("hasSolution");

let premiumPluginStatus = useSWR(
"nfd_slug_wonder_cart",
() =>
PluginsSdk.queries
.status("nfd_slug_wonder_cart", "sensei-lms", "wp-seo", "yith-woocommerce-affiliates", "yith-woocommerce-booking", "yith-woocommerce-points-and-rewards", "yith-woocommerce-wishlist", "yith-woocommerce-advanced-reviews", "yith-woocommerce-dynamic-pricing-and-discounts")
.status("nfd_slug_wonder_cart", "sensei-lms", "wp-seo", "yith-woocommerce-affiliates-premium", "yith-woocommerce-booking-premium", "yith-woocommerce-points-and-rewards-premium", "yith-woocommerce-wishlist-premium", "yith-woocommerce-advanced-reviews-premium", "yith-woocommerce-dynamic-pricing-and-discounts")
.then(res => {
setPluginActiveStatusArray(res?.details)
}),
Expand Down Expand Up @@ -82,7 +83,8 @@ export function WPSolutionsBanner() {
wpSolutionsPromotedPluginsList[0]['WP_SOLUTION_SERVICE'] : wpSolutionsPromotedPluginsList[0]['WP_SOLUTION_COMMERCE'];
let solutionsCards = Object.values(currentSolution);
return(
<Section.Container className="nfd-container">
hasSolution &&
(<Section.Container className="nfd-container">
<Section.Header
title={__("Explore Your Plugins and Tools", "wp-module-ecommerce")}
subTitle={__("Improve your site with the tools and services included in your plan.", "wp-module-ecommerce")}
Expand All @@ -92,7 +94,7 @@ export function WPSolutionsBanner() {
<div className={classNames('nfd-grid nfd-grid-flow-row-dense nfd-grid-cols-3 nfd-grid-rows-2 nfd-gap-6')}>
{
solutionsCards?.map((details, index) => {
return (<div key={index} className={classNames("max-[950px]:nfd-col-span-3", "nfd-flex nfd-flex-col nfd-bg-[#F1F5F7] nfd-p-6 nfd-rounded-lg nfd-border nfd-border-[#E2E8F0] nfd-box-content", `${ index === 0 || index === 3 ? 'nfd-col-span-1': 'nfd-col-span-2'}`)}>
return (<div key={`card-${index}`} className={classNames("max-[950px]:nfd-col-span-3", "nfd-flex nfd-flex-col nfd-bg-[#F1F5F7] nfd-p-6 nfd-rounded-lg nfd-border nfd-border-[#E2E8F0] nfd-box-content", `${ index === 0 || index === 3 ? 'nfd-col-span-1': 'nfd-col-span-2'}`)}>
<h2 className="nfd-text-[#0F172A] nfd-text-lg nfd-leading-5 nfd-font-semibold nfd-mb-4">
{ __(`${details['title']}`,"wp-module-ecommerce") }
</h2>
Expand All @@ -109,7 +111,7 @@ export function WPSolutionsBanner() {
//installed & active
status === "active" ?
(
<Button className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="a" href={url}>
<Button key={`btn-${index}`} className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="a" href={url}>
{ __(`${details['buttonText']}`,"wp-module-ecommerce") }
<RightArrow className="nfd-mt-2.5" />
</Button>
Expand All @@ -118,7 +120,7 @@ export function WPSolutionsBanner() {
//installed but not active
status === "need_to_activate" ?
(
<Button className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="button" data-plugin={details.basename}>
<Button key={`btn-${index}`} className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="button" data-plugin={details.basename}>
{ __(`${details['buttonText']}`,"wp-module-ecommerce") }
<RightArrow className="nfd-mt-2.5" />
</Button>
Expand All @@ -127,17 +129,17 @@ export function WPSolutionsBanner() {
//need to install
status === "need_to_install" ?
//premium
details.plsProviderName && details.plsSlug ?
details.plsProviderName && details.plsSlug && !details.download ?
(
<Button
key={`btn-${index}`}
className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start"
as="button"
data-nfd-installer-plugin-activate={true}
data-nfd-installer-plugin-slug={slug}
data-nfd-installer-plugin-provider={details.plsProviderName}
data-nfd-installer-pls-slug={slug}
data-nfd-installer-pls-provider={details.plsProviderName}
data-nfd-installer-plugin-name={details.name}
data-nfd-installer-plugin-url={url}
data-nfd-installer-plugin-storage-key={details.storageKey}
isLoading={status==="installing"}
>
{ __(`${details['buttonText']}`,"wp-module-ecommerce") }
Expand All @@ -149,13 +151,13 @@ export function WPSolutionsBanner() {
details.download ?
(
<Button
key={`btn-${index}`}
className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start"
as="button"
data-nfd-installer-plugin-activate={true}
data-nfd-installer-plugin-name={details.name}
data-nfd-installer-download-url={details.download}
data-nfd-installer-plugin-url={url}
data-nfd-installer-plugin-storage-key={details.storageKey}
isLoading={status==="installing"}
>
{ __(`${details['buttonText']}`,"wp-module-ecommerce") }
Expand All @@ -169,7 +171,7 @@ export function WPSolutionsBanner() {
))
:
//For type not plugin
(<Button className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="a" href={details.url+"89538934954"}>
(<Button key={`btn-${index}`} className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="a" href={details.url+"89538934954"}>
{ __(`${details['buttonText']}`,"wp-module-ecommerce") }
<RightArrow className="nfd-mt-2.5" />
</Button>)
Expand All @@ -185,7 +187,7 @@ export function WPSolutionsBanner() {
{__(`View all your plugins and tools`, "wp-module-ecommerce")}
</Button>
</Section.Content>
</Section.Container>
</Section.Container>)
)
}

Expand Down
Loading

0 comments on commit 270f9d5

Please sign in to comment.