mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Feature / Streamer Mode (#159)
* feat(phone/settings): Add streamer mode setting and PictureReveal component :) * feat(phone/settings): Add PictureReveal streamer mode to twitter and improve its theme a bit
This commit is contained in:
1 parent
d841ee0958
commit
75a4eb176e
27 files changed
+175
-92
No files matched your search
@@ -1,10 +1,15 @@
|
||||
import React, { memo } from 'react';
|
||||
import { Picker } from 'emoji-mart';
|
||||
import { useTheme } from '@material-ui/core';
|
||||
|
||||
export const EmojiSelect = ({ visible, onEmojiClick }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
if (!visible) return null;
|
||||
|
||||
return <Picker onClick={onEmojiClick} set="google" theme="dark" showPreview={false} />;
|
||||
return (
|
||||
<Picker onClick={onEmojiClick} set="google" theme={theme.palette.type} showPreview={false} />
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(EmojiSelect); // The picker is an expensive render
|
||||
@@ -43,7 +43,6 @@ export const TwitterApp = () => {
|
||||
const { profile } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
// this is a polling implementation. It is possible that
|
||||
// there is some interaction where, on a new tweet, all
|
||||
// clients are sent the updated query data. Until that can
|
||||
@@ -113,6 +112,7 @@ InjectDebugData([
|
||||
avatar_url: 'http://i.tasoagc.dev/jtKL',
|
||||
seconds_since_tweet: 500,
|
||||
isMine: false,
|
||||
isRetweetedByPlayer: true,
|
||||
updateAt: '2021-02-08 14:37:46',
|
||||
visible: 1,
|
||||
likes: 50000,
|
||||
|
||||
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Button } from '@material-ui/core';
|
||||
import { StatusButton } from '../../../../ui/components/StatusButton';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
buttons: {
|
||||
@@ -32,14 +33,14 @@ export const ControlButtons = ({ showImagePrompt, showEmoji, onCloseClick, onPri
|
||||
{primaryButtonText}
|
||||
</Button>
|
||||
{showCloseButton && (
|
||||
<Button
|
||||
<StatusButton
|
||||
className={classes.close}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
color="error"
|
||||
onClick={onCloseClick}
|
||||
>
|
||||
{t('APPS_TWITTER_CLOSE_IMAGE')}
|
||||
</Button>
|
||||
</StatusButton>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -28,7 +28,11 @@ function LikeButton({ tweetId, isLiked }) {
|
||||
);
|
||||
}
|
||||
|
||||
return <Button onClick={handleClick}>{liked ? <FavoriteIcon /> : <FavoriteBorderIcon />}</Button>;
|
||||
return (
|
||||
<Button onClick={handleClick}>
|
||||
{liked ? <FavoriteIcon color="primary" /> : <FavoriteBorderIcon />}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export default LikeButton;
|
||||
@@ -2,8 +2,6 @@ import React, { useState } from 'react';
|
||||
import { CircularProgress, makeStyles, Button } from '@material-ui/core';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faRetweet } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { ITwitterTheme } from '../../twitter.theme';
|
||||
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||
|
||||
interface IProps {
|
||||
@@ -12,11 +10,10 @@ interface IProps {
|
||||
isRetweet: boolean | number;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: ITwitterTheme) => ({
|
||||
icon: {}, // no styles on default icon
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
iconFilled: {
|
||||
color: theme.palette.twitter.main,
|
||||
}
|
||||
color: theme.palette.primary.main,
|
||||
},
|
||||
}));
|
||||
|
||||
const LOADING_TIME = 1250;
|
||||
@@ -43,7 +40,6 @@ export const RetweetButton = ({ tweetId, isRetweet, retweetId }: IProps) => {
|
||||
setLoading(false);
|
||||
}, LOADING_TIME);
|
||||
};
|
||||
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
@@ -53,7 +49,7 @@ export const RetweetButton = ({ tweetId, isRetweet, retweetId }: IProps) => {
|
||||
);
|
||||
}
|
||||
|
||||
const className = retweeted ? classes.iconFilled : classes.icon;
|
||||
const className = retweeted ? classes.iconFilled : '';
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick}>
|
||||
|
||||
@@ -9,9 +9,6 @@ const useStyles = makeStyles((theme) => ({
|
||||
bottom: '15px',
|
||||
right: '15px',
|
||||
},
|
||||
button: {
|
||||
background: '#00acee',
|
||||
},
|
||||
}));
|
||||
|
||||
export function ProfileUpdateButton({ handleClick }) {
|
||||
@@ -19,7 +16,7 @@ export function ProfileUpdateButton({ handleClick }) {
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color="primary" onClick={handleClick}>
|
||||
<Fab color="primary" onClick={handleClick}>
|
||||
<SearchIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,8 @@ import React from 'react';
|
||||
import { IconButton } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
import { PictureReveal } from '../../../../ui/components/PictureReveal';
|
||||
import { PictureResponsive } from '../../../../ui/components/PictureResponsive';
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
@@ -24,19 +26,9 @@ const useStyles = makeStyles(() => ({
|
||||
backgroundColor: '#000',
|
||||
},
|
||||
},
|
||||
img: {
|
||||
maxHeight: '125px', // constrain images so we don't overwhelm the UI
|
||||
maxWidth: '300px',
|
||||
padding: '0px 3px 3px 0px',
|
||||
},
|
||||
imgSmall: {
|
||||
maxHeight: '200px', // constrain images so we don't overwhelm the UI
|
||||
maxWidth: '100%',
|
||||
padding: '0px 1px 1px 0px',
|
||||
},
|
||||
}));
|
||||
|
||||
export const Image = ({ link, handleClick, small }) => {
|
||||
export const Image = ({ link, handleClick }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.imageContainer}>
|
||||
@@ -45,7 +37,9 @@ export const Image = ({ link, handleClick, small }) => {
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img alt="small avatar" className={small ? classes.imgSmall : classes.img} src={link} />
|
||||
<PictureReveal>
|
||||
<PictureResponsive alt="small avatar" src={link} />
|
||||
</PictureReveal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Box } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
|
||||
import Image from './Image';
|
||||
@@ -5,19 +6,16 @@ import Image from './Image';
|
||||
export const ImageDisplay = ({ visible, images, removeImage, small }) => {
|
||||
if (!visible || !images || images.length === 0) return null;
|
||||
|
||||
const styles = { margin: small ? '2px 0px' : '2px 15px' };
|
||||
|
||||
return (
|
||||
<div style={styles}>
|
||||
<Box p={1}>
|
||||
{images.map((image) => (
|
||||
<Image
|
||||
key={image.id}
|
||||
link={image.link}
|
||||
handleClick={removeImage ? () => removeImage(image.id) : null}
|
||||
small={small}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
||||
@@ -4,13 +4,11 @@ import { makeStyles } from '@material-ui/core/styles';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faRetweet } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import { ITwitterTheme } from '../../twitter.theme';
|
||||
|
||||
interface IProps {
|
||||
profileName: string;
|
||||
profileName: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: ITwitterTheme) => ({
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
color: theme.palette.secondary.main,
|
||||
fontSize: '16px',
|
||||
@@ -18,18 +16,18 @@ const useStyles = makeStyles((theme: ITwitterTheme) => ({
|
||||
width: '100%',
|
||||
paddingBottom: '8px',
|
||||
marginBottom: '6px',
|
||||
marginTop: '-6px'
|
||||
marginTop: '-6px',
|
||||
},
|
||||
}));
|
||||
|
||||
function Retweet({ profileName }: IProps) {
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<FontAwesomeIcon icon={faRetweet} /> {profileName} {t('APPS_TWITTER_RETWEETED')}
|
||||
</div>
|
||||
)
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<FontAwesomeIcon icon={faRetweet} /> {profileName} {t('APPS_TWITTER_RETWEETED')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Retweet;
|
||||
export default Retweet;
|
||||
@@ -78,7 +78,6 @@ export const Tweet = (tweet: ITweet) => {
|
||||
isMine,
|
||||
isReported,
|
||||
isRetweet,
|
||||
isRetweetedByPlayer,
|
||||
} = tweet;
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
@@ -137,12 +136,7 @@ export const Tweet = (tweet: ITweet) => {
|
||||
<div className={classes.buttonContainer}>
|
||||
<ReplyButton profile_name={profile_name} />
|
||||
<LikeButton tweetId={id} isLiked={isLiked} />
|
||||
{!isMine && (
|
||||
<RetweetButton
|
||||
tweetId={id}
|
||||
retweetId={retweetId}
|
||||
isRetweet={isRetweet}
|
||||
/>)}
|
||||
{!isMine && <RetweetButton tweetId={id} retweetId={retweetId} isRetweet={isRetweet} />}
|
||||
<ShowMore isMine={isMine} isReported={isReported} id={id} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user