// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; import classNames from 'classnames'; import type { ConversationType } from '../state/ducks/conversations'; import type { LocalizerType } from '../types/Util'; import type { ShowToastActionCreatorType } from '../state/ducks/toast'; import type { StoryViewType } from '../types/Stories'; import { Avatar, AvatarSize } from './Avatar'; import { HasStories } from '../types/Stories'; import { StoryImage } from './StoryImage'; import { getAvatarColor } from '../types/Colors'; import { MessageTimestamp } from './conversation/MessageTimestamp'; import { StoriesAddStoryButton } from './StoriesAddStoryButton'; export type PropsType = { hasMultiple: boolean; i18n: LocalizerType; me: ConversationType; newestStory?: StoryViewType; onAddStory: () => unknown; onClick: () => unknown; queueStoryDownload: (storyId: string) => unknown; showToast: ShowToastActionCreatorType; }; export const MyStoriesButton = ({ hasMultiple, i18n, me, newestStory, onAddStory, onClick, queueStoryDownload, showToast, }: PropsType): JSX.Element => { const { acceptedMessageRequest, avatarPath, color, isMe, profileName, sharedGroupNames, title, } = me; if (!newestStory) { return (
<>
{i18n('Stories__mine')}
{i18n('Stories__add')}
); } return (
{ if (ev.key === 'Enter') { onClick(); ev.stopPropagation(); ev.preventDefault(); } }} role="button" tabIndex={0} >
{i18n('Stories__mine')}
{hasMultiple &&
}
); };