From a1e356afb4ed1281b4df124592aa214945842c92 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 31 Jul 2025 00:53:14 +0200 Subject: [PATCH] Modal Styles: Fix styles in `SuggestMessageModal`, `GiftInfoModal` and `StarsBalanceModal` (#6093) --- CLAUDE.md | 9 ++++++++ .../gift/info/GiftInfoModal.module.scss | 2 +- .../stars/StarsBalanceModal.module.scss | 8 +++++-- .../modals/stars/StarsBalanceModal.tsx | 23 +++++++++++++++---- .../SuggestMessageModal.module.scss | 6 ++++- .../suggestMessage/SuggestMessageModal.tsx | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 6669542f6..440df53d3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,6 +42,15 @@ You are an expert in TypeScript, JavaScript, HTML, SCSS and Teact with deep expe // ✅ GOOD - Full type checking { field: condition ? value : undefined } ``` + - **IMPORTANT: Use string templates for inline styles** - Always use template literals for style prop: + ```typescript + // ✅ CORRECT + style={`transform: translateX(${value}%)`} + + // ❌ WRONG + style={{ transform: `translateX(${value}%)` }} + style={{ '--custom-prop': value } as React.CSSProperties} + ``` - **Localization & Text Rules:** - **ALWAYS** use `lang()` for all text content - never hardcode strings. diff --git a/src/components/modals/gift/info/GiftInfoModal.module.scss b/src/components/modals/gift/info/GiftInfoModal.module.scss index 3e3e65947..b749871e2 100644 --- a/src/components/modals/gift/info/GiftInfoModal.module.scss +++ b/src/components/modals/gift/info/GiftInfoModal.module.scss @@ -45,12 +45,12 @@ color: white; background-color: rgba(0, 0, 0, 0.2); - backdrop-filter: blur(25px); outline: none !important; } .giftResalePriceContainer { font-size: 0.75rem; + backdrop-filter: blur(25px); } .starAmountIcon, diff --git a/src/components/modals/stars/StarsBalanceModal.module.scss b/src/components/modals/stars/StarsBalanceModal.module.scss index b4166c8df..c88670610 100644 --- a/src/components/modals/stars/StarsBalanceModal.module.scss +++ b/src/components/modals/stars/StarsBalanceModal.module.scss @@ -10,7 +10,7 @@ .root :global(.modal-dialog) { max-width: 26.25rem; - height: min(45rem, 90vh); + height: min(var(--modal-height, 45rem), 90vh); } .minimal :global(.modal-dialog) { @@ -33,6 +33,11 @@ flex-direction: column-reverse; } +.section { + @include mixins.side-panel-section; +} + +.lastSection, .section { position: relative; @@ -43,7 +48,6 @@ padding: 0.5rem; @include mixins.adapt-padding-to-scrollbar(0.5rem); - @include mixins.side-panel-section; } .sectionTitle { diff --git a/src/components/modals/stars/StarsBalanceModal.tsx b/src/components/modals/stars/StarsBalanceModal.tsx index 1c4616146..9ba7a31b1 100644 --- a/src/components/modals/stars/StarsBalanceModal.tsx +++ b/src/components/modals/stars/StarsBalanceModal.tsx @@ -133,6 +133,20 @@ const StarsBalanceModal = ({ const shouldShowItems = Boolean(history?.all?.transactions.length && !shouldOpenOnBuy); const shouldSuggestGifting = !shouldOpenOnBuy; + const modalHeight = useMemo(() => { + const transactionCount = history?.all?.transactions.length || 0; + if (transactionCount == 1) { + return '35.5rem'; + } + if (transactionCount == 2) { + return '39.25rem'; + } + if (transactionCount == 3) { + return '43rem'; + } + return '45rem'; + }, [history?.all?.transactions.length]); + const transactionTabs: TabWithProperties[] = useMemo(() => { return TRANSACTION_TABS_KEYS.map((key) => ({ title: lang(key), @@ -168,7 +182,7 @@ const StarsBalanceModal = ({ ]; }, [isOpen, oldLang]); - const renderStarsSection = () => { + const renderStarsHeaderSection = () => { return ( <> { + const renderTonHeaderSection = () => { const tonAmount = convertCurrencyFromBaseUnit(balance?.amount || 0, TON_CURRENCY_CODE); return ( <> @@ -285,6 +299,7 @@ const StarsBalanceModal = ({ className={buildClassName(styles.root, !shouldForceHeight && !areBuyOptionsShown && styles.minimal)} isOpen={isOpen} onClose={closeStarsBalanceModal} + dialogStyle={`--modal-height: ${modalHeight}`} >
- {currency === TON_CURRENCY_CODE ? renderTonSection() : renderStarsSection()} + {currency === TON_CURRENCY_CODE ? renderTonHeaderSection() : renderStarsHeaderSection()}
{areBuyOptionsShown && (
@@ -345,7 +360,7 @@ const StarsBalanceModal = ({ )} {shouldShowItems && (
-
+
-
+