Skip to content

Commit eeb67db

Browse files
authored
feat: predict agents feature parity (#77)
1 parent 8fe3286 commit eeb67db

4 files changed

Lines changed: 27 additions & 31 deletions

File tree

apps/predict-ui/src/app/agent.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { Card } from '../components/ui/Card';
1414
import { COLOR } from '../constants/theme';
1515
import { useAgentDetails } from '../hooks/useAgentDetails';
1616
import { useFeatures } from '../hooks/useFeatures';
17-
import { isOmenstratAgent } from '../utils/agentMap';
1817

1918
const AgentContent = styled.div`
2019
display: flex;
@@ -110,7 +109,7 @@ export const Agent = () => {
110109
lastActiveAt={agentDetails.last_active_at}
111110
/>
112111
<AgentPerformance performance={performance} />
113-
{isOmenstratAgent && <ProfitOverTime />}
112+
<ProfitOverTime />
114113
<TradeHistory />
115114
<Strategy />
116115
<ChatContent />

apps/predict-ui/src/components/Performance.tsx

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useMemo } from 'react';
55
import { CURRENCY, CurrencyCode } from '../constants/currency';
66
import { COLOR } from '../constants/theme';
77
import { AgentMetricsResponse } from '../types';
8-
import { isOmenstratAgent } from '../utils/agentMap';
98
import { Card } from './ui/Card';
109

1110
const { Text, Title } = Typography;
@@ -33,13 +32,11 @@ export const AgentPerformance = ({ performance }: { performance: AgentMetricsRes
3332
value: getValue(metrics.all_time_funds_used || 0, currency),
3433
tooltip: 'Total funds your agent has allocated to prediction-market trades over time.',
3534
},
36-
isOmenstratAgent
37-
? {
38-
title: 'All time profit',
39-
value: getValue(metrics.all_time_profit || 0, currency),
40-
tooltip: `The total net profit your agent has generated across all trades. With your All-time funds used, this gives an ROI of ${((metrics.roi ?? 0) * 100).toFixed(2)}%.`,
41-
}
42-
: null,
35+
{
36+
title: 'All time profit',
37+
value: getValue(metrics.all_time_profit || 0, currency),
38+
tooltip: `The total net profit your agent has generated across all trades. With your All-time funds used, this gives an ROI of ${((metrics.roi ?? 0) * 100).toFixed(2)}%.`,
39+
},
4340
{
4441
title: 'Funds locked in markets',
4542
value: getValue(metrics.funds_locked_in_markets || 0, currency),
@@ -56,16 +53,14 @@ export const AgentPerformance = ({ performance }: { performance: AgentMetricsRes
5653
? Intl.NumberFormat('en-US').format(stats.predictions_made)
5754
: '0',
5855
},
59-
isOmenstratAgent
60-
? {
61-
title: 'Prediction accuracy',
62-
value:
63-
stats.prediction_accuracy === null
64-
? 'Will appear with the first resolved market.'
65-
: `${(stats.prediction_accuracy * 100).toFixed(2)}%`,
66-
variant: stats.prediction_accuracy === null ? 'text' : 'title',
67-
}
68-
: null,
56+
{
57+
title: 'Prediction accuracy',
58+
value:
59+
stats.prediction_accuracy === null
60+
? 'Will appear with the first resolved market.'
61+
: `${(stats.prediction_accuracy * 100).toFixed(2)}%`,
62+
variant: stats.prediction_accuracy === null ? 'text' : 'title',
63+
},
6964
];
7065

7166
return items.filter(isPerformanceItem);

apps/predict-ui/src/components/ProfitOverTime/ProfitOverTime.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ export const ProfitOverTime = () => {
5757

5858
return (
5959
<Card $gap="24px">
60-
<Flex justify="space-between" align="center">
61-
<Title level={4} className="m-0 font-normal">
62-
Profit Over Time
63-
</Title>
60+
<Flex justify="space-between" align="start">
61+
<Flex vertical gap={4}>
62+
<Title level={4} className="m-0 font-normal">
63+
Profit Over Time
64+
</Title>
65+
<Text type="secondary" className="text-sm" style={{ maxWidth: 320 }}>
66+
Each timeframe begins at $0, highlighting profit movement within the selected range
67+
</Text>
68+
</Flex>
6469
{points.length > 0 && (
6570
<Segmented<AgentWindow>
6671
options={WINDOW_OPTIONS}

apps/predict-ui/src/components/TradeHistory/TradeHistory.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { COLOR } from '../../constants/theme';
1212
import { useAgentDetails } from '../../hooks/useAgentDetails';
1313
import { useTradeHistory } from '../../hooks/useTradeHistory';
1414
import { TradeHistoryItem } from '../../types';
15-
import { isOmenstratAgent, isPolystratAgent } from '../../utils/agentMap';
15+
import { isPolystratAgent } from '../../utils/agentMap';
1616
import { getPolymarketProfileUrl } from '../../utils/urls';
1717
import { Card } from '../ui/Card';
1818
import { PositionDetailsModal } from './PositionDetailsModal/PositionDetailsModal';
@@ -188,7 +188,6 @@ export const TradeHistory = () => {
188188
dataSource={data?.items ?? []}
189189
loading={isLoading}
190190
rowKey={(record) => record.id}
191-
rowHoverable={isOmenstratAgent}
192191
pagination={{
193192
current: currentPage,
194193
pageSize: PAGE_SIZE,
@@ -198,12 +197,10 @@ export const TradeHistory = () => {
198197
}}
199198
onRow={(record) => ({
200199
onClick: () => {
201-
if (isOmenstratAgent) {
202-
setSelectedPositionId(record.id);
203-
setIsPositionDetailsModalOpen(true);
204-
}
200+
setSelectedPositionId(record.id);
201+
setIsPositionDetailsModalOpen(true);
205202
},
206-
style: isOmenstratAgent ? { cursor: 'pointer' } : undefined,
203+
style: { cursor: 'pointer' },
207204
})}
208205
/>
209206
)}

0 commit comments

Comments
 (0)