diff --git a/.gitignore b/.gitignore
index 8b13789..e69de29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +0,0 @@
-
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..23fd35f
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "editor.formatOnSave": true
+}
\ No newline at end of file
diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js
index 86a1227..d146663 100644
--- a/phone/src/apps/twitter/components/AddTweetModal.js
+++ b/phone/src/apps/twitter/components/AddTweetModal.js
@@ -1,12 +1,15 @@
-import React, { useState } from "react";
+import React, { useState, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { makeStyles } from "@material-ui/core/styles";
-import { Button, TextField, Paper } from "@material-ui/core";
+import { Button, Paper } from "@material-ui/core";
import InsertPhotoIcon from "@material-ui/icons/InsertPhoto";
import GifIcon from "@material-ui/icons/Gif";
import CloseIcon from "@material-ui/icons/Close";
import EmojiIcon from "@material-ui/icons/SentimentSatisfied";
+import types from "../types";
+import MediaDisplay from "./MediaDisplay";
+import MediaPrompt from "./MediaPrompt";
import TweetText from "./TweetText";
const useStyles = makeStyles((theme) => ({
@@ -50,6 +53,12 @@ const useStyles = makeStyles((theme) => ({
button: {
background: "transparent",
},
+ buttonHidden: {
+ display: "none",
+ },
+ closeMedia: {
+ marginLeft: "8px",
+ },
displayBlock: {
/*Sets modal to center*/
display: "flex",
@@ -65,6 +74,9 @@ const useStyles = makeStyles((theme) => ({
export const AddTweetModal = ({ visible, handleClose }) => {
const [text, setText] = useState("");
+ const [media, setMedia] = useState(null);
+ const [mediaType, setMediaType] = useState(null);
+ const [mediaLink, setMediaLink] = useState(null);
const classes = useStyles();
const { t } = useTranslation();
const showHideClassName = visible
@@ -72,32 +84,70 @@ export const AddTweetModal = ({ visible, handleClose }) => {
: classes.displayNone;
const submitTweet = () => {
+ const data = { text, ...media };
+
console.log("submitting tweet");
+
+ console.log(data);
};
+ const addMedia = useCallback(() => {
+ setMedia({ mediaType, mediaLink });
+ setMediaType(null);
+ setMediaLink(null);
+ }, [mediaType, mediaLink]);
+
+ const closeMedia = useCallback(() => {
+ setMediaType(null);
+ setMediaLink(null);
+ }, []);
+
return (
- setText(e.target.value)} />
+ setText(e.target.value)} />
+ {mediaType && (
+ setMediaLink(e.target.value)}
+ />
+ )}
+ {media && }
-
-
- {t("APPS_TWITTER_TWEET")}
+
+ {mediaType
+ ? t("APPS_TWITTER_SUBMIT_MEDIA")
+ : t("APPS_TWITTER_TWEET")}
+ {mediaType && (
+
+ {t("APPS_TWITTER_CLOSE_MEDIA")}
+
+ )}
diff --git a/phone/src/apps/twitter/components/MediaDisplay.js b/phone/src/apps/twitter/components/MediaDisplay.js
new file mode 100644
index 0000000..6b9e112
--- /dev/null
+++ b/phone/src/apps/twitter/components/MediaDisplay.js
@@ -0,0 +1,34 @@
+import React from "react";
+import { makeStyles } from "@material-ui/core/styles";
+import types from "../types";
+
+const useStyles = makeStyles((theme) => ({
+ root: {
+ margin: "2px 15px",
+ },
+ img: {
+ maxHeight: "125px",
+ },
+}));
+
+export const Media = ({ mediaType, mediaLink }) => {
+ const classes = useStyles();
+ switch (mediaType) {
+ case types.IMAGE:
+ case types.GIF:
+ return

;
+ default:
+ return null;
+ }
+};
+
+export const MediaDisplay = (props) => {
+ const classes = useStyles();
+ return (
+
+
+
+ );
+};
+
+export default MediaDisplay;
diff --git a/phone/src/apps/twitter/components/MediaPrompt.js b/phone/src/apps/twitter/components/MediaPrompt.js
new file mode 100644
index 0000000..a8fcfed
--- /dev/null
+++ b/phone/src/apps/twitter/components/MediaPrompt.js
@@ -0,0 +1,33 @@
+import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { makeStyles } from "@material-ui/core/styles";
+import { TextField } from "@material-ui/core";
+
+const useStyles = makeStyles((theme) => ({
+ textField: {
+ flex: "1 1 100%",
+ padding: "10px 15px",
+ marginTop: "15px",
+ },
+ textFieldInput: {
+ fontSize: "22px",
+ },
+}));
+
+export const MediaPrompt = ({ value, handleChange }) => {
+ const { t } = useTranslation();
+ const classes = useStyles();
+
+ return (
+
+ );
+};
+
+export default MediaPrompt;
diff --git a/phone/src/apps/twitter/components/TweetText.js b/phone/src/apps/twitter/components/TweetText.js
index eafd261..3d39326 100644
--- a/phone/src/apps/twitter/components/TweetText.js
+++ b/phone/src/apps/twitter/components/TweetText.js
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React from "react";
import { useTranslation } from "react-i18next";
import { makeStyles } from "@material-ui/core/styles";
import { TextField } from "@material-ui/core";
@@ -12,18 +12,20 @@ const useStyles = makeStyles((theme) => ({
textFieldInput: {
fontSize: "22px",
},
+ display: {
+ height: "200px",
+ },
}));
-export const TweetText = ({ text, setText }) => {
+export const TweetText = ({ text, handleChange }) => {
const classes = useStyles();
const { t } = useTranslation();
-
return (
setText(e.target.value)}
+ onChange={handleChange}
multiline
placeholder={t("APPS_TWITTER_PLACEHOLDER")}
/>
diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js
index c3ee118..75ef0de 100644
--- a/phone/src/apps/twitter/components/TwitterApp.js
+++ b/phone/src/apps/twitter/components/TwitterApp.js
@@ -38,7 +38,8 @@ export const TwitterApp = () => {
const listener = window.addEventListener(
"keydown",
(e) => {
- if (e.key == "Escape" || e.key == "Esc") {
+ const isEscapeKey = e.key == "Escape" || e.key == "Esc";
+ if (isEscapeKey) {
e.preventDefault();
hideModal();
}
diff --git a/phone/src/apps/twitter/types.js b/phone/src/apps/twitter/types.js
new file mode 100644
index 0000000..77963c2
--- /dev/null
+++ b/phone/src/apps/twitter/types.js
@@ -0,0 +1,5 @@
+export default {
+ IMAGE: "image",
+ GIF: "gif",
+ VIDEO: "video",
+};
diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json
index 1caf2e9..52629b1 100644
--- a/phone/src/locale/en.json
+++ b/phone/src/locale/en.json
@@ -14,6 +14,9 @@
"APPS_SETTINGS_OPTIONS_FRAME": "Frame",
"APPS_TWITTER": "Twitter",
"APPS_TWITTER_PLACEHOLDER": "What's happening?",
+ "APPS_TWITTER_MEDIA_PLACEHOLDER": "A link to your image or gif",
+ "APPS_TWITTER_SUBMIT_MEDIA": "Add Media",
+ "APPS_TWITTER_CLOSE_MEDIA": "Close",
"APPS_TWITTER_TWEET": "Tweet",
"APPS_TWITTER_CLOSE": "Close"
}