Skip to content

Commit

Permalink
馃摫(frontend) make the box title of the video info bar responsive
Browse files Browse the repository at this point in the history
The box title had responsive problems on smaller screens.
This commit fixes this issue by making the box title more responsive.
  • Loading branch information
AntoLC committed Mar 17, 2023
1 parent 1e96ea6 commit 03bae59
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const TeacherVideoInfoBar = ({
<Box
direction="column"
justify="center"
style={{ flexBasis: '0%', minWidth: '0' }}
style={{ flex: 'auto' }}
{...props}
>
<VideoInfoBar isTeacher startDate={startDate} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ import { useUpdateVideo } from 'api/useUpdateVideo';
import { useCurrentVideo } from 'hooks/useCurrentVideo';
import { useParticipantsStore } from 'hooks/useParticipantsStore';

const StyledBoxTextInput = styled(Box)`
& > div:first-child {
display: flex;
flex-direction: row-reverse;
width: 100%;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
}
`;

const StyledTitleTextInput = styled(TextInput)`
border: 1px solid ${normalizeColor('blue-active', theme)};
border-radius: 4px;
Expand Down Expand Up @@ -134,19 +145,14 @@ export const VideoInfoBar = ({ isTeacher, startDate }: VideoInfoBarProps) => {
return (
<Fragment>
{isTeacher ? (
<Box
margin={{ right: 'small' }}
gap="small"
alignContent="center"
direction="row"
>
<StyledBoxTextInput alignContent="center" direction="row">
<StyledTitleTextInput
icon={
<EditionSVG
iconColor={normalizeColor('blue-chat', theme)}
width="25px"
height="25px"
containerStyle={{ margin: 'auto', marginRight: '8px' }}
containerStyle={{ margin: 'auto' }}
/>
}
onBlur={(event) => handleChange(event.target.value)}
Expand All @@ -156,8 +162,12 @@ export const VideoInfoBar = ({ isTeacher, startDate }: VideoInfoBarProps) => {
value={title}
plain
reverse
width={{
min: '270px',
width: `100%`,
}}
/>
</Box>
</StyledBoxTextInput>
) : (
<Heading
a11yTitle={title}
Expand All @@ -172,28 +182,30 @@ export const VideoInfoBar = ({ isTeacher, startDate }: VideoInfoBarProps) => {
{title}
</Heading>
)}
<Box direction="row">
{numberOfStudents > 0 && (
<Paragraph
color="blue-active"
margin={{ left: 'small', right: 'large', bottom: 'small' }}
size="small"
>
{intl.formatMessage(messages.nbViewers, {
numberOfStudents,
})}
</Paragraph>
)}
{localStartDate && (
<Paragraph
color="blue-active"
margin={{ right: 'large', bottom: 'small' }}
size="small"
>
{localStartDate}
</Paragraph>
)}
</Box>
{numberOfStudents > 0 || localStartDate ? (
<Box direction="row">
{numberOfStudents > 0 && (
<Paragraph
color="blue-active"
margin={{ left: 'small', right: 'large', bottom: 'small' }}
size="small"
>
{intl.formatMessage(messages.nbViewers, {
numberOfStudents,
})}
</Paragraph>
)}
{localStartDate && (
<Paragraph
color="blue-active"
margin={{ right: 'large', bottom: 'small' }}
size="small"
>
{localStartDate}
</Paragraph>
)}
</Box>
) : null}
</Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import { DisplayNameForm } from './DisplayNameForm';
const StyledLiveVideoInformationBarWrapper = styled(Box)`
-webkit-box-shadow: 0px 0px 7px 5px ${normalizeColor('shadow-1', theme)};
box-shadow: 0px 0px 7px 5px ${normalizeColor('shadow-1', theme)};
flex-wrap: wrap;
gap: 1rem;
height: auto;
justify-content: space-evenly;
`;

interface LiveStudentLayoutProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export const TeacherLiveControlBar = () => {
};
}, [video, isStarted, setIsStarted]);

return (
const isBoxToDisplay =
(isMobileView && availableItems.includes(LivePanelItem.CHAT)) ||
(isMobileView && availableItems.includes(LivePanelItem.VIEWERS_LIST)) ||
(video.live_type === LiveModeType.RAW && isStarted);

return isBoxToDisplay ? (
<Box direction="row" height="100%">
{isMobileView && availableItems.includes(LivePanelItem.CHAT) && (
<Box height="100%" style={{ minWidth: '60px' }}>
Expand All @@ -69,5 +74,5 @@ export const TeacherLiveControlBar = () => {
</Box>
)}
</Box>
);
) : null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export const TeacherLiveLifecycleControls = ({
return (
<Box
direction="row"
style={{ flexBasis: '0%', whiteSpace: 'nowrap' }}
margin={{ right: 'none', vertical: 'auto' }}
{...props}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ export const Controls = ({
return (
<Fragment>
{isLiveStarted && <TeacherLiveControlBar />}
<Box flex={isLiveStarted} direction="row" justify="end">
<Box
flex={isLiveStarted}
direction="row"
style={{ flex: '0' }}
justify="evenly"
width={{
min: 'auto',
}}
>
<TeacherLiveRecordingActions isJitsiAdministrator={canStartLive} />
<TeacherLiveLifecycleControls
canStartStreaming={canShowStartButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const messages = defineMessages({
const StyledLiveVideoInformationBarWrapper = styled(Box)`
-webkit-box-shadow: 0px 0px 7px 5px ${normalizeColor('shadow-1', theme)};
box-shadow: 0px 0px 7px 5px ${normalizeColor('shadow-1', theme)};
flex-wrap: wrap;
`;

interface DashboardProps {
Expand Down

0 comments on commit 03bae59

Please sign in to comment.