snakes fixed, few fixes

This commit is contained in:
Sewmina 2025-05-31 04:09:16 +05:30
parent 323890e136
commit 500b60ffde
7 changed files with 13 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -81,7 +81,10 @@ export default function Activities() {
const formatActivityMessage = (activity: Activity) => { const formatActivityMessage = (activity: Activity) => {
const ownerUsername = userData[activity.owner_id]?.username || "Anonymous"; const ownerUsername = userData[activity.owner_id]?.username || "Anonymous";
const joinerUsername = activity.joiner_id ? (userData[activity.joiner_id]?.username || "Anonymous") : null; const joinerUsername = activity.joiner_id ? (userData[activity.joiner_id]?.username || "Anonymous") : null;
const amount = parseFloat(activity.amount); let amount = parseFloat(activity.amount);
if(activity.type == "won"){
amount = amount * 1.9;
}
const formattedAmount = amount > 0 ? `${amount} SOL` : ""; const formattedAmount = amount > 0 ? `${amount} SOL` : "";
switch (activity.type) { switch (activity.type) {

View File

@ -10,7 +10,6 @@ import { createBet } from "@/shared/solana_helpers";
import { Game } from "@/types/Game"; import { Game } from "@/types/Game";
import { connection, EXPLORER_TX_TEMPLATE } from "@/data/shared"; import { connection, EXPLORER_TX_TEMPLATE } from "@/data/shared";
import { CONFIRMATION_THRESHOLD } from "@/shared/constants"; import { CONFIRMATION_THRESHOLD } from "@/shared/constants";
import { fetchUserById, showNewGameNotification } from "@/shared/data_fetcher";
interface GameModalProps { interface GameModalProps {
isOpen: boolean; isOpen: boolean;
onClose: () => void; onClose: () => void;
@ -64,7 +63,7 @@ export default function GameModal({ isOpen, onClose }: GameModalProps) {
setIsProcessing(true); setIsProcessing(true);
toast.loading("Creating Game"); toast.loading("Creating Game");
try { try {
const ownerProfile = await fetchUserById(user?.id ?? ""); //const ownerProfile = await fetchUserById(user?.id ?? "");
const tx = await createBet(wallet, user?.id ?? "", selectedPrice, selectedGame.id, false); const tx = await createBet(wallet, user?.id ?? "", selectedPrice, selectedGame.id, false);
const url = EXPLORER_TX_TEMPLATE.replace("{address}", tx); const url = EXPLORER_TX_TEMPLATE.replace("{address}", tx);
if (tx.length > 5) { if (tx.length > 5) {
@ -78,7 +77,7 @@ export default function GameModal({ isOpen, onClose }: GameModalProps) {
}, },
}); });
showNewGameNotification(ownerProfile?.username ?? "", selectedGame.name, selectedPrice.toString()); //showNewGameNotification(ownerProfile?.username ?? "", selectedGame.name, selectedPrice.toString());
}) })

View File

@ -36,10 +36,10 @@ export function HowItWorksModal({ isOpen, onClose }: HowItWorksModalProps) {
<div className="space-y-4"> <div className="space-y-4">
{[ {[
{ step: "Sign In or Connect Your Wallet", desc: "Sign up with X, Google, or connect an existing wallet—your wallet is created instantly and securely with Privy." }, { step: "Sign In or Connect Your Wallet", desc: "Log in with X, Google, or connect your wallet. A secure wallet is created instantly with Privy." },
{ step: "Create or Join a Game", desc: "Start your own match with your preferred entry amount, or join an existing one." }, { step: "Create or Join a Game", desc: "Start a game with your own entry amount or join one that's already waiting." },
{ step: "Place Your Entry", desc: "Confirm it and get ready to play." }, { step: "Enter the Game", desc: "Confirm your entry and stay on the website—the game will start automatically once all players are ready." },
{ step: "Win & Get Paid", desc: "Win the game and your prize is automatically sent to your wallet." }, { step: "Win and Get Paid", desc: "Win the match and your prize goes straight to your wallet." },
].map(({ step, desc }, index) => ( ].map(({ step, desc }, index) => (
<div key={index}> <div key={index}>
<h3 className="text-[rgb(248,144,22)] font-bold text-lg"> <h3 className="text-[rgb(248,144,22)] font-bold text-lg">

View File

@ -21,7 +21,8 @@ export async function showNewGameNotification(username:string, game:string, wage
export async function add_new_activity(type:string, owner_id:string, joiner_id:string, game:string, amount:number ){ export async function add_new_activity(type:string, owner_id:string, joiner_id:string, game:string, amount:number ){
try{ try{
const url = `${API_URL}add_activity.php?type=${type}&owner_id=${owner_id}&joiner_id=${joiner_id}&game=${game}&amount=${amount}`; const isDevnet = CLUSTER_URL === clusterApiUrl("devnet");
const url = `${API_URL}add_activity.php?type=${type}&owner_id=${owner_id}&joiner_id=${joiner_id}&game=${game}&amount=${amount}&devnet=${isDevnet ? "1" : "0"}`;
console.log(url); console.log(url);
await fetch(url); await fetch(url);
}catch(error){ }catch(error){