diff --git a/src/components/chats/ChatItem/ChatItem.tsx b/src/components/chats/ChatItem/ChatItem.tsx index 6b517ea95..9926ebc21 100644 --- a/src/components/chats/ChatItem/ChatItem.tsx +++ b/src/components/chats/ChatItem/ChatItem.tsx @@ -30,6 +30,7 @@ export type ChatItemProps = Omit, 'children'> & { hubId: string bg?: 'background-light' | 'background' showApproveButton?: boolean + disableSuperLike?: boolean menuIdPrefix?: string } @@ -41,6 +42,7 @@ export default function ChatItem({ enableChatMenu = true, chatId, hubId, + disableSuperLike, bg = 'background-light', showApproveButton, enableProfileModal = true, diff --git a/src/components/chats/ChatItem/variants/DefaultChatItem.tsx b/src/components/chats/ChatItem/variants/DefaultChatItem.tsx index 528ab0792..e1478a67f 100644 --- a/src/components/chats/ChatItem/variants/DefaultChatItem.tsx +++ b/src/components/chats/ChatItem/variants/DefaultChatItem.tsx @@ -26,6 +26,7 @@ export default function DefaultChatItem({ hubId, message, isMyMessage, + disableSuperLike, scrollToMessage, enableProfileModal = true, bg = 'background', @@ -101,30 +102,6 @@ export default function DefaultChatItem({ { - // const href = attributes.href || '' - // const baseUrl = 'https://epicapp.net' - // if (href.startsWith(baseUrl)) { - // content = content.replace(/(https?:\/\/)?(www\.)?/, '') - // } - - // const messageLinkRegex = - // /^(https?:\/\/)?(www\.)?epicapp\.net\/([^\/?#]+)\/([^\/?#]+)\/([^\/?#]+)\/?$/i - // const match = href.match(messageLinkRegex) - // const messageId = match?.[5] - // if (messageId) { - // return ( - // - // ) - // } - return ( {relativeTime()} diff --git a/src/components/chats/ChatItem/variants/EmojiChatItem.tsx b/src/components/chats/ChatItem/variants/EmojiChatItem.tsx index f590a2d61..f94351275 100644 --- a/src/components/chats/ChatItem/variants/EmojiChatItem.tsx +++ b/src/components/chats/ChatItem/variants/EmojiChatItem.tsx @@ -30,6 +30,7 @@ export default function EmojiChatItem({ isMyMessage, scrollToMessage, chatId, + disableSuperLike, enableProfileModal = true, hubId, ...props @@ -132,6 +133,7 @@ export default function EmojiChatItem({ & { chatId: string hubId: string message: PostData + disableSuperLike?: boolean isMyMessage: boolean scrollToMessage?: ScrollToMessage bg?: 'background-light' | 'background' diff --git a/src/components/chats/ChatList/ChatItemContainer.tsx b/src/components/chats/ChatList/ChatItemContainer.tsx index b56819d85..9060efabb 100644 --- a/src/components/chats/ChatList/ChatItemContainer.tsx +++ b/src/components/chats/ChatList/ChatItemContainer.tsx @@ -14,6 +14,7 @@ export type ChatItemContainerProps = Omit & { enableProfileModal?: boolean showBlockedMessage?: boolean chatId: string + disableSuperLike?: boolean hubId: string showApproveButton?: boolean } @@ -25,6 +26,7 @@ function ChatItemContainer( hubId, showBlockedMessage, enableProfileModal = true, + disableSuperLike, showApproveButton, ...props }: ChatItemContainerProps, @@ -75,6 +77,7 @@ function ChatItemContainer( chatId={chatId} isMyMessage={isMyMessage} enableProfileModal={enableProfileModal} + disableSuperLike={disableSuperLike} hubId={hubId} showApproveButton={showApproveButton} /> diff --git a/src/components/chats/ChatList/ChatItemWithMenu.tsx b/src/components/chats/ChatList/ChatItemWithMenu.tsx index 5934e62c9..8fb411e1c 100644 --- a/src/components/chats/ChatList/ChatItemWithMenu.tsx +++ b/src/components/chats/ChatList/ChatItemWithMenu.tsx @@ -17,6 +17,7 @@ export type ChatItemWithMenuProps = { hubId: string enableProfileModal?: boolean showBlockedMessage?: boolean + disableSuperLike?: boolean scrollToMessage?: ScrollToMessage showApproveButton?: boolean menuIdPrefix?: string @@ -28,6 +29,7 @@ function InnerChatItemWithMenu({ hubId, enableProfileModal = true, showBlockedMessage, + disableSuperLike, scrollToMessage, showApproveButton, menuIdPrefix, diff --git a/src/components/chats/ChatList/ChatList.tsx b/src/components/chats/ChatList/ChatList.tsx index b341a7c55..cce7a994f 100644 --- a/src/components/chats/ChatList/ChatList.tsx +++ b/src/components/chats/ChatList/ChatList.tsx @@ -28,6 +28,7 @@ export type ChatListProps = ComponentProps<'div'> & { scrollContainerRef?: React.RefObject scrollableContainerClassName?: string hubId: string + disableSuperLike?: boolean chatId: string onlyDisplayUnapprovedMessages?: boolean newMessageNoticeClassName?: string @@ -55,6 +56,7 @@ function ChatListContent({ hubId, chatId, scrollContainerRef: _scrollContainerRef, + disableSuperLike, newMessageNoticeClassName, onlyDisplayUnapprovedMessages, ...props @@ -210,6 +212,7 @@ function ChatListContent({ chatId={chatId} hubId={hubId} message={message} + disableSuperLike={disableSuperLike} scrollToMessage={scrollToMessage} showApproveButton={onlyDisplayUnapprovedMessages} /> diff --git a/src/components/chats/ChatRoom/ChatRoom.tsx b/src/components/chats/ChatRoom/ChatRoom.tsx index 05b27e42c..cc295db22 100644 --- a/src/components/chats/ChatRoom/ChatRoom.tsx +++ b/src/components/chats/ChatRoom/ChatRoom.tsx @@ -19,6 +19,7 @@ export type ChatRoomProps = ComponentProps<'div'> & { asContainer?: boolean scrollableContainerClassName?: string customAction?: ReactNode + disableSuperLike?: boolean chatId: string hubId: string topElement?: ReactNode @@ -31,6 +32,7 @@ export default function ChatRoom({ scrollableContainerClassName, customAction, chatId, + disableSuperLike, hubId, topElement, onlyDisplayUnapprovedMessages, @@ -46,6 +48,7 @@ export default function ChatRoom({ onlyDisplayUnapprovedMessages={onlyDisplayUnapprovedMessages} topElement={topElement} hubId={hubId} + disableSuperLike={disableSuperLike} newMessageNoticeClassName={cx(replyTo && 'bottom-2')} chatId={chatId} asContainer={asContainer} diff --git a/src/components/content-staking/SuperLike.tsx b/src/components/content-staking/SuperLike.tsx index d11f395bf..415a0e4ab 100644 --- a/src/components/content-staking/SuperLike.tsx +++ b/src/components/content-staking/SuperLike.tsx @@ -31,6 +31,7 @@ export type SuperLikeProps = ComponentProps<'div'> & { postRewardClassName?: string isMyMessage?: boolean showWhenZero?: boolean + disabled?: boolean } export function SuperLikeWrapper({ @@ -223,6 +224,7 @@ export default function SuperLike({ isMyMessage, withPostReward, showWhenZero, + disabled, ...props }: SuperLikeProps) { const myAddress = useMyMainAddress() @@ -263,7 +265,7 @@ export default function SuperLike({ ? { backgroundPosition: '-1px', backgroundSize: '105%' } : {} } - disabled={isDisabled} + disabled={isDisabled || disabled} /> ) return ( diff --git a/src/components/extensions/common/CommonChatItem.tsx b/src/components/extensions/common/CommonChatItem.tsx index 8e3e0268a..174a03f69 100644 --- a/src/components/extensions/common/CommonChatItem.tsx +++ b/src/components/extensions/common/CommonChatItem.tsx @@ -77,6 +77,7 @@ export default function CommonChatItem({ hubId, bg = 'background', showApproveButton, + disableSuperLike, dummySuperLike, }: CommonChatItemProps) { const { inView, ref } = useInView({ @@ -381,6 +382,7 @@ export default function CommonChatItem({ showWhenZero={showSuperLikeWhenZero} withPostReward postId={message.id} + disabled={disableSuperLike} className='mb-1.5 ml-2.5 mt-1 self-start' /> ) : ( diff --git a/src/components/extensions/types.ts b/src/components/extensions/types.ts index cb8b1126d..9fc6586cd 100644 --- a/src/components/extensions/types.ts +++ b/src/components/extensions/types.ts @@ -7,6 +7,7 @@ export type ExtensionChatItemProps = { isMyMessage?: boolean scrollToMessage?: (messageId: string) => Promise chatId: string + disableSuperLike?: boolean hubId: string enableProfileModal?: boolean bg?: 'background' | 'background-light' | 'background-lighter' diff --git a/src/modules/chat/HomePage/ChatContent.tsx b/src/modules/chat/HomePage/ChatContent.tsx index 3b22883d2..016a88923 100644 --- a/src/modules/chat/HomePage/ChatContent.tsx +++ b/src/modules/chat/HomePage/ChatContent.tsx @@ -89,6 +89,7 @@ export default function ChatContent({ className }: Props) { chatId={chatId} hubId={env.NEXT_PUBLIC_MAIN_SPACE_ID} className='overflow-hidden' + disableSuperLike={selectedTab === 'contest' && !!isContestEnded} onlyDisplayUnapprovedMessages={shouldShowUnapproved} customAction={ isCannotPost ? (