signal-desktop/ts/components/AvatarLightbox.tsx

65 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-08-05 20:17:05 -04:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
2022-12-09 21:02:22 -05:00
import { noop } from 'lodash';
2021-08-05 20:17:05 -04:00
import type { AvatarColorType } from '../types/Colors';
2021-08-05 20:17:05 -04:00
import { AvatarPreview } from './AvatarPreview';
import { Lightbox } from './Lightbox';
import type { LocalizerType } from '../types/Util';
2021-08-05 20:17:05 -04:00
export type PropsType = {
avatarColor?: AvatarColorType;
2024-07-11 12:44:09 -07:00
avatarUrl?: string;
2021-08-05 20:17:05 -04:00
conversationTitle?: string;
i18n: LocalizerType;
isGroup?: boolean;
noteToSelf?: boolean;
2021-08-05 20:17:05 -04:00
onClose: () => unknown;
};
2022-11-17 16:45:19 -08:00
export function AvatarLightbox({
2021-08-05 20:17:05 -04:00
avatarColor,
2024-07-11 12:44:09 -07:00
avatarUrl,
2021-08-05 20:17:05 -04:00
conversationTitle,
i18n,
isGroup,
noteToSelf,
2021-08-05 20:17:05 -04:00
onClose,
2022-11-17 16:45:19 -08:00
}: PropsType): JSX.Element {
2021-08-05 20:17:05 -04:00
return (
2022-12-09 21:02:22 -05:00
<Lightbox
closeLightbox={onClose}
i18n={i18n}
isViewOnce
2022-12-14 13:12:04 -05:00
media={[]}
playbackDisabled={false}
2022-12-14 13:12:04 -05:00
saveAttachment={noop}
2023-03-20 15:23:53 -07:00
toggleForwardMessagesModal={noop}
2023-02-24 16:18:57 -07:00
onMediaPlaybackStart={noop}
2023-03-03 19:03:15 -08:00
onNextAttachment={noop}
onPrevAttachment={noop}
onSelectAttachment={noop}
selectedIndex={0}
2022-12-09 21:02:22 -05:00
>
2021-08-05 20:17:05 -04:00
<AvatarPreview
avatarColor={avatarColor}
2024-07-11 12:44:09 -07:00
avatarUrl={avatarUrl}
2021-08-05 20:17:05 -04:00
conversationTitle={conversationTitle}
i18n={i18n}
isGroup={isGroup}
noteToSelf={noteToSelf}
2021-08-05 20:17:05 -04:00
style={{
fontSize: '16em',
2024-06-06 13:37:05 -07:00
width: 'auto',
minHeight: '64px',
height: '100%',
maxHeight: `min(${512}px, 100%)`,
aspectRatio: '1 / 1',
2021-08-05 20:17:05 -04:00
}}
/>
</Lightbox>
);
2022-11-17 16:45:19 -08:00
}