replace all require(svgs) with esm import (#7948)
Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
522ad1aafb
commit
61cd463a3b
33 changed files with 104 additions and 54 deletions
|
@ -29,6 +29,7 @@ import { PlaybackManager } from "../../../audio/PlaybackManager";
|
|||
import { isVoiceMessage } from "../../../utils/EventUtils";
|
||||
import { PlaybackQueue } from "../../../audio/PlaybackQueue";
|
||||
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
|
||||
import WarningSvg from '../../../../res/img/warning.svg';
|
||||
|
||||
interface IState {
|
||||
error?: Error;
|
||||
|
@ -96,7 +97,7 @@ export default class MAudioBody extends React.PureComponent<IBodyProps, IState>
|
|||
if (this.state.error) {
|
||||
return (
|
||||
<span className="mx_MAudioBody">
|
||||
<img src={require("../../../../res/img/warning.svg")} width="16" height="16" />
|
||||
<img src={WarningSvg} width="16" height="16" />
|
||||
{ _t("Error processing audio message") }
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -37,6 +37,7 @@ import { IBodyProps } from "./IBodyProps";
|
|||
import { ImageSize, suggestedSize as suggestedImageSize } from "../../../settings/enums/ImageSize";
|
||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
|
||||
import WarningSvg from '../../../../res/img/warning.svg';
|
||||
|
||||
interface IState {
|
||||
decryptedUrl?: string;
|
||||
|
@ -543,7 +544,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
if (this.state.error !== null) {
|
||||
return (
|
||||
<div className="mx_MImageBody">
|
||||
<img src={require("../../../../res/img/warning.svg")} width="16" height="16" />
|
||||
<img src={WarningSvg} width="16" height="16" />
|
||||
{ _t("Error decrypting image") }
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -20,6 +20,7 @@ import MImageBody from './MImageBody';
|
|||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import { BLURHASH_FIELD } from "../../../ContentMessages";
|
||||
import Tooltip from "../elements/Tooltip";
|
||||
import ShowStickersSvg from '../../../../res/img/icons-show-stickers.svg';
|
||||
|
||||
@replaceableComponent("views.messages.MStickerBody")
|
||||
export default class MStickerBody extends MImageBody {
|
||||
|
@ -45,7 +46,7 @@ export default class MStickerBody extends MImageBody {
|
|||
// img onLoad hasn't fired yet.
|
||||
protected getPlaceholder(width: number, height: number): JSX.Element {
|
||||
if (this.props.mxEvent.getContent().info?.[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
|
||||
return <img src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />;
|
||||
return <img src={ShowStickersSvg} width="75" height="75" />;
|
||||
}
|
||||
|
||||
// Tooltip to show on mouse over
|
||||
|
|
|
@ -29,6 +29,7 @@ import { IBodyProps } from "./IBodyProps";
|
|||
import MFileBody from "./MFileBody";
|
||||
import { ImageSize, suggestedSize as suggestedVideoSize } from "../../../settings/enums/ImageSize";
|
||||
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
|
||||
import WarningSvg from '../../../../res/img/warning.svg';
|
||||
|
||||
interface IState {
|
||||
decryptedUrl?: string;
|
||||
|
@ -257,7 +258,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
|
|||
if (this.state.error !== null) {
|
||||
return (
|
||||
<span className="mx_MVideoBody">
|
||||
<img src={require("../../../../res/img/warning.svg")} width="16" height="16" />
|
||||
<img src={WarningSvg} width="16" height="16" />
|
||||
{ _t("Error decrypting video") }
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -22,6 +22,7 @@ import { _t } from "../../../languageHandler";
|
|||
import RecordingPlayback from "../audio_messages/RecordingPlayback";
|
||||
import MAudioBody from "./MAudioBody";
|
||||
import MFileBody from "./MFileBody";
|
||||
import WarningSvg from '../../../../res/img/warning.svg';
|
||||
|
||||
@replaceableComponent("views.messages.MVoiceMessageBody")
|
||||
export default class MVoiceMessageBody extends MAudioBody {
|
||||
|
@ -30,7 +31,7 @@ export default class MVoiceMessageBody extends MAudioBody {
|
|||
if (this.state.error) {
|
||||
return (
|
||||
<span className="mx_MVoiceMessageBody">
|
||||
<img src={require("../../../../res/img/warning.svg")} width="16" height="16" />
|
||||
<img src={WarningSvg} width="16" height="16" />
|
||||
{ _t("Error processing voice message") }
|
||||
</span>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue