Make trade cards clickable to navigate to detail page
This commit is contained in:
parent
43a58565c0
commit
7019bf2e1d
1 changed files with 10 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useState, useCallback, CSSProperties } from "react";
|
import { useEffect, useState, useCallback, CSSProperties } from "react";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
import { Permission } from "../auth-context";
|
import { Permission } from "../auth-context";
|
||||||
import { api } from "../api";
|
import { api } from "../api";
|
||||||
import { Header } from "../components/Header";
|
import { Header } from "../components/Header";
|
||||||
|
|
@ -21,6 +22,7 @@ import {
|
||||||
type ExchangeResponse = components["schemas"]["ExchangeResponse"];
|
type ExchangeResponse = components["schemas"]["ExchangeResponse"];
|
||||||
|
|
||||||
export default function TradesPage() {
|
export default function TradesPage() {
|
||||||
|
const router = useRouter();
|
||||||
const { user, isLoading, isAuthorized } = useRequireAuth({
|
const { user, isLoading, isAuthorized } = useRequireAuth({
|
||||||
requiredPermission: Permission.VIEW_OWN_EXCHANGES,
|
requiredPermission: Permission.VIEW_OWN_EXCHANGES,
|
||||||
fallbackRedirect: "/",
|
fallbackRedirect: "/",
|
||||||
|
|
@ -113,7 +115,14 @@ export default function TradesPage() {
|
||||||
const status = getTradeStatusDisplay(trade.status);
|
const status = getTradeStatusDisplay(trade.status);
|
||||||
const isBuy = trade.direction === "buy";
|
const isBuy = trade.direction === "buy";
|
||||||
return (
|
return (
|
||||||
<div key={trade.id} style={tradeCardStyles.tradeCard}>
|
<div
|
||||||
|
key={trade.id}
|
||||||
|
style={{
|
||||||
|
...tradeCardStyles.tradeCard,
|
||||||
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
onClick={() => router.push(`/trades/${trade.id}`)}
|
||||||
|
>
|
||||||
<div style={tradeCardStyles.tradeHeader}>
|
<div style={tradeCardStyles.tradeHeader}>
|
||||||
<div style={tradeCardStyles.tradeInfo}>
|
<div style={tradeCardStyles.tradeInfo}>
|
||||||
<div style={tradeCardStyles.tradeTime}>
|
<div style={tradeCardStyles.tradeTime}>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue