mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
implemented twitter configuration parameters
This commit is contained in:
1 parent
345f591670
commit
7d287ccd08
18 files changed
+144
-37
No files matched your search
@@ -16,6 +16,7 @@ import ReplyButton from "../buttons/ReplyButton";
|
||||
import ImageDisplay from "../images/ImageDisplay";
|
||||
import Avatar from "../Avatar";
|
||||
import { QuoteButton } from "../buttons/QuoteButton";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
@@ -70,6 +71,12 @@ export const Tweet = (tweet) => {
|
||||
} = tweet;
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { config } = usePhone();
|
||||
|
||||
console.log(config);
|
||||
|
||||
if (!config) return null;
|
||||
const { enableAvatars, enableImages } = config.twitter;
|
||||
|
||||
// this is a workaround to transfer string new lines and returns that
|
||||
// are stored into the database into html for the UI to render
|
||||
@@ -77,11 +84,13 @@ export const Tweet = (tweet) => {
|
||||
|
||||
return (
|
||||
<ListItem className={classes.root} divider>
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar>
|
||||
<Avatar avatarUrl={avatar_url} height="45px" width="45px" />
|
||||
</MuiAvatar>
|
||||
</ListItemAvatar>
|
||||
{enableAvatars && (
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar>
|
||||
<Avatar avatarUrl={avatar_url} height="45px" width="45px" />
|
||||
</MuiAvatar>
|
||||
</ListItemAvatar>
|
||||
)}
|
||||
<div className={classes.content}>
|
||||
<div className={classes.primary}>
|
||||
<div className={classes.profile}>{`@${profile_name}`}</div>
|
||||
@@ -98,7 +107,7 @@ export const Tweet = (tweet) => {
|
||||
className={classes.message}
|
||||
dangerouslySetInnerHTML={{ __html: formattedMessage }}
|
||||
/>
|
||||
<ImageDisplay visible images={images} small />
|
||||
{enableImages && <ImageDisplay visible images={images} small />}
|
||||
<div className={classes.buttonContainer}>
|
||||
<ReplyButton profile_name={profile_name} />
|
||||
<Button>
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
textField: {
|
||||
@@ -19,8 +20,12 @@ const useStyles = makeStyles((theme) => ({
|
||||
|
||||
export const TweetMessage = ({ message, handleChange }) => {
|
||||
const classes = useStyles();
|
||||
const { config } = usePhone();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const overCharacterLimit = message.trim().length > config.twitter.characterLimit;
|
||||
const characterWarningPrompt = `${t("APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT")} (${config.twitter.characterLimit})`;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
value={message}
|
||||
@@ -30,6 +35,8 @@ export const TweetMessage = ({ message, handleChange }) => {
|
||||
multiline
|
||||
placeholder={t("APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER")}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
error={overCharacterLimit}
|
||||
helperText={overCharacterLimit ? characterWarningPrompt : null}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user