-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add Outputs tab to Address page (#1115)
* feat: add output tab to address page * Remove unused code in AddressPageTabbedSections component * chore: Remove unused state interfaces --------- Co-authored-by: Mario Sarcevic <[email protected]>
- Loading branch information
Showing
11 changed files
with
109 additions
and
48 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
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
50 changes: 50 additions & 0 deletions
50
client/src/app/components/nova/address/section/AddressPageTabbedSections.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,50 @@ | ||
import React, { useState } from "react"; | ||
import associatedOuputsMessage from "~assets/modals/stardust/address/associated-outputs.json"; | ||
import TabbedSection from "../../../hoc/TabbedSection"; | ||
import AssociatedOutputs from "./association/AssociatedOutputs"; | ||
import { IAddressDetails } from "~/models/api/nova/IAddressDetails"; | ||
|
||
enum DEFAULT_TABS { | ||
AssocOutputs = "Outputs", | ||
} | ||
|
||
const buildDefaultTabsOptions = (associatedOutputCount: number) => ({ | ||
[DEFAULT_TABS.AssocOutputs]: { | ||
disabled: associatedOutputCount === 0, | ||
counter: associatedOutputCount, | ||
infoContent: associatedOuputsMessage, | ||
}, | ||
}); | ||
|
||
interface IAddressPageTabbedSectionsProps { | ||
readonly addressDetails: IAddressDetails; | ||
readonly setAssociatedOutputsLoading: (isLoading: boolean) => void; | ||
} | ||
|
||
export const AddressPageTabbedSections: React.FC<IAddressPageTabbedSectionsProps> = ({ addressDetails, setAssociatedOutputsLoading }) => { | ||
const [outputCount, setOutputCount] = useState<number>(0); | ||
|
||
if (!addressDetails) { | ||
return null; | ||
} | ||
|
||
const defaultSections = [ | ||
<AssociatedOutputs | ||
key={`assoc-outputs-${addressDetails.bech32}`} | ||
addressDetails={addressDetails} | ||
setOutputCount={setOutputCount} | ||
setIsLoading={setAssociatedOutputsLoading} | ||
/>, | ||
]; | ||
|
||
const tabEnums = DEFAULT_TABS; | ||
const defaultTabsOptions = buildDefaultTabsOptions(outputCount); | ||
const tabOptions = defaultTabsOptions; | ||
const tabbedSections = defaultSections; | ||
|
||
return ( | ||
<TabbedSection key={addressDetails.bech32} tabsEnum={tabEnums} tabOptions={tabOptions}> | ||
{tabbedSections} | ||
</TabbedSection> | ||
); | ||
}; |
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