Skip to content

Commit

Permalink
Merge pull request #2291 from daostack/cw-2254-show-@-tag-if-mentioned
Browse files Browse the repository at this point in the history
Add (personal) @ icon on unread “mentioned” stream #2254
  • Loading branch information
roienatan authored Nov 6, 2023
2 parents ad70171 + 90d178c commit 3495fc3
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pages/common/components/ChatComponent/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ChatItem {
lastSeenItem?: CommonFeedObjectUserUnique["lastSeen"];
lastSeenAt?: CommonFeedObjectUserUnique["lastSeenAt"];
seenOnce?: boolean;
hasUnseenMention?: CommonFeedObjectUserUnique["hasUnseenMention"];
}

export interface ChatContextValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(
lastSeenItem: feedItemUserMetadata?.lastSeen,
lastSeenAt: feedItemUserMetadata?.lastSeenAt,
seenOnce: feedItemUserMetadata?.seenOnce,
hasUnseenMention: feedItemUserMetadata?.hasUnseenMention,
});
}
}, [
Expand All @@ -177,6 +178,7 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(
feedItemUserMetadata?.lastSeen,
feedItemUserMetadata?.lastSeenAt,
feedItemUserMetadata?.seenOnce,
feedItemUserMetadata?.hasUnseenMention,
]);

const onDiscussionDelete = useCallback(async () => {
Expand Down Expand Up @@ -333,6 +335,10 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(
seen={feedItemUserMetadata?.seen ?? !isFeedItemUserMetadataFetched}
ownerId={item.userId}
discussionPredefinedType={discussion?.predefinedType}
hasUnseenMention={
feedItemUserMetadata?.hasUnseenMention ??
!isFeedItemUserMetadataFetched
}
>
{renderContent()}
</FeedCard>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/common/components/FeedCard/FeedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type FeedCardProps = PropsWithChildren<{
discussionPredefinedType?: PredefinedTypes;
hasFiles?: boolean;
hasImages?: boolean;
hasUnseenMention?: boolean;
}>;

const MOBILE_HEADER_HEIGHT = 52;
Expand Down Expand Up @@ -79,6 +80,7 @@ export const FeedCard = forwardRef<FeedCardRef, FeedCardProps>((props, ref) => {
menuItems,
seenOnce,
seen,
hasUnseenMention,
ownerId,
discussionPredefinedType,
hasImages,
Expand Down Expand Up @@ -204,6 +206,7 @@ export const FeedCard = forwardRef<FeedCardRef, FeedCardProps>((props, ref) => {
discussionPredefinedType,
hasFiles,
hasImages,
hasUnseenMention,
})}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@
border-radius: 50%;
background-color: $c-pink-primary;
}

.hasUnseenMention {
color: $c-pink-primary;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface FeedCardTagsProps {
isActive: boolean;
isPinned?: boolean;
isFollowing?: boolean;
hasUnseenMention?: boolean;
}

export const FeedCardTags: FC<FeedCardTagsProps> = (props) => {
Expand All @@ -28,6 +29,7 @@ export const FeedCardTags: FC<FeedCardTagsProps> = (props) => {
isActive,
isPinned,
isFollowing,
hasUnseenMention,
} = props;
const user = useSelector(selectUser());
const isOwner = ownerId === user?.uid;
Expand All @@ -54,6 +56,7 @@ export const FeedCardTags: FC<FeedCardTagsProps> = (props) => {
})}
/>
)}
{hasUnseenMention && <div className={styles.hasUnseenMention}>@</div>}
{isFollowing && (
<StarIcon className={styles.starIcon} stroke="currentColor" />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
isFollowing,
isLoading = false,
shouldHideBottomContent = false,
hasUnseenMention,
} = props;
const contextMenuRef = useRef<ContextMenuRef>(null);
const [isLongPressing, setIsLongPressing] = useState(false);
Expand Down Expand Up @@ -154,6 +155,7 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
isActive={isActive}
isPinned={isPinned}
isFollowing={isFollowing}
hasUnseenMention={hasUnseenMention}
/>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/pages/common/components/FeedItem/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface FeedItemBaseContentProps {
hasImages?: boolean;
isLoading?: boolean;
shouldHideBottomContent?: boolean;
hasUnseenMention?: boolean;
}

export interface GetLastMessageOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ const ProposalFeedCard = forwardRef<FeedItemRef, ProposalFeedCardProps>(
lastSeenItem: feedItemUserMetadata?.lastSeen,
lastSeenAt: feedItemUserMetadata?.lastSeenAt,
seenOnce: feedItemUserMetadata?.seenOnce,
hasUnseenMention: feedItemUserMetadata?.hasUnseenMention,
});
}
}, [
Expand All @@ -281,6 +282,7 @@ const ProposalFeedCard = forwardRef<FeedItemRef, ProposalFeedCardProps>(
feedItemUserMetadata?.lastSeen,
feedItemUserMetadata?.lastSeenAt,
feedItemUserMetadata?.seenOnce,
feedItemUserMetadata?.hasUnseenMention,
]);

useEffect(() => {
Expand Down Expand Up @@ -458,6 +460,10 @@ const ProposalFeedCard = forwardRef<FeedItemRef, ProposalFeedCardProps>(
seen={feedItemUserMetadata?.seen ?? !isFeedItemUserMetadataFetched}
menuItems={menuItems}
ownerId={item.userId}
hasUnseenMention={
feedItemUserMetadata?.hasUnseenMention ??
!isFeedItemUserMetadataFetched
}
>
{renderContent()}
</FeedCard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
isImageRounded,
isProject,
discussionPredefinedType,
hasUnseenMention,
} = props;
const contextMenuRef = useRef<ContextMenuRef>(null);
const [isLongPressing, setIsLongPressing] = useState(false);
Expand Down Expand Up @@ -160,6 +161,7 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
ownerId={ownerId}
isActive={isActive}
isPinned={false}
hasUnseenMention={hasUnseenMention}
/>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/shared/models/CommonFeedObjectUserUnique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface CommonFeedObjectUserUnique extends BaseEntity {
commonId: string;
seenOnce?: boolean;
seen?: boolean;
hasUnseenMention?: boolean;
}

0 comments on commit 3495fc3

Please sign in to comment.