From ecf374655d26173b54bb7191dd14d97c88531c42 Mon Sep 17 00:00:00 2001 From: pranavmene2000 Date: Sun, 11 Aug 2024 19:49:55 +0530 Subject: [PATCH 01/17] feat: added chevron button to hide/re-open images --- .../ChatMessage/Renderers/ImageMessage.tsx | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx index 2405543af..56d49fbac 100644 --- a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx +++ b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx @@ -1,9 +1,9 @@ import { getFileName } from '@/utils/operations' import { ImageMessage } from '../../../../../../../types/Messaging/Message' -import { Box, Button, Dialog, Flex, Link } from '@radix-ui/themes' -import { Suspense, lazy, memo, useState } from 'react' +import { Box, Button, Dialog, Flex, IconButton, Link, Text } from '@radix-ui/themes' +import { Suspense, lazy, memo, useState, useRef, useEffect } from 'react' import { DIALOG_CONTENT_CLASS } from '@/utils/layout/dialog' -import { BiDownload } from 'react-icons/bi' +import { BiDownload, BiChevronDown, BiChevronRight } from 'react-icons/bi' import { UserFields } from '@/utils/users/UserListProvider' import { DateMonthAtHourMinuteAmPm } from '@/utils/dateConversions' import { clsx } from 'clsx' @@ -30,15 +30,46 @@ export const ImageMessageBlock = memo(({ message, isScrolling = false, user }: I const fileName = getFileName(message.file) + const [isVisible, setIsVisible] = useState(true) + const contentRef = useRef(null); + + useEffect(() => { + if (isVisible && contentRef.current) { + setTimeout(() => { + if(contentRef.current){ + contentRef.current.scrollIntoView({ behavior: 'smooth', block: 'end' }); + } + }, 300); + } + }, [isVisible]); + return ( - {fileName} + + setIsVisible(prev => !prev)} + > + {isVisible ? : } + + {fileName} + + setIsOpen(!isScrolling && true)} style={{ From 861474aefde41f4a40ee064335766500d06a41f9 Mon Sep 17 00:00:00 2001 From: Pranav Mene <55917200+pranavmene2000@users.noreply.github.com> Date: Tue, 13 Aug 2024 00:29:26 +0530 Subject: [PATCH 02/17] fix: image scrollIntoView block position change --- .../feature/chat/ChatMessage/Renderers/ImageMessage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx index 56d49fbac..a0da0a057 100644 --- a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx +++ b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx @@ -37,7 +37,7 @@ export const ImageMessageBlock = memo(({ message, isScrolling = false, user }: I if (isVisible && contentRef.current) { setTimeout(() => { if(contentRef.current){ - contentRef.current.scrollIntoView({ behavior: 'smooth', block: 'end' }); + contentRef.current.scrollIntoView({ behavior: 'smooth', block: 'center' }); } }, 300); } @@ -149,4 +149,4 @@ export const ImageMessageBlock = memo(({ message, isScrolling = false, user }: I } ) -}) \ No newline at end of file +}) From d3eaa657bb0989cc76a98032e589388ee7be947a Mon Sep 17 00:00:00 2001 From: Pranav Mene <55917200+pranavmene2000@users.noreply.github.com> Date: Tue, 13 Aug 2024 00:31:21 +0530 Subject: [PATCH 03/17] fix: contentRef type fix --- .../feature/chat/ChatMessage/Renderers/ImageMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx index a0da0a057..3352c2005 100644 --- a/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx +++ b/frontend/src/components/feature/chat/ChatMessage/Renderers/ImageMessage.tsx @@ -31,7 +31,7 @@ export const ImageMessageBlock = memo(({ message, isScrolling = false, user }: I const fileName = getFileName(message.file) const [isVisible, setIsVisible] = useState(true) - const contentRef = useRef(null); + const contentRef = useRef(null); useEffect(() => { if (isVisible && contentRef.current) { From d30e7f8dbc74a3cf51c45f310e54802abfe8f1f6 Mon Sep 17 00:00:00 2001 From: Janhvi Patil Date: Fri, 16 Aug 2024 12:48:48 +0530 Subject: [PATCH 04/17] chore: fix placeholders in create poll modal --- frontend/src/components/feature/polls/CreatePoll.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/feature/polls/CreatePoll.tsx b/frontend/src/components/feature/polls/CreatePoll.tsx index a9a8e1e57..54d9bfd67 100644 --- a/frontend/src/components/feature/polls/CreatePoll.tsx +++ b/frontend/src/components/feature/polls/CreatePoll.tsx @@ -41,8 +41,6 @@ const CreatePollContent = ({ setIsOpen }: { setIsOpen: (open: boolean) => void } name: 'options' }) - const optionPlaceholders = ['Cersei Lannister', 'Jon Snow', 'Daenerys Targaryen', 'Tyrion Lannister', 'Night King', 'Arya Stark', 'Sansa Stark', 'Jaime Lannister', 'Bran Stark', 'The Hound'] - const handleAddOption = () => { // limit the number of options to 10 if (fields.length >= 10) { @@ -104,7 +102,7 @@ const CreatePollContent = ({ setIsOpen }: { setIsOpen: (open: boolean) => void }