Shared Components Restructure, Cherry Picked | Room Timeline (#32916)

* refactor(shared-components): move room timeline tree

* refactor(web): move room timeline viewmodels

* Prettier FIx

* fix(refactor): align newer imports with room timeline paths

* test(shared-components): add room timeline visual baselines

* test(shared-components): drop stale timeline baseline paths
This commit is contained in:
Zack
2026-03-30 15:15:21 +00:00
committed by GitHub
parent 7c60752b04
commit dda9ec061b
192 changed files with 157 additions and 144 deletions
@@ -15,19 +15,19 @@ import React from "react";
import { Direction, ConnectionError, HTTPError, MatrixError } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { formatFullDateNoDay, formatFullDateNoTime, getDaysArray } from "../../DateUtils";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import dispatcher from "../../dispatcher/dispatcher";
import { Action } from "../../dispatcher/actions";
import { type ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload";
import { _t, getUserLanguage } from "../../languageHandler";
import Modal from "../../Modal";
import SettingsStore from "../../settings/SettingsStore";
import { UIFeature } from "../../settings/UIFeature";
import ErrorDialog from "../../components/views/dialogs/ErrorDialog";
import BugReportDialog from "../../components/views/dialogs/BugReportDialog";
import AccessibleButton from "../../components/views/elements/AccessibleButton";
import { SdkContextClass } from "../../contexts/SDKContext";
import { formatFullDateNoDay, formatFullDateNoTime, getDaysArray } from "../../../DateUtils";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
import dispatcher from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
import { type ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { _t, getUserLanguage } from "../../../languageHandler";
import Modal from "../../../Modal";
import SettingsStore from "../../../settings/SettingsStore";
import { UIFeature } from "../../../settings/UIFeature";
import ErrorDialog from "../../../components/views/dialogs/ErrorDialog";
import BugReportDialog from "../../../components/views/dialogs/BugReportDialog";
import AccessibleButton from "../../../components/views/elements/AccessibleButton";
import { SdkContextClass } from "../../../contexts/SDKContext";
export interface DateSeparatorViewModelProps {
/**
@@ -12,9 +12,9 @@ import {
} from "@element-hq/web-shared-components";
import { type MouseEvent } from "react";
import { _t } from "../../languageHandler";
import { getUserNameColorClass } from "../../utils/FormattingUtils";
import UserIdentifier from "../../customisations/UserIdentifier";
import { _t } from "../../../../languageHandler";
import { getUserNameColorClass } from "../../../../utils/FormattingUtils";
import UserIdentifier from "../../../../customisations/UserIdentifier";
/**
* Information about a member for disambiguation purposes.
@@ -15,11 +15,11 @@ import {
} from "@element-hq/web-shared-components";
import type { RoomEncryptionEventContent } from "matrix-js-sdk/src/types";
import DMRoomMap from "../../utils/DMRoomMap";
import { MEGOLM_ENCRYPTION_ALGORITHM } from "../../utils/crypto";
import { isLocalRoom } from "../../utils/localRoom/isLocalRoom";
import { isRoomEncrypted } from "../../hooks/useIsEncrypted";
import { objectHasDiff } from "../../utils/objects";
import DMRoomMap from "../../../../utils/DMRoomMap";
import { MEGOLM_ENCRYPTION_ALGORITHM } from "../../../../utils/crypto";
import { isLocalRoom } from "../../../../utils/localRoom/isLocalRoom";
import { isRoomEncrypted } from "../../../../hooks/useIsEncrypted";
import { objectHasDiff } from "../../../../utils/objects";
export interface EncryptionEventViewModelProps {
/** Caller-provided client. */
@@ -8,9 +8,9 @@ Please see LICENSE files in the repository root for full details.
import { MatrixEventEvent } from "matrix-js-sdk/src/matrix";
import { type TextualEventViewSnapshot, BaseViewModel } from "@element-hq/web-shared-components";
import { type EventTileTypeProps } from "../../events/EventTileFactory";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import { textForEvent } from "../../TextForEvent";
import { type EventTileTypeProps } from "../../../../events/EventTileFactory";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import { textForEvent } from "../../../../TextForEvent";
export class TextualEventViewModel extends BaseViewModel<TextualEventViewSnapshot, EventTileTypeProps> {
public constructor(props: EventTileTypeProps) {
@@ -14,10 +14,10 @@ import {
type AudioPlayerViewModel as AudioPlayerViewModelInterface,
} from "@element-hq/web-shared-components";
import { type Playback } from "../../audio/Playback";
import { UPDATE_EVENT } from "../../stores/AsyncStore";
import { getKeyBindingsManager } from "../../KeyBindingsManager";
import { KeyBindingAction } from "../../accessibility/KeyboardShortcuts";
import { type Playback } from "../../../../../audio/Playback";
import { UPDATE_EVENT } from "../../../../../stores/AsyncStore";
import { getKeyBindingsManager } from "../../../../../KeyBindingsManager";
import { KeyBindingAction } from "../../../../../accessibility/KeyboardShortcuts";
/**
* The number of seconds to skip when the user presses the left or right arrow keys.
@@ -12,9 +12,9 @@ import {
type ReactionsRowButtonTooltipViewModel as ReactionsRowButtonTooltipViewModelInterface,
} from "@element-hq/web-shared-components";
import { _t } from "../../languageHandler";
import { formatList } from "../../utils/FormattingUtils";
import { unicodeToShortcode } from "../../HtmlUtils";
import { _t } from "../../../../../languageHandler";
import { formatList } from "../../../../../utils/FormattingUtils";
import { unicodeToShortcode } from "../../../../../HtmlUtils";
import { REACTION_SHORTCODE_KEY } from "./reactionShortcode";
export interface ReactionsRowButtonTooltipViewModelProps {
@@ -12,10 +12,10 @@ import {
type ReactionsRowButtonViewModel as ReactionsRowButtonViewModelInterface,
} from "@element-hq/web-shared-components";
import { mediaFromMxc } from "../../customisations/Media";
import { _t } from "../../languageHandler";
import { formatList } from "../../utils/FormattingUtils";
import dis from "../../dispatcher/dispatcher";
import { mediaFromMxc } from "../../../../../customisations/Media";
import { _t } from "../../../../../languageHandler";
import { formatList } from "../../../../../utils/FormattingUtils";
import dis from "../../../../../dispatcher/dispatcher";
import { ReactionsRowButtonTooltipViewModel } from "./ReactionsRowButtonTooltipViewModel";
import { REACTION_SHORTCODE_KEY } from "./reactionShortcode";
@@ -12,7 +12,7 @@ import {
type ReactionsRowViewModel as ReactionsRowViewModelInterface,
} from "@element-hq/web-shared-components";
import { _t } from "../../languageHandler";
import { _t } from "../../../../../languageHandler";
export const MAX_ITEMS_WHEN_LIMITED = 8;
@@ -12,8 +12,8 @@ import {
type MessageTimestampViewModel as MessageTimestampViewModelInterface,
} from "@element-hq/web-shared-components";
import { formatFullDate, formatTime, formatFullTime, formatRelativeTime } from "../../DateUtils";
import { objectHasDiff } from "../../utils/objects";
import { formatFullDate, formatTime, formatFullTime, formatRelativeTime } from "../../../../../DateUtils";
import { objectHasDiff } from "../../../../../utils/objects";
export interface MessageTimestampViewModelProps {
/**