Chat Folders: Fix translations (#1988)

This commit is contained in:
Alexander Zinchuk 2022-08-07 21:16:08 +02:00
parent 206e9d063d
commit 7be9f5373c
2 changed files with 7 additions and 3 deletions

View File

@ -223,7 +223,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
return (
<div className="ChatFolders">
{shouldRenderFolders ? (
<TabList tabs={folderTabs} activeTab={activeChatFolder} onSwitchTab={handleSwitchTab} />
<TabList tabs={folderTabs} activeTab={activeChatFolder} onSwitchTab={handleSwitchTab} areFolders />
) : shouldRenderPlaceholder ? (
<div className={buildClassName('tabs-placeholder', transitionClassNames)} />
) : undefined}

View File

@ -1,8 +1,10 @@
import type { FC } from '../../lib/teact/teact';
import React, { memo, useRef, useEffect } from '../../lib/teact/teact';
import { ALL_FOLDER_ID } from '../../config';
import { IS_ANDROID, IS_IOS } from '../../util/environment';
import fastSmoothScrollHorizontal from '../../util/fastSmoothScrollHorizontal';
import usePrevious from '../../hooks/usePrevious';
import useHorizontalScroll from '../../hooks/useHorizontalScroll';
import useLang from '../../hooks/useLang';
@ -21,6 +23,7 @@ export type TabWithProperties = {
type OwnProps = {
tabs: readonly TabWithProperties[];
areFolders?: boolean;
activeTab: number;
big?: boolean;
onSwitchTab: (index: number) => void;
@ -31,7 +34,7 @@ const TAB_SCROLL_THRESHOLD_PX = 16;
const SCROLL_DURATION = IS_IOS ? 450 : IS_ANDROID ? 400 : 300;
const TabList: FC<OwnProps> = ({
tabs, activeTab, big, onSwitchTab,
tabs, areFolders, activeTab, big, onSwitchTab,
}) => {
// eslint-disable-next-line no-null/no-null
const containerRef = useRef<HTMLDivElement>(null);
@ -74,7 +77,8 @@ const TabList: FC<OwnProps> = ({
{tabs.map((tab, i) => (
<Tab
key={tab.id ?? tab.title}
title={lang(tab.title)}
// TODO Remove dependency on usage context
title={(!areFolders || tab.id === ALL_FOLDER_ID) ? lang(tab.title) : tab.title}
isActive={i === activeTab}
isBlocked={tab.isBlocked}
badgeCount={tab.badgeCount}