mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
more formatting
This commit is contained in:
1 parent
046447b0fb
commit
f552c1212c
157 files changed
+635
-1579
No files matched your search
@@ -86,9 +86,7 @@ export const AddTweetModal = () => {
|
||||
|
||||
const handleimageChange = useCallback((link) => setLink(link), []);
|
||||
|
||||
const handleMessageChange = useCallback((message) => setMessage(message), [
|
||||
setMessage,
|
||||
]);
|
||||
const handleMessageChange = useCallback((message) => setMessage(message), [setMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('keydown', _handleEscape, true);
|
||||
@@ -138,8 +136,7 @@ export const AddTweetModal = () => {
|
||||
setShowImagePrompt(false);
|
||||
setLink('');
|
||||
};
|
||||
const removeImage = (id) =>
|
||||
setImages(images.filter((image) => id !== image.id));
|
||||
const removeImage = (id) => setImages(images.filter((image) => id !== image.id));
|
||||
|
||||
const toggleShowImagePrompt = () => {
|
||||
setShowEmoji(false); // clear the emoji so we can switch between emoji/images
|
||||
@@ -180,9 +177,7 @@ export const AddTweetModal = () => {
|
||||
<div className={classes.buttonsContainer}>
|
||||
<IconButtons
|
||||
onImageClick={
|
||||
images.length < config.twitter.maxImages
|
||||
? toggleShowImagePrompt
|
||||
: null
|
||||
images.length < config.twitter.maxImages ? toggleShowImagePrompt : null
|
||||
}
|
||||
onEmojiClick={toggleShowEmoji}
|
||||
/>
|
||||
|
||||
@@ -30,14 +30,14 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
|
||||
<img
|
||||
className={classes.img}
|
||||
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
|
||||
alt='Invalid avatar'
|
||||
alt="Invalid avatar"
|
||||
style={{ height, width }}
|
||||
/>
|
||||
)}
|
||||
<img
|
||||
className={classes.img}
|
||||
src={avatarUrl || IMG_DEFAULT_AVATAR}
|
||||
alt='Your profile avatar'
|
||||
alt="Your profile avatar"
|
||||
onError={handleImageError}
|
||||
onLoad={handleImageLoad}
|
||||
style={{ display: showImageError ? 'none' : 'block', height, width }}
|
||||
|
||||
@@ -16,24 +16,16 @@ export function TwitterBottomNavigation({ activePage, handleChange }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<BottomNavigation
|
||||
value={activePage}
|
||||
onChange={handleChange}
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigation value={activePage} onChange={handleChange} className={classes.root}>
|
||||
<BottomNavigationAction component={Link} to="/twitter" icon={<HomeIcon />} />
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to='/twitter'
|
||||
icon={<HomeIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to='/twitter/search'
|
||||
to="/twitter/search"
|
||||
icon={<SearchIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to='/twitter/profile'
|
||||
to="/twitter/profile"
|
||||
icon={<ProfileIcon />}
|
||||
/>
|
||||
</BottomNavigation>
|
||||
|
||||
@@ -4,14 +4,7 @@ import { Picker } from 'emoji-mart';
|
||||
export const EmojiSelect = ({ visible, onEmojiClick }) => {
|
||||
if (!visible) return null;
|
||||
|
||||
return (
|
||||
<Picker
|
||||
onClick={onEmojiClick}
|
||||
set='google'
|
||||
theme='dark'
|
||||
showPreview={false}
|
||||
/>
|
||||
);
|
||||
return <Picker onClick={onEmojiClick} set="google" theme="dark" showPreview={false} />;
|
||||
};
|
||||
|
||||
export default memo(EmojiSelect); // The picker is an expensive render
|
||||
@@ -67,7 +67,7 @@ export const TwitterApp = () => {
|
||||
const showTweetButton = !promptProfileName && activePage === 0;
|
||||
|
||||
return (
|
||||
<AppWrapper id='twitter-app'>
|
||||
<AppWrapper id="twitter-app">
|
||||
<AddTweetModal />
|
||||
<div className={modalVisible ? classes.backgroundModal : undefined} />
|
||||
<TwitterTitle />
|
||||
@@ -76,18 +76,15 @@ export const TwitterApp = () => {
|
||||
<ProfilePrompt />
|
||||
) : (
|
||||
<Switch>
|
||||
<Route path='/twitter' exact component={TweetListContainer} />
|
||||
<Route path='/twitter/search' component={TwitterSearch} />
|
||||
<Route path='/twitter/profile' component={TwitterProfile} />
|
||||
<Route path="/twitter" exact component={TweetListContainer} />
|
||||
<Route path="/twitter/search" component={TwitterSearch} />
|
||||
<Route path="/twitter/profile" component={TwitterProfile} />
|
||||
</Switch>
|
||||
)}
|
||||
</AppContent>
|
||||
{showTweetButton && <TweetButton openModal={openModal} />}
|
||||
{!promptProfileName && (
|
||||
<BottomNavigation
|
||||
activePage={activePage}
|
||||
handleChange={handlePageChange}
|
||||
/>
|
||||
<BottomNavigation activePage={activePage} handleChange={handlePageChange} />
|
||||
)}
|
||||
</AppWrapper>
|
||||
);
|
||||
@@ -191,5 +188,5 @@ InjectDebugData(
|
||||
},
|
||||
},
|
||||
],
|
||||
3000
|
||||
3000,
|
||||
);
|
||||
@@ -47,7 +47,7 @@ function TwitterSearch() {
|
||||
label={t('APPS_TWITTER_SEARCH_TWEETS')}
|
||||
value={searchValue}
|
||||
onChange={handleChange}
|
||||
size='medium'
|
||||
size="medium"
|
||||
inputRef={(input) => input && input.focus()}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
export function TwitterTitle() {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper elevation={24} variant='outlined' square className={classes.root}>
|
||||
<Paper elevation={24} variant="outlined" square className={classes.root}>
|
||||
<TwitterIcon className={classes.icon} />
|
||||
</Paper>
|
||||
);
|
||||
|
||||
@@ -33,14 +33,14 @@ export const ControlButtons = ({
|
||||
|
||||
return (
|
||||
<div className={classes.buttons}>
|
||||
<Button variant='contained' color='primary' onClick={onPrimaryClick}>
|
||||
<Button variant="contained" color="primary" onClick={onPrimaryClick}>
|
||||
{primaryButtonText}
|
||||
</Button>
|
||||
{showCloseButton && (
|
||||
<Button
|
||||
className={classes.close}
|
||||
variant='contained'
|
||||
color='secondary'
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
onClick={onCloseClick}
|
||||
>
|
||||
{t('APPS_TWITTER_CLOSE_IMAGE')}
|
||||
|
||||
@@ -29,12 +29,12 @@ export const IconButtons = ({ onImageClick, onEmojiClick }) => {
|
||||
<div className={classes.buttons}>
|
||||
{enableImages && (
|
||||
<Button className={classes.button} onClick={onImageClick}>
|
||||
<InsertPhotoIcon color='action' />
|
||||
<InsertPhotoIcon color="action" />
|
||||
</Button>
|
||||
)}
|
||||
{enableEmojis && (
|
||||
<Button className={classes.button} onClick={onEmojiClick}>
|
||||
<EmojiIcon color='action' />
|
||||
<EmojiIcon color="action" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@ export function ProfileUpdateButton({ handleClick }) {
|
||||
<div className={classes.root}>
|
||||
<Fab
|
||||
className={classes.button}
|
||||
color='primary'
|
||||
color="primary"
|
||||
onClick={handleClick}
|
||||
disabled={isLoading}
|
||||
>
|
||||
|
||||
@@ -32,7 +32,7 @@ function ReportButton({ handleClose, tweetId, isReported }) {
|
||||
if (loading) {
|
||||
return (
|
||||
<Button disabled>
|
||||
<CircularProgress id='twitter-report-progress' size={22} />
|
||||
<CircularProgress id="twitter-report-progress" size={22} />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export function ProfileUpdateButton({ handleClick }) {
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color='primary' onClick={handleClick}>
|
||||
<Fab className={classes.button} color="primary" onClick={handleClick}>
|
||||
<SearchIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@ export function TweetButton({ openModal }) {
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color='primary' onClick={openModal}>
|
||||
<Fab className={classes.button} color="primary" onClick={openModal}>
|
||||
<CreateIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
|
||||
@@ -41,16 +41,12 @@ export const Image = ({ link, handleClick, small }) => {
|
||||
return (
|
||||
<div className={classes.imageContainer}>
|
||||
{handleClick && (
|
||||
<IconButton
|
||||
className={classes.imgButton}
|
||||
onClick={handleClick}
|
||||
size='small'
|
||||
>
|
||||
<IconButton className={classes.imgButton} onClick={handleClick} size="small">
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img
|
||||
alt='small avatar'
|
||||
alt="small avatar"
|
||||
className={small ? classes.imgSmall : classes.img}
|
||||
src={link}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ export const ImagePrompt = ({ visible, value, handleChange }) => {
|
||||
className={classes.textField}
|
||||
onChange={handleImageChange}
|
||||
multiline
|
||||
size='small'
|
||||
size="small"
|
||||
placeholder={t('APPS_TWITTER_IMAGE_PLACEHOLDER')}
|
||||
inputRef={textFieldRef}
|
||||
/>
|
||||
|
||||
@@ -12,14 +12,7 @@ const useStyles = makeStyles({
|
||||
},
|
||||
});
|
||||
|
||||
function ProfileField({
|
||||
label,
|
||||
value,
|
||||
handleChange,
|
||||
allowChange,
|
||||
multiline,
|
||||
inputRef,
|
||||
}) {
|
||||
function ProfileField({ label, value, handleChange, allowChange, multiline, inputRef }) {
|
||||
const classes = useStyles();
|
||||
const _handleChange = (e) => handleChange(e.target.value);
|
||||
|
||||
|
||||
@@ -58,20 +58,15 @@ export const ShowMore = ({ id, isReported, isMine }) => {
|
||||
|
||||
// if the user cannot perform any actions in show more then don't
|
||||
// allow them to interact with it
|
||||
let _handleClick =
|
||||
allowedToDelete || allowedToReport ? handleClick : () => null;
|
||||
let _handleClick = allowedToDelete || allowedToReport ? handleClick : () => null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
aria-controls='simple-menu'
|
||||
aria-haspopup='true'
|
||||
onClick={_handleClick}
|
||||
>
|
||||
<Button aria-controls="simple-menu" aria-haspopup="true" onClick={_handleClick}>
|
||||
<MoreIcon />
|
||||
</Button>
|
||||
<Menu
|
||||
id='simple-menu'
|
||||
id="simple-menu"
|
||||
anchorEl={anchorEl}
|
||||
keepMounted
|
||||
open={Boolean(anchorEl)}
|
||||
@@ -82,16 +77,10 @@ export const ShowMore = ({ id, isReported, isMine }) => {
|
||||
}}
|
||||
>
|
||||
{allowedToDelete && (
|
||||
<MenuItem onClick={handleDeleteTweet}>
|
||||
{t('APPS_TWITTER_DELETE')}
|
||||
</MenuItem>
|
||||
<MenuItem onClick={handleDeleteTweet}>{t('APPS_TWITTER_DELETE')}</MenuItem>
|
||||
)}
|
||||
{allowedToReport && (
|
||||
<ReportButton
|
||||
handleClose={handleClose}
|
||||
isReported={isReported}
|
||||
tweetId={id}
|
||||
/>
|
||||
<ReportButton handleClose={handleClose} isReported={isReported} tweetId={id} />
|
||||
)}
|
||||
</Menu>
|
||||
</>
|
||||
|
||||
@@ -98,7 +98,7 @@ export const Tweet = (tweet) => {
|
||||
{enableAvatars && (
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar>
|
||||
<Avatar avatarUrl={avatar_url} height='40px' width='40px' />
|
||||
<Avatar avatarUrl={avatar_url} height="40px" width="40px" />
|
||||
</MuiAvatar>
|
||||
</ListItemAvatar>
|
||||
)}
|
||||
@@ -107,9 +107,9 @@ export const Tweet = (tweet) => {
|
||||
<div className={classes.profile}>{profileName}</div>
|
||||
<Typography
|
||||
className={classes.date}
|
||||
component='div'
|
||||
variant='body2'
|
||||
color='textSecondary'
|
||||
component="div"
|
||||
variant="body2"
|
||||
color="textSecondary"
|
||||
>
|
||||
{secondsToHumanReadable(t, seconds_since_tweet)}
|
||||
</Typography>
|
||||
|
||||
@@ -43,7 +43,7 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
textFieldRef.current.scrollTop = textFieldRef.current.scrollHeight;
|
||||
handleChange(e.target.value);
|
||||
},
|
||||
[handleChange]
|
||||
[handleChange],
|
||||
);
|
||||
|
||||
if (!config) return null;
|
||||
@@ -52,12 +52,12 @@ export const TweetMessage = ({ modalVisible, message, handleChange }) => {
|
||||
|
||||
const overCharacterLimit = message.trim().length > characterLimit;
|
||||
const characterWarningPrompt = `${t(
|
||||
'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT'
|
||||
'APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT',
|
||||
)} (${characterLimit})`;
|
||||
|
||||
const overNewLineLimit = getNewLineCount(message) > newLineLimit;
|
||||
const newLineWarningPrompt = `${t(
|
||||
'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT'
|
||||
'APPS_TWITTER_TWEET_MESSAGE_NEW_LINE_LIMIT',
|
||||
)} (${newLineLimit})`;
|
||||
|
||||
if (overCharacterLimit) {
|
||||
|
||||
@@ -25,11 +25,11 @@ export default function TweetSkeleton() {
|
||||
<>
|
||||
<div className={classes.root}>
|
||||
<div className={classes.left}>
|
||||
<Skeleton variant='circle' width={60} height={60} />
|
||||
<Skeleton variant="circle" width={60} height={60} />
|
||||
</div>
|
||||
<div className={classes.right}>
|
||||
<Skeleton variant='text' />
|
||||
<Skeleton variant='rect' width={250} height={118} />
|
||||
<Skeleton variant="text" />
|
||||
<Skeleton variant="rect" width={250} height={118} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { twitterState } from './state';
|
||||
|
||||
export const useModal = () => {
|
||||
const [modalVisible, setModalVisible] = useRecoilState(
|
||||
twitterState.showCreateTweetModal
|
||||
twitterState.showCreateTweetModal,
|
||||
);
|
||||
const [message, setMessage] = useRecoilState(twitterState.modalMessage);
|
||||
return { modalVisible, setModalVisible, message, setMessage };
|
||||
|
||||
@@ -18,11 +18,9 @@ interface IUseProfile {
|
||||
|
||||
export const useProfile = (): IUseProfile => {
|
||||
const profile = useRecoilValue(twitterState.profile);
|
||||
const updateProfileLoading = useRecoilValue(
|
||||
twitterState.updateProfileLoading
|
||||
);
|
||||
const updateProfileLoading = useRecoilValue(twitterState.updateProfileLoading);
|
||||
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(
|
||||
twitterState.updateProfileSuccess
|
||||
twitterState.updateProfileSuccess,
|
||||
);
|
||||
return {
|
||||
profile,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { twitterState } from './state';
|
||||
export const useTweetStatus = () => {
|
||||
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
|
||||
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(
|
||||
twitterState.createTweetSuccessful
|
||||
twitterState.createTweetSuccessful,
|
||||
);
|
||||
return {
|
||||
createTweetLoading,
|
||||
|
||||
@@ -14,9 +14,7 @@ export const useTwitterNotifications = () => {
|
||||
|
||||
const { icon, notificationIcon } = useApp('TWITTER');
|
||||
|
||||
const [unreadCount, setUnreadCount] = useRecoilState(
|
||||
twitterState.unreadTweetsCount
|
||||
);
|
||||
const [unreadCount, setUnreadCount] = useRecoilState(twitterState.unreadTweetsCount);
|
||||
|
||||
const setNotification = useCallback(
|
||||
({ profile_name, message }) => {
|
||||
@@ -38,12 +36,12 @@ export const useTwitterNotifications = () => {
|
||||
count: unread,
|
||||
}),
|
||||
content: null,
|
||||
}
|
||||
},
|
||||
);
|
||||
return unread;
|
||||
});
|
||||
},
|
||||
[setUnreadCount, addNotificationAlert, t, icon, notificationIcon, history]
|
||||
[setUnreadCount, addNotificationAlert, t, icon, notificationIcon, history],
|
||||
);
|
||||
|
||||
return { setNotification, setUnreadCount, unreadCount };
|
||||
|
||||
@@ -34,9 +34,7 @@ export const useTwitterService = () => {
|
||||
const { setNotification } = useTwitterNotifications();
|
||||
|
||||
const setProfile = useSetRecoilState(twitterState.profile);
|
||||
const setUpdateProfileLoading = useSetRecoilState(
|
||||
twitterState.updateProfileLoading
|
||||
);
|
||||
const setUpdateProfileLoading = useSetRecoilState(twitterState.updateProfileLoading);
|
||||
|
||||
const setTweets = useSetRecoilState(twitterState.tweets);
|
||||
const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets);
|
||||
|
||||
@@ -14,7 +14,7 @@ const DAYS = 'APPS_TWITTER_TIME_DAYS';
|
||||
*/
|
||||
export function secondsToHumanReadable(
|
||||
t: (input: string) => string,
|
||||
seconds: number
|
||||
seconds: number,
|
||||
): string {
|
||||
if (seconds < 60) {
|
||||
return t(JUST_NOW);
|
||||
|
||||
Reference in new issue
Block a user