-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b70880f
commit 4a309c3
Showing
29 changed files
with
420 additions
and
1,034 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function ConfigDockedControls() { | ||
return null | ||
} |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { SiacoinField, Text, Tooltip } from '@siafoundation/design-system' | ||
import { useSpendingEstimateFromEnabledPricingValues } from '../../contexts/config/pricingAndSpendingHooks' | ||
import { useConfig } from '../../contexts/config' | ||
import { Information20, PendingFilled20 } from '@siafoundation/react-icons' | ||
import { spendingFactor } from '../../contexts/config/spendingConfig' | ||
|
||
export function SpendingEstimate() { | ||
const { form } = useConfig() | ||
const storageTB = form.watch('storageTB') | ||
|
||
const estimate = useSpendingEstimateFromEnabledPricingValues() | ||
|
||
return ( | ||
<div className="relative"> | ||
<div className="flex flex-col gap-2 bg-gray-50 dark:bg-graydark-50 border-b border-x border-gray-300 dark:border-graydark-400 rounded-b px-3 py-1.5"> | ||
<div className="flex gap-2 items-center"> | ||
<Tooltip | ||
content={ | ||
<> | ||
The spending estimate is calculated using the current estimated | ||
usage and max price values. The estimate assumes spending will | ||
be across a distribution of hosts with various prices that fit | ||
within max price values, this is modeled with a factor of 1/ | ||
{spendingFactor}x. | ||
</> | ||
} | ||
> | ||
<Text color="amber"> | ||
<Information20 /> | ||
</Text> | ||
</Tooltip> | ||
<Text size="16" weight="medium" color="subtle"> | ||
Spending estimate | ||
</Text> | ||
</div> | ||
{estimate && storageTB?.gt(0) ? ( | ||
<SiacoinField | ||
tabIndex={-1} | ||
className="min-w-[250px]" | ||
readOnly | ||
sc={estimate.div(storageTB)} | ||
size="small" | ||
units={`SC per month for ${storageTB.toNumber()} TB`} | ||
unitsFiatPostfix={` per month for ${storageTB.toNumber()} TB`} | ||
decimalsLimitSc={0} | ||
decimalsLimitFiat={2} | ||
/> | ||
) : ( | ||
<div className="flex gap-2 items-center"> | ||
<Text color="contrast"> | ||
<PendingFilled20 /> | ||
</Text> | ||
<Text size="16" weight="medium"> | ||
The system will estimate spending once expected usage and pricing | ||
fields are filled. | ||
</Text> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
) | ||
} |
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,17 @@ | ||
import { SpendingEstimate } from './SpendingEstimate' | ||
import { Recommendations } from './Recommendations' | ||
|
||
export function Stickies({ children }: { children?: React.ReactNode }) { | ||
return ( | ||
<div className="relative"> | ||
<div className="z-10 absolute top-0 w-full flex gap-2 justify-end px-3"> | ||
{/* <Container pad={false} className="flex gap-4 px-3"> */} | ||
<div className="flex-1" /> | ||
<Recommendations /> | ||
<SpendingEstimate /> | ||
{/* </Container> */} | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} |
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
Oops, something went wrong.