diff --git a/src/components/BuyServices/NewKubernetisUtho.jsx b/src/components/BuyServices/NewKubernetisUtho.jsx
index 51f0c14..b4611e9 100644
--- a/src/components/BuyServices/NewKubernetisUtho.jsx
+++ b/src/components/BuyServices/NewKubernetisUtho.jsx
@@ -9,12 +9,13 @@ import { useToast } from "../ui/toast";
import { useIsLoggedIn } from '../../lib/isLoggedIn';
export default function Kubernetes() {
- const { isLoggedIn, loading } = useIsLoggedIn();
+ const { isLoggedIn, loading, balance } = useIsLoggedIn();
const { showToast } = useToast();
const [isLoading, setIsLoading] = useState(false);
const [deployError, setDeployError] = useState(null);
const [deployStatus, setDeployStatus] = useState({});
const [clusterStatus, setClusterStatus] = useState('');
+ const [productAmount, setProductAmount] = useState(100);
const [nodePools, setNodePools] = useState([{
label: `${getRandomString()}`,
size: '10215',
@@ -88,6 +89,9 @@ export default function Kubernetes() {
}, [deployStatus.clusterId, deployStatus.isReady]);
const handleSubmit = async (e) => {
+ if(balance < productAmount){
+ return;
+ }
e.preventDefault();
setIsLoading(true);
setDeployError(null);
@@ -229,6 +233,13 @@ export default function Kubernetes() {
);
}
+ if (balance < productAmount) {
+ return (
+
+ You have insufficient balance to deploy this service. Please click here to go to your profile and add balance, then try again.
+ );
+ }
+
if (deployStatus.status === 'success') {
return (
diff --git a/src/components/BuyServices/NewUthoCloudInstance.jsx b/src/components/BuyServices/NewUthoCloudInstance.jsx
index 141e911..7a47281 100644
--- a/src/components/BuyServices/NewUthoCloudInstance.jsx
+++ b/src/components/BuyServices/NewUthoCloudInstance.jsx
@@ -13,13 +13,14 @@ import { useIsLoggedIn } from '../../lib/isLoggedIn';
export default function NewCloudInstance() {
const PUBLIC_UTHO_API_KEY = import.meta.env.PUBLIC_UTHO_API_KEY;
- const { isLoggedIn, loading, error, sessionData } = useIsLoggedIn();
+ const { isLoggedIn, loading, error, sessionData, balance } = useIsLoggedIn();
const { showToast } = useToast();
const [isLoading, setIsLoading] = useState(false);
const [isFetchingData, setIsFetchingData] = useState(true);
const [deployError, setDeployError] = useState()
const [deployStatus, setDeployStatus] = useState({});
const [copied, setCopied] = useState(false);
+ const [productAmount, setProductAmount] = useState(100);
const [plans, setPlans] = useState([
{
"id": "10027",
@@ -313,6 +314,9 @@ export default function NewCloudInstance() {
const handleSubmit = async (e) => {
+ if(balance < productAmount){
+ return;
+ }
e.preventDefault();
setIsLoading(true);
@@ -441,6 +445,13 @@ export default function NewCloudInstance() {
return ;
}
+ if (balance < productAmount) {
+ return (
+
+ You have insufficient balance to deploy this service. Please click here to go to your profile and add balance, then try again.
+ );
+ }
+
if (deployError) return Error: {deployError?.message}
;
if (!isLoggedIn) {
@@ -529,7 +540,7 @@ export default function NewCloudInstance() {
{plans.map(plan => (
- {`${plan.cpu} vCPU, ${plan.ram}MB RAM - ${plan.price_cur}/mo`}
+ {`${plan.cpu} vCPU, ${plan.ram}MB RAM`} {/* {`${plan.cpu} vCPU, ${plan.ram}MB RAM - ${plan.price_cur}/mo`} */}
))}
{/*
diff --git a/src/components/TopicItem.jsx b/src/components/TopicItem.jsx
index de43321..2152288 100644
--- a/src/components/TopicItem.jsx
+++ b/src/components/TopicItem.jsx
@@ -14,9 +14,9 @@ export default function TopicItems(props) {
return Loading...
;
}
- if (error) {
- return Error loading authentication status
;
- }
+ // if (error) {
+ // return Error loading authentication status
;
+ // }
const handleSearchChange = (e) => {
setLocalSearchTerm(e.target.value);