diff options
author | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-10 14:35:56 +0200 |
---|---|---|
committer | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-10 14:35:56 +0200 |
commit | d858bd4e0fc7aaba15509a17b35138e843667bc1 (patch) | |
tree | b8251d1579bebe7128efe5b93ed734f9a75b234b /src/client/utils.ts | |
parent | e29a1b9a652fe254d13afef7f5c7a3d7a64b68cc (diff) |
refactor: improve layout and spacing across all views
- Remove extra space at the top of the page by adjusting body and root styles
- Add consistent 20px top padding to all views through app-container
- Simplify layout structure by removing unnecessary flex containers
- Adjust spacing between elements for better visual hierarchy:
- Reduce gaps between elements from 1.5rem to 1rem
- Reduce bottom margin of h1 from 1.5rem to 1rem
- Remove negative margins and extra padding
- Maintain consistent box dimensions (390px width, 560px height) for all views
- Ensure proper spacing for QR code and other content within views
Diffstat (limited to 'src/client/utils.ts')
-rw-r--r-- | src/client/utils.ts | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/client/utils.ts b/src/client/utils.ts index cd9c8ba..6a95f7b 100644 --- a/src/client/utils.ts +++ b/src/client/utils.ts @@ -1,20 +1,31 @@ -// Simple utility to determine DigiByte address type based on prefix +// Utility to determine DigiByte address type based on prefix -export type DigiByteAddressType = 'DigiByte (DGB)' | 'DigiAsset (DGA)' | 'Unknown'; +export type DigiByteAddressFormat = 'Legacy (P2PKH)' | 'Script (P2SH)' | 'SegWit (Bech32)' | 'Unknown'; -export function getDigiByteAddressType(address: string | undefined | null): DigiByteAddressType { +/** + * Determines the format of a DigiByte address based on its prefix. + * Note: P2SH addresses on DigiByte often start with 'S', but complex scripts + * might result in different prefixes. This function covers common cases. + * Legacy starts with 'D'. SegWit starts with 'dgb1'. + * + * @param address The DigiByte address string. + * @returns The determined address format. + */ +export function getDigiByteAddressType(address: string | undefined | null): DigiByteAddressFormat { if (!address) { return 'Unknown'; } if (address.startsWith('dgb1')) { - return 'DigiByte (DGB)'; + return 'SegWit (Bech32)'; } - // Add other prefixes if DigiAssets use a distinct one, e.g., 'dga1' - // For now, assume non-DGB is DigiAsset, but this might need refinement - // depending on actual DigiAsset address formats. - else { - // Assuming DigiAssets might start differently or be the fallback - // This is a placeholder assumption. - return 'DigiAsset (DGA)'; // Placeholder - ADJUST BASED ON ACTUAL DGA PREFIX + if (address.startsWith('S')) { // Common prefix for P2SH on DGB + return 'Script (P2SH)'; } + if (address.startsWith('D')) { + return 'Legacy (P2PKH)'; + } + + // If it doesn't match known prefixes, return Unknown + // Could potentially add DigiAsset checks here if they have distinct prefixes + return 'Unknown'; }
\ No newline at end of file |