Global Search: Remove border for first entry (#3359)
This commit is contained in:
parent
ae4b193bf8
commit
e5bae9adcd
@ -11,6 +11,7 @@ import { createMapStateToProps } from './helpers/createMapStateToProps';
|
|||||||
import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';
|
import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';
|
||||||
import { getSenderName } from './helpers/getSenderName';
|
import { getSenderName } from './helpers/getSenderName';
|
||||||
import { throttle } from '../../../util/schedulers';
|
import { throttle } from '../../../util/schedulers';
|
||||||
|
import buildClassName from '../../../util/buildClassName';
|
||||||
|
|
||||||
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
@ -79,7 +80,8 @@ const AudioResults: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
function renderList() {
|
function renderList() {
|
||||||
return foundMessages.map((message, index) => {
|
return foundMessages.map((message, index) => {
|
||||||
const shouldDrawDateDivider = index === 0
|
const isFirst = index === 0;
|
||||||
|
const shouldDrawDateDivider = isFirst
|
||||||
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -87,7 +89,14 @@ const AudioResults: FC<OwnProps & StateProps> = ({
|
|||||||
key={message.id}
|
key={message.id}
|
||||||
>
|
>
|
||||||
{shouldDrawDateDivider && (
|
{shouldDrawDateDivider && (
|
||||||
<p className="section-heading" dir={lang.isRtl ? 'rtl' : undefined}>
|
<p
|
||||||
|
className={buildClassName(
|
||||||
|
'section-heading',
|
||||||
|
isFirst && 'section-heading-first',
|
||||||
|
!isFirst && 'section-heading-with-border',
|
||||||
|
)}
|
||||||
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
|
>
|
||||||
{formatMonthAndYear(lang, new Date(message.date * 1000))}
|
{formatMonthAndYear(lang, new Date(message.date * 1000))}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';
|
|||||||
import { getSenderName } from './helpers/getSenderName';
|
import { getSenderName } from './helpers/getSenderName';
|
||||||
import { throttle } from '../../../util/schedulers';
|
import { throttle } from '../../../util/schedulers';
|
||||||
import { getMessageDocument } from '../../../global/helpers';
|
import { getMessageDocument } from '../../../global/helpers';
|
||||||
|
import buildClassName from '../../../util/buildClassName';
|
||||||
|
|
||||||
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
@ -88,7 +89,8 @@ const FileResults: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
function renderList() {
|
function renderList() {
|
||||||
return foundMessages.map((message, index) => {
|
return foundMessages.map((message, index) => {
|
||||||
const shouldDrawDateDivider = index === 0
|
const isFirst = index === 0;
|
||||||
|
const shouldDrawDateDivider = isFirst
|
||||||
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -96,7 +98,16 @@ const FileResults: FC<OwnProps & StateProps> = ({
|
|||||||
key={message.id}
|
key={message.id}
|
||||||
>
|
>
|
||||||
{shouldDrawDateDivider && (
|
{shouldDrawDateDivider && (
|
||||||
<p className="section-heading">{formatMonthAndYear(lang, new Date(message.date * 1000))}</p>
|
<p
|
||||||
|
className={buildClassName(
|
||||||
|
'section-heading',
|
||||||
|
isFirst && 'section-heading-first',
|
||||||
|
!isFirst && 'section-heading-with-border',
|
||||||
|
)}
|
||||||
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
|
>
|
||||||
|
{formatMonthAndYear(lang, new Date(message.date * 1000))}
|
||||||
|
</p>
|
||||||
)}
|
)}
|
||||||
<Document
|
<Document
|
||||||
message={message}
|
message={message}
|
||||||
|
|||||||
@ -32,14 +32,18 @@
|
|||||||
font-size: 0.9375rem;
|
font-size: 0.9375rem;
|
||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
|
|
||||||
&::before {
|
&-first {
|
||||||
|
padding-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-with-border::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: calc(100% + 1.25rem);
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: var(--color-borders);
|
background: var(--color-borders);
|
||||||
left: 0.625rem;
|
left: 0;
|
||||||
top: -1px;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&[dir="rtl"],
|
&[dir="rtl"],
|
||||||
@ -71,6 +75,10 @@
|
|||||||
&::before {
|
&::before {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.without-border {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.WebLink {
|
.WebLink {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { createMapStateToProps } from './helpers/createMapStateToProps';
|
|||||||
import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';
|
import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat';
|
||||||
import { getSenderName } from './helpers/getSenderName';
|
import { getSenderName } from './helpers/getSenderName';
|
||||||
import { throttle } from '../../../util/schedulers';
|
import { throttle } from '../../../util/schedulers';
|
||||||
|
import buildClassName from '../../../util/buildClassName';
|
||||||
|
|
||||||
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
import useAsyncRendering from '../../right/hooks/useAsyncRendering';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
@ -85,7 +86,8 @@ const LinkResults: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
function renderList() {
|
function renderList() {
|
||||||
return foundMessages.map((message, index) => {
|
return foundMessages.map((message, index) => {
|
||||||
const shouldDrawDateDivider = index === 0
|
const isFirst = index === 0;
|
||||||
|
const shouldDrawDateDivider = isFirst
|
||||||
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
|| toYearMonth(message.date) !== toYearMonth(foundMessages[index - 1].date);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -94,7 +96,14 @@ const LinkResults: FC<OwnProps & StateProps> = ({
|
|||||||
key={message.id}
|
key={message.id}
|
||||||
>
|
>
|
||||||
{shouldDrawDateDivider && (
|
{shouldDrawDateDivider && (
|
||||||
<p className="section-heading" dir={lang.isRtl ? 'rtl' : undefined}>
|
<p
|
||||||
|
className={buildClassName(
|
||||||
|
'section-heading',
|
||||||
|
isFirst && 'section-heading-first',
|
||||||
|
!isFirst && 'section-heading-with-border',
|
||||||
|
)}
|
||||||
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
|
>
|
||||||
{formatMonthAndYear(lang, new Date(message.date * 1000))}
|
{formatMonthAndYear(lang, new Date(message.date * 1000))}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import type { ApiUser } from '../../../api/types';
|
|||||||
import { getUserFirstOrLastName } from '../../../global/helpers';
|
import { getUserFirstOrLastName } from '../../../global/helpers';
|
||||||
import renderText from '../../common/helpers/renderText';
|
import renderText from '../../common/helpers/renderText';
|
||||||
import { throttle } from '../../../util/schedulers';
|
import { throttle } from '../../../util/schedulers';
|
||||||
|
import buildClassName from '../../../util/buildClassName';
|
||||||
import useHorizontalScroll from '../../../hooks/useHorizontalScroll';
|
import useHorizontalScroll from '../../../hooks/useHorizontalScroll';
|
||||||
import useLang from '../../../hooks/useLang';
|
import useLang from '../../../hooks/useLang';
|
||||||
|
|
||||||
@ -92,7 +93,13 @@ const RecentContacts: FC<OwnProps & StateProps> = ({
|
|||||||
)}
|
)}
|
||||||
{recentlyFoundChatIds && (
|
{recentlyFoundChatIds && (
|
||||||
<div className="search-section pt-1">
|
<div className="search-section pt-1">
|
||||||
<h3 className="section-heading mt-0 recent-chats-header" dir={lang.isRtl ? 'rtl' : undefined}>
|
<h3
|
||||||
|
className={buildClassName(
|
||||||
|
'section-heading mt-0 recent-chats-header',
|
||||||
|
!topUserIds && 'without-border',
|
||||||
|
)}
|
||||||
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
|
>
|
||||||
{lang('Recent')}
|
{lang('Recent')}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import { replaceSettings } from '../../reducers';
|
|||||||
const HISTORY_ANIMATION_DURATION = 450;
|
const HISTORY_ANIMATION_DURATION = 450;
|
||||||
|
|
||||||
setSystemThemeChangeCallback((theme) => {
|
setSystemThemeChangeCallback((theme) => {
|
||||||
|
// eslint-disable-next-line eslint-multitab-tt/no-immediate-global
|
||||||
let global = getGlobal();
|
let global = getGlobal();
|
||||||
|
|
||||||
if (!global.settings.byKey.shouldUseSystemTheme) return;
|
if (!global.settings.byKey.shouldUseSystemTheme) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user