-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Inform users that there are no available slots on staking contr…
…act and prompt them to switch (#421) * fix: improve error messages in AgentButton component * feat: add NoAvailableSlotsOnTheContract component * feat: integrate NoAvailableSlotsOnTheContract component and enhance service slot checks * feat: implement useCanStartUpdateStakingContract hook and update related components * feat: add available slots display and max-width styling to StakingContractDetails * feat: add POPOVER_WIDTH_LARGE constant and apply max-width styling to CountdownUntilMigration component * fix: correct spelling of 'occurred' in error notifications in AgentButton component * refactor: rename useCanStartUpdateStakingContract hook to useCanUpdateStakingContract and update related components * feat: update StakingContractUpdate and NoAvailableSlotsOnTheContract components to accept stakingProgramId prop and remove useCanUpdateStakingContract hook * chore: bump version to 0.1.0-rc186 in package.json and pyproject.toml
- Loading branch information
1 parent
7c0d5b8
commit f7fcd5e
Showing
14 changed files
with
120 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
frontend/components/MainPage/sections/AlertSections/NoAvailableSlotsOnTheContract.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Flex, Typography } from 'antd'; | ||
|
||
import { useMigrate } from '@/components/ManageStakingPage/StakingContractSection/useMigrate'; | ||
import { Pages } from '@/enums/PageState'; | ||
import { StakingProgramId } from '@/enums/StakingProgram'; | ||
import { usePageState } from '@/hooks/usePageState'; | ||
import { useStakingContractInfo } from '@/hooks/useStakingContractInfo'; | ||
|
||
import { CustomAlert } from '../../../Alert'; | ||
|
||
const { Text } = Typography; | ||
|
||
type NoAvailableSlotsOnTheContractProps = { | ||
stakingProgramId: StakingProgramId; | ||
}; | ||
export const NoAvailableSlotsOnTheContract = ({ | ||
stakingProgramId, | ||
}: NoAvailableSlotsOnTheContractProps) => { | ||
const { goto } = usePageState(); | ||
const { hasEnoughServiceSlots } = useStakingContractInfo(); | ||
const { canUpdateStakingContract } = useMigrate(stakingProgramId); | ||
|
||
if (hasEnoughServiceSlots) return null; | ||
|
||
return ( | ||
<CustomAlert | ||
type="warning" | ||
fullWidth | ||
showIcon | ||
message={ | ||
<Flex justify="space-between" gap={4} vertical> | ||
<Text className="font-weight-600"> | ||
No available slots on the contract | ||
</Text> | ||
<span className="text-sm"> | ||
Select a contract with available slots to be able to start your | ||
agent. | ||
</span> | ||
{canUpdateStakingContract && ( | ||
<Text | ||
className="pointer hover-underline text-primary text-sm" | ||
onClick={() => goto(Pages.ManageStaking)} | ||
> | ||
Change staking contract | ||
</Text> | ||
)} | ||
</Flex> | ||
} | ||
/> | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
frontend/components/MainPage/sections/AlertSections/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import { CardSection } from '@/components/styled/CardSection'; | ||
import { useStakingProgram } from '@/hooks/useStakingProgram'; | ||
|
||
import { AddBackupWalletAlert } from './AddBackupWalletAlert'; | ||
import { AvoidSuspensionAlert } from './AvoidSuspensionAlert'; | ||
import { LowTradingBalanceAlert } from './LowTradingBalanceAlert'; | ||
import { NewStakingProgramAlert } from './NewStakingProgramAlert'; | ||
import { NoAvailableSlotsOnTheContract } from './NoAvailableSlotsOnTheContract'; | ||
import { UpdateAvailableAlert } from './UpdateAvailableAlert'; | ||
|
||
export const AlertSections = () => { | ||
const { activeStakingProgramId } = useStakingProgram(); | ||
|
||
return ( | ||
<CardSection vertical> | ||
<UpdateAvailableAlert /> | ||
<AddBackupWalletAlert /> | ||
<NewStakingProgramAlert /> | ||
<AvoidSuspensionAlert /> | ||
<LowTradingBalanceAlert /> | ||
{activeStakingProgramId && ( | ||
<NoAvailableSlotsOnTheContract | ||
stakingProgramId={activeStakingProgramId} | ||
/> | ||
)} | ||
</CardSection> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const NA = 'n/a'; | ||
|
||
export const UNICODE_SYMBOLS = { | ||
OLAS: '☴', | ||
EXTERNAL_LINK: '↗', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const MODAL_WIDTH = 412; | ||
|
||
export const POPOVER_WIDTH_MEDIUM = 260; | ||
|
||
export const POPOVER_WIDTH_LARGE = 340; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "olas-operate-middleware" | ||
version = "0.1.0-rc184" | ||
version = "0.1.0-rc186" | ||
description = "" | ||
authors = ["David Vilela <[email protected]>", "Viraj Patel <[email protected]>"] | ||
readme = "README.md" | ||
|