Skip to content

Commit

Permalink
Merge pull request #120 from CheesecakeLabs/T1AS-179_operating_expens…
Browse files Browse the repository at this point in the history
…es_helper

fea operating expenses helper
  • Loading branch information
lucasmagnus authored Feb 20, 2024
2 parents 4f0d2dd + f27d989 commit ad4148f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
42 changes: 29 additions & 13 deletions frontend/src/app/core/pages/cost-center/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { Flex, VStack, useMediaQuery } from '@chakra-ui/react'
import { Flex, VStack, useMediaQuery, Text } from '@chakra-ui/react'
import React, { useCallback, useEffect, useState } from 'react'

import { useAssets } from 'hooks/useAssets'
import { useAuth } from 'hooks/useAuth'
import { useHorizon } from 'hooks/useHorizon'
import { useTransactions } from 'hooks/useTransactions'
import { useVaults } from 'hooks/useVaults'
import {
operatingExpensesHelperP1,
operatingExpensesHelperP2,
} from 'utils/constants/helpers'
import { GAService } from 'utils/ga'

import { PathRoute } from 'components/enums/path-route'
import { SettingsOptions } from 'components/enums/settings-options'
import { ActionHelper } from 'components/molecules/action-helper'
import { MenuSettings } from 'components/organisms/menu-settings'
import { Sidebar } from 'components/organisms/sidebar'
import { CostCenterTemplate } from 'components/templates/cost-center'
Expand Down Expand Up @@ -105,19 +110,22 @@ export const CostCenter: React.FC = () => {
)}`
}

const walletToName = useCallback((publicKey: string): string => {
if (
assets &&
assets.find(asset => asset.distributor.key.publicKey === publicKey)
) {
return 'Asset issuer'
}
const walletToName = useCallback(
(publicKey: string): string => {
if (
assets &&
assets.find(asset => asset.distributor.key.publicKey === publicKey)
) {
return 'Asset issuer'
}

return (
vaults?.find(vault => vault.wallet.key.publicKey === publicKey)?.name ||
formatAccount(publicKey)
)
}, [assets, vaults])
return (
vaults?.find(vault => vault.wallet.key.publicKey === publicKey)?.name ||
formatAccount(publicKey)
)
},
[assets, vaults]
)

const getTransactionData = useCallback(
(transaction: Hooks.UseHorizonTypes.ITransactionItem): IHorizonData => {
Expand Down Expand Up @@ -294,6 +302,14 @@ export const CostCenter: React.FC = () => {
{isLargerThanMd && (
<VStack>
<MenuSettings option={SettingsOptions.COST_CENTER} />
<ActionHelper title={'About Operating Expenses'}>
<Text color="gray.900" lineHeight="22px" fontSize="sm">
{operatingExpensesHelperP1}
</Text>
<Text color="gray.900" lineHeight="22px" fontSize="sm" mt="1rem">
{operatingExpensesHelperP2}
</Text>
</ActionHelper>
</VStack>
)}
</Flex>
Expand Down
16 changes: 11 additions & 5 deletions frontend/src/components/molecules/action-helper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import { Container, Flex, Text } from '@chakra-ui/react'
import React from 'react'
import React, { ReactNode } from 'react'

import { InfoIcon } from 'components/icons'

interface IActionHelper {
title: string
description: string
description?: string
children?: ReactNode
}

export const ActionHelper: React.FC<IActionHelper> = ({
title,
description,
children,
}) => {
return (
<Container variant="primary" maxW={{ base: 'full', md: '290px' }} mt="1rem">
<Flex justifyContent="space-between" alignItems="center" mb="0.75rem">
<Text>{title}</Text>
<InfoIcon />
</Flex>
<Text color="gray.900" lineHeight="22px" fontSize="sm">
{description}
</Text>
{children ? (
children
) : (
<Text color="gray.900" lineHeight="22px" fontSize="sm">
{description}
</Text>
)}
</Container>
)
}
6 changes: 6 additions & 0 deletions frontend/src/utils/constants/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ export const newContractHelper =

export const assetHomeHelper =
'Each asset represents a unique tokenized asset on the Stellar Network. It provides a digital representation of value, whether it be fiat, cryptocurrency, or other tangible or intangible assets. Within the Stellar ecosystem, assets can be traded, transferred, and used in various financial operations, providing liquidity and interoperability between different asset classes.'

export const operatingExpensesHelperP1 =
'This is the central administration area to monitor the network expenses required for the Sandbox to run. All transactions handled by the Sandbox are set to have their network fees covered by this Operating Expenses account as well as the underlying reserved balances required for certain features to be operational.'

export const operatingExpensesHelperP2 =
"It's important to note that the Sandbox operates within the testnet environment, which is free of charge. The figures displayed represent a simulation of the expenses that would be incurred if operating within the mainnet."

0 comments on commit ad4148f

Please sign in to comment.