Skip to content

Commit b60cdb5

Browse files
seanbonnerclaude
andcommitted
Truncate wallet addresses on mobile (0xabc…1234)
Show full wallet address on desktop, shortened form on screens narrower than 480px to prevent horizontal overflow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c6d7f39 commit b60cdb5

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

wp-content/plugins/sb-punks-registry/assets/sbpr.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* SB Punks Registry 0.1.10 */
1+
/* SB Punks Registry 0.1.11 */
22

33
/* Front page: kill theme header/nav/logo wrappers. */
44
.sbpr-front header#masthead,
@@ -264,6 +264,9 @@
264264
}
265265
}
266266

267+
/* Wallet address: show full by default, short on mobile */
268+
.sbpr-wallet-short { display: none; }
269+
267270
/* Small mobile: stack fact labels above values */
268271
@media (max-width: 480px){
269272
.sbpr-single__wrap{
@@ -273,9 +276,9 @@
273276
grid-template-columns: 1fr;
274277
gap: 2px;
275278
}
276-
.sbpr-single__facts dd{
277-
word-break: break-all;
278-
}
279+
/* Show truncated wallet address on mobile */
280+
.sbpr-wallet-full { display: none; }
281+
.sbpr-wallet-short { display: inline; }
279282
}
280283

281284

wp-content/plugins/sb-punks-registry/templates/single-sb_punk.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,22 @@
5151
function sbpr_wallet_link($wallet, $name = '') {
5252
$wallet = trim((string)$wallet);
5353
if (!$wallet) return '';
54-
$text = $name ? $name : $wallet;
5554
$url = SB_Punks_Registry::cp_account_url($wallet);
56-
return '<a href="'.esc_url($url).'">'.esc_html($text).'</a>';
55+
56+
// If there's a name, just show the name (no truncation needed)
57+
if ($name) {
58+
return '<a href="'.esc_url($url).'">'.esc_html($name).'</a>';
59+
}
60+
61+
// For wallet addresses, show full on desktop, truncated on mobile
62+
$short = strlen($wallet) > 10
63+
? substr($wallet, 0, 6) . '' . substr($wallet, -4)
64+
: $wallet;
65+
66+
return '<a href="'.esc_url($url).'" class="sbpr-wallet-addr">'
67+
. '<span class="sbpr-wallet-full">'.esc_html($wallet).'</span>'
68+
. '<span class="sbpr-wallet-short">'.esc_html($short).'</span>'
69+
. '</a>';
5770
}
5871

5972
?>

0 commit comments

Comments
 (0)