printWidth: 100

This commit is contained in:
Christopher committed 2021-03-02 21:03:06 +01:00
1 parent d27aeb3b0e
commit 6f4ee009a9
63 files changed
+602 -223

No files matched your search

@@ -106,7 +106,8 @@ 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);
@@ -155,10 +156,18 @@ export const AddTweetModal = () => {
return (
<Modal visible={modalVisible} handleClose={_handleClose}>
<TweetMessage modalVisible={modalVisible} message={message} handleChange={handleMessageChange} />
<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}
@@ -82,7 +82,9 @@ export const TwitterApp = () => {
)}
</AppContent>
{showTweetButton && <TweetButton openModal={openModal} />}
{!promptProfileName && <BottomNavigation activePage={activePage} handleChange={handlePageChange} />}
{!promptProfileName && (
<BottomNavigation activePage={activePage} handleChange={handlePageChange} />
)}
</AppWrapper>
);
};
@@ -21,7 +21,9 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri
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 (
@@ -30,7 +32,12 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri
{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>
)}
@@ -70,13 +70,22 @@ 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,8 +76,12 @@ 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>
</>
);
@@ -56,7 +56,17 @@ 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();
@@ -90,7 +100,12 @@ 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,10 +51,14 @@ 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;
+3 -1
View File
@@ -19,7 +19,9 @@ 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,7 +4,9 @@ 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,