Skip to content

Commit

Permalink
feat: add more trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
HuberTRoy committed Jan 20, 2025
1 parent 90db59d commit 4ad6cd9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/pages/delegator/Indexers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@ import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { Outlet } from 'react-router';
import { AppPageHeader } from '@components/AppPageHeader';
import { ChatBoxPlanTextTrigger, Typography } from '@subql/components';

import { useChatBoxStore } from 'src/stores/chatbox';

export const Indexers: React.FC = () => {
const { t } = useTranslation();

const { chatBoxRef } = useChatBoxStore();
return (
<>
<AppPageHeader title={t('indexer.indexers')} desc={t('allIndexers.desc')} />
<AppPageHeader
title={
<div className="col-flex" style={{ gap: '8px' }}>
<Typography variant="h5">{t('indexer.indexers')}</Typography>
<ChatBoxPlanTextTrigger triggerMsg="Which operator should I delegate to?" chatBoxInstance={chatBoxRef}>
Which operator should I delegate to?
</ChatBoxPlanTextTrigger>
</div>
}
desc={t('allIndexers.desc')}
/>
<Outlet></Outlet>
</>
);
Expand Down
16 changes: 14 additions & 2 deletions src/pages/delegator/MyDelegation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useMinCommissionRate } from '@hooks/useMinCommissionRate';
import { FormatCardLine } from '@pages/account';
import { BalanceLayout } from '@pages/dashboard';
import { RewardsLineChart } from '@pages/dashboard/components/RewardsLineChart/RewardsLineChart';
import { Spinner, SubqlCard, TableText, TableTitle, Typography } from '@subql/components';
import { ChatBoxPlanTextTrigger, Spinner, SubqlCard, TableText, TableTitle, Typography } from '@subql/components';
import {
truncFormatEtherStr,
useAsyncMemo,
Expand All @@ -48,6 +48,7 @@ import { parseEther } from 'ethers/lib/utils';
import { t, TFunction } from 'i18next';

import { PER_MILL } from 'src/const/const';
import { useChatBoxStore } from 'src/stores/chatbox';

import { formatNumberWithLocale, formatSQT } from '../../utils/numberFormatters';
import { DoDelegate } from './DoDelegate';
Expand Down Expand Up @@ -455,6 +456,7 @@ export const MyDelegation: React.FC = () => {
const { account } = useWeb3();
const filterParams = { delegator: account ?? '', filterIndexer: account ?? '', offset: 0 };
const { getDisplayedCommission } = useMinCommissionRate();
const { chatBoxRef } = useChatBoxStore();
const { width } = useSize(document.querySelector('body')) || { width: 0 };
const [fetchIndexerLeverageLimit] = useLazyQuery<{ cach: { value: string } }>(gql`
query {
Expand Down Expand Up @@ -562,7 +564,17 @@ export const MyDelegation: React.FC = () => {

return (
<>
<AppPageHeader title={'My Delegation'} desc={t('delegate.delegationDesc')} />
<AppPageHeader
title={
<div className="col-flex" style={{ gap: '8px' }}>
<Typography variant="h5">My Delegation</Typography>
<ChatBoxPlanTextTrigger triggerMsg="Give me advise on delegate" chatBoxInstance={chatBoxRef}>
Give me advise on delegate.
</ChatBoxPlanTextTrigger>
</div>
}
desc={t('delegate.delegationDesc')}
/>
<WalletRoute
componentMode
element={renderAsync(delegationList, {
Expand Down

0 comments on commit 4ad6cd9

Please sign in to comment.