From d59acd72dc1aae79c6122b8b7f58b41d13c89d3e Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Mon, 8 Jul 2024 15:58:45 +0200 Subject: [PATCH 1/7] fix(wasm): #657: stop truncating metadata symbols in wasm --- packages/wasm/crate/src/metadata.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/wasm/crate/src/metadata.rs b/packages/wasm/crate/src/metadata.rs index 5055fc25ca..b9b262ac9b 100644 --- a/packages/wasm/crate/src/metadata.rs +++ b/packages/wasm/crate/src/metadata.rs @@ -11,7 +11,6 @@ pub static DELEGATION_TOKEN_REGEX: &str = "^udelegation_(?Ppenumbravalid1(?P[a-zA-HJ-NP-Z0-9]+))$"; pub static AUCTION_NFT_REGEX: &str = "^auctionnft_(?P(?[a-z_0-9]+)_pauctid1(?P[a-zA-HJ-NP-Z0-9]+))$"; -pub static SHORTENED_ID_LENGTH: usize = 8; /// Given a binary-encoded `Metadata`, returns a new binary-encoded `Metadata` /// with the symbol customized if the token is one of several specific types @@ -37,29 +36,29 @@ pub fn customize_symbol_inner(metadata: Metadata) -> WasmResult { let auction_re = Regex::new(AUCTION_NFT_REGEX)?; if let Some(captures) = unbonding_re.captures(&metadata.base) { - let shortened_id = shorten_id(&captures)?; + let asset_id = collect_id(&captures)?; let start_match = captures .name("start") .ok_or_else(|| anyhow!(" not matched in unbonding token regex"))? .as_str(); return Ok(Metadata { - symbol: format!("unbondUMat{start_match}({shortened_id}…)"), + symbol: format!("unbondUMat{start_match}({asset_id})"), ..metadata }); } else if let Some(captures) = delegation_re.captures(&metadata.base) { - let shortened_id = shorten_id(&captures)?; + let asset_id = collect_id(&captures)?; return Ok(Metadata { - symbol: format!("delUM({shortened_id}…)"), + symbol: format!("delUM({asset_id})"), ..metadata }); } else if let Some(captures) = auction_re.captures(&metadata.base) { - let shortened_id = shorten_id(&captures)?; + let asset_id = collect_id(&captures)?; let seq_num = get_seq_num(&captures)?; return Ok(Metadata { - symbol: format!("auction@{seq_num}({shortened_id}…)"), + symbol: format!("auction@{seq_num}({asset_id})"), ..metadata }); } @@ -67,15 +66,11 @@ pub fn customize_symbol_inner(metadata: Metadata) -> WasmResult { Ok(metadata) } -fn shorten_id(captures: ®ex::Captures) -> WasmResult { +fn collect_id(captures: ®ex::Captures) -> WasmResult { let id_match = captures .name("id") .ok_or_else(|| anyhow!(" not matched in token regex"))?; - Ok(id_match - .as_str() - .chars() - .take(SHORTENED_ID_LENGTH) - .collect()) + Ok(id_match.as_str().to_string()) } fn get_seq_num(captures: ®ex::Captures) -> WasmResult { From 67fdf0afbb72fa4681a1f0a2e00693df49d50474 Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Mon, 8 Jul 2024 16:08:37 +0200 Subject: [PATCH 2/7] fix(minifront): #657: add max-width to the metadata symbol rendering --- packages/ui/components/ui/value/value.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/ui/components/ui/value/value.tsx b/packages/ui/components/ui/value/value.tsx index 78917687f3..24171e670b 100644 --- a/packages/ui/components/ui/value/value.tsx +++ b/packages/ui/components/ui/value/value.tsx @@ -38,7 +38,9 @@ export const ValueComponent = ({ )} {showDenom && ( - {symbol} + + {symbol} + )} From 1a35607539ceeee243f97edc7bb8677c3b36aeaf Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Mon, 8 Jul 2024 16:09:18 +0200 Subject: [PATCH 3/7] chore: changesets --- .changeset/dry-tigers-sneeze.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/dry-tigers-sneeze.md diff --git a/.changeset/dry-tigers-sneeze.md b/.changeset/dry-tigers-sneeze.md new file mode 100644 index 0000000000..6bfc53598d --- /dev/null +++ b/.changeset/dry-tigers-sneeze.md @@ -0,0 +1,6 @@ +--- +'@penumbra-zone/wasm': patch +'@repo/ui': patch +--- + +Stop truncating metadata symbols programatically From 62e6fd73b9efce57059f7acae9d944b399547d9c Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Tue, 9 Jul 2024 12:00:21 +0200 Subject: [PATCH 4/7] fix(ui): fix DialogContent size on mobile screens --- .../staking-actions/form-dialog.tsx | 2 +- packages/ui/components/ui/dialog/index.tsx | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/minifront/src/components/staking/account/delegation-value-view/staking-actions/form-dialog.tsx b/apps/minifront/src/components/staking/account/delegation-value-view/staking-actions/form-dialog.tsx index 6af013c8e3..9fb0f5757a 100644 --- a/apps/minifront/src/components/staking/account/delegation-value-view/staking-actions/form-dialog.tsx +++ b/apps/minifront/src/components/staking/account/delegation-value-view/staking-actions/form-dialog.tsx @@ -70,7 +70,7 @@ export const FormDialog = ({ return ( - + {!!open && !!action && ( <> {getCapitalizedAction(action)} diff --git a/packages/ui/components/ui/dialog/index.tsx b/packages/ui/components/ui/dialog/index.tsx index 67ad4393a1..23d1a93bde 100644 --- a/packages/ui/components/ui/dialog/index.tsx +++ b/packages/ui/components/ui/dialog/index.tsx @@ -103,8 +103,7 @@ const dialogContentVariants = cva( { variants: { size: { - lg: ['max-w-5xl'], - sm: ['max-w-[312px]', 'md:max-w-[400px]'], + sm: ['max-w-[350px]', 'md:max-w-[400px] lg:max-w-[600px]'], }, }, defaultVariants: { @@ -124,7 +123,11 @@ const DialogContent = React.forwardRef< - + {children} @@ -135,7 +138,7 @@ DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ children }: { children?: React.ReactNode }) => (
Date: Tue, 9 Jul 2024 12:03:18 +0200 Subject: [PATCH 5/7] fix(minifront): #657: fix symbol rendering in different places --- .../src/components/shared/selectors/balance-item.tsx | 5 ++++- apps/minifront/src/components/swap/unclaimed-swaps.tsx | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/minifront/src/components/shared/selectors/balance-item.tsx b/apps/minifront/src/components/shared/selectors/balance-item.tsx index 36ee9c91b2..67bce0206f 100644 --- a/apps/minifront/src/components/shared/selectors/balance-item.tsx +++ b/apps/minifront/src/components/shared/selectors/balance-item.tsx @@ -45,7 +45,10 @@ export const BalanceItem = ({ asset, value, onSelect }: BalanceItemProps) => {
-

+

{metadataFromAsset?.symbol ? metadataFromAsset.symbol : 'Unknown asset'}

diff --git a/apps/minifront/src/components/swap/unclaimed-swaps.tsx b/apps/minifront/src/components/swap/unclaimed-swaps.tsx index 4fed62091e..109d56736b 100644 --- a/apps/minifront/src/components/swap/unclaimed-swaps.tsx +++ b/apps/minifront/src/components/swap/unclaimed-swaps.tsx @@ -29,10 +29,10 @@ export const UnclaimedSwaps = () => {
-

{asset1.symbol || 'Unknown asset'}

+

{asset1.symbol || 'Unknown asset'}

-

{asset2.symbol || 'Unknown asset'}

+

{asset2.symbol || 'Unknown asset'}

Block Height: {Number(swap.outputData?.height)}
From 572ff0ee695d7c044b9cfb6a6a5d0e2bc3c4508e Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Tue, 9 Jul 2024 12:03:54 +0200 Subject: [PATCH 6/7] fix(storage): #657: bump IDB version --- packages/storage/src/indexed-db/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/storage/src/indexed-db/config.ts b/packages/storage/src/indexed-db/config.ts index 637aff2283..be8b568b99 100644 --- a/packages/storage/src/indexed-db/config.ts +++ b/packages/storage/src/indexed-db/config.ts @@ -2,4 +2,4 @@ * The version number for the IndexedDB schema. This version number is used to manage * database upgrades and ensure that the correct schema version is applied. */ -export const IDB_VERSION = 44; +export const IDB_VERSION = 45; From 1a40a6c49ee3d1f654d62487865323d5f529093f Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Tue, 9 Jul 2024 12:05:37 +0200 Subject: [PATCH 7/7] chore: changesets --- .changeset/thin-walls-beam.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/thin-walls-beam.md diff --git a/.changeset/thin-walls-beam.md b/.changeset/thin-walls-beam.md new file mode 100644 index 0000000000..67bf332c90 --- /dev/null +++ b/.changeset/thin-walls-beam.md @@ -0,0 +1,7 @@ +--- +'@penumbra-zone/storage': minor +'minifront': patch +'@repo/ui': patch +--- + +Storage: bump IDB version. UI: fix Dialog rendering on mobile screens. Minifront: fix metadata symbol truncation.