Skip to content

Commit

Permalink
Fix voice recorder (#159)
Browse files Browse the repository at this point in the history
* ✨ Feat(profile-picture): set/remove profile picture

feat(profile-picture): set/remove profile picture

* admin mock

* fix: adjust sixing (#158)

fix: voice notes

* fix: voice recoder

---------

Co-authored-by: Sarah Kamal <[email protected]>
  • Loading branch information
AhmedHamdiy and sarah-kamall authored Dec 21, 2024
1 parent 603c259 commit d679009
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
Empty file.
4 changes: 2 additions & 2 deletions app/src/features/chats/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ChatInput() {
isEmojiSelectorOpen,
handleSubmit,
showForwardUsers,
handleClose,
handleClose
} = useContext(ChatInputContext);

const chats = useAppSelector((state) => state.chats.chats);
Expand Down Expand Up @@ -133,7 +133,7 @@ function ChatInput() {
data-testid="send-button"
/>
) : (
<VoiceRecorder chatId={chatId} />
<VoiceRecorder />
)}
</Input>
) : (
Expand Down
10 changes: 8 additions & 2 deletions app/src/features/chats/ChatInputIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,25 @@ function ChatInputIcons() {
setInput,
file,
setFile,
setIsFilePreviewOpen,
setIsFilePreviewOpen
} = useContext(ChatInputContext);

const toggleShowEmojies = () => {
setIsEmojiSelectorOpen((show: boolean) => !show);
};

const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
setIsEmojiSelectorOpen(false);
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit(e as unknown as Event);
}
};
const handleSetFile = (file: File) => {
setIsEmojiSelectorOpen(false);
setFile(file);
setIsFilePreviewOpen(true);
};

return (
<>
Expand All @@ -50,7 +56,7 @@ function ChatInputIcons() {

<MediaUploadComponent
file={file}
setFile={setFile}
setFile={handleSetFile}
setIsFilePreviewOpen={setIsFilePreviewOpen}
/>
</>
Expand Down
4 changes: 2 additions & 2 deletions app/src/features/chats/ChatItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type ChatItemProps = {

const ChatItem = ({
chat: { _id, lastMessage, name, photo },
onClick,
onClick
}: ChatItemProps) => {
const navigate = useNavigate();

Expand All @@ -86,7 +86,7 @@ const ChatItem = ({
<Timestamp data-testid="chat-timestamp">
{new Date(timestamp).toLocaleTimeString("en-US", {
hour: "2-digit",
minute: "2-digit",
minute: "2-digit"
}) || "No messages"}
</Timestamp>
</ChatHeader>
Expand Down
1 change: 0 additions & 1 deletion app/src/features/chats/Topbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import styled from "styled-components";

Expand Down
2 changes: 1 addition & 1 deletion app/src/features/chats/media/MediaUploadComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const InvisibleButton = styled.div`
`;
interface ChildProps {
file: File | null;
setFile: React.Dispatch<React.SetStateAction<File | null>>;
setFile: (file: File) => void;
setIsFilePreviewOpen: React.Dispatch<React.SetStateAction<boolean>>;
}

Expand Down

0 comments on commit d679009

Please sign in to comment.