mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
120 in printWidth since rocky got md
This commit is contained in:
1 parent
f552c1212c
commit
d27aeb3b0e
90 files changed
+398
-1146
No files matched your search
@@ -19,9 +19,7 @@ export const AccountTransactions = (): any => {
|
||||
<div id="account-section">
|
||||
<div className={classes.header}>
|
||||
<h2 className={classes.title}>{t('APPS_BANK_ACCOUNT_TRANSACTIONS')}</h2>
|
||||
<Button className={classes.seeAll}>
|
||||
{t('APPS_BANK_ACCOUNT_SEE_TRANSACTION')}
|
||||
</Button>
|
||||
<Button className={classes.seeAll}>{t('APPS_BANK_ACCOUNT_SEE_TRANSACTION')}</Button>
|
||||
</div>
|
||||
|
||||
<div className={classes.transcationDiv}>
|
||||
|
||||
@@ -25,11 +25,7 @@ export const BankAccount = () => {
|
||||
<div>
|
||||
<h1 className={classes.title}>{t('APPS_BANK_ACCOUNT_TITLE')}</h1>
|
||||
</div>
|
||||
<BankCard
|
||||
name={credentials.name}
|
||||
account="Checking"
|
||||
balance={credentials.balance}
|
||||
/>
|
||||
<BankCard name={credentials.name} account="Checking" balance={credentials.balance} />
|
||||
<AccountTransactions />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -24,8 +24,7 @@ export const BankHome = () => {
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Typography className={classes.headTitle}>
|
||||
<span style={{ fontWeight: 'bold' }}>{t('APPS_BANK_HOME_TITLE')}</span>,{' '}
|
||||
{credentials.name}
|
||||
<span style={{ fontWeight: 'bold' }}>{t('APPS_BANK_HOME_TITLE')}</span>, {credentials.name}
|
||||
</Typography>
|
||||
<div className={classes.accounts}>
|
||||
<h2 className={classes.accountsType}>Checking:</h2>
|
||||
|
||||
@@ -30,21 +30,9 @@ export const NavigationBar = () => {
|
||||
showLabels
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faHome} />}
|
||||
to="/bank"
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faMoneyCheck} />}
|
||||
to="/bank/account"
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faList} />}
|
||||
to="/bank/transactions"
|
||||
/>
|
||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faHome} />} to="/bank" />
|
||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faMoneyCheck} />} to="/bank/account" />
|
||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faList} />} to="/bank/transactions" />
|
||||
</BottomNavigation>
|
||||
);
|
||||
};
|
||||
@@ -33,22 +33,20 @@ export const TransactionList = () => {
|
||||
</div>
|
||||
|
||||
<div className={classes.transcationDiv}>
|
||||
{transactionList
|
||||
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
||||
.map((transaction: any) => (
|
||||
<div className={classes.transactions}>
|
||||
<div>
|
||||
<h1 className={classes.tranSource}>{transaction.source}</h1>
|
||||
<p className={classes.tranType}>{transaction.type}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className={TransactionTypes[transaction.type]}>
|
||||
{transaction.type === 'Withdraw' ? '-' : '+'}
|
||||
{transaction.amount}
|
||||
</p>
|
||||
</div>
|
||||
{transactionList.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((transaction: any) => (
|
||||
<div className={classes.transactions}>
|
||||
<div>
|
||||
<h1 className={classes.tranSource}>{transaction.source}</h1>
|
||||
<p className={classes.tranType}>{transaction.type}</p>
|
||||
</div>
|
||||
))}
|
||||
<div>
|
||||
<p className={TransactionTypes[transaction.type]}>
|
||||
{transaction.type === 'Withdraw' ? '-' : '+'}
|
||||
{transaction.amount}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<TablePagination
|
||||
rowsPerPageOptions={[3, 5]}
|
||||
className={classes.pagination}
|
||||
|
||||
@@ -28,18 +28,9 @@ export const GalleryGrid = () => {
|
||||
|
||||
if (!photos)
|
||||
return (
|
||||
<Box
|
||||
display="flex"
|
||||
flexWrap="wrap"
|
||||
alignContent="flex-start"
|
||||
className={classes.root}
|
||||
>
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
<Box>
|
||||
<Button
|
||||
onClick={handleCamera}
|
||||
style={{ borderRadius: 0 }}
|
||||
className={classes.photo}
|
||||
>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large" />
|
||||
</Button>
|
||||
</Box>
|
||||
@@ -48,27 +39,15 @@ export const GalleryGrid = () => {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Box
|
||||
display="flex"
|
||||
flexWrap="wrap"
|
||||
alignContent="flex-start"
|
||||
className={classes.root}
|
||||
>
|
||||
<Box display="flex" flexWrap="wrap" alignContent="flex-start" className={classes.root}>
|
||||
<Box>
|
||||
<Button
|
||||
onClick={handleCamera}
|
||||
style={{ borderRadius: 0 }}
|
||||
className={classes.photo}
|
||||
>
|
||||
<Button onClick={handleCamera} style={{ borderRadius: 0 }} className={classes.photo}>
|
||||
<AddIcon fontSize="large" />
|
||||
</Button>
|
||||
</Box>
|
||||
{photos.map((photo) => (
|
||||
<Box key={photo.id} onClick={() => handlePhotoOpen(photo)}>
|
||||
<div
|
||||
style={{ backgroundImage: `url(${photo.image})` }}
|
||||
className={classes.photo}
|
||||
/>
|
||||
<div style={{ backgroundImage: `url(${photo.image})` }} className={classes.photo} />
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
@@ -18,10 +18,7 @@ export const GalleryModal = () => {
|
||||
|
||||
const [shareOpen, setShareOpen] = useState(null);
|
||||
|
||||
const meta: ICameraPhoto = useMemo(
|
||||
() => ({ id: query.id as string, image: query.image as string }),
|
||||
[query],
|
||||
);
|
||||
const meta: ICameraPhoto = useMemo(() => ({ id: query.id as string, image: query.image as string }), [query]);
|
||||
|
||||
const _handleClose = () => {
|
||||
history.push(referal);
|
||||
@@ -48,10 +45,7 @@ export const GalleryModal = () => {
|
||||
<Button onClick={_handleClose}>
|
||||
<ArrowBackIcon />
|
||||
</Button>
|
||||
<div
|
||||
className={classes.image}
|
||||
style={{ backgroundImage: `url(${meta.image})` }}
|
||||
/>
|
||||
<div className={classes.image} style={{ backgroundImage: `url(${meta.image})` }} />
|
||||
<div className={classes.actionDiv}>
|
||||
<Button onClick={handleDeletePhoto}>
|
||||
<DeleteIcon fontSize="large" />
|
||||
|
||||
@@ -28,9 +28,7 @@ export const ShareModal = ({ meta, onClose, referal }: IShareModalProps) => {
|
||||
<div className={classes.shareModal}>
|
||||
<div className={classes.innerShareModal}>
|
||||
<>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>
|
||||
Where do you want to share the photo?
|
||||
</h4>
|
||||
<h4 style={{ textAlign: 'center', marginTop: 20 }}>Where do you want to share the photo?</h4>
|
||||
<Button>{<MessageIcon />} Message</Button>
|
||||
<h4>Or just copy the image here:</h4>
|
||||
<Button onClick={handleCopyImage} variant="contained">
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import React from 'react';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
import {
|
||||
Button,
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
List,
|
||||
ListItem,
|
||||
} from '@material-ui/core';
|
||||
import { Button, ListItemAvatar, Avatar as MuiAvatar, List, ListItem } from '@material-ui/core';
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
import PhoneIcon from '@material-ui/icons/Phone';
|
||||
import ChatIcon from '@material-ui/icons/Chat';
|
||||
@@ -54,10 +48,7 @@ export const ContactList = () => {
|
||||
<SearchContacts />
|
||||
<List>
|
||||
{contacts
|
||||
.filter(
|
||||
(contact) =>
|
||||
contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx),
|
||||
)
|
||||
.filter((contact) => contact.display.match(filteredRegEx) || contact.number.match(filteredRegEx))
|
||||
.map((contact) => (
|
||||
<ListItem key={contact.id} divider>
|
||||
<ListItemAvatar>
|
||||
|
||||
@@ -25,11 +25,7 @@ export const ContactPage = () => {
|
||||
return (
|
||||
<>
|
||||
<ContactList />
|
||||
<Fab
|
||||
color="primary"
|
||||
onClick={() => history.push('/contacts/-1')}
|
||||
className={classes.absolute}
|
||||
>
|
||||
<Fab color="primary" onClick={() => history.push('/contacts/-1')} className={classes.absolute}>
|
||||
<PersonAddIcon />
|
||||
</Fab>
|
||||
</>
|
||||
|
||||
@@ -7,8 +7,6 @@ interface FilterdContactsProps {
|
||||
}
|
||||
|
||||
export const useFilteredContacts = (): FilterdContactsProps => {
|
||||
const [filteredContacts, setFilteredContacts] = useRecoilState(
|
||||
contactsState.filterContacts,
|
||||
);
|
||||
const [filteredContacts, setFilteredContacts] = useRecoilState(contactsState.filterContacts);
|
||||
return { filteredContacts, setFilteredContacts };
|
||||
};
|
||||
@@ -44,11 +44,7 @@ export const DialerInput = () => {
|
||||
|
||||
return (
|
||||
<Box component={Paper} className={classes.root}>
|
||||
<InputBase
|
||||
placeholder="Enter a number"
|
||||
className={classes.input}
|
||||
value={inputVal}
|
||||
/>
|
||||
<InputBase placeholder="Enter a number" className={classes.input} value={inputVal} />
|
||||
<IconButton color="primary" className={classes.iconBtn}>
|
||||
<PhoneIcon fontSize="large" onClick={() => handleCall(inputVal)} />
|
||||
</IconButton>
|
||||
|
||||
@@ -26,19 +26,8 @@ const DialerNavBar = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<BottomNavigation
|
||||
value={page}
|
||||
onChange={handleChange}
|
||||
showLabels
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
label="History"
|
||||
value="/phone"
|
||||
component={NavLink}
|
||||
icon={<HistoryIcon />}
|
||||
to="/phone"
|
||||
/>
|
||||
<BottomNavigation value={page} onChange={handleChange} showLabels className={classes.root}>
|
||||
<BottomNavigationAction label="History" value="/phone" component={NavLink} icon={<HistoryIcon />} to="/phone" />
|
||||
<BottomNavigationAction
|
||||
label="Dial"
|
||||
value="/phone/dial"
|
||||
|
||||
@@ -58,25 +58,17 @@ export const DialerHistory = ({ calls }) => {
|
||||
{calls.map((call: ICall) =>
|
||||
call.transmitter === number ? (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemIcon>
|
||||
{<PhoneForwardedIcon className={classes.callForward} />}
|
||||
</ListItemIcon>
|
||||
<ListItemIcon>{<PhoneForwardedIcon className={classes.callForward} />}</ListItemIcon>
|
||||
|
||||
<ListItemText
|
||||
primary={getDisplayByNumber(call.receiver)}
|
||||
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
|
||||
/>
|
||||
<IconButton onClick={() => handleCall(call.receiver)}>
|
||||
{<PhoneIcon />}
|
||||
</IconButton>
|
||||
<IconButton onClick={() => handleCall(call.receiver)}>{<PhoneIcon />}</IconButton>
|
||||
|
||||
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
history.push(
|
||||
`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`,
|
||||
)
|
||||
}
|
||||
onClick={() => history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)}
|
||||
>
|
||||
{<PersonAddIcon />}
|
||||
</IconButton>
|
||||
@@ -84,25 +76,17 @@ export const DialerHistory = ({ calls }) => {
|
||||
</ListItem>
|
||||
) : (
|
||||
<ListItem key={call.id} divider>
|
||||
<ListItemIcon>
|
||||
{<PhoneCallbackIcon className={classes.callBack} />}
|
||||
</ListItemIcon>
|
||||
<ListItemIcon>{<PhoneCallbackIcon className={classes.callBack} />}</ListItemIcon>
|
||||
|
||||
<ListItemText
|
||||
primary={getDisplayByNumber(call.transmitter)}
|
||||
secondary={dayjs.unix(call.start).format(t('DATE_TIME_FORMAT'))}
|
||||
/>
|
||||
<IconButton onClick={() => handleCall(call.transmitter)}>
|
||||
{<PhoneIcon />}
|
||||
</IconButton>
|
||||
<IconButton onClick={() => handleCall(call.transmitter)}>{<PhoneIcon />}</IconButton>
|
||||
|
||||
{getDisplayByNumber(call.transmitter) === call.transmitter ? (
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
history.push(
|
||||
`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`,
|
||||
)
|
||||
}
|
||||
onClick={() => history.push(`/contacts/-1?addNumber=${call.transmitter}&referal=/phone/contacts`)}
|
||||
>
|
||||
{<PersonAddIcon />}
|
||||
</IconButton>
|
||||
|
||||
@@ -35,9 +35,7 @@ export const ExampleApp = () => {
|
||||
<Button color="primary">{example.id}</Button>
|
||||
{/* Here we are using the value in a h3 tag */}
|
||||
<h3>{exampleString}</h3>
|
||||
<IconButton onClick={() => (playing ? stop() : play())}>
|
||||
{playing ? <StopIcon /> : <PlayIcon />}
|
||||
</IconButton>
|
||||
<IconButton onClick={() => (playing ? stop() : play())}>{playing ? <StopIcon /> : <PlayIcon />}</IconButton>
|
||||
<Button onClick={toggleSound}>Change sound on the fly</Button>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
|
||||
@@ -38,11 +38,7 @@ export const MessagesApp = () => {
|
||||
/>
|
||||
</Switch>
|
||||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={['/messages/new/:phoneNumber', '/messages/new']}
|
||||
render={() => <MessageGroupModal />}
|
||||
/>
|
||||
<Route exact path={['/messages/new/:phoneNumber', '/messages/new']} render={() => <MessageGroupModal />} />
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NewMessageGroupButton onClick={() => history.push('/messages/new')} />
|
||||
|
||||
@@ -32,9 +32,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
||||
// handles phone numbers in a csv format and strips all spaces and
|
||||
// external characters out of them:
|
||||
// 123-4567, 987-6543, 333-4444
|
||||
const phoneNumbers = participants.map(({ number }) =>
|
||||
number.replace(/[^0-9]/g, ''),
|
||||
);
|
||||
const phoneNumbers = participants.map(({ number }) => number.replace(/[^0-9]/g, ''));
|
||||
const labelValue = isGroupChat ? label.trim() : null;
|
||||
|
||||
if (phoneNumbers.length) {
|
||||
@@ -101,13 +99,7 @@ const NewMessageGroupForm = ({ phoneNumber }: { phoneNumber?: string }) => {
|
||||
</Box>
|
||||
)}
|
||||
<Box px={2} py={3}>
|
||||
<Button
|
||||
disabled={submitDisabled}
|
||||
variant="contained"
|
||||
fullWidth
|
||||
color="primary"
|
||||
type="submit"
|
||||
>
|
||||
<Button disabled={submitDisabled} variant="contained" fullWidth color="primary" type="submit">
|
||||
{t('APPS_MESSAGES_NEW_MESSAGE_GROUP_SUBMIT')}
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
ListItem,
|
||||
ListItemText,
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
} from '@material-ui/core';
|
||||
import { ListItem, ListItemText, ListItemAvatar, Avatar as MuiAvatar } from '@material-ui/core';
|
||||
|
||||
import { MessageGroup } from '../../../../common/typings/messages';
|
||||
|
||||
@@ -15,12 +10,7 @@ interface IProps {
|
||||
|
||||
const MessageGroupItem = ({ messageGroup, handleClick }: IProps): any => {
|
||||
return (
|
||||
<ListItem
|
||||
key={messageGroup.groupId}
|
||||
onClick={handleClick(messageGroup)}
|
||||
divider
|
||||
button
|
||||
>
|
||||
<ListItem key={messageGroup.groupId} onClick={handleClick(messageGroup)} divider button>
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar src={messageGroup?.avatar} />
|
||||
</ListItemAvatar>
|
||||
|
||||
@@ -7,9 +7,7 @@ import useStyles from './list.styles';
|
||||
|
||||
interface IProps {
|
||||
value: string;
|
||||
handleChange: (
|
||||
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
|
||||
) => void;
|
||||
handleChange: (event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
||||
}
|
||||
|
||||
const MessageSearch = ({ value, handleChange }: IProps) => {
|
||||
|
||||
@@ -13,46 +13,30 @@ const MessagesList = (): any => {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
const {
|
||||
messageGroups,
|
||||
createMessageGroupResult,
|
||||
clearMessageGroupResult,
|
||||
} = useMessages();
|
||||
const { messageGroups, createMessageGroupResult, clearMessageGroupResult } = useMessages();
|
||||
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
|
||||
const goToConversation = useCallback(
|
||||
(messageGroup) =>
|
||||
history.push(
|
||||
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`,
|
||||
),
|
||||
(messageGroup) => history.push(`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`),
|
||||
[history],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (createMessageGroupResult?.groupId) {
|
||||
const findGroup = messageGroups.find(
|
||||
(g) => g.groupId === createMessageGroupResult.groupId,
|
||||
);
|
||||
const findGroup = messageGroups.find((g) => g.groupId === createMessageGroupResult.groupId);
|
||||
clearMessageGroupResult();
|
||||
if (findGroup) {
|
||||
goToConversation(findGroup);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
messageGroups,
|
||||
createMessageGroupResult,
|
||||
goToConversation,
|
||||
clearMessageGroupResult,
|
||||
]);
|
||||
}, [messageGroups, createMessageGroupResult, goToConversation, clearMessageGroupResult]);
|
||||
|
||||
if (!messageGroups) return null;
|
||||
|
||||
const handleClick = (messageGroup: MessageGroup) => () => {
|
||||
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
||||
history.push(
|
||||
`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`,
|
||||
);
|
||||
history.push(`/messages/conversations/${messageGroup.groupId}/?${qs.stringify(messageGroup)}`);
|
||||
};
|
||||
|
||||
const formattedSearch = searchValue.toLowerCase().trim();
|
||||
@@ -62,25 +46,16 @@ const MessagesList = (): any => {
|
||||
const displayIncludes = groupDisplay.includes(formattedSearch);
|
||||
|
||||
const label = group.label?.toLowerCase();
|
||||
return label
|
||||
? displayIncludes || label.includes(formattedSearch)
|
||||
: displayIncludes;
|
||||
return label ? displayIncludes || label.includes(formattedSearch) : displayIncludes;
|
||||
})
|
||||
: messageGroups;
|
||||
|
||||
return (
|
||||
<>
|
||||
<MessageSearch
|
||||
value={searchValue}
|
||||
handleChange={(e) => setSearchValue(e.target.value)}
|
||||
/>
|
||||
<MessageSearch value={searchValue} handleChange={(e) => setSearchValue(e.target.value)} />
|
||||
<List className={classes.root}>
|
||||
{filteredGroups.map((messageGroup) => (
|
||||
<MessageGroupItem
|
||||
key={messageGroup.groupId}
|
||||
messageGroup={messageGroup}
|
||||
handleClick={handleClick}
|
||||
/>
|
||||
<MessageGroupItem key={messageGroup.groupId} messageGroup={messageGroup} handleClick={handleClick} />
|
||||
))}
|
||||
</List>
|
||||
</>
|
||||
|
||||
@@ -38,17 +38,10 @@ const Conversation = ({ activeMessageGroup, messages }: IProps) => {
|
||||
className={classes.overflowAutoY}
|
||||
>
|
||||
{messages.map((message) => (
|
||||
<MessageBubble
|
||||
key={message.id}
|
||||
message={message}
|
||||
isGroupChat={activeMessageGroup?.isGroupChat}
|
||||
/>
|
||||
<MessageBubble key={message.id} message={message} isGroupChat={activeMessageGroup?.isGroupChat} />
|
||||
))}
|
||||
</Box>
|
||||
<MessageInput
|
||||
messageGroupId={activeMessageGroup.groupId}
|
||||
onAddImageClick={() => setImageModalOpen(true)}
|
||||
/>
|
||||
<MessageInput messageGroupId={activeMessageGroup.groupId} onAddImageClick={() => setImageModalOpen(true)} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -41,33 +41,21 @@ const isImage = (url) => {
|
||||
return /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|png|jpeg|gif)/g.test(url);
|
||||
};
|
||||
|
||||
export const MessageBubble = ({
|
||||
message,
|
||||
isGroupChat,
|
||||
}: {
|
||||
message: Message;
|
||||
isGroupChat: boolean;
|
||||
}) => {
|
||||
export const MessageBubble = ({ message, isGroupChat }: { message: Message; isGroupChat: boolean }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div>
|
||||
<Paper className={message.isMine ? classes.mySms : classes.sms} variant="outlined">
|
||||
<Box>
|
||||
{isImage(message.message) ? (
|
||||
<img
|
||||
src={message.message}
|
||||
className={classes.imageMessage}
|
||||
alt="multimedia"
|
||||
/>
|
||||
<img src={message.message} className={classes.imageMessage} alt="multimedia" />
|
||||
) : (
|
||||
<div>{message.message}</div>
|
||||
)}
|
||||
</Box>
|
||||
<Box>
|
||||
<Typography variant="subtitle1" color="secondary">
|
||||
{isGroupChat && !message.isMine
|
||||
? message.display || message.phone_number
|
||||
: null}
|
||||
{isGroupChat && !message.isMine ? message.display || message.phone_number : null}
|
||||
</Typography>
|
||||
</Box>
|
||||
</Paper>
|
||||
|
||||
@@ -89,10 +89,7 @@ export const MessageImageModal = ({ isOpen, messageGroupId, onClose, image }: IP
|
||||
<Modal visible={queryParamImagePreview} handleClose={removeQueryParamImage}>
|
||||
<Box py={1}>
|
||||
<Typography paragraph>Do you want to share this image?</Typography>
|
||||
<PictureResponsive
|
||||
src={queryParamImagePreview}
|
||||
alt={'Share gallery image preview'}
|
||||
/>
|
||||
<PictureResponsive src={queryParamImagePreview} alt={'Share gallery image preview'} />
|
||||
<Button
|
||||
fullWidth
|
||||
variant="contained"
|
||||
|
||||
@@ -75,13 +75,9 @@ export const MessageModal = () => {
|
||||
// don't allow too many characters, it takes too much room
|
||||
let header = activeMessageGroup ? activeMessageGroup.groupDisplay : '';
|
||||
const truncatedHeader = `${header.slice(0, MAX_HEADER_CHARS).trim()}...`;
|
||||
header =
|
||||
header.length > MAX_HEADER_CHARS
|
||||
? activeMessageGroup?.label || truncatedHeader
|
||||
: header;
|
||||
header = header.length > MAX_HEADER_CHARS ? activeMessageGroup?.label || truncatedHeader : header;
|
||||
|
||||
const headerClass =
|
||||
header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay;
|
||||
const headerClass = header.length > LARGE_HEADER_CHARS ? classes.largeGroupDisplay : classes.groupdisplay;
|
||||
|
||||
return (
|
||||
<Slide direction="left" in={!!activeMessageGroup}>
|
||||
|
||||
@@ -6,9 +6,7 @@ import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
export const useMessagesService = () => {
|
||||
const setMessageGroups = useSetRecoilState(messageState.messageGroups);
|
||||
const setMessages = useSetRecoilState(messageState.messages);
|
||||
const setCreateMessageGroupResult = useSetRecoilState(
|
||||
messageState.createMessageGroupResult,
|
||||
);
|
||||
const setCreateMessageGroupResult = useSetRecoilState(messageState.createMessageGroupResult);
|
||||
const { addAlert } = useSnackbar();
|
||||
|
||||
useNuiEvent('MESSAGES', 'phone:fetchMessageGroupsSuccess', setMessageGroups);
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import {
|
||||
CreateMessageGroupResult,
|
||||
Message,
|
||||
MessageGroup,
|
||||
} from '../../../common/typings/messages';
|
||||
import { CreateMessageGroupResult, Message, MessageGroup } from '../../../common/typings/messages';
|
||||
import { messageState } from './state';
|
||||
|
||||
interface IUseMessages {
|
||||
@@ -18,10 +14,7 @@ export default (): IUseMessages => {
|
||||
const [messages, setMessages] = useRecoilState<Message[] | null>(messageState.messages);
|
||||
const messageGroups = useRecoilValue<MessageGroup[] | null>(messageState.messageGroups);
|
||||
|
||||
const [
|
||||
createMessageGroupResult,
|
||||
setCreateMessageGroupResult,
|
||||
] = useRecoilState<CreateMessageGroupResult | null>(
|
||||
const [createMessageGroupResult, setCreateMessageGroupResult] = useRecoilState<CreateMessageGroupResult | null>(
|
||||
messageState.createMessageGroupResult,
|
||||
);
|
||||
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
Button,
|
||||
TextField,
|
||||
Slide,
|
||||
Paper,
|
||||
Typography,
|
||||
Container,
|
||||
CircularProgress,
|
||||
Box,
|
||||
} from '@material-ui/core';
|
||||
import { Button, TextField, Slide, Paper, Typography, Container, CircularProgress, Box } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
||||
import { useNoteDetail } from '../hooks/useNoteDetail';
|
||||
@@ -109,11 +100,7 @@ export const NoteModal = () => {
|
||||
</Button>
|
||||
</Box>
|
||||
<Box display="inline" p={1}>
|
||||
<StatusButton
|
||||
color="error"
|
||||
variant="contained"
|
||||
onClick={_handleClose}
|
||||
>
|
||||
<StatusButton color="error" variant="contained" onClick={_handleClose}>
|
||||
{t('GENERIC_CANCEL')}
|
||||
</StatusButton>
|
||||
</Box>
|
||||
@@ -121,20 +108,12 @@ export const NoteModal = () => {
|
||||
) : (
|
||||
<>
|
||||
<Box display="inline" p={1}>
|
||||
<Button
|
||||
color="primary"
|
||||
variant="contained"
|
||||
onClick={handleUpdateNote}
|
||||
>
|
||||
<Button color="primary" variant="contained" onClick={handleUpdateNote}>
|
||||
{t('GENERIC_UPDATE')}
|
||||
</Button>
|
||||
</Box>
|
||||
<Box display="inline" p={1}>
|
||||
<StatusButton
|
||||
color="error"
|
||||
variant="contained"
|
||||
onClick={handleDeleteNote}
|
||||
>
|
||||
<StatusButton color="error" variant="contained" onClick={handleDeleteNote}>
|
||||
{t('GENERIC_DELETE')}
|
||||
</StatusButton>
|
||||
</Box>
|
||||
|
||||
@@ -54,10 +54,7 @@ export const SelloutItem = (listing) => {
|
||||
<Typography className={classes.headerTypo} variant="h5">
|
||||
{listing.name}
|
||||
</Typography>
|
||||
<Typography
|
||||
className={classes.headerTypo}
|
||||
style={{ borderBottom: '1px solid #f44336' }}
|
||||
>
|
||||
<Typography className={classes.headerTypo} style={{ borderBottom: '1px solid #f44336' }}>
|
||||
{listing.number}
|
||||
</Typography>
|
||||
<Typography variant="h5" style={{ padding: 5 }}>
|
||||
|
||||
@@ -28,16 +28,8 @@ export const NavigationBar = () => {
|
||||
showLabels
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faHome} />}
|
||||
to="/sellout"
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<AddCircleIcon />}
|
||||
to="/sellout/new"
|
||||
/>
|
||||
<BottomNavigationAction component={Link} icon={<FontAwesomeIcon icon={faHome} />} to="/sellout" />
|
||||
<BottomNavigationAction component={Link} icon={<AddCircleIcon />} to="/sellout/new" />
|
||||
</BottomNavigation>
|
||||
);
|
||||
};
|
||||
@@ -10,15 +10,7 @@ import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import { SettingItem } from './SettingItem';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import {
|
||||
Brush,
|
||||
Wallpaper,
|
||||
Phone,
|
||||
Smartphone,
|
||||
ZoomIn,
|
||||
LibraryMusic,
|
||||
VolumeUp,
|
||||
} from '@material-ui/icons';
|
||||
import { Brush, Wallpaper, Phone, Smartphone, ZoomIn, LibraryMusic, VolumeUp } from '@material-ui/icons';
|
||||
|
||||
import {
|
||||
Box,
|
||||
@@ -53,11 +45,7 @@ export const SettingsApp = () => {
|
||||
useEffect(() => {
|
||||
setSliders((curr) => {
|
||||
if (!curr.length) {
|
||||
return [
|
||||
settings.ringtoneVol,
|
||||
settings.notificationVol,
|
||||
settings.TWITTER_notificationVol,
|
||||
];
|
||||
return [settings.ringtoneVol, settings.notificationVol, settings.TWITTER_notificationVol];
|
||||
}
|
||||
return curr;
|
||||
});
|
||||
@@ -74,9 +62,7 @@ export const SettingsApp = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const wallpapers = config.wallpapers.map(
|
||||
MapStringOptions(settings.wallpaper, (val: string) =>
|
||||
handleSettingChange('wallpaper', val),
|
||||
),
|
||||
MapStringOptions(settings.wallpaper, (val: string) => handleSettingChange('wallpaper', val)),
|
||||
);
|
||||
const frames = config.frames.map(
|
||||
MapStringOptions(settings.frame, (val: string) => handleSettingChange('frame', val)),
|
||||
@@ -88,20 +74,14 @@ export const SettingsApp = () => {
|
||||
MapStringOptions(settings.zoom, (val: string) => handleSettingChange('zoom', val)),
|
||||
);
|
||||
const ringtones = config.ringtones.map(
|
||||
MapStringOptions(settings.ringtone, (val: string) =>
|
||||
handleSettingChange('ringtone', val),
|
||||
),
|
||||
MapStringOptions(settings.ringtone, (val: string) => handleSettingChange('ringtone', val)),
|
||||
);
|
||||
const notifications = config.notifications.map(
|
||||
MapStringOptions(settings.notification, (val: string) =>
|
||||
handleSettingChange('notification', val),
|
||||
),
|
||||
MapStringOptions(settings.notification, (val: string) => handleSettingChange('notification', val)),
|
||||
);
|
||||
|
||||
const twitterNotifications = config.notifications.map(
|
||||
MapStringOptions(settings.notification, (val: string) =>
|
||||
handleSettingChange('TWITTER_notification', val),
|
||||
),
|
||||
MapStringOptions(settings.notification, (val: string) => handleSettingChange('TWITTER_notification', val)),
|
||||
);
|
||||
|
||||
const [openMenu, closeMenu, ContextMenu, isMenuOpen] = useContextMenu();
|
||||
@@ -110,11 +90,7 @@ export const SettingsApp = () => {
|
||||
<AppTitle app={settingsApp} />
|
||||
<AppContent backdrop={isMenuOpen} onClickBackdrop={closeMenu}>
|
||||
<List disablePadding subheader={<SubHeaderComp text="Phone" />}>
|
||||
<SettingItem
|
||||
label={t('APPS_SETTINGS_PHONE_NUMBER')}
|
||||
value={simcard.number}
|
||||
icon={<Phone />}
|
||||
/>
|
||||
<SettingItem label={t('APPS_SETTINGS_PHONE_NUMBER')} value={simcard.number} icon={<Phone />} />
|
||||
<SettingItem
|
||||
label={t('APPS_SETTINGS_OPTION_RINGTONE')}
|
||||
value={settings.ringtone}
|
||||
@@ -126,10 +102,7 @@ export const SettingsApp = () => {
|
||||
<ListItemIcon>
|
||||
<VolumeUp />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={t('APPS_SETTINGS_OPTION_RINGTONEVOL')}
|
||||
secondary={settings.ringtoneVol}
|
||||
/>
|
||||
<ListItemText primary={t('APPS_SETTINGS_OPTION_RINGTONEVOL')} secondary={settings.ringtoneVol} />
|
||||
<ListItemSecondaryAction>
|
||||
<Box p={2} width={150}>
|
||||
<Slider
|
||||
@@ -153,10 +126,7 @@ export const SettingsApp = () => {
|
||||
<ListItemIcon>
|
||||
<VolumeUp />
|
||||
</ListItemIcon>
|
||||
<ListItemText
|
||||
primary={t('APPS_SETTINGS_OPTION_NOTIFICATIONVOL')}
|
||||
secondary={settings.notificationVol}
|
||||
/>
|
||||
<ListItemText primary={t('APPS_SETTINGS_OPTION_NOTIFICATIONVOL')} secondary={settings.notificationVol} />
|
||||
<ListItemSecondaryAction>
|
||||
<Box p={2} width={150}>
|
||||
<Slider
|
||||
@@ -164,9 +134,7 @@ export const SettingsApp = () => {
|
||||
min={0}
|
||||
max={100}
|
||||
onChange={handleSliderChange(1)}
|
||||
onChangeCommitted={() =>
|
||||
handleSettingChange('notificationVol', sliders[1])
|
||||
}
|
||||
onChangeCommitted={() => handleSettingChange('notificationVol', sliders[1])}
|
||||
/>
|
||||
</Box>
|
||||
</ListItemSecondaryAction>
|
||||
@@ -226,9 +194,7 @@ export const SettingsApp = () => {
|
||||
min={0}
|
||||
max={100}
|
||||
onChange={handleSliderChange(2)}
|
||||
onChangeCommitted={() =>
|
||||
handleSettingChange('TWITTER_notificationVol', sliders[2])
|
||||
}
|
||||
onChangeCommitted={() => handleSettingChange('TWITTER_notificationVol', sliders[2])}
|
||||
/>
|
||||
</Box>
|
||||
</ListItemSecondaryAction>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
export const getRingtonePath = (name?: string) =>
|
||||
`./media/ringtones/${name || 'pixel'}.ogg`;
|
||||
export const getRingtonePath = (name?: string) => `./media/ringtones/${name || 'pixel'}.ogg`;
|
||||
|
||||
export const getNotificationPath = (name?: string) =>
|
||||
`./media/notifications/${name || 'online'}.ogg`;
|
||||
export const getNotificationPath = (name?: string) => `./media/notifications/${name || 'online'}.ogg`;
|
||||
@@ -106,10 +106,7 @@ export const AddTweetModal = () => {
|
||||
|
||||
const data = {
|
||||
message,
|
||||
images:
|
||||
images && images.length > 0
|
||||
? images.map((image) => image.link).join(IMAGE_DELIMITER)
|
||||
: '',
|
||||
images: images && images.length > 0 ? images.map((image) => image.link).join(IMAGE_DELIMITER) : '',
|
||||
realUser: 'testUser',
|
||||
};
|
||||
Nui.send('phone:createTweet', data);
|
||||
@@ -158,27 +155,13 @@ export const AddTweetModal = () => {
|
||||
|
||||
return (
|
||||
<Modal visible={modalVisible} handleClose={_handleClose}>
|
||||
<TweetMessage
|
||||
modalVisible={modalVisible}
|
||||
message={message}
|
||||
handleChange={handleMessageChange}
|
||||
/>
|
||||
<ImagePrompt
|
||||
visible={showImagePrompt}
|
||||
value={link}
|
||||
handleChange={handleimageChange}
|
||||
/>
|
||||
<TweetMessage modalVisible={modalVisible} message={message} handleChange={handleMessageChange} />
|
||||
<ImagePrompt visible={showImagePrompt} value={link} handleChange={handleimageChange} />
|
||||
<EmojiSelect visible={showEmoji} onEmojiClick={handleSelectEmoji} />
|
||||
<ImageDisplay
|
||||
visible={!showEmoji && images.length > 0}
|
||||
images={images}
|
||||
removeImage={removeImage}
|
||||
/>
|
||||
<ImageDisplay visible={!showEmoji && images.length > 0} images={images} removeImage={removeImage} />
|
||||
<div className={classes.buttonsContainer}>
|
||||
<IconButtons
|
||||
onImageClick={
|
||||
images.length < config.twitter.maxImages ? toggleShowImagePrompt : null
|
||||
}
|
||||
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
|
||||
onEmojiClick={toggleShowEmoji}
|
||||
/>
|
||||
<ControlButtons
|
||||
|
||||
@@ -18,16 +18,8 @@ export function TwitterBottomNavigation({ activePage, handleChange }) {
|
||||
return (
|
||||
<BottomNavigation value={activePage} onChange={handleChange} className={classes.root}>
|
||||
<BottomNavigationAction component={Link} to="/twitter" icon={<HomeIcon />} />
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to="/twitter/search"
|
||||
icon={<SearchIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to="/twitter/profile"
|
||||
icon={<ProfileIcon />}
|
||||
/>
|
||||
<BottomNavigationAction component={Link} to="/twitter/search" icon={<SearchIcon />} />
|
||||
<BottomNavigationAction component={Link} to="/twitter/profile" icon={<ProfileIcon />} />
|
||||
</BottomNavigation>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ export const TwitterApp = () => {
|
||||
|
||||
// before any other action can be taken by the user we force
|
||||
// them have a profile name
|
||||
const promptProfileName =
|
||||
profile && (!profile.profile_name || !profile.profile_name.trim());
|
||||
const promptProfileName = profile && (!profile.profile_name || !profile.profile_name.trim());
|
||||
|
||||
const openModal = () => setModalVisible(true);
|
||||
const handlePageChange = (e, page) => setActivePage(page);
|
||||
@@ -83,9 +82,7 @@ export const TwitterApp = () => {
|
||||
)}
|
||||
</AppContent>
|
||||
{showTweetButton && <TweetButton openModal={openModal} />}
|
||||
{!promptProfileName && (
|
||||
<BottomNavigation activePage={activePage} handleChange={handlePageChange} />
|
||||
)}
|
||||
{!promptProfileName && <BottomNavigation activePage={activePage} handleChange={handlePageChange} />}
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -16,19 +16,12 @@ const useStyles = makeStyles((theme) => ({
|
||||
},
|
||||
}));
|
||||
|
||||
export const ControlButtons = ({
|
||||
showImagePrompt,
|
||||
showEmoji,
|
||||
onCloseClick,
|
||||
onPrimaryClick,
|
||||
}) => {
|
||||
export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPrimaryClick }) => {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const imagePromptVisible = showImagePrompt && !showEmoji;
|
||||
const primaryButtonText = imagePromptVisible
|
||||
? t('APPS_TWITTER_SUBMIT_IMAGE')
|
||||
: t('APPS_TWITTER_TWEET');
|
||||
const primaryButtonText = imagePromptVisible ? t('APPS_TWITTER_SUBMIT_IMAGE') : t('APPS_TWITTER_TWEET');
|
||||
const showCloseButton = showImagePrompt || showEmoji;
|
||||
|
||||
return (
|
||||
@@ -37,12 +30,7 @@ export const ControlButtons = ({
|
||||
{primaryButtonText}
|
||||
</Button>
|
||||
{showCloseButton && (
|
||||
<Button
|
||||
className={classes.close}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
onClick={onCloseClick}
|
||||
>
|
||||
<Button className={classes.close} variant="contained" color="secondary" onClick={onCloseClick}>
|
||||
{t('APPS_TWITTER_CLOSE_IMAGE')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -28,11 +28,7 @@ function LikeButton({ tweetId, isLiked }) {
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick}>
|
||||
{liked ? <FavoriteIcon /> : <FavoriteBorderIcon />}
|
||||
</Button>
|
||||
);
|
||||
return <Button onClick={handleClick}>{liked ? <FavoriteIcon /> : <FavoriteBorderIcon />}</Button>;
|
||||
}
|
||||
|
||||
export default LikeButton;
|
||||
@@ -35,12 +35,7 @@ export function ProfileUpdateButton({ handleClick }) {
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab
|
||||
className={classes.button}
|
||||
color="primary"
|
||||
onClick={handleClick}
|
||||
disabled={isLoading}
|
||||
>
|
||||
<Fab className={classes.button} color="primary" onClick={handleClick} disabled={isLoading}>
|
||||
<PublishIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
|
||||
@@ -45,11 +45,7 @@ export const Image = ({ link, handleClick, small }) => {
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img
|
||||
alt="small avatar"
|
||||
className={small ? classes.imgSmall : classes.img}
|
||||
src={link}
|
||||
/>
|
||||
<img alt="small avatar" className={small ? classes.imgSmall : classes.img} src={link} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -23,9 +23,7 @@ export const ImagePrompt = ({ visible, value, handleChange }) => {
|
||||
textFieldRef.current && textFieldRef.current.focus();
|
||||
}, [visible]);
|
||||
|
||||
const handleImageChange = useCallback((e) => handleChange(e.target.value), [
|
||||
handleChange,
|
||||
]);
|
||||
const handleImageChange = useCallback((e) => handleChange(e.target.value), [handleChange]);
|
||||
|
||||
if (!visible) return null;
|
||||
return (
|
||||
|
||||
@@ -70,22 +70,13 @@ export function Profile() {
|
||||
handleChange={handleNameChange}
|
||||
allowChange={allowEdtiableProfileName}
|
||||
/>
|
||||
<ProfileField
|
||||
label={t('APPS_TWITTER_EDIT_PROFILE_BIO')}
|
||||
value={bio}
|
||||
handleChange={handleBioChange}
|
||||
multiline
|
||||
/>
|
||||
<ProfileField label={t('APPS_TWITTER_EDIT_PROFILE_BIO')} value={bio} handleChange={handleBioChange} multiline />
|
||||
<ProfileField
|
||||
label={t('APPS_TWITTER_EDIT_PROFILE_LOCATION')}
|
||||
value={location}
|
||||
handleChange={handleLocationChange}
|
||||
/>
|
||||
<ProfileField
|
||||
label={t('APPS_TWITTER_EDIT_PROFILE_JOB')}
|
||||
value={job}
|
||||
handleChange={handleJobChange}
|
||||
/>
|
||||
<ProfileField label={t('APPS_TWITTER_EDIT_PROFILE_JOB')} value={job} handleChange={handleJobChange} />
|
||||
<ProfileUpdateButton handleClick={handleUpdate} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -76,12 +76,8 @@ export const ShowMore = ({ id, isReported, isMine }) => {
|
||||
horizontal: 'left',
|
||||
}}
|
||||
>
|
||||
{allowedToDelete && (
|
||||
<MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>
|
||||
)}
|
||||
{allowedToReport && (
|
||||
<ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />
|
||||
)}
|
||||
{allowedToDelete && <MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>}
|
||||
{allowedToReport && <ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />}
|
||||
</Menu>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import React, { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import {
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
ListItem,
|
||||
Typography,
|
||||
} from '@material-ui/core';
|
||||
import { ListItemAvatar, Avatar as MuiAvatar, ListItem, Typography } from '@material-ui/core';
|
||||
import { secondsToHumanReadable } from '../../utils/time';
|
||||
import LikeButton from '../buttons/LikeButton';
|
||||
import ReplyButton from '../buttons/ReplyButton';
|
||||
@@ -61,17 +56,7 @@ const useStyles = makeStyles(() => ({
|
||||
}));
|
||||
|
||||
export const Tweet = (tweet) => {
|
||||
const {
|
||||
id,
|
||||
message,
|
||||
images,
|
||||
avatar_url,
|
||||
profile_name,
|
||||
seconds_since_tweet,
|
||||
isLiked,
|
||||
isMine,
|
||||
isReported,
|
||||
} = tweet;
|
||||
const { id, message, images, avatar_url, profile_name, seconds_since_tweet, isLiked, isMine, isReported } = tweet;
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { config } = usePhone();
|
||||
@@ -105,12 +90,7 @@ export const Tweet = (tweet) => {
|
||||
<div className={classes.content}>
|
||||
<div className={classes.primary}>
|
||||
<div className={classes.profile}>{profileName}</div>
|
||||
<Typography
|
||||
className={classes.date}
|
||||
component="div"
|
||||
variant="body2"
|
||||
color="textSecondary"
|
||||
>
|
||||
<Typography className={classes.date} component="div" variant="body2" color="textSecondary">
|
||||
{secondsToHumanReadable(t, seconds_since_tweet)}
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
@@ -51,14 +51,10 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
let errorMessage = null;
|
||||
|
||||
const overCharacterLimit = message.trim().length > characterLimit;
|
||||
const characterWarningPrompt = `${t(
|
||||
'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT',
|
||||
)} (${characterLimit})`;
|
||||
const characterWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT')} (${characterLimit})`;
|
||||
|
||||
const overNewLineLimit = getNewLineCount(message) > newLineLimit;
|
||||
const newLineWarningPrompt = `${t(
|
||||
'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT',
|
||||
)} (${newLineLimit})`;
|
||||
const newLineWarningPrompt = `${t('APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT')} (${newLineLimit})`;
|
||||
|
||||
if (overCharacterLimit) {
|
||||
errorMessage = characterWarningPrompt;
|
||||
|
||||
@@ -2,9 +2,7 @@ import { useRecoilState } from 'recoil';
|
||||
import { twitterState } from './state';
|
||||
|
||||
export const useModal = () => {
|
||||
const [modalVisible, setModalVisible] = useRecoilState(
|
||||
twitterState.showCreateTweetModal,
|
||||
);
|
||||
const [modalVisible, setModalVisible] = useRecoilState(twitterState.showCreateTweetModal);
|
||||
const [message, setMessage] = useRecoilState(twitterState.modalMessage);
|
||||
return { modalVisible, setModalVisible, message, setMessage };
|
||||
};
|
||||
@@ -19,9 +19,7 @@ interface IUseProfile {
|
||||
export const useProfile = (): IUseProfile => {
|
||||
const profile = useRecoilValue(twitterState.profile);
|
||||
const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading);
|
||||
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(
|
||||
twitterState.updateProfileSuccess,
|
||||
);
|
||||
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(twitterState.updateProfileSuccess);
|
||||
return {
|
||||
profile,
|
||||
updateProfileLoading,
|
||||
|
||||
@@ -4,9 +4,7 @@ import { twitterState } from './state';
|
||||
|
||||
export const useTweetStatus = () => {
|
||||
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
|
||||
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(
|
||||
twitterState.createTweetSuccessful,
|
||||
);
|
||||
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(twitterState.createTweetSuccessful);
|
||||
return {
|
||||
createTweetLoading,
|
||||
createTweetSuccessful,
|
||||
|
||||
@@ -12,10 +12,7 @@ const DAYS = 'APPS_TWITTER_TIME_DAYS';
|
||||
* @param {function} t - translation object passed from a component implementing the hook
|
||||
* @param {number} seconds - seconds to translate to a string
|
||||
*/
|
||||
export function secondsToHumanReadable(
|
||||
t: (input: string) => string,
|
||||
seconds: number,
|
||||
): string {
|
||||
export function secondsToHumanReadable(t: (input: string) => string, seconds: number): string {
|
||||
if (seconds < 60) {
|
||||
return t(JUST_NOW);
|
||||
} else if (seconds < ONE_HOUR) {
|
||||
|
||||
Reference in new issue
Block a user