diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index fb6baf2d9..cf6c9d15c 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -5448,7 +5448,6 @@ button.module-image__border-overlay:focus { .module-timeline { display: flex; - flex-direction: column; height: 100%; overflow: hidden; } @@ -5463,7 +5462,6 @@ button.module-image__border-overlay:focus { overflow-y: overlay; display: flex; flex-direction: column; - position: relative; } .module-timeline__messages { diff --git a/stylesheets/components/TimelineFloatingHeader.scss b/stylesheets/components/TimelineFloatingHeader.scss index 89ee71d92..a43d57dc3 100644 --- a/stylesheets/components/TimelineFloatingHeader.scss +++ b/stylesheets/components/TimelineFloatingHeader.scss @@ -7,7 +7,7 @@ flex-direction: column; left: 0; pointer-events: none; - position: sticky; + position: absolute; top: 10px; transition: opacity 0.25s ease-out; width: 100%; diff --git a/stylesheets/components/TimelineWarnings.scss b/stylesheets/components/TimelineWarnings.scss index 617a7b116..5b1b2db71 100644 --- a/stylesheets/components/TimelineWarnings.scss +++ b/stylesheets/components/TimelineWarnings.scss @@ -2,7 +2,12 @@ // SPDX-License-Identifier: AGPL-3.0-only .module-TimelineWarnings { + left: 0; + position: absolute; + top: 0; + width: 100%; + z-index: $z-index-above-above-base; + display: flex; flex-direction: column; - width: 100%; } diff --git a/ts/components/conversation/Timeline.tsx b/ts/components/conversation/Timeline.tsx index 916583ab6..50194d616 100644 --- a/ts/components/conversation/Timeline.tsx +++ b/ts/components/conversation/Timeline.tsx @@ -173,6 +173,7 @@ export type PropsType = PropsDataType & type StateType = { hasDismissedDirectContactSpoofingWarning: boolean; hasRecentlyScrolled: boolean; + lastMeasuredWarningHeight: number; newestBottomVisibleMessageId?: string; oldestPartiallyVisibleMessageId?: string; widthBreakpoint: WidthBreakpoint; @@ -276,7 +277,8 @@ export class Timeline extends React.Component< hasRecentlyScrolled: true, hasDismissedDirectContactSpoofingWarning: false, - // This may be swiftly overridden. + // These may be swiftly overridden. + lastMeasuredWarningHeight: 0, widthBreakpoint: WidthBreakpoint.Wide, }; @@ -792,6 +794,7 @@ export class Timeline extends React.Component< } = this.props; const { hasRecentlyScrolled, + lastMeasuredWarningHeight, newestBottomVisibleMessageId, oldestPartiallyVisibleMessageId, widthBreakpoint, @@ -845,6 +848,11 @@ export class Timeline extends React.Component< - - - - - {text} - - + { + if (!bounds) { + assert(false, 'We should be measuring the bounds'); + return; + } + this.setState({ lastMeasuredWarningHeight: bounds.height }); + }} + > + {({ measureRef }) => ( + + + + + + {text} + + + )} + ); } @@ -1066,13 +1087,13 @@ export class Timeline extends React.Component< > {timelineWarning} + {floatingHeader} +
- {floatingHeader} -
- {haveOldest && - renderHeroRow(id, unblurAvatar, updateSharedGroups)} + {haveOldest && ( + <> + {Timeline.getWarning(this.props, this.state) && ( +
+ )} + {renderHeroRow(id, unblurAvatar, updateSharedGroups)} + + )} {messageNodes} diff --git a/ts/components/conversation/TimelineFloatingHeader.tsx b/ts/components/conversation/TimelineFloatingHeader.tsx index dcdb4c3ae..8aee0e2a1 100644 --- a/ts/components/conversation/TimelineFloatingHeader.tsx +++ b/ts/components/conversation/TimelineFloatingHeader.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import classNames from 'classnames'; -import type { ReactElement } from 'react'; +import type { CSSProperties, ReactElement } from 'react'; import React, { useEffect, useState } from 'react'; import type { LocalizerType } from '../../types/Util'; import { TimelineDateHeader } from './TimelineDateHeader'; @@ -11,11 +11,13 @@ import { Spinner } from '../Spinner'; export const TimelineFloatingHeader = ({ i18n, isLoading, + style, timestamp, visible, }: Readonly<{ i18n: LocalizerType; isLoading: boolean; + style?: CSSProperties; timestamp: number; visible: boolean; }>): ReactElement => { @@ -33,6 +35,7 @@ export const TimelineFloatingHeader = ({ visible && hasRendered ? 'visible' : 'hidden' }` )} + style={style} >
( -
{children}
+type PropsType = { + children: ReactNode; +}; + +export const TimelineWarnings = forwardRef( + ({ children }, ref) => ( +
+ {children} +
+ ) );