Remove unused functions (#6548)
This commit is contained in:
parent
9a9e8d03aa
commit
dbc363e79d
@ -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 {
|
const {
|
||||||
suggestion, title, description, url,
|
suggestion, title, description, url,
|
||||||
} = pendingSuggestion;
|
} = 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
|
return mtpString instanceof GramJs.LangPackString
|
||||||
? mtpString.value
|
? mtpString.value
|
||||||
: mtpString instanceof GramJs.LangPackStringPluralized
|
: mtpString instanceof GramJs.LangPackStringPluralized
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import type {
|
import type {
|
||||||
ApiFormattedText,
|
|
||||||
ApiStarGift,
|
ApiStarGift,
|
||||||
ApiStarGiftAttribute,
|
ApiStarGiftAttribute,
|
||||||
ApiStarGiftAttributeBackdrop,
|
ApiStarGiftAttributeBackdrop,
|
||||||
@ -32,19 +31,13 @@ export function getTotalGiftAvailability(gift: ApiStarGift): number | undefined
|
|||||||
return gift.totalCount;
|
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 {
|
export function getGiftAttributes(gift: ApiStarGift): GiftAttributes | undefined {
|
||||||
if (gift.type !== 'starGiftUnique') return undefined;
|
if (gift.type !== 'starGiftUnique') return undefined;
|
||||||
|
|
||||||
return getGiftAttributesFromList(gift.attributes);
|
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 model = attributes.find((attr): attr is ApiStarGiftAttributeModel => attr.type === 'model');
|
||||||
const backdrop = attributes.find((attr): attr is ApiStarGiftAttributeBackdrop => attr.type === 'backdrop');
|
const backdrop = attributes.find((attr): attr is ApiStarGiftAttributeBackdrop => attr.type === 'backdrop');
|
||||||
const pattern = attributes.find((attr): attr is ApiStarGiftAttributePattern => attr.type === 'pattern');
|
const pattern = attributes.find((attr): attr is ApiStarGiftAttributePattern => attr.type === 'pattern');
|
||||||
|
|||||||
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -131,7 +131,7 @@ const AttachmentModalItem: FC<OwnProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getDisplayType(attachment: ApiAttachment, shouldDisplayCompressed?: boolean) {
|
function getDisplayType(attachment: ApiAttachment, shouldDisplayCompressed?: boolean) {
|
||||||
if (shouldDisplayCompressed && attachment.quick) {
|
if (shouldDisplayCompressed && attachment.quick) {
|
||||||
if (SUPPORTED_PHOTO_CONTENT_TYPES.has(attachment.mimeType)) {
|
if (SUPPORTED_PHOTO_CONTENT_TYPES.has(attachment.mimeType)) {
|
||||||
return 'photo';
|
return 'photo';
|
||||||
|
|||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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 type { OldLangFn } from '../../../../hooks/useOldLang';
|
||||||
|
|
||||||
import { STARS_CURRENCY_CODE, TON_CURRENCY_CODE } from '../../../../config';
|
import { STARS_CURRENCY_CODE, TON_CURRENCY_CODE } from '../../../../config';
|
||||||
@ -64,14 +64,10 @@ export function getTransactionTitle(oldLang: OldLangFn, lang: LangFn, transactio
|
|||||||
return transaction.title;
|
return transaction.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNegativeStarsAmount(starsAmount: ApiStarsAmount) {
|
|
||||||
if (starsAmount.amount) return starsAmount.amount < 0;
|
|
||||||
return starsAmount.nanos < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isNegativeAmount(currencyAmount: ApiTypeCurrencyAmount) {
|
export function isNegativeAmount(currencyAmount: ApiTypeCurrencyAmount) {
|
||||||
if (currencyAmount.currency === STARS_CURRENCY_CODE) {
|
if (currencyAmount.currency === STARS_CURRENCY_CODE) {
|
||||||
return isNegativeStarsAmount(currencyAmount);
|
if (currencyAmount.amount) return currencyAmount.amount < 0;
|
||||||
|
return currencyAmount.nanos < 0;
|
||||||
}
|
}
|
||||||
return currencyAmount.amount < 0;
|
return currencyAmount.amount < 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
|
||||||
}
|
|
||||||
@ -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<OwnProps> = ({
|
|
||||||
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' ? (
|
|
||||||
<Checkbox
|
|
||||||
label={label || ''}
|
|
||||||
subLabel={subLabel}
|
|
||||||
disabled={disabled}
|
|
||||||
checked={isChecked}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Radio
|
|
||||||
label=""
|
|
||||||
disabled={disabled}
|
|
||||||
checked={isChecked}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ListItem
|
|
||||||
key={key}
|
|
||||||
className={buildClassName('chat-item-clickable picker-list-item', isChatItem && 'chat-item')}
|
|
||||||
disabled={disabled}
|
|
||||||
inactive={inactive}
|
|
||||||
allowDisabledClick={allowDisabledClick}
|
|
||||||
secondaryIcon={shouldRenderLockIcon ? 'lock-badge' : undefined}
|
|
||||||
|
|
||||||
onClick={() => handleItemClick(key)}
|
|
||||||
ripple={ripple}
|
|
||||||
>
|
|
||||||
{!isChatItem ? renderInput() : undefined}
|
|
||||||
{category ? renderCategory?.(category) : renderChatInfo?.(key)}
|
|
||||||
{isChatItem ? renderInput() : undefined}
|
|
||||||
</ListItem>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default memo(ListItemWithOptions);
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
.wrapper {
|
|
||||||
cursor: var(--custom-cursor, pointer);
|
|
||||||
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
margin-bottom: 0;
|
|
||||||
border: none;
|
|
||||||
|
|
||||||
line-height: 1.5rem;
|
|
||||||
}
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user