-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: send transfer fees to shared fee editor
- Loading branch information
Showing
20 changed files
with
257 additions
and
308 deletions.
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
src/app/components/approve-transaction/approve-transaction-selected-fee.tsx
This file was deleted.
Oops, something went wrong.
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
48 changes: 48 additions & 0 deletions
48
src/app/features/fee-editor/components/current-fee-item.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,48 @@ | ||
import type { MarketData } from '@leather.io/models'; | ||
import { Approver, ItemLayout, Pressable } from '@leather.io/ui'; | ||
|
||
import type { EditorFee } from '@app/features/fee-editor/fee-editor.context'; | ||
import { formatEditorFeeItem } from '@app/features/fee-editor/fee-editor.utils'; | ||
|
||
import { CryptoAssetItemPlaceholder } from '../../../components/crypto-asset-item/crypto-asset-item-placeholder'; | ||
import { FeeItemIcon } from './fee-item-icon'; | ||
|
||
interface CurrentFeeItemProps { | ||
currentFee: EditorFee | null; | ||
isLoading: boolean; | ||
marketData: MarketData; | ||
onEditFee(): void; | ||
} | ||
export function CurrentFeeItem({ | ||
currentFee, | ||
isLoading, | ||
marketData, | ||
onEditFee, | ||
}: CurrentFeeItemProps) { | ||
if (isLoading || !currentFee) | ||
return ( | ||
<Approver.Section> | ||
<Approver.Subheader>Fee</Approver.Subheader> | ||
<CryptoAssetItemPlaceholder my="0" /> | ||
</Approver.Section> | ||
); | ||
const { titleLeft, captionLeft, titleRight, captionRight } = formatEditorFeeItem({ | ||
editorFee: currentFee, | ||
marketData: marketData, | ||
}); | ||
return ( | ||
<Approver.Section> | ||
<Approver.Subheader>Fee</Approver.Subheader> | ||
<Pressable onClick={onEditFee} mb="space.02"> | ||
<ItemLayout | ||
img={<FeeItemIcon feeType={currentFee.type} />} | ||
titleLeft={titleLeft} | ||
captionLeft={captionLeft} | ||
titleRight={titleRight} | ||
captionRight={captionRight} | ||
showChevron | ||
/> | ||
</Pressable> | ||
</Approver.Section> | ||
); | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/app/features/fee-editor/components/default-fees-list.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,16 @@ | ||
import { useFeeEditorContext } from '../fee-editor.context'; | ||
import { CustomFeeItem } from './custom-fee-item'; | ||
import { FeeItem } from './fee-item'; | ||
|
||
export function DefaultFeesList() { | ||
const { customEditorFeeRate, editorFees, getCustomEditorFee } = useFeeEditorContext(); | ||
if (!editorFees) return null; | ||
return ( | ||
<> | ||
<FeeItem fee={editorFees.slow} /> | ||
<FeeItem fee={editorFees.standard} /> | ||
<FeeItem fee={editorFees.fast} /> | ||
<CustomFeeItem fee={getCustomEditorFee(Number(customEditorFeeRate))} /> | ||
</> | ||
); | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.