Compare commits

..

No commits in common. "main" and "solana-payment" have entirely different histories.

9 changed files with 124 additions and 313 deletions

View File

@ -1,6 +1,4 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {};
transpilePackages: ["geist"],
};
module.exports = nextConfig; module.exports = nextConfig;

View File

@ -15,7 +15,7 @@ export default function Form() {
useEffect(() => { useEffect(() => {
if (ready && authenticated) { if (ready && authenticated) {
router.push("/dashboard/rent"); router.push("/dashboard/home");
} }
}, [ready, authenticated, router]); }, [ready, authenticated, router]);

View File

@ -4,7 +4,6 @@ import Sidebar from "@/components/Sidebar";
import Topbar from "@/components/Topbar"; import Topbar from "@/components/Topbar";
import { usePrivy } from "@privy-io/react-auth"; import { usePrivy } from "@privy-io/react-auth";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import Script from "next/script";
export default function DashboardLayout({ export default function DashboardLayout({
children, children,
@ -22,26 +21,6 @@ export default function DashboardLayout({
} }
return ( return (
<main className="relative z-10"> <main className="relative z-10">
<Script id="landbot-script">{`
window.addEventListener('mouseover', initLandbot, { once: true });
window.addEventListener('touchstart', initLandbot, { once: true });
var myLandbot;
function initLandbot() {
if (!myLandbot) {
var s = document.createElement('script');
s.type = "module"
s.async = true;
s.addEventListener('load', function() {
var myLandbot = new Landbot.Livechat({
configUrl: 'https://storage.googleapis.com/landbot.online/v3/H-2923167-WL26NF7VJKJ3PAMV/index.json',
});
});
s.src = 'https://cdn.landbot.io/landbot-3/landbot-3.0.0.mjs';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
}
`}</Script>
<div className="mx-auto container max-w-[1720px] px-14"> <div className="mx-auto container max-w-[1720px] px-14">
<div className="min-h-[100svh] p-14 grid grid-cols-[268px_auto] gap-12 overflow-hidden"> <div className="min-h-[100svh] p-14 grid grid-cols-[268px_auto] gap-12 overflow-hidden">
<Sidebar /> <Sidebar />

View File

@ -19,10 +19,10 @@ export default function Boxes() {
const gpus: IGPU[] = [ const gpus: IGPU[] = [
{ {
id: 'k80', id: 'k80',
title: 'NVIDIA K80', title: 'NVIDIA Tesla K80',
subTitle: '24 GB GDDR5 - 4992 CUDA Cores', subTitle: '24 GB GDDR5 - 4992 CUDA Cores',
price: '$0.15/hour ($110/mo)', price: '$0.15/hour ($110/mo)',
price_usd: 110, //110, price_usd: 110,
}, },
{ {
id: 't1000', id: 't1000',

View File

@ -1,5 +1,10 @@
"use client"; "use client";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import Image from "next/image";
import serverIcon1 from "@/assets/images/server-1-icon.svg";
import serverIcon2 from "@/assets/images/server-2-icon.svg";
import serverIcon3 from "@/assets/images/server-3-icon.svg";
import serverIcon4 from "@/assets/images/server-4-icon.svg";
export default function Box() { export default function Box() {
return ( return (
@ -17,249 +22,91 @@ export default function Box() {
}} }}
className="relative p-5 border border-white/5 bg-[#0E1618]/10 backdrop-blur-sm" className="relative p-5 border border-white/5 bg-[#0E1618]/10 backdrop-blur-sm"
> >
<h3 className="mb-1 font-medium uppercase text-[#0CE77E]">All Systems Operational</h3> <h3 className="mb-1 font-medium uppercase text-[#0CE77E]">Live and preparing servers</h3>
<p className="mb-4 text-sm text-white/75"> <p className="mb-4 text-sm text-white/75">List of our GPUs and their current status</p>
Last updated on{" "}
{new Date(Date.now() - 3 * 60 * 1000)
.toLocaleString("en-US", {
month: "short",
day: "numeric",
hour: "numeric",
minute: "2-digit",
hour12: true,
timeZoneName: "short",
})
.replace(",", "")
.replace("AM", "am")
.replace("PM", "pm")}
</p>
<div className="py-4 border-t border-[#0CE77E]/25 items-center"> <div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center justify-between mb-2"> <div className="flex items-center gap-4">
<h3 className="font-medium text-[#0CE77E]">GPU Instance</h3> <Image src={serverIcon1} alt="" className="w-[40px] h-[40px]" />
<h3 className="font-medium text-[#0CE77E]">99.960% uptime</h3>
</div>
{/* uptime status */} <div>
<div className="relative"> <h3 className="font-medium text-[#0CE77E]">GAMING GPUs</h3>
<div className="flex h-[28px] w-full overflow-visible relative"> <p className="text-sm text-white/75">Total GPUs : 52</p>
{[
{ status: "operational", width: "60%", details: "No incident reported" },
{
status: "degraded",
width: "0.5%",
details: "Resolved - Nvidia driver issue",
},
{ status: "operational", width: "39.5%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div> </div>
</div> </div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center"> <div className="flex">
<div className="flex items-center justify-between mb-2"> <div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<h3 className="font-medium text-[#0CE77E]">Console</h3> <p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 38</p>
<h3 className="font-medium text-[#0CE77E]">99.890% uptime</h3>
</div> </div>
{/* uptime status */} <div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<div className="relative"> <p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 14</p>
<div className="flex h-[28px] w-full overflow-visible relative">
{[
{ status: "operational", width: "20%", details: "No incident reported" },
{
status: "downtime",
width: "0.5%",
details: "Service Unavailable",
},
{ status: "operational", width: "28%", details: "No incident reported" },
{ status: "degraded", width: "0.5%", details: "Updating SMTP" },
{ status: "operational", width: "51%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div> </div>
</div> </div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div>
</div> </div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center"> <div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center justify-between mb-2"> <div className="flex items-center gap-4">
<h3 className="font-medium text-[#0CE77E]">Network</h3> <Image src={serverIcon2} alt="" className="w-[40px] h-[40px]" />
<h3 className="font-medium text-[#0CE77E]">99.940% uptime</h3>
</div>
{/* uptime status */} <div>
<div className="relative"> <h3 className="font-medium text-[#E2F410]">Datacenter GPUs</h3>
<div className="flex h-[28px] w-full overflow-visible relative"> <p className="text-sm text-white/75">Total GPUs : 45</p>
{[
{ status: "operational", width: "34%", details: "No incident reported" },
{
status: "degraded",
width: "0.5%",
details: "Resolved - Unusual high latency on some regions",
},
{ status: "operational", width: "35%", details: "No incident reported" },
{ status: "downtime", width: "0.5%", details: "Service Unavailable" },
{ status: "operational", width: "30%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div>
</div>
))}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div> </div>
</div> </div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center"> <div className="flex">
<div className="flex items-center justify-between mb-2"> <div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<h3 className="font-medium text-[#0CE77E]">Proxy</h3> <p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 33</p>
<h3 className="font-medium text-[#0CE77E]">100% uptime</h3>
</div> </div>
{/* uptime status */} <div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<div className="relative"> <p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 12</p>
<div className="flex h-[28px] w-full overflow-visible relative">
{[{ status: "operational", width: "100%", details: "No incident reported" }].map(
(segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div> </div>
</div> </div>
)
)}
</div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
</div>
</div> </div>
<div className="py-4 border-t border-[#0CE77E]/25 items-center"> <div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center justify-between mb-2"> <div className="flex items-center gap-4">
<h3 className="font-medium text-[#0CE77E]">Database</h3> <Image src={serverIcon3} alt="" className="w-[40px] h-[40px]" />
<h3 className="font-medium text-[#0CE77E]">99.910% uptime</h3>
<div>
<h3 className="font-medium text-[#F65927]">Integrated GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 17</p>
</div>
</div> </div>
{/* uptime status */} <div className="flex">
<div className="relative"> <div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<div className="flex h-[28px] w-full overflow-visible relative"> <p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 12</p>
{[ </div>
{ status: "operational", width: "80%", details: "No incident reported" },
{ <div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
status: "degraded", <p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 5</p>
width: "0.5%",
details: "Resolved - Deprecated DB API",
},
{ status: "operational", width: "19%", details: "No incident reported" },
].map((segment, index) => (
<div
key={index}
className={`h-full group cursor-help relative
${
segment.status === "operational"
? "bg-[#0CE77E]"
: segment.status === "degraded"
? "bg-yellow-500"
: "bg-red-500"
}`}
style={{ width: segment.width }}
>
<div className="absolute invisible z-20 group-hover:visible bg-black/90 text-white text-xs py-1 px-2 rounded -top-8 left-1/2 -translate-x-1/2 whitespace-nowrap">
{segment.status === "operational"
? "Fully Operational"
: segment.status === "degraded"
? "Degraded Performance"
: "System Down"}
<br />
Status: {segment.details}
</div> </div>
</div> </div>
))}
</div> </div>
<div className="mt-2 text-xs text-white/50">Last 30 days - Hover segments for more details</div>
<div className="py-4 border-t border-[#0CE77E]/25 grid grid-cols-[250px_auto] items-center">
<div className="flex items-center gap-4">
<Image src={serverIcon4} alt="" className="w-[40px] h-[40px]" />
<div>
<h3 className="font-medium text-[#0CBFE7]">AI GPUs</h3>
<p className="text-sm text-white/75">Total GPUs : 61</p>
</div>
</div>
<div className="flex">
<div className="flex-1 h-[28px] px-5 bg-[#0CE77E] flex items-center">
<p className="text-sm font-semibold uppercase text-[#0B1315]">Ready : 44</p>
</div>
<div className="h-[28px] px-5 bg-[#0A492F] flex items-center">
<p className="text-sm font-medium uppercase text-[#0CE77E]">PREPARING : 17</p>
</div>
</div> </div>
</div> </div>

View File

@ -1,10 +1,12 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { GeistSans } from "geist/font/sans"; import { GeistSans, GeistMono } from "geist/font";
import { GeistMono } from "geist/font/mono";
import "./globals.css"; import "./globals.css";
import Bg from "@/components/Bg"; import Bg from "@/components/Bg";
import Providers from "@/components/Providers"; import Providers from "@/components/Providers";
const geistSans = GeistSans;
const geistMono = GeistMono;
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Login to Your Dashboard - Vertex", title: "Login to Your Dashboard - Vertex",
description: description:
@ -26,7 +28,7 @@ export default function RootLayout({
}>) { }>) {
return ( return (
<html lang="en"> <html lang="en">
<body className={`${GeistSans.variable} ${GeistMono.className} antialiased bg-[#070F11]`}> <body className={`${geistSans.variable} ${geistMono.className} antialiased bg-[#070F11]`}>
<Providers>{children}</Providers> <Providers>{children}</Providers>
<Bg /> <Bg />
</body> </body>

View File

@ -1,6 +1,5 @@
'use client'; 'use client';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import React from "react"; import React from "react";
import { import {
@ -18,7 +17,6 @@ import {
getAssociatedTokenAddress, getAssociatedTokenAddress,
createTransferInstruction, createTransferInstruction,
TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID,
createAssociatedTokenAccountInstruction, createAssociatedTokenAccountInstruction,
} from "@solana/spl-token"; } from "@solana/spl-token";
@ -44,7 +42,7 @@ const BUSINESS_WALLET = process.env.NEXT_PUBLIC_BUSINESS_WALLET!;
const EMAIL_API_URL = process.env.NEXT_PUBLIC_EMAIL_API_URL!; const EMAIL_API_URL = process.env.NEXT_PUBLIC_EMAIL_API_URL!;
const CUSTOM_TOKEN_API_URL = "https://catools.dev3vds1.link/get/vertex"; const CUSTOM_TOKEN_API_URL = "https://catools.dev3vds1.link/get/vertex";
const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); const USDC_MINT = new PublicKey("Es9vMFrzaCERJ8gLhEvX5yQceQ2uKcXfUrx2Wcikgqay");
const CornerEdge = ({ position }: { position: 'left-top' | 'right-top' | 'left-bottom' | 'right-bottom' }) => { const CornerEdge = ({ position }: { position: 'left-top' | 'right-top' | 'left-bottom' | 'right-bottom' }) => {
const paths = { const paths = {
@ -311,7 +309,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
// Second attempt: Try using Jupiter Aggregator API for Solana tokens // Second attempt: Try using Jupiter Aggregator API for Solana tokens
try { try {
// Jupiter provides price data for most Solana tokens // Jupiter provides price data for most Solana tokens
const jupiterUrl = `https://lite-api.jup.ag/price/v2?ids=${tokenAddress}`; const jupiterUrl = `https://price.jup.ag/v4/price?ids=${tokenAddress}`;
const jupResponse = await axios.get(jupiterUrl); const jupResponse = await axios.get(jupiterUrl);
if (jupResponse.data && if (jupResponse.data &&
@ -425,8 +423,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
setErrorMsg(null); setErrorMsg(null);
setSuccessMsg(null); setSuccessMsg(null);
let priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd;
try { try {
if (!userEmail || !isValidEmail(userEmail)) { if (!userEmail || !isValidEmail(userEmail)) {
throw new Error("Please enter a valid email address for your receipt."); throw new Error("Please enter a valid email address for your receipt.");
@ -437,10 +433,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
throw new Error("No connected Solana wallet found or wallet can't sign."); throw new Error("No connected Solana wallet found or wallet can't sign.");
} }
// Define the correct program IDs
const TOKEN_PROGRAM_ID = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
const fromPubKey = new PublicKey(solWallet.address); const fromPubKey = new PublicKey(solWallet.address);
const toPubKey = new PublicKey(BUSINESS_WALLET); const toPubKey = new PublicKey(BUSINESS_WALLET);
const transaction = new Transaction(); const transaction = new Transaction();
@ -449,7 +441,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
let amountDisplay = ""; let amountDisplay = "";
if (selectedToken === "SOL") { if (selectedToken === "SOL") {
// SOL Payment Logic (unchanged)
const { data } = await axios.get( const { data } = await axios.get(
"https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd" "https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd"
); );
@ -465,7 +456,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
}) })
); );
} else { } else {
// Token Payment Logic // For both USDC and VERTEX tokens
const selectedMint = selectedToken === "USDC" const selectedMint = selectedToken === "USDC"
? USDC_MINT ? USDC_MINT
: new PublicKey(customToken?.address || ""); : new PublicKey(customToken?.address || "");
@ -477,45 +468,31 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
tokenPrice = customTokenPrice || 0.5; tokenPrice = customTokenPrice || 0.5;
} }
const priceUsd = selectedToken === "VERTEX" ? gpu.price_usd * 0.9 : gpu.price_usd; const tokenAmount = (gpu.price_usd / tokenPrice).toFixed(tokenDecimals);
const tokenAmount = (priceUsd / tokenPrice).toFixed(tokenDecimals);
amountDisplay = `${tokenAmount} ${selectedToken}`; amountDisplay = `${tokenAmount} ${selectedToken}`;
// Get or create token accounts using the correct method const fromTokenAccount = await getAssociatedTokenAddress(selectedMint, fromPubKey);
const fromTokenAccount = await getAssociatedTokenAddress( const toTokenAccount = await getAssociatedTokenAddress(selectedMint, toPubKey);
selectedMint,
fromPubKey,
false,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
);
const toTokenAccount = await getAssociatedTokenAddress( // Check if destination token account exists, if not create it
selectedMint,
toPubKey,
false,
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
);
// Check if destination token account exists
const toTokenAccountInfo = await connection.getAccountInfo(toTokenAccount); const toTokenAccountInfo = await connection.getAccountInfo(toTokenAccount);
if (!toTokenAccountInfo) { if (!toTokenAccountInfo) {
// Create associated token account with explicit program IDs // Import the necessary function
const { createAssociatedTokenAccountInstruction } = await import("@solana/spl-token");
// Add instruction to create the associated token account for the business wallet
transaction.add( transaction.add(
createAssociatedTokenAccountInstruction( createAssociatedTokenAccountInstruction(
fromPubKey, fromPubKey, // payer
toTokenAccount, toTokenAccount, // associated token account address
toPubKey, toPubKey, // owner of the new account
selectedMint, selectedMint // token mint
TOKEN_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID
) )
); );
} }
// Add token transfer instruction with explicit program ID // Add the transfer instruction after ensuring the account exists
transaction.add( transaction.add(
createTransferInstruction( createTransferInstruction(
fromTokenAccount, fromTokenAccount,
@ -528,24 +505,22 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
); );
} }
// Set transaction properties (unchanged)
transaction.feePayer = fromPubKey; transaction.feePayer = fromPubKey;
const { blockhash } = await connection.getLatestBlockhash(); const { blockhash } = await connection.getLatestBlockhash();
transaction.recentBlockhash = blockhash; transaction.recentBlockhash = blockhash;
// Sign and send (unchanged)
const signedTx = await solWallet.signTransaction(transaction); const signedTx = await solWallet.signTransaction(transaction);
txId = await connection.sendRawTransaction(signedTx.serialize()); txId = await connection.sendRawTransaction(signedTx.serialize());
await connection.confirmTransaction(txId, "confirmed"); await connection.confirmTransaction(txId, "confirmed");
// Process order completion (unchanged)
await axios.post(EMAIL_API_URL, { await axios.post(EMAIL_API_URL, {
email: userEmail, email: userEmail,
product: gpu.title, product: gpu.title,
price_hour: gpu.price_per_hour, price_hour: gpu.price_per_hour,
price: priceUsd.toFixed(2) price: gpu.price_usd.toFixed(2)
}); });
// Generate a random order ID (in production this would come from the backend)
const generatedOrderId = `${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}`; const generatedOrderId = `${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}-${Math.floor(Math.random() * 900) + 100}`;
setOrderId(generatedOrderId); setOrderId(generatedOrderId);
@ -553,7 +528,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
{ {
gpu: `${gpu.id} ${gpu.title}`, gpu: `${gpu.id} ${gpu.title}`,
user_email: userEmail, user_email: userEmail,
amount_usd: priceUsd, amount_usd: gpu.price_usd,
token_used: tokenUsed, token_used: tokenUsed,
token_amount: amountDisplay, token_amount: amountDisplay,
token_tx_signature: txId, token_tx_signature: txId,
@ -576,7 +551,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
{ {
gpu: `${gpu.id} ${gpu.title}`, gpu: `${gpu.id} ${gpu.title}`,
user_email: userEmail, user_email: userEmail,
amount_usd: priceUsd, amount_usd: gpu.price_usd,
token_used: selectedToken, token_used: selectedToken,
status: "failed", status: "failed",
error_message: err.message || "Unknown error", error_message: err.message || "Unknown error",
@ -596,10 +571,6 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
}; };
if (!isOpen) return null; if (!isOpen) return null;
const displayPrice = selectedToken === 'VERTEX'
? (gpu.price_usd * 0.9).toFixed(2)
: gpu.price_usd.toFixed(2);
// Show failure screen if payment failed // Show failure screen if payment failed
if (paymentFailure) { if (paymentFailure) {
@ -732,7 +703,7 @@ export const GpuPaymentModal = ({ isOpen, onClose, gpu }: GpuPaymentModalProps)
<div className="flex justify-between items-center p-3 w-full"> <div className="flex justify-between items-center p-3 w-full">
<span className="text-base font-medium text-white">Total Price</span> <span className="text-base font-medium text-white">Total Price</span>
<div className="flex gap-3 items-center"> <div className="flex gap-3 items-center">
<span className="text-base font-bold text-[#0CE77E]">${displayPrice}</span> <span className="text-base font-bold text-[#0CE77E]">${gpu.price_usd}</span>
<span className="text-base text-[#0CE77E]">(~{currentTokenAmount} {selectedToken})</span> <span className="text-base text-[#0CE77E]">(~{currentTokenAmount} {selectedToken})</span>
</div> </div>
</div> </div>

View File

@ -47,6 +47,20 @@ export default function Sidebar() {
{ {
title: "Dashboard", title: "Dashboard",
links: [ links: [
{
icon: (
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M5.31636 3.57182L4.56635 4.15724C3.42886 5.04511 2.86011 5.48905 2.55505 6.115C2.25 6.74094 2.25 7.46404 2.25 8.91022V10.4786C2.25 13.3172 2.25 14.7364 3.12868 15.6182C4.00736 16.5 5.42157 16.5 8.25 16.5H9.75C12.5784 16.5 13.9927 16.5 14.8713 15.6182C15.75 14.7364 15.75 13.3172 15.75 10.4786V8.91022C15.75 7.46404 15.75 6.74094 15.445 6.115C15.1399 5.48905 14.5712 5.04511 13.4336 4.15724L12.6836 3.57182C10.9141 2.19061 10.0293 1.5 9 1.5C7.9707 1.5 7.0859 2.19061 5.31636 3.57182Z"
stroke="#0CE77E"
strokeWidth="1.125"
strokeLinejoin="round"
/>
</svg>
),
title: "Home",
href: "/dashboard/home",
},
{ {
icon: ( icon: (
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
@ -216,7 +230,7 @@ export default function Sidebar() {
<div className="border border-white/5 bg-[#0E1618] h-full p-5 flex flex-col justify-between"> <div className="border border-white/5 bg-[#0E1618] h-full p-5 flex flex-col justify-between">
<div> <div>
<div className="pb-5 border-b border-[#0CE77E]/25 flex justify-center"> <div className="pb-5 border-b border-[#0CE77E]/25 flex justify-center">
<Link href={"/dashboard/rent"}> <Link href={"/dashboard/home"}>
<Image src={iconImg} alt="" width={32} height={32} /> <Image src={iconImg} alt="" width={32} height={32} />
</Link> </Link>
</div> </div>