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

Bug Fixes Solutions module #1346

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 33 additions & 10 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use function NewfoldLabs\WP\Context\getContext;
use function NewfoldLabs\WP\Module\Features\isEnabled;
use NewfoldLabs\WP\Module\Data\SiteCapabilities;

/**
* \Bluehost\Admin
Expand Down Expand Up @@ -66,6 +67,10 @@ public static function add_to_runtime( $sdk ) {
public static function subpages() {
global $bluehost_module_container;

$capability = new SiteCapabilities();

$hasSolution = $capability->get( 'hasSolution' );

$home = array(
'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ),
);
Expand All @@ -78,6 +83,9 @@ public static function subpages() {
$marketplace = array(
'bluehost#/marketplace' => __( 'Marketplace', 'wp-plugin-bluehost' ),
);
$mypluginsandtools = array(
'bluehost#/my_plugins_and_tools' => __( 'My Plugins & Tools', 'wp-plugin-bluehost' ),
);
// add performance if enabled
$performance = isEnabled( 'performance' )
? array(
Expand All @@ -97,16 +105,31 @@ public static function subpages() {
'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ),
);

return array_merge(
$home,
$pagesAndPosts,
$store,
$marketplace,
$performance,
$settings,
$staging,
$help
);
if($hasSolution){
return array_merge(
$home,
$pagesAndPosts,
$store,
$marketplace,
$mypluginsandtools,
$performance,
$settings,
$staging,
$help
);
}
else{
return array_merge(
$home,
$pagesAndPosts,
$store,
$marketplace,
$performance,
$settings,
$staging,
$help
);
}
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/app/data/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const topRoutePaths = [
'/pages-and-posts',
'/store',
'/marketplace',
'/my_plugins_and_tools',
'/my_plugins_and_tools',
'/performance',
'/settings',
'/staging',
Expand Down Expand Up @@ -138,13 +138,13 @@ export const routes = [
subRoutes: await getMarketplaceSubnavRoutes(),
condition: true,
},
{
NewfoldRuntime.hasCapability( 'hasSolution' ) && {
name: '/my_plugins_and_tools',
title: __( 'My Plugins & Tools', 'wp-plugin-bluehost' ),
Component: Solutions,
Icon: PuzzlePieceIcon,
condition: true,
},
},
{
name: '/performance',
title: __( 'Performance', 'wp-plugin-bluehost' ),
Expand Down
9 changes: 3 additions & 6 deletions src/app/pages/solutions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import './style.scss';
import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { useLocation, useMatch, useNavigate } from 'react-router-dom';
import { Container, Page, Title } from '@newfold/ui-component-library';
import { Container, Page } from '@newfold/ui-component-library';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
import { default as NewfoldEntitlements } from '@modules/wp-module-solutions/components/entitlements';

const Solutions = () => {

// constants to pass to module
const moduleConstants = {
text: {
Expand Down Expand Up @@ -38,13 +37,11 @@ const Solutions = () => {
useNavigate,
NewfoldRuntime,
};

return (
<Page>
<Container
className={
'newfold-entitlements-container nfd-overflow-clip'
}
className={ 'newfold-entitlements-container nfd-overflow-clip' }
>
<NewfoldEntitlements
methods={ moduleMethods }
Expand Down
Loading