diff --git a/src/api/gramjs/apiBuilders/misc.ts b/src/api/gramjs/apiBuilders/misc.ts index 4099c1d09..278ebf1fd 100644 --- a/src/api/gramjs/apiBuilders/misc.ts +++ b/src/api/gramjs/apiBuilders/misc.ts @@ -226,7 +226,7 @@ export function buildApiPromoData(promoData: GramJs.help.PromoData): ApiPromoDat }; } -export function buildApiPendingSuggestion(pendingSuggestion: GramJs.TypePendingSuggestion): ApiPendingSuggestion { +function buildApiPendingSuggestion(pendingSuggestion: GramJs.TypePendingSuggestion): ApiPendingSuggestion { const { suggestion, title, description, url, } = pendingSuggestion; @@ -245,7 +245,7 @@ export function oldBuildLangPack(mtpLangPack: GramJs.LangPackDifference) { }, {}); } -export function oldBuildLangPackString(mtpString: GramJs.TypeLangPackString) { +function oldBuildLangPackString(mtpString: GramJs.TypeLangPackString) { return mtpString instanceof GramJs.LangPackString ? mtpString.value : mtpString instanceof GramJs.LangPackStringPluralized diff --git a/src/components/common/helpers/gifts.ts b/src/components/common/helpers/gifts.ts index e08318a21..f8009c52d 100644 --- a/src/components/common/helpers/gifts.ts +++ b/src/components/common/helpers/gifts.ts @@ -1,5 +1,4 @@ import type { - ApiFormattedText, ApiStarGift, ApiStarGiftAttribute, ApiStarGiftAttributeBackdrop, @@ -32,19 +31,13 @@ export function getTotalGiftAvailability(gift: ApiStarGift): number | undefined return gift.totalCount; } -export function getGiftMessage(gift: ApiStarGift): ApiFormattedText | undefined { - if (gift.type !== 'starGiftUnique') return undefined; - - return gift.attributes.find((attr): attr is ApiStarGiftAttributeOriginalDetails => attr.type === 'model')?.message; -} - export function getGiftAttributes(gift: ApiStarGift): GiftAttributes | undefined { if (gift.type !== 'starGiftUnique') return undefined; return getGiftAttributesFromList(gift.attributes); } -export function getGiftAttributesFromList(attributes: ApiStarGiftAttribute[]) { +function getGiftAttributesFromList(attributes: ApiStarGiftAttribute[]) { const model = attributes.find((attr): attr is ApiStarGiftAttributeModel => attr.type === 'model'); const backdrop = attributes.find((attr): attr is ApiStarGiftAttributeBackdrop => attr.type === 'backdrop'); const pattern = attributes.find((attr): attr is ApiStarGiftAttributePattern => attr.type === 'pattern'); diff --git a/src/components/middle/MobileSearch.scss b/src/components/middle/MobileSearch.scss deleted file mode 100644 index c68df89a6..000000000 --- a/src/components/middle/MobileSearch.scss +++ /dev/null @@ -1,92 +0,0 @@ -#MobileSearch > .header { - position: absolute; - z-index: var(--z-mobile-search); - top: 0; - left: 0; - - display: flex; - align-items: center; - - width: 100%; - height: 3.5rem; - padding-right: max(0.5rem, env(safe-area-inset-right)); - padding-left: max(0.25rem, env(safe-area-inset-left)); - - background: var(--color-background); - - > .SearchInput { - flex: 1; - margin-left: 0.25rem; - } - - body.is-tauri.is-macos & { - padding-left: var(--window-controls-width); - } -} - -#MobileSearch > .tags-subheader { - --color-reaction: var(--color-background-secondary); - --hover-color-reaction: var(--color-background-secondary-accent); - --text-color-reaction: var(--color-text-secondary); - --color-reaction-chosen: var(--color-primary); - --text-color-reaction-chosen: #FFFFFF; - --hover-color-reaction-chosen: var(--color-primary-shade); - - position: absolute; - z-index: var(--z-mobile-search); - top: 3.5rem; - left: 0; - - overflow-x: scroll; - display: flex; - gap: 0.375rem; - align-items: center; - - width: 100%; - height: 3rem; - padding-right: max(0.5rem, env(safe-area-inset-right)); - padding-left: max(0.25rem, env(safe-area-inset-left)); - - background: var(--color-background); -} - -#MobileSearch > .footer { - position: absolute; - z-index: var(--z-mobile-search); - bottom: 0; - left: 0; - - display: flex; - align-items: center; - - width: 100%; - height: 3.5rem; - padding-right: max(0.5rem, env(safe-area-inset-right)); - padding-left: max(1rem, env(safe-area-inset-left)); - - background: var(--color-background); - - body:not(.keyboard-visible) & { - height: 3.5rem; - padding-bottom: 0; - } - - > .counter { - flex: 1; - color: var(--color-text-secondary); - } - - @media (max-width: 600px) { - body:not(.keyboard-visible) & { - height: calc(3.5rem + env(safe-area-inset-bottom)); - padding-bottom: env(safe-area-inset-bottom); - } - } -} - -#MobileSearch:not(.active) { - .header, .tags-subheader, .footer { - // `display: none` will prevent synchronous focus on iOS - transform: translateX(-999rem); - } -} diff --git a/src/components/middle/composer/AttachmentModalItem.tsx b/src/components/middle/composer/AttachmentModalItem.tsx index e9f18b1e4..b656dbf8b 100644 --- a/src/components/middle/composer/AttachmentModalItem.tsx +++ b/src/components/middle/composer/AttachmentModalItem.tsx @@ -131,7 +131,7 @@ const AttachmentModalItem: FC = ({ ); }; -export function getDisplayType(attachment: ApiAttachment, shouldDisplayCompressed?: boolean) { +function getDisplayType(attachment: ApiAttachment, shouldDisplayCompressed?: boolean) { if (shouldDisplayCompressed && attachment.quick) { if (SUPPORTED_PHOTO_CONTENT_TYPES.has(attachment.mimeType)) { return 'photo'; diff --git a/src/components/middle/composer/inlineResults/StickerResult.scss b/src/components/middle/composer/inlineResults/StickerResult.scss deleted file mode 100644 index 2ede1f409..000000000 --- a/src/components/middle/composer/inlineResults/StickerResult.scss +++ /dev/null @@ -1,30 +0,0 @@ -.StickerResult { - cursor: var(--custom-cursor, pointer); - - position: relative; - - overflow: hidden; - - height: 0; - padding-bottom: 100%; - - background: transparent no-repeat center; - background-size: contain; - - transition: background-color 0.15s ease, opacity 0.3s ease !important; - - .AnimatedSticker, - img, - canvas { - position: absolute; - top: 0; - left: 0; - - width: 100% !important; - height: 100% !important; - } - - img { - object-fit: contain; - } -} diff --git a/src/components/modals/stars/helpers/transaction.ts b/src/components/modals/stars/helpers/transaction.ts index efaaa99e6..7cb84b050 100644 --- a/src/components/modals/stars/helpers/transaction.ts +++ b/src/components/modals/stars/helpers/transaction.ts @@ -1,4 +1,4 @@ -import type { ApiStarsAmount, ApiStarsTransaction, ApiTypeCurrencyAmount } from '../../../../api/types'; +import type { ApiStarsTransaction, ApiTypeCurrencyAmount } from '../../../../api/types'; import type { OldLangFn } from '../../../../hooks/useOldLang'; import { STARS_CURRENCY_CODE, TON_CURRENCY_CODE } from '../../../../config'; @@ -64,14 +64,10 @@ export function getTransactionTitle(oldLang: OldLangFn, lang: LangFn, transactio return transaction.title; } -export function isNegativeStarsAmount(starsAmount: ApiStarsAmount) { - if (starsAmount.amount) return starsAmount.amount < 0; - return starsAmount.nanos < 0; -} - export function isNegativeAmount(currencyAmount: ApiTypeCurrencyAmount) { if (currencyAmount.currency === STARS_CURRENCY_CODE) { - return isNegativeStarsAmount(currencyAmount); + if (currencyAmount.amount) return currencyAmount.amount < 0; + return currencyAmount.nanos < 0; } return currencyAmount.amount < 0; } diff --git a/src/components/payment/ReceiptModal.module.scss b/src/components/payment/ReceiptModal.module.scss deleted file mode 100644 index 6b0843e34..000000000 --- a/src/components/payment/ReceiptModal.module.scss +++ /dev/null @@ -1,73 +0,0 @@ -.modal { - z-index: calc(var(--z-modal-low-priority) + 1); -} - -.positive { - color: var(--color-success); -} - -.negative { - color: var(--color-error); -} - -.header { - position: relative; - - display: flex; - flex-direction: column; - gap: 0.5rem; - align-items: center; - - margin-bottom: 1rem; -} - -.amount { - display: flex; - gap: 0.25rem; - - font-size: 1.25rem; - font-weight: var(--font-weight-medium); - line-height: 1.325; -} - -.title, .description, .amount { - margin-bottom: 0; -} - -.tid { - cursor: pointer; - font-family: var(--font-family-monospace); - font-size: 0.875rem; -} - -.description { - text-align: center; -} - -.footer { - margin-block: 0.5rem; - text-align: center; -} - -.starsBackground { - position: absolute; - top: -8.5rem; - left: 50%; - transform: translateX(-50%); - - height: 8rem; -} - -.mediaShift { - top: -1.5rem; -} - -.copyIcon { - margin-inline-start: 0.25rem; - color: var(--color-primary); -} - -.mediaPreview { - cursor: var(--custom-cursor, pointer); - margin-bottom: 2rem; -} diff --git a/src/components/ui/ListItemWithOptions.tsx b/src/components/ui/ListItemWithOptions.tsx deleted file mode 100644 index dd18bb24c..000000000 --- a/src/components/ui/ListItemWithOptions.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import type { FC, TeactNode } from '../../lib/teact/teact'; -import { memo } from '../../lib/teact/teact'; - -import type { CustomPeer } from '../../types'; - -import buildClassName from '../../util/buildClassName'; - -import Checkbox from './Checkbox'; -import ListItem from './ListItem'; -import Radio from './Radio'; - -type OwnProps = { - key: string; - isChecked?: boolean; - disabled?: boolean; - inactive?: boolean; - isChatItem?: boolean; - ripple?: boolean; - shouldRenderLockIcon?: boolean; - category?: CustomPeer; - handleItemClick: (id: string) => void; - renderCategory?: (category: CustomPeer) => TeactNode; - renderChatInfo?: (id: string) => TeactNode; - allowDisabledClick?: boolean; - label?: TeactNode; - subLabel?: string; - type?: 'checkbox' | 'radio'; -}; - -const ListItemWithOptions: FC = ({ - key, - isChecked, - disabled, - inactive, - isChatItem, - shouldRenderLockIcon, - category, - handleItemClick, - ripple, - renderCategory, - renderChatInfo, - allowDisabledClick, - label, - subLabel, - type, -}) => { - function renderInput() { - if (inactive || disabled) { - return undefined; - } - return type === 'checkbox' ? ( - - ) : ( - - ); - } - - return ( - handleItemClick(key)} - ripple={ripple} - > - {!isChatItem ? renderInput() : undefined} - {category ? renderCategory?.(category) : renderChatInfo?.(key)} - {isChatItem ? renderInput() : undefined} - - ); -}; - -export default memo(ListItemWithOptions); diff --git a/src/components/ui/RadioGroup.module.scss b/src/components/ui/RadioGroup.module.scss deleted file mode 100644 index 610eabca8..000000000 --- a/src/components/ui/RadioGroup.module.scss +++ /dev/null @@ -1,12 +0,0 @@ -.wrapper { - cursor: var(--custom-cursor, pointer); - - position: relative; - - display: block; - - margin-bottom: 0; - border: none; - - line-height: 1.5rem; -} diff --git a/src/util/activeTabMonitor.ts b/src/util/activeTabMonitor.ts deleted file mode 100644 index 96c5535ff..000000000 --- a/src/util/activeTabMonitor.ts +++ /dev/null @@ -1,19 +0,0 @@ -const STORAGE_KEY = 'tt-active-tab'; -const INTERVAL = 2000; - -const tabKey = String(Date.now() + Math.random()); - -localStorage.setItem(STORAGE_KEY, tabKey); - -let callback: NoneToVoidFunction; - -const interval = window.setInterval(() => { - if (callback && localStorage.getItem(STORAGE_KEY) !== tabKey) { - callback(); - clearInterval(interval); - } -}, INTERVAL); - -export function addActiveTabChangeListener(_callback: NoneToVoidFunction) { - callback = _callback; -}