"use client"; import React, { useEffect, useState } from "react"; import Link from "next/link"; const formatCurrency = (amount, currency = "USD") => { return new Intl.NumberFormat("en-US", { style: "currency", currency: currency, }).format(amount); }; const urlFormatter = (url) => { if (!url.startsWith("http://") && !url.startsWith("https://")) { url = "https://" + url; } return url; }; const urlCleaner = (url) => { if (url.startsWith("http://")) { url = url.substr(7); } else if (url.startsWith("https://")) { url = url.substr(8); } return url; }; const formattedDate = (date) => new Date(date).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", }); function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } export default function PortalSelector() { const name = "John Doe"; const client_id = "12345"; const email = "johndoe@example.com"; const [monthlyPayment, setMonthlyPayment] = useState(100); const [additionalPayment, setadditionalPayment] = useState(20); const [manager, setManager] = useState("Fausto Vasconez"); const [managerEmail, setManagerEmail] = useState("support@rankrunners.net"); const [managerPosition, setManagerPosition] = useState( "Technical Strategist" ); const [projectArray, setProjectArray] = useState([]); const [paymentLogArray, setpaymentLogArray] = useState([]); const [totalPayment, setTotalPayment] = useState(0); useEffect(() => { setTotalPayment(monthlyPayment + additionalPayment); // Simulate fetching project and payment log data setProjectArray([ { Title: "Project 1", URL: "https://example.com", "Price Monthly": 100, Services: "Service1, Service2", "PDF Contract": [], }, ]); setpaymentLogArray([ { id: "PAY123", created: "2025-01-01", amount_paid: 120, }, ]); }, []); return (
{project["Title"]} | {project["URL"] && ( {urlCleaner(project["URL"])} )} {!project["URL"] && "No URL"} | ${project["Price Monthly"]}/mo |
---|---|---|
{project["Services"].replace(/,/g, ", ")} | {project["PDF Contract"] && project["PDF Contract"].length > 0 ? ( project["PDF Contract"].map((contract, index) => ( View PDF Contract )) ) : ( No PDF Attachment )} |
You currently have no projects. Contact your account manager
You don't have any payment history. If you have, please refresh the page or contact your account manager
Payment ID | Date | Amount Paid (USD) |
---|---|---|
{payment["id"]} | {formattedDate(payment["created"])} | {payment["amount_paid"]} |