Include distribution list name on sent stories

This commit is contained in:
Josh Perez 2022-09-22 14:56:49 -04:00 committed by GitHub
parent 94ef800e33
commit d911439f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 18 deletions

View file

@ -56,13 +56,33 @@
&__meta { &__meta {
bottom: 0; bottom: 0;
left: 50%; left: 50%;
min-width: 284px;
padding: 0 16px; padding: 0 16px;
position: absolute; position: absolute;
transform: translateX(-50%); transform: translateX(-50%);
min-width: 284px;
width: 56.25vh; width: 56.25vh;
z-index: $z-index-story-meta; z-index: $z-index-story-meta;
&__list {
@include font-body-2;
align-items: center;
display: flex;
color: $color-white-alpha-80;
margin-left: 8px;
&::before {
@include color-svg(
'../images/icons/v2/lock-solid-24.svg',
$color-white-alpha-80
);
content: '';
display: block;
height: 14px;
margin-right: 6px;
width: 14px;
}
}
&--group-avatar { &--group-avatar {
margin-left: -8px; margin-left: -8px;
} }
@ -82,6 +102,12 @@
&__playback-bar { &__playback-bar {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
user-select: none;
&__container {
align-items: center;
display: flex;
}
} }
&__playback-controls { &__playback-controls {

View file

@ -147,6 +147,7 @@ export const YourStory = Template.bind({});
); );
YourStory.args = { YourStory.args = {
distributionListName: 'Close Friends',
story: { story: {
...storyView, ...storyView,
sender: { sender: {

View file

@ -44,6 +44,7 @@ import { useEscapeHandling } from '../hooks/useEscapeHandling';
export type PropsType = { export type PropsType = {
currentIndex: number; currentIndex: number;
deleteStoryForEveryone: (story: StoryViewType) => unknown; deleteStoryForEveryone: (story: StoryViewType) => unknown;
distributionListName?: string;
getPreferredBadge: PreferredBadgeSelectorType; getPreferredBadge: PreferredBadgeSelectorType;
group?: Pick< group?: Pick<
ConversationType, ConversationType,
@ -104,6 +105,7 @@ enum Arrow {
export const StoryViewer = ({ export const StoryViewer = ({
currentIndex, currentIndex,
deleteStoryForEveryone, deleteStoryForEveryone,
distributionListName,
getPreferredBadge, getPreferredBadge,
group, group,
hasActiveCall, hasActiveCall,
@ -572,7 +574,7 @@ export const StoryViewer = ({
</div> </div>
)} )}
<div className="StoryViewer__meta__playback-bar"> <div className="StoryViewer__meta__playback-bar">
<div> <div className="StoryViewer__meta__playback-bar__container">
<Avatar <Avatar
acceptedMessageRequest={acceptedMessageRequest} acceptedMessageRequest={acceptedMessageRequest}
avatarPath={avatarPath} avatarPath={avatarPath}
@ -604,6 +606,7 @@ export const StoryViewer = ({
title={group.title} title={group.title}
/> />
)} )}
<div>
<div className="StoryViewer__meta--title"> <div className="StoryViewer__meta--title">
{(group && {(group &&
i18n('Stories__from-to-group', { i18n('Stories__from-to-group', {
@ -618,6 +621,12 @@ export const StoryViewer = ({
module="StoryViewer__meta--timestamp" module="StoryViewer__meta--timestamp"
timestamp={timestamp} timestamp={timestamp}
/> />
{distributionListName && (
<div className="StoryViewer__meta__list">
{distributionListName}
</div>
)}
</div>
</div> </div>
<div className="StoryViewer__meta__playback-controls"> <div className="StoryViewer__meta__playback-controls">
<button <button

View file

@ -11,6 +11,7 @@ import type {
ConversationStoryType, ConversationStoryType,
MyStoryType, MyStoryType,
ReplyStateType, ReplyStateType,
StoryDistributionListWithMembersDataType,
StorySendStateType, StorySendStateType,
StoryViewType, StoryViewType,
} from '../../types/Stories'; } from '../../types/Stories';
@ -463,12 +464,19 @@ export const getHasStoriesSelector = createSelector(
export const getStoryByIdSelector = createSelector( export const getStoryByIdSelector = createSelector(
getStoriesState, getStoriesState,
getUserConversationId, getUserConversationId,
({ stories }, ourConversationId) => getDistributionListSelector,
({ stories }, ourConversationId, distributionListSelector) =>
( (
conversationSelector: GetConversationByIdType, conversationSelector: GetConversationByIdType,
messageId: string messageId: string
): ):
| { conversationStory: ConversationStoryType; storyView: StoryViewType } | {
conversationStory: ConversationStoryType;
distributionList:
| Pick<StoryDistributionListWithMembersDataType, 'id' | 'name'>
| undefined;
storyView: StoryViewType;
}
| undefined => { | undefined => {
const story = stories.find(item => item.messageId === messageId); const story = stories.find(item => item.messageId === messageId);
@ -476,12 +484,25 @@ export const getStoryByIdSelector = createSelector(
return; return;
} }
let distributionList:
| Pick<StoryDistributionListWithMembersDataType, 'id' | 'name'>
| undefined;
if (story.storyDistributionListId) {
distributionList =
story.storyDistributionListId === MY_STORIES_ID
? { id: MY_STORIES_ID, name: MY_STORIES_ID }
: distributionListSelector(
story.storyDistributionListId.toLowerCase()
);
}
return { return {
conversationStory: getConversationStory( conversationStory: getConversationStory(
conversationSelector, conversationSelector,
ourConversationId, ourConversationId,
story story
), ),
distributionList,
storyView: getStoryView(conversationSelector, ourConversationId, story), storyView: getStoryView(conversationSelector, ourConversationId, story),
}; };
} }

View file

@ -67,7 +67,7 @@ export function SmartStoryViewer(): JSX.Element | null {
storyInfo, storyInfo,
'StoryViewer: selected story does not exist in stories' 'StoryViewer: selected story does not exist in stories'
); );
const { conversationStory, storyView } = storyInfo; const { conversationStory, distributionList, storyView } = storyInfo;
const recentEmojis = useRecentEmojis(); const recentEmojis = useRecentEmojis();
const skinTone = useSelector<StateType, number>(getEmojiSkinTone); const skinTone = useSelector<StateType, number>(getEmojiSkinTone);
@ -84,6 +84,7 @@ export function SmartStoryViewer(): JSX.Element | null {
return ( return (
<StoryViewer <StoryViewer
currentIndex={selectedStoryData.currentIndex} currentIndex={selectedStoryData.currentIndex}
distributionListName={distributionList?.name}
getPreferredBadge={getPreferredBadge} getPreferredBadge={getPreferredBadge}
group={conversationStory.group} group={conversationStory.group}
hasActiveCall={hasActiveCall} hasActiveCall={hasActiveCall}