mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 10:19:22 +03:00
fix: mobile chat layout
This commit is contained in:
parent
a6e3e5f88e
commit
e7cfd26b1b
@ -10,13 +10,7 @@ export interface ISidebarComposition {
|
|||||||
|
|
||||||
const Sidebar: React.FC<GridItemProps> & ISidebarComposition = props => {
|
const Sidebar: React.FC<GridItemProps> & ISidebarComposition = props => {
|
||||||
return (
|
return (
|
||||||
<GridItem
|
<GridItem pt='7rem' borderRightWidth={{ base: '0', lg: '1px' }} px={{ base: '0', lg: '3' }} {...props}>
|
||||||
pt='7rem'
|
|
||||||
borderRightWidth={{ base: '0', lg: '1px' }}
|
|
||||||
width={{ base: 'full', lg: '400px' }}
|
|
||||||
px={{ base: '0', lg: '3' }}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{props.children}
|
{props.children}
|
||||||
</GridItem>
|
</GridItem>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -16,12 +16,12 @@ const Info: React.FC<IInfoProps> = ({ fullname, lastMessage }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box ml='4' maxW='200px'>
|
<Box ml='4' maxW='200px'>
|
||||||
<Text fontWeight={'semibold'} textOverflow={'ellipsis'} overflow={'hidden'} whiteSpace='nowrap'>
|
<Text fontWeight={'semibold'}>
|
||||||
{isMe ? 'Favorites' : fullname} <br />
|
{isMe ? 'Favorites' : fullname} <br />
|
||||||
{lastMessage && (
|
{lastMessage && (
|
||||||
<Text as={'span'} fontWeight='normal' fontSize={'sm'} color='gray.500'>
|
<Text as={'span'} fontWeight='normal' fontSize={'sm'} color='gray.500' wordBreak={'break-all'}>
|
||||||
{lastMessage.from === me?.id && `You: `}
|
{lastMessage.from === me?.id && `You: `}
|
||||||
{lastMessage.content}
|
{lastMessage.content.length >= 20 ? lastMessage.content.slice(0, 20 - 1) + '...' : lastMessage.content}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export interface IAvatarProps {
|
|||||||
|
|
||||||
const Avatar: React.FC<IAvatarProps> = memo(({ fullname: name }) => {
|
const Avatar: React.FC<IAvatarProps> = memo(({ fullname: name }) => {
|
||||||
return (
|
return (
|
||||||
<WrapItem>
|
<WrapItem alignSelf={'flex-start'}>
|
||||||
<ChakraAvatar name={name} size={'sm'} />
|
<ChakraAvatar name={name} size={'sm'} />
|
||||||
</WrapItem>
|
</WrapItem>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ const Text: React.FC<ITextProps> = ({ content, time }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box mx={'4'} maxW={'450px'} bg={bgColor} borderRadius='3xl' px='6' py='3'>
|
<Box mx={'4'} maxW={'450px'} bg={bgColor} borderRadius='3xl' px='6' py='3'>
|
||||||
<ChakraText fontSize={'15px'}>
|
<ChakraText fontSize={'15px'} wordBreak='break-all'>
|
||||||
{content}
|
{content}
|
||||||
<Box
|
<Box
|
||||||
as='time'
|
as='time'
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import { useRootStore } from '@educt/hooks/useRootStore';
|
|||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
const Wrapper: React.FC<GridItemProps> = props => (
|
const Wrapper: React.FC<GridItemProps> = props => (
|
||||||
<GridItem pt={'7rem'} pb='5' px='12' {...props}>
|
<GridItem pt={'7rem'} pb='5' px={{ base: '4', lg: '12' }} {...props}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</GridItem>
|
</GridItem>
|
||||||
);
|
);
|
||||||
@ -192,7 +192,6 @@ const Window: React.FC = props => {
|
|||||||
resize={'block'}
|
resize={'block'}
|
||||||
type='text'
|
type='text'
|
||||||
placeholder='Write a message...'
|
placeholder='Write a message...'
|
||||||
maxW='900px'
|
|
||||||
variant={'outline'}
|
variant={'outline'}
|
||||||
rounded='xl'
|
rounded='xl'
|
||||||
mr='2'
|
mr='2'
|
||||||
|
|||||||
@ -40,6 +40,8 @@ const MainPage: React.FC<IPageProps> = () => {
|
|||||||
|
|
||||||
if (me === null || courses === null || stat === null) return <LoadingPage />;
|
if (me === null || courses === null || stat === null) return <LoadingPage />;
|
||||||
|
|
||||||
|
const unreadMessages = me.notifications.filter(n => n.type === 'MESSAGE');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Page.Heading heading={`👋 Hello ${me.first_name},`} description="This what we've got today for you." />
|
<Page.Heading heading={`👋 Hello ${me.first_name},`} description="This what we've got today for you." />
|
||||||
@ -58,7 +60,7 @@ const MainPage: React.FC<IPageProps> = () => {
|
|||||||
<StatContent>
|
<StatContent>
|
||||||
<StatNumber>
|
<StatNumber>
|
||||||
<Link as={ReactRouterLink} to='/messages'>
|
<Link as={ReactRouterLink} to='/messages'>
|
||||||
0
|
{unreadMessages.length}
|
||||||
</Link>
|
</Link>
|
||||||
</StatNumber>
|
</StatNumber>
|
||||||
<StatIcon icon={MdOutlineMessage} />
|
<StatIcon icon={MdOutlineMessage} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user