Skip to content

Commit

Permalink
Merge pull request #812 from subquery/feat/add-more-shortcut
Browse files Browse the repository at this point in the history
feat: add more shortcut
  • Loading branch information
HuberTRoy authored Jan 20, 2025
2 parents 6b4ed3e + 4ad6cd9 commit cf1d116
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/components/DeploymentInfo/DeploymentInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export const DeploymentInfo: React.FC<Props> = ({ project, deploymentId, type, m
label: 'What flex plan price should I set?',
value: `What flex plan price should I set for project deployment ${deploymentId}?`,
},
{
label: 'How should I allocate my SQT to this deployment?',
value: `How much SQT should I allocated to deployment ${deploymentId}?`,
},
]}
chatBoxInstance={chatBoxStore.chatBoxRef}
>
Expand Down
8 changes: 3 additions & 5 deletions src/components/DoAllocate/DoAllocate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,12 @@ const DoAllocate: FC<IProps> = ({ projectId, deploymentId, actionBtn, onSuccess,
},
]}
>
{/* <ChatBoxPlanTextTrigger
triggerMsg={`
How much SQT should I allocated to deployment ${deploymentId}?
`}
<ChatBoxPlanTextTrigger
triggerMsg={`How much SQT should I allocated to deployment ${deploymentId}?`}
chatBoxInstance={chatBoxStore.chatBoxRef}
>
How should I allocate my SQT to this project deployment?
</ChatBoxPlanTextTrigger> */}
</ChatBoxPlanTextTrigger>
<NumberInput
description=""
maxAmount={addOrRemove === 'Add' ? avaibleStakeAmount : currentAllocatedTokensOfThisDeployment}
Expand Down
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 cf1d116

Please sign in to comment.