Skip to content

Commit

Permalink
feat(ui): prevent controls from obscuring transcript
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Nov 22, 2023
1 parent e8313fe commit 8d3faa8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/components/ChatTranscript/ChatTranscript.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { HTMLAttributes, useRef, useEffect, useState } from 'react'
import { HTMLAttributes, useRef, useEffect, useState, useContext } from 'react'
import cx from 'classnames'
import Box from '@mui/material/Box'
import useTheme from '@mui/material/styles/useTheme'

import { Message as IMessage, InlineMedia } from 'models/chat'
import { Message } from 'components/Message'
import useTheme from '@mui/material/styles/useTheme'
import { ShellContext } from 'contexts/ShellContext'

export interface ChatTranscriptProps extends HTMLAttributes<HTMLDivElement> {
messageLog: Array<IMessage | InlineMedia>
Expand All @@ -16,6 +17,7 @@ export const ChatTranscript = ({
messageLog,
userId,
}: ChatTranscriptProps) => {
const { showRoomControls } = useContext(ShellContext)
const theme = useTheme()
const boxRef = useRef<HTMLDivElement>(null)
const [previousMessageLogLength, setPreviousMessageLogLength] = useState(0)
Expand Down Expand Up @@ -69,7 +71,9 @@ export const ChatTranscript = ({
display: 'flex',
flexDirection: 'column',
py: transcriptMinPadding,
pt: showRoomControls ? theme.spacing(10) : theme.spacing(2),
px: `max(${transcriptPaddingX}, ${transcriptMinPadding})`,
transition: `padding-top ${theme.transitions.duration.short}ms ${theme.transitions.easing.easeInOut}`,
width: '100%',
}}
>
Expand Down
15 changes: 9 additions & 6 deletions src/components/Room/Room.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useContext } from 'react'
import { useWindowSize } from '@react-hook/window-size'
import Collapse from '@mui/material/Collapse'
import Zoom from '@mui/material/Zoom'
import Box from '@mui/material/Box'
import Divider from '@mui/material/Divider'
import useTheme from '@mui/material/styles/useTheme'
import { v4 as uuid } from 'uuid'

import { rtcConfig } from 'config/rtcConfig'
Expand Down Expand Up @@ -40,6 +40,7 @@ export function Room({
password,
userId,
}: RoomProps) {
const theme = useTheme()
const settingsContext = useContext(SettingsContext)
const { showActiveTypingStatus } = settingsContext.getUserSettings()
const {
Expand Down Expand Up @@ -96,14 +97,16 @@ export function Room({
overflow: 'auto',
}}
>
<Collapse in={showRoomControls}>
<Zoom in={showRoomControls}>
<Box
sx={{
alignItems: 'flex-start',
display: 'flex',
justifyContent: 'center',
padding: 1,
overflowX: 'auto',
overflow: 'visible',
height: 0,
position: 'relative',
top: theme.spacing(1),
}}
>
<RoomAudioControls peerRoom={peerRoom} />
Expand All @@ -120,7 +123,7 @@ export function Room({
</Zoom>
<RoomHideRoomControls />
</Box>
</Collapse>
</Zoom>
<Box
sx={{
display: 'flex',
Expand Down Expand Up @@ -150,7 +153,7 @@ export function Room({
<ChatTranscript
messageLog={messageLog}
userId={userId}
className="grow overflow-auto px-4"
className="grow overflow-auto"
/>
<Divider />
<Box>
Expand Down

0 comments on commit 8d3faa8

Please sign in to comment.