Commit e2043886 by Arjun Jhukal

updated the credentails sc and gc

parent 208b0661
...@@ -10,7 +10,11 @@ import { CardPasswordField } from './CardPasswordHandler' ...@@ -10,7 +10,11 @@ import { CardPasswordField } from './CardPasswordHandler'
import CopyToClipboard from './CopyToClipboard' import CopyToClipboard from './CopyToClipboard'
export default function CredentialsCard({ cred }: { cred: CredentialsProps }) { export default function CredentialsCard({ cred, balance }: { cred: CredentialsProps; balance: any }) {
const currentBalance = balance?.data?.game_information?.[cred.name] || null;
const scValue =
currentBalance?.type === "sc" ? currentBalance.balance ?? 0 : null;
return ( return (
<Box sx={{ <Box sx={{
borderRadius: "24px", borderRadius: "24px",
...@@ -20,7 +24,10 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) { ...@@ -20,7 +24,10 @@ export default function CredentialsCard({ cred }: { cred: CredentialsProps }) {
<Image src={cred?.logo || "/assets/images/fallback.png"} alt={cred?.full_name} className='rounded-full aspect-square' width={74} height={74} /> <Image src={cred?.logo || "/assets/images/fallback.png"} alt={cred?.full_name} className='rounded-full aspect-square' width={74} height={74} />
<div className="game__detail"> <div className="game__detail">
<strong className='block text-[16px] text-white'>{cred.full_name}</strong> <strong className='block text-[16px] text-white'>{cred.full_name}</strong>
<p className='text-[14px] my-[6px]'>SC: 59</p> <p className="text-[14px] my-[6px] uppercase">
{currentBalance.type}: {scValue !== null ? scValue : "N/A"}
</p>
<BalanceRefresh label='Refresh Balance' icon={true} /> <BalanceRefresh label='Refresh Balance' icon={true} />
</div> </div>
</div> </div>
......
import React from 'react' import React from 'react'
import CredentialsCard from './CredentialsCard' import CredentialsCard from './CredentialsCard'
import { getUserGameCredentials } from '@/serverApi/game'; import { getUserGameBalance, getUserGameCredentials } from '@/serverApi/game';
export default async function GameCredentialsPage() { export default async function GameCredentialsPage() {
const creds = await getUserGameCredentials(); const creds = await getUserGameCredentials();
const balance = await getUserGameBalance();
return ( return (
<section className="credentials__listing "> <section className="credentials__listing ">
<div className="section__title mb-8 lg:max-w-[521px]"> <div className="section__title mb-8 lg:max-w-[521px]">
...@@ -15,7 +16,7 @@ export default async function GameCredentialsPage() { ...@@ -15,7 +16,7 @@ export default async function GameCredentialsPage() {
{creds?.data.length ? creds?.data.map((cred) => ( {creds?.data.length ? creds?.data.map((cred) => (
<div className="col-span-1" key={cred.full_name}> <div className="col-span-1" key={cred.full_name}>
<CredentialsCard cred={cred} /> <CredentialsCard cred={cred} balance={balance} />
</div> </div>
)) : ""} )) : ""}
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment