Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanpachori committed Oct 9, 2024
1 parent 13df0c3 commit e1d67be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
19 changes: 10 additions & 9 deletions apps/client/app/(lobby)/event/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
"use client"
"use client";

import OrderBook from '@/components/landing/Orderbook';
import { useParams } from 'next/navigation'
import OrderBook from "@/components/landing/Orderbook";
import { useParams } from "next/navigation";
/*
TODO:
1. server actiosn to fetch the event from the event id (not sure but for now).
2. Add sources of truth.
3. Add event details like name and all.
*/
export default function Page() {
const {id} = useParams()
const { id } = useParams();
console.log(id);
const eventId = Array.isArray(id) ? id[id.length - 1] : id;


if (!eventId) {
return <div>Error: Event ID not found</div>;
}
return <div>
<OrderBook eventId = {eventId}/>
</div>
}
return (
<div>
<OrderBook eventId={eventId} />
</div>
);
}
14 changes: 6 additions & 8 deletions apps/client/app/(lobby)/portfolio/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getTrades } from "@/actions/Trade/getTrades";
import Portfolio from "../../../components/landing/Portfolio";
import { getEventDetails } from "@/actions/Event/getEventDetails";
import axios from "axios";
import {toast, Toaster} from "react-hot-toast"
import { toast, Toaster } from "react-hot-toast";

export interface Trade {
id: string;
Expand All @@ -18,7 +18,7 @@ export interface Trade {
side: "YES" | "NO";
title?: string;
gainloss: number | null;
status : "ACTIVE"|"PAST"
status: "ACTIVE" | "PAST";
}
export interface Portfolio {
id: string;
Expand Down Expand Up @@ -50,15 +50,13 @@ const Page = () => {
}, [userId]);

const { status } = useSession();
const userId = "cm1r277l500178uzhh6kiewxa";


const getPortfolioDetails = useCallback(async (userId: string) => {
setLoading(true);
try {
const portfolio = await getTrades(userId);
console.log("portfolio", portfolio);

setPortfolioData(portfolio);
if (portfolio) {
const updatedTrades = await fetchTitles(portfolio.trades);
Expand Down Expand Up @@ -138,11 +136,11 @@ const Page = () => {
price: trade.price,
quantity: trade.quantity,
type: trade.side,
gainloss : trade.gainloss,
status :trade.status
gainloss: trade.gainloss,
status: trade.status,
}))}
/>
<Toaster position="top-center"/>
<Toaster position="top-center" />
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/client/components/landing/Orderbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getEventDetails } from "@/actions/Event/getEventDetails";
import { ArrowUpDown } from "lucide-react";

import { useSession } from "next-auth/react";
=======

import {toast, Toaster} from "react-hot-toast"


Expand Down

0 comments on commit e1d67be

Please sign in to comment.