Skip to content

Commit

Permalink
rearrange chat for SR users
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisinajar committed Feb 29, 2024
1 parent ac16595 commit 3960e93
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/components/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import MessageIcon from "@mui/icons-material/Message";
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
import CancelIcon from "@mui/icons-material/Cancel";

import { visuallyHidden } from "@mui/utils";

import {
InventoryItem,
useGetChatTokenQuery,
Expand Down Expand Up @@ -111,7 +113,7 @@ export function Chat(): JSX.Element {
notifications: { type: "built-in" },
});
const [alertArtifact, setAlertArtifact] = useState<ArtifactItem | false>(
false
false,
);

const socketRef = useRef<Socket>();
Expand Down Expand Up @@ -144,7 +146,7 @@ export function Chat(): JSX.Element {
if (data.item) {
data.message = data.message.replace(
"{{item}}",
itemDisplayName(data.item)
itemDisplayName(data.item),
);
}

Expand Down Expand Up @@ -242,7 +244,7 @@ export function Chat(): JSX.Element {
(data: ChatMessage) => {
console.log("Got a confirmation!", data);
setChat((oldChat) => [data, ...oldChat]);
}
},
);
setMessage("");
return;
Expand All @@ -256,7 +258,7 @@ export function Chat(): JSX.Element {
(data: ChatMessage) => {
console.log("Got a reply!", data);
setChat((oldChat) => [data, ...oldChat]);
}
},
);
setMessage("");
}
Expand Down Expand Up @@ -414,7 +416,7 @@ export function Chat(): JSX.Element {
}}
>
{chatMessage.time && (
<Typography variant="caption">
<Typography variant="caption" aria-hidden="true">
({timeAgo(new Date(chatMessage.time * 1000))})&nbsp;
</Typography>
)}
Expand All @@ -439,7 +441,12 @@ export function Chat(): JSX.Element {
</Button>
)}
{!chatMessage.heroId && <b>{chatMessage.from}</b>}{" "}
{emojify(chatMessage.message)}
{emojify(chatMessage.message)}{" "}
{chatMessage.time && (
<Typography variant="caption" sx={visuallyHidden}>
({timeAgo(new Date(chatMessage.time * 1000))})&nbsp;
</Typography>
)}
</Typography>
))}
{/* <Button variant="contained">Send</Button> */}
Expand Down

0 comments on commit 3960e93

Please sign in to comment.