Skip to content

Commit b11e03d

Browse files
balogh.adam@icloud.combalogh.adam@icloud.com
authored andcommitted
fixups
1 parent e621b77 commit b11e03d

2 files changed

Lines changed: 19 additions & 23 deletions

File tree

lib/hooks/useNavItems.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,6 @@ export default function useNavItems(): ReturnType {
264264
isActive: blockchainNavItems.flat().some(item => isInternalItem(item) && item.isActive),
265265
subItems: blockchainNavItems,
266266
},
267-
{
268-
text: 'AI Workflows',
269-
nextRoute: { pathname: '/workflows' as const },
270-
icon: 'opengradient/workflow',
271-
isActive: pathname.startsWith('/workflows'),
272-
},
273267
// {
274268
// text: 'Tokens',
275269
// icon: 'token',

ui/home/HeroBanner.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
// we use custom heading size for hero banner
22

33
import { Box, Flex, VStack, Text, Grid } from '@chakra-ui/react';
4-
import { useQuery } from '@tanstack/react-query';
54
import React from 'react';
65

76
import { route } from 'nextjs-routes';
87

98
import config from 'configs/app';
109
import useApiQuery from 'lib/api/useApiQuery';
11-
import { getAllTasks } from 'lib/opengradient/contracts/scheduler';
1210
import { HOMEPAGE_STATS, HOMEPAGE_STATS_MICROSERVICE } from 'stubs/stats';
1311
import { LinkBox, LinkOverlay } from 'toolkit/chakra/link';
1412
import { Skeleton } from 'toolkit/chakra/skeleton';
@@ -46,10 +44,12 @@ const HeroBanner = () => {
4644
},
4745
});
4846

49-
const workflowsQuery = useQuery({
50-
queryKey: [ 'opengradient', 'getAllTasks' ],
51-
queryFn: getAllTasks,
52-
refetchOnMount: false,
47+
const settlementContractAddress = '0xAa3bB22c5Ef24fe3837134A25A4D801308E2516d';
48+
const settlementQuery = useApiQuery('address_counters', {
49+
pathParams: { hash: settlementContractAddress },
50+
queryOptions: {
51+
refetchOnMount: false,
52+
},
5353
});
5454

5555
const totalTransactions = React.useMemo(() => {
@@ -76,11 +76,13 @@ const HeroBanner = () => {
7676
return null;
7777
}, [ statsQuery.data, apiQuery.data ]);
7878

79-
const activeWorkflowsCount = React.useMemo(() => {
80-
const tasks = workflowsQuery.data ?? [];
81-
const now = BigInt(Math.floor(Date.now() / 1000));
82-
return tasks.filter((t) => t.endTime > now).length;
83-
}, [ workflowsQuery.data ]);
79+
const llmBatchSettlementsCount = React.useMemo(() => {
80+
const countersData = settlementQuery.data;
81+
if (countersData?.transactions_count) {
82+
return Number(countersData.transactions_count);
83+
}
84+
return null;
85+
}, [ settlementQuery.data ]);
8486

8587
const formatNumber = (num: number | null, decimals: number = 2): string => {
8688
if (num === null) return '—';
@@ -342,7 +344,7 @@ const HeroBanner = () => {
342344
</Skeleton>
343345
</LinkBox>
344346

345-
{ /* Active Workflows */ }
347+
{ /* LLM Batch Settlements */ }
346348
<LinkBox
347349
p={ 5 }
348350
position="relative"
@@ -359,7 +361,7 @@ const HeroBanner = () => {
359361
}}
360362
>
361363
<LinkOverlay
362-
href={ route({ pathname: '/workflows' }) }
364+
href={ route({ pathname: '/address/[hash]', query: { hash: settlementContractAddress } }) }
363365
noIcon
364366
/>
365367
<Flex
@@ -375,15 +377,15 @@ const HeroBanner = () => {
375377
color={{ _light: 'rgba(6, 182, 212, 0.9)', _dark: 'rgba(125, 211, 252, 1)' }}
376378
fontFamily="system-ui, -apple-system, sans-serif"
377379
>
378-
AI Workflows
380+
LLM Batch Settlements
379381
</Text>
380382
<IconSvg
381-
name="opengradient/workflow"
383+
name="transactions_slim"
382384
boxSize={ 3 }
383385
color={{ _light: 'rgba(6, 182, 212, 0.9)', _dark: 'rgba(125, 211, 252, 1)' }}
384386
/>
385387
</Flex>
386-
<Skeleton loading={ workflowsQuery.isPlaceholderData } w="fit-content">
388+
<Skeleton loading={ settlementQuery.isPlaceholderData } w="fit-content">
387389
<Text
388390
fontSize="32px"
389391
fontWeight={ 200 }
@@ -392,7 +394,7 @@ const HeroBanner = () => {
392394
fontFamily="system-ui, -apple-system, sans-serif"
393395
lineHeight="1"
394396
>
395-
{ activeWorkflowsCount.toLocaleString() }
397+
{ formatNumber(llmBatchSettlementsCount) }
396398
</Text>
397399
</Skeleton>
398400
</LinkBox>

0 commit comments

Comments
 (0)