Size fix for mobile
This commit is contained in:
parent
e512cdf71f
commit
f5ce84a310
@ -48,6 +48,7 @@ div {
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.user-message {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import FormGroup from '@mui/material/FormGroup';
|
||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||
import { useTheme } from '@mui/material';
|
||||
import Switch from '@mui/material/Switch';
|
||||
import Divider from '@mui/material/Divider';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
@ -646,10 +647,10 @@ const App = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', height: 1 }}>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100dvh' }}>
|
||||
<CssBaseline />
|
||||
<AppBar
|
||||
position="fixed"
|
||||
position="static"
|
||||
sx={{
|
||||
zIndex: (theme) => theme.zIndex.drawer + 1,
|
||||
}}
|
||||
@ -683,85 +684,89 @@ const App = () => {
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Box
|
||||
component="nav"
|
||||
aria-label="mailbox folders"
|
||||
>
|
||||
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
|
||||
<Drawer
|
||||
container={window.document.body}
|
||||
variant="temporary"
|
||||
open={mobileOpen}
|
||||
onTransitionEnd={handleDrawerTransitionEnd}
|
||||
onClose={handleDrawerClose}
|
||||
sx={{
|
||||
display: 'block',
|
||||
'& .MuiDrawer-paper': { boxSizing: 'border-box' },
|
||||
}}
|
||||
slotProps={{
|
||||
root: {
|
||||
keepMounted: true, // Better open performance on mobile.
|
||||
},
|
||||
}}
|
||||
|
||||
<Box sx={{ display: "flex", flexGrow: 1, flexDirection: "column" }}>
|
||||
<Box
|
||||
component="nav"
|
||||
aria-label="mailbox folders"
|
||||
>
|
||||
<Toolbar />
|
||||
{drawer}
|
||||
</Drawer>
|
||||
</Box>
|
||||
{/* The implementation can be swapped with js to avoid SEO duplication of links. */}
|
||||
<Drawer
|
||||
container={window.document.body}
|
||||
variant="temporary"
|
||||
open={mobileOpen}
|
||||
onTransitionEnd={handleDrawerTransitionEnd}
|
||||
onClose={handleDrawerClose}
|
||||
sx={{
|
||||
display: 'block',
|
||||
'& .MuiDrawer-paper': { boxSizing: 'border-box' },
|
||||
}}
|
||||
slotProps={{
|
||||
root: {
|
||||
keepMounted: true, // Better open performance on mobile.
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Toolbar />
|
||||
{drawer}
|
||||
</Drawer>
|
||||
</Box>
|
||||
<Box
|
||||
component="main"
|
||||
sx={{
|
||||
flexGrow: 1,
|
||||
overflow: 'auto'
|
||||
}}
|
||||
className="ChatBox">
|
||||
|
||||
<Box
|
||||
component="main"
|
||||
sx={{ flexGrow: 1, p: 1, height: '100vh' }}
|
||||
className="ChatBox">
|
||||
<Toolbar />
|
||||
<Box className="Conversation"
|
||||
sx={{ flexGrow: 2, p: 1 }}
|
||||
ref={conversationRef}>
|
||||
{conversation.map((message, index) => {
|
||||
const formattedContent = message.content.trim();
|
||||
|
||||
<Box className="Conversation"
|
||||
sx={{ flexGrow: 1, p: 1 }}
|
||||
ref={conversationRef}>
|
||||
{conversation.map((message, index) => {
|
||||
const formattedContent = message.content.trim();
|
||||
|
||||
return (
|
||||
<div key={index} className={message.role === 'user' ? 'user-message' : 'assistant-message'}>
|
||||
{message.metadata ? (
|
||||
<>
|
||||
<div className="metadata">{message.metadata.title}</div>
|
||||
{message.user && (
|
||||
<div>{message.user}</div>
|
||||
)}
|
||||
{message.role === 'assistant' ? (
|
||||
<div className="markdown-content">
|
||||
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]} children={formattedContent} />
|
||||
</div>
|
||||
) : (
|
||||
<div>{formattedContent}</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{message.user && (
|
||||
return (
|
||||
<div key={index} className={message.role === 'user' ? 'user-message' : 'assistant-message'}>
|
||||
{message.metadata ? (
|
||||
<>
|
||||
<div className="metadata">{message.metadata.title}</div>
|
||||
{message.user && (
|
||||
<div>{message.user}</div>
|
||||
)}
|
||||
{message.role === 'assistant' ? (
|
||||
<div className="markdown-content">
|
||||
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]} children={formattedContent} />
|
||||
</div>
|
||||
) : (
|
||||
<div>{formattedContent}</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div style={{ justifyContent: "center", display: "flex", paddingBottom: "0.5rem" }}>
|
||||
<PropagateLoader
|
||||
size="10px"
|
||||
loading={processing}
|
||||
aria-label="Loading Spinner"
|
||||
data-testid="loader"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{message.role === 'assistant' ? (
|
||||
<div className="markdown-content">
|
||||
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]} children={formattedContent} />
|
||||
</div>
|
||||
) : (
|
||||
<div>{formattedContent}</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{message.user && (
|
||||
<div>{message.user}</div>
|
||||
)}
|
||||
{message.role === 'assistant' ? (
|
||||
<div className="markdown-content">
|
||||
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]} children={formattedContent} />
|
||||
</div>
|
||||
) : (
|
||||
<div>{formattedContent}</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div style={{ justifyContent: "center", display: "flex", paddingBottom: "0.5rem" }}>
|
||||
<PropagateLoader
|
||||
size="10px"
|
||||
loading={processing}
|
||||
aria-label="Loading Spinner"
|
||||
data-testid="loader"
|
||||
/>
|
||||
</div>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box className="Query" sx={{ display: "flex", flexDirection: "row", p: 1 }}>
|
||||
@ -784,6 +789,8 @@ const App = () => {
|
||||
</AccordionActions>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
|
||||
<Snackbar open={snackOpen} autoHideDuration={(snackSeverity === "success" || snackSeverity === "info") ? 1500 : 6000} onClose={handleSnackClose}>
|
||||
<Alert
|
||||
onClose={handleSnackClose}
|
||||
|
@ -6,8 +6,7 @@ body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
code {
|
||||
|
Loading…
x
Reference in New Issue
Block a user