From 64973a5cc99de2c41eccf8ed763664d88118a5c2 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 19 Sep 2020 20:33:46 -0400 Subject: [PATCH 01/44] first working UI --- .../apps/twitter/components/AddTweetModal.js | 108 ++++++++++++++++++ .../src/apps/twitter/components/TweetText.js | 33 ++++++ .../src/apps/twitter/components/TwitterApp.js | 66 +++++++++++ phone/src/locale/en.json | 6 +- phone/src/os/apps/hooks/useApps.js | 12 ++ resources/config.lua | 8 +- resources/html/index.html | 45 +++++++- 7 files changed, 275 insertions(+), 3 deletions(-) create mode 100644 phone/src/apps/twitter/components/AddTweetModal.js create mode 100644 phone/src/apps/twitter/components/TweetText.js create mode 100644 phone/src/apps/twitter/components/TwitterApp.js diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js new file mode 100644 index 0000000..86a1227 --- /dev/null +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -0,0 +1,108 @@ +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { makeStyles } from "@material-ui/core/styles"; +import { Button, TextField, 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 TweetText from "./TweetText"; + +const useStyles = makeStyles((theme) => ({ + button: { + margin: 5, + marginTop: 20, + }, + root: { + zIndex: 2, + background: "#232323", + marginTop: "15px", + width: "90%", + display: "flex", + flexFlow: "column nowrap", + }, + close: { + position: "absolute", + top: "12px", + right: "4px", + zIndex: 2, + }, + buttonsContainer: { + paddingBottom: "8px", + display: "flex", + flexFlow: "row nowrap", + justifyContent: "space-between", + flex: "1 0 45px", + }, + leftButtons: { + display: "flex", + flexFlow: "row nowrap", + justifyContent: "flex-start", + }, + rightButtons: { + display: "flex", + flexFlow: "row nowrap", + justifyContent: "flex-end", + alignItems: "justify-content", + marginRight: "15px", + }, + button: { + background: "transparent", + }, + displayBlock: { + /*Sets modal to center*/ + display: "flex", + flexFlow: "column nowrap", + justifyContent: "center", + alignItems: "center", + position: "relative", + }, + displayNone: { + display: "none", + }, +})); + +export const AddTweetModal = ({ visible, handleClose }) => { + const [text, setText] = useState(""); + const classes = useStyles(); + const { t } = useTranslation(); + const showHideClassName = visible + ? classes.displayBlock + : classes.displayNone; + + const submitTweet = () => { + console.log("submitting tweet"); + }; + + return ( +
+ + + setText(e.target.value)} /> +
+
+ + + +
+
+ +
+
+
+
+ ); +}; + +export default AddTweetModal; diff --git a/phone/src/apps/twitter/components/TweetText.js b/phone/src/apps/twitter/components/TweetText.js new file mode 100644 index 0000000..eafd261 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetText.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 TweetText = ({ text, setText }) => { + const classes = useStyles(); + const { t } = useTranslation(); + + return ( + setText(e.target.value)} + multiline + placeholder={t("APPS_TWITTER_PLACEHOLDER")} + /> + ); +}; + +export default TweetText; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js new file mode 100644 index 0000000..c3ee118 --- /dev/null +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -0,0 +1,66 @@ +import React, { useState, useCallback, useEffect } from "react"; +import { blue } from "@material-ui/core/colors"; +import { makeStyles, Button } from "@material-ui/core"; +import AddCircleIcon from "@material-ui/icons/AddCircle"; +import { AppTitle } from "../../../ui/components/AppTitle"; +import { AppWrapper } from "../../../ui/components"; +import { AppContent } from "../../../ui/components/AppContent"; +import { useTranslation } from "react-i18next"; +import { useApp } from "../../../os/apps/hooks/useApps"; + +import AddTweetModal from "./AddTweetModal"; + +const useStyles = makeStyles((theme) => ({ + root: { + height: "90px", + display: "flex", + justifyContent: "center", + backgroundColor: blue[600], + alignItems: "center", + }, + header: { + fontFamily: "'Bebas Neue', cursive", + textAlign: "center", + fontSize: 50, + }, +})); + +export const TwitterApp = () => { + const [modalVisible, setModalVisible] = useState(true); + const { t } = useTranslation(); + const classes = useStyles(); + const twitter = useApp("TWITTER"); + + const openModal = useCallback(() => setModalVisible(true), []); + const hideModal = useCallback(() => setModalVisible(false), []); + + useEffect(() => { + const listener = window.addEventListener( + "keydown", + (e) => { + if (e.key == "Escape" || e.key == "Esc") { + e.preventDefault(); + hideModal(); + } + }, + true + ); + return () => window.removeEventListener("keydown", listener); + }, []); + + return ( + + + + + + + + ); +}; diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 8b55405..1caf2e9 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -11,6 +11,10 @@ "APPS_BANK_WITHDRAW": "Withdraw", "APPS_BANK_TRANSFER": "Transfer", "APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper", - "APPS_SETTINGS_OPTIONS_FRAME": "Frame" + "APPS_SETTINGS_OPTIONS_FRAME": "Frame", + "APPS_TWITTER": "Twitter", + "APPS_TWITTER_PLACEHOLDER": "What's happening?", + "APPS_TWITTER_TWEET": "Tweet", + "APPS_TWITTER_CLOSE": "Close" } } diff --git a/phone/src/os/apps/hooks/useApps.js b/phone/src/os/apps/hooks/useApps.js index a5a3d0c..289bc3d 100644 --- a/phone/src/os/apps/hooks/useApps.js +++ b/phone/src/os/apps/hooks/useApps.js @@ -2,6 +2,7 @@ import React from "react"; import { useConfig } from "../../../config/hooks/useConfig"; import { blue, + common, grey, green, orange, @@ -13,6 +14,7 @@ import SettingsIcon from "@material-ui/icons/Settings"; import PhoneIcon from "@material-ui/icons/Phone"; import AccountBalanceIcon from "@material-ui/icons/AccountBalance"; import MessageIcon from "@material-ui/icons/Message"; +import AccessibilityIcon from "@material-ui/icons/Accessibility"; import { atom } from "recoil"; import { CalculatorIcon } from "../../../apps/calculator/components/CalculatorIcon"; import { Route } from "react-router-dom"; @@ -22,6 +24,7 @@ import { CalculatorApp } from "../../../apps/calculator/components/CalculatorApp import { SettingsApp } from "../../../apps/settings/components/SettingsApp"; import { BankApp } from "../../../apps/bank/components/BankApp"; import { MessagesApp } from "../../../apps/messages/components/MessagesApp"; +import { TwitterApp } from "../../../apps/twitter/components/TwitterApp"; const appsState = atom({ key: "apps", @@ -81,6 +84,15 @@ const appsState = atom({ path: "/bank", Route: () => , }, + { + id: "TWITTER", + nameLocale: "APPS_TWITTER", + icon: , + backgroundColor: blue[600], + color: common.white, + path: "/twitter", + Route: () => , + }, ], }, }); diff --git a/resources/config.lua b/resources/config.lua index dd545a0..923f3ad 100644 --- a/resources/config.lua +++ b/resources/config.lua @@ -4,4 +4,10 @@ Config.Locale = 'en' Config.KeyTogglePhone = 288 -- F1 Config.KeyTakeCall = 38 -- E -Config.PhoneAsItem = true \ No newline at end of file +Config.PhoneAsItem = false + +Config.twitter = {} +Config.twitter.characterLimit = 240 +Config.twitter.renderImages = true -- whether or not links to images are automatically rendered on the UI +Config.twitter.renderGifs = true -- whether or not links to gifs are automatically rendered on the UI +Config.twitter.renderVideos = true -- whether or not links to videos are automatically rendered on the UI diff --git a/resources/html/index.html b/resources/html/index.html index 9c511ba..d196fe9 100644 --- a/resources/html/index.html +++ b/resources/html/index.html @@ -1 +1,44 @@ -React App
\ No newline at end of file + + + + + + + + + + + + + + React App + + + +
+ + + From e5303436ff496b3ff050b57b25f991c1740a38ca Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 19 Sep 2020 23:42:29 -0400 Subject: [PATCH 02/44] working version of creating a tweet --- .gitignore | 1 - .vscode/settings.json | 3 + .../apps/twitter/components/AddTweetModal.js | 68 ++++++++++++++++--- .../apps/twitter/components/MediaDisplay.js | 34 ++++++++++ .../apps/twitter/components/MediaPrompt.js | 33 +++++++++ .../src/apps/twitter/components/TweetText.js | 10 +-- .../src/apps/twitter/components/TwitterApp.js | 3 +- phone/src/apps/twitter/types.js | 5 ++ phone/src/locale/en.json | 3 + 9 files changed, 145 insertions(+), 15 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 phone/src/apps/twitter/components/MediaDisplay.js create mode 100644 phone/src/apps/twitter/components/MediaPrompt.js create mode 100644 phone/src/apps/twitter/types.js 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 && }
- -
- + {mediaType && ( + + )}
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" } From 2fc78df59b07a468a93dd793218c5f518b8f36c3 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 20 Sep 2020 11:51:41 -0400 Subject: [PATCH 03/44] working media adding and removal --- phone/package.json | 3 +- .../apps/twitter/components/AddTweetModal.js | 56 ++++++++++++++++--- .../apps/twitter/components/MediaDisplay.js | 56 +++++++++++++++++-- phone/yarn.lock | 5 ++ resources/config.lua | 3 +- 5 files changed, 107 insertions(+), 16 deletions(-) diff --git a/phone/package.json b/phone/package.json index 0c5d0ed..dbb4c28 100644 --- a/phone/package.json +++ b/phone/package.json @@ -20,7 +20,8 @@ "react-router-dom": "^5.2.0", "react-scripts": "3.4.3", "recoil": "^0.0.10", - "styled-components": "^5.1.1" + "styled-components": "^5.1.1", + "uuid": "^8.3.0" }, "devDependencies": { "@babel/cli": "^7.4.4", diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index d146663..8c7c31a 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -1,5 +1,6 @@ import React, { useState, useCallback } from "react"; import { useTranslation } from "react-i18next"; +import { v4 as uuidv4 } from "uuid"; import { makeStyles } from "@material-ui/core/styles"; import { Button, Paper } from "@material-ui/core"; import InsertPhotoIcon from "@material-ui/icons/InsertPhoto"; @@ -42,6 +43,7 @@ const useStyles = makeStyles((theme) => ({ display: "flex", flexFlow: "row nowrap", justifyContent: "flex-start", + paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing }, rightButtons: { display: "flex", @@ -52,6 +54,7 @@ const useStyles = makeStyles((theme) => ({ }, button: { background: "transparent", + minWidth: "45px", // override default material-ui spacing between buttons }, buttonHidden: { display: "none", @@ -72,9 +75,42 @@ const useStyles = makeStyles((theme) => ({ }, })); +const TEMP_MEDIA = [ + { + id: uuidv4(), + mediaType: "image", + mediaLink: + "http://www.freedigitalphotos.net/images/thumbs/city-10011901.jpg", + }, + { + id: uuidv4(), + mediaType: "image", + mediaLink: + "https://images.unsplash.com/photo-1541963463532-d68292c34b19?ixlib=rb-1.2.1&w=1000&q=80", + }, + { + id: uuidv4(), + mediaType: "image", + mediaLink: + "https://static01.nyt.com/images/2020/07/17/business/00virus-cities1/00virus-cities1-mediumSquareAt3X.jpg", + }, + { + id: uuidv4(), + mediaType: "image", + mediaLink: + "https://image.cnbcfm.com/api/v1/image/105066394-GettyImages-498350103_1.jpg?v=1591858410", + }, + { + id: uuidv4(), + mediaType: "image", + mediaLink: + "https://www.cbre.us/-/media/cbre/countryunitedkingdom/images/our-cities/231_what_makes_a_successful_city_image2_1024x576.jpg", + }, +]; + export const AddTweetModal = ({ visible, handleClose }) => { const [text, setText] = useState(""); - const [media, setMedia] = useState(null); + const [media, setMedia] = useState(TEMP_MEDIA); const [mediaType, setMediaType] = useState(null); const [mediaLink, setMediaLink] = useState(null); const classes = useStyles(); @@ -84,24 +120,30 @@ export const AddTweetModal = ({ visible, handleClose }) => { : classes.displayNone; const submitTweet = () => { - const data = { text, ...media }; + const data = { text, media }; console.log("submitting tweet"); - console.log(data); }; const addMedia = useCallback(() => { - setMedia({ mediaType, mediaLink }); + // we add an ID here so that we can have a distinct identifier on the + // client before it is added to the database. This ID is NOT what used + // or contained in the database. + setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])); setMediaType(null); setMediaLink(null); }, [mediaType, mediaLink]); - const closeMedia = useCallback(() => { + const _removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); + const removeMedia = useCallback(_removeMedia, [media]); + + const closeMediaPrompt = useCallback(() => { setMediaType(null); setMediaLink(null); }, []); + console.log(media); return (
@@ -115,7 +157,7 @@ export const AddTweetModal = ({ visible, handleClose }) => { handleChange={(e) => setMediaLink(e.target.value)} /> )} - {media && } +
diff --git a/phone/src/apps/twitter/components/MediaDisplay.js b/phone/src/apps/twitter/components/MediaDisplay.js index 6b9e112..fea449f 100644 --- a/phone/src/apps/twitter/components/MediaDisplay.js +++ b/phone/src/apps/twitter/components/MediaDisplay.js @@ -1,32 +1,76 @@ -import React from "react"; +import React, { useCallback } from "react"; +import { IconButton } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; +import CloseIcon from "@material-ui/icons/Close"; import types from "../types"; const useStyles = makeStyles((theme) => ({ root: { margin: "2px 15px", }, + mediaImage: { + // catch the close button here so it doesn't go all the way up to the modal + position: "relative", + display: "inline-block", + }, + imgButton: { + position: "absolute", // show the close button in the top right of the image + top: "2px", + right: "5px", + backgroundColor: "#000", + opacity: 0.7, + "&:hover": { + // fixes a bug where when the user closes one image material-ui puts + // the hover status on the previous image + backgroundColor: "#000", + }, + }, img: { - maxHeight: "125px", + maxHeight: "125px", // constrain images so we don't overwhelm the UI + maxWidth: "500px", + padding: "0px 3px 3px 0px", }, })); -export const Media = ({ mediaType, mediaLink }) => { +export const MediaImage = ({ mediaLink, handleClick }) => { const classes = useStyles(); + return ( +
+ + + + +
+ ); +}; + +export const Media = ({ id, mediaType, mediaLink, handleClose }) => { switch (mediaType) { case types.IMAGE: case types.GIF: - return ; + return ; default: return null; } }; -export const MediaDisplay = (props) => { +export const MediaDisplay = ({ media, removeMedia }) => { const classes = useStyles(); + if (media.length === 0) return null; + return (
- + {media.map((mediaItem) => ( + removeMedia(mediaItem.id)} + {...mediaItem} + /> + ))}
); }; diff --git a/phone/yarn.lock b/phone/yarn.lock index b127ba9..19465f2 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -11415,6 +11415,11 @@ uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea" + integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ== + v8-compile-cache@^2.0.3, v8-compile-cache@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" diff --git a/resources/config.lua b/resources/config.lua index 923f3ad..218ddb5 100644 --- a/resources/config.lua +++ b/resources/config.lua @@ -9,5 +9,4 @@ Config.PhoneAsItem = false Config.twitter = {} Config.twitter.characterLimit = 240 Config.twitter.renderImages = true -- whether or not links to images are automatically rendered on the UI -Config.twitter.renderGifs = true -- whether or not links to gifs are automatically rendered on the UI -Config.twitter.renderVideos = true -- whether or not links to videos are automatically rendered on the UI +Config.twitter.maxImages = 3 -- max amount of images that can be attached to a single tweet From e577b37d6bec6da51da197219314165f980e9915 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 20 Sep 2020 20:09:51 -0400 Subject: [PATCH 04/44] working emoji integration and workflow --- phone/package.json | 2 + .../apps/twitter/components/AddTweetModal.js | 118 ++++++++++++++---- .../apps/twitter/components/EmojiSelect.js | 33 +++++ .../apps/twitter/components/MediaDisplay.js | 47 +------ .../src/apps/twitter/components/MediaImage.js | 50 ++++++++ .../apps/twitter/components/MediaPrompt.js | 5 +- .../src/apps/twitter/components/TwitterApp.js | 15 --- phone/src/apps/twitter/components/emoji.css | 8 ++ phone/yarn.lock | 15 ++- resources/config.lua | 1 + 10 files changed, 209 insertions(+), 85 deletions(-) create mode 100644 phone/src/apps/twitter/components/EmojiSelect.js create mode 100644 phone/src/apps/twitter/components/MediaImage.js create mode 100644 phone/src/apps/twitter/components/emoji.css diff --git a/phone/package.json b/phone/package.json index dbb4c28..0633562 100644 --- a/phone/package.json +++ b/phone/package.json @@ -10,6 +10,8 @@ "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "core-js": "^3.6.5", + "emoji-mart": "^3.0.0", + "emoji-picker-react": "^3.2.3", "husky": "^4.2.5", "i18next": "^19.7.0", "prettier": "^2.0.5", diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index 8c7c31a..1c0ecb5 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -1,14 +1,16 @@ -import React, { useState, useCallback } from "react"; +import React, { useState, useCallback, useEffect } from "react"; import { useTranslation } from "react-i18next"; +import Picker from "emoji-picker-react"; import { v4 as uuidv4 } from "uuid"; import { makeStyles } from "@material-ui/core/styles"; 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 "./emoji.css"; +import EmojiSelect from "./EmojiSelect"; import MediaDisplay from "./MediaDisplay"; import MediaPrompt from "./MediaPrompt"; import TweetText from "./TweetText"; @@ -73,6 +75,11 @@ const useStyles = makeStyles((theme) => ({ displayNone: { display: "none", }, + emojiPicker: { + background: "none", + border: "none", + boxShadow: "none", + }, })); const TEMP_MEDIA = [ @@ -108,13 +115,46 @@ const TEMP_MEDIA = [ }, ]; +const URL_REGEX = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/; + export const AddTweetModal = ({ visible, handleClose }) => { + const [showEmoji, setShowEmoji] = useState(false); + const [text, setText] = useState(""); const [media, setMedia] = useState(TEMP_MEDIA); const [mediaType, setMediaType] = useState(null); const [mediaLink, setMediaLink] = useState(null); const classes = useStyles(); const { t } = useTranslation(); + + const reset = useCallback(() => { + setMediaType(null); + setMediaLink(null); + setShowMedia(false); + setShowEmoji(false); + setMedia([]); + setText(""); + }, []); + + // when the user presses escape we should close the modal + const _handleEscape = (e) => { + const isEscapeKey = e.key == "Escape" || e.key == "Esc"; + if (isEscapeKey) { + e.preventDefault(); + reset(); + handleClose(); + } + }; + useEffect(() => { + const listener = window.addEventListener("keydown", _handleEscape, true); + return () => window.removeEventListener("keydown", listener); + }, []); + + const _handleClose = useCallback(() => { + reset(); + handleClose(); + }); + const showHideClassName = visible ? classes.displayBlock : classes.displayNone; @@ -126,47 +166,77 @@ export const AddTweetModal = ({ visible, handleClose }) => { console.log(data); }; + const handleTextChange = useCallback((e) => setText(e.target.value), []); + const addMedia = useCallback(() => { - // we add an ID here so that we can have a distinct identifier on the - // client before it is added to the database. This ID is NOT what used - // or contained in the database. - setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])); setMediaType(null); setMediaLink(null); + // only add the media if it's a valid URL + // TODO - can we test that it's a valid image in JS? + if (mediaLink.match(URL_REGEX)) { + // we add an ID here so that we can have a distinct identifier on the + // client before it is added to the database. This ID is NOT what used + // or contained in the database. + setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])); + } }, [mediaType, mediaLink]); - const _removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); const removeMedia = useCallback(_removeMedia, [media]); - + const _handleMediaChange = (e) => setMediaLink(e.target.value); + const handleMediaChange = useCallback(_handleMediaChange, []); + const setMediaTypeImage = useCallback(() => { + setShowEmoji(false); // clear the emoji so we can switch between emoji/media + setMediaType(types.IMAGE); + }); const closeMediaPrompt = useCallback(() => { setMediaType(null); setMediaLink(null); }, []); - console.log(media); + const toggleShowEmoji = useCallback(() => { + // clear the media items so we can seemlessly toggle between emoji/media + setMediaType(null); + setMediaLink(null); + setShowEmoji(!showEmoji); + }); + const _handleEmojiClick = (emojiObject, e) => { + setText(text.concat(emojiObject.native)); + }; + const handleEmojiClick = useCallback(_handleEmojiClick, [text]); + + const mediaPromptVisible = mediaType && !showEmoji; + const primaryButtonText = mediaPromptVisible + ? t("APPS_TWITTER_SUBMIT_MEDIA") + : t("APPS_TWITTER_TWEET"); + const showCloseButton = mediaType || showEmoji; + return (
- - setText(e.target.value)} /> - {mediaType && ( - setMediaLink(e.target.value)} - /> - )} - + + + +
-
@@ -176,16 +246,14 @@ export const AddTweetModal = ({ visible, handleClose }) => { color="primary" onClick={mediaType ? addMedia : submitTweet} > - {mediaType - ? t("APPS_TWITTER_SUBMIT_MEDIA") - : t("APPS_TWITTER_TWEET")} + {primaryButtonText} - {mediaType && ( + {showCloseButton && ( diff --git a/phone/src/apps/twitter/components/EmojiSelect.js b/phone/src/apps/twitter/components/EmojiSelect.js new file mode 100644 index 0000000..97bec24 --- /dev/null +++ b/phone/src/apps/twitter/components/EmojiSelect.js @@ -0,0 +1,33 @@ +import React, { memo } from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import { Picker } from "emoji-mart"; + +import "./emoji.css"; +import "emoji-mart/css/emoji-mart.css"; + +const useStyles = makeStyles((theme) => ({ + emojiPicker: { + background: "none", + border: "none", + boxShadow: "none", + }, +})); + +export const EmojiSelect = ({ visible, onEmojiClick }) => { + const classes = useStyles(); + + if (!visible) return null; + + return ( + + ); +}; + +export default memo(EmojiSelect); // The picker is an expensive render diff --git a/phone/src/apps/twitter/components/MediaDisplay.js b/phone/src/apps/twitter/components/MediaDisplay.js index fea449f..ae6c21d 100644 --- a/phone/src/apps/twitter/components/MediaDisplay.js +++ b/phone/src/apps/twitter/components/MediaDisplay.js @@ -1,52 +1,15 @@ -import React, { useCallback } from "react"; -import { IconButton } from "@material-ui/core"; +import React from "react"; import { makeStyles } from "@material-ui/core/styles"; -import CloseIcon from "@material-ui/icons/Close"; + import types from "../types"; const useStyles = makeStyles((theme) => ({ root: { margin: "2px 15px", }, - mediaImage: { - // catch the close button here so it doesn't go all the way up to the modal - position: "relative", - display: "inline-block", - }, - imgButton: { - position: "absolute", // show the close button in the top right of the image - top: "2px", - right: "5px", - backgroundColor: "#000", - opacity: 0.7, - "&:hover": { - // fixes a bug where when the user closes one image material-ui puts - // the hover status on the previous image - backgroundColor: "#000", - }, - }, - img: { - maxHeight: "125px", // constrain images so we don't overwhelm the UI - maxWidth: "500px", - padding: "0px 3px 3px 0px", - }, })); -export const MediaImage = ({ mediaLink, handleClick }) => { - const classes = useStyles(); - return ( -
- - - - -
- ); -}; +import MediaImage from "./MediaImage"; export const Media = ({ id, mediaType, mediaLink, handleClose }) => { switch (mediaType) { @@ -58,9 +21,9 @@ export const Media = ({ id, mediaType, mediaLink, handleClose }) => { } }; -export const MediaDisplay = ({ media, removeMedia }) => { +export const MediaDisplay = ({ visible, media, removeMedia }) => { const classes = useStyles(); - if (media.length === 0) return null; + if (!visible || media.length === 0) return null; return (
diff --git a/phone/src/apps/twitter/components/MediaImage.js b/phone/src/apps/twitter/components/MediaImage.js new file mode 100644 index 0000000..9c90065 --- /dev/null +++ b/phone/src/apps/twitter/components/MediaImage.js @@ -0,0 +1,50 @@ +import React from "react"; +import { IconButton } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core/styles"; +import CloseIcon from "@material-ui/icons/Close"; + +const useStyles = makeStyles((theme) => ({ + root: { + margin: "2px 15px", + }, + mediaImage: { + // catch the close button here so it doesn't go all the way up to the modal + position: "relative", + display: "inline-block", + }, + imgButton: { + position: "absolute", // show the close button in the top right of the image + top: "2px", + right: "5px", + backgroundColor: "#000", + opacity: 0.7, + "&:hover": { + // fixes a bug where when the user closes one image material-ui puts + // the hover status on the previous image + backgroundColor: "#000", + }, + }, + img: { + maxHeight: "125px", // constrain images so we don't overwhelm the UI + maxWidth: "500px", + padding: "0px 3px 3px 0px", + }, +})); + +export const MediaImage = ({ mediaLink, handleClick }) => { + const classes = useStyles(); + return ( +
+ + + + +
+ ); +}; + +export default MediaImage; diff --git a/phone/src/apps/twitter/components/MediaPrompt.js b/phone/src/apps/twitter/components/MediaPrompt.js index a8fcfed..a5b670a 100644 --- a/phone/src/apps/twitter/components/MediaPrompt.js +++ b/phone/src/apps/twitter/components/MediaPrompt.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"; @@ -14,10 +14,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const MediaPrompt = ({ value, handleChange }) => { +export const MediaPrompt = ({ visible, value, handleChange }) => { const { t } = useTranslation(); const classes = useStyles(); + if (!visible) return null; return ( { const openModal = useCallback(() => setModalVisible(true), []); const hideModal = useCallback(() => setModalVisible(false), []); - useEffect(() => { - const listener = window.addEventListener( - "keydown", - (e) => { - const isEscapeKey = e.key == "Escape" || e.key == "Esc"; - if (isEscapeKey) { - e.preventDefault(); - hideModal(); - } - }, - true - ); - return () => window.removeEventListener("keydown", listener); - }, []); - return ( diff --git a/phone/src/apps/twitter/components/emoji.css b/phone/src/apps/twitter/components/emoji.css new file mode 100644 index 0000000..5e8187d --- /dev/null +++ b/phone/src/apps/twitter/components/emoji.css @@ -0,0 +1,8 @@ +.emoji-mart { + margin: 0px 15px 8px 15px !important; + width: calc(100% - 30px) !important; +} + +.emoji-mart-bar { + display: none; +} diff --git a/phone/yarn.lock b/phone/yarn.lock index 19465f2..7cdfbc1 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -4362,6 +4362,19 @@ elliptic@^6.5.3: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" +emoji-mart@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/emoji-mart/-/emoji-mart-3.0.0.tgz#eca24a04881e27752a6921e09f65a86ce8539a50" + integrity sha512-r5DXyzOLJttdwRYfJmPq/XL3W5tiAE/VsRnS0Hqyn27SqPA/GOYwVUSx50px/dXdJyDSnvmoPbuJ/zzhwSaU4A== + dependencies: + "@babel/runtime" "^7.0.0" + prop-types "^15.6.0" + +emoji-picker-react@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/emoji-picker-react/-/emoji-picker-react-3.2.3.tgz#c8f51d0130a1171475f94847a5dca851412aad43" + integrity sha512-Rw29mb3wPVRwgW+kUz5kVjXqvTMRax7ye9onF5qi5pdBroQzjPWdfV//wcF+fxKO3ppoaomy0OhPS5Scq3VtFA== + emoji-regex@^7.0.1, emoji-regex@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -9304,7 +9317,7 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.4" -prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== diff --git a/resources/config.lua b/resources/config.lua index 218ddb5..9e46f77 100644 --- a/resources/config.lua +++ b/resources/config.lua @@ -8,5 +8,6 @@ Config.PhoneAsItem = false Config.twitter = {} Config.twitter.characterLimit = 240 +Config.twitter.enableEmojis = true Config.twitter.renderImages = true -- whether or not links to images are automatically rendered on the UI Config.twitter.maxImages = 3 -- max amount of images that can be attached to a single tweet From 1d719a5b2ed7a976948b78fe7b6ddb8d6a67236c Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 20 Sep 2020 20:17:30 -0400 Subject: [PATCH 05/44] fixed bug with closing modal --- phone/src/apps/twitter/components/AddTweetModal.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index 1c0ecb5..bf0bd1c 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -130,19 +130,23 @@ export const AddTweetModal = ({ visible, handleClose }) => { const reset = useCallback(() => { setMediaType(null); setMediaLink(null); - setShowMedia(false); setShowEmoji(false); setMedia([]); setText(""); }, []); + const _handleClose = useCallback(() => { + reset(); + handleClose(); + }); + // when the user presses escape we should close the modal const _handleEscape = (e) => { const isEscapeKey = e.key == "Escape" || e.key == "Esc"; if (isEscapeKey) { e.preventDefault(); reset(); - handleClose(); + _handleClose(); } }; useEffect(() => { @@ -150,11 +154,6 @@ export const AddTweetModal = ({ visible, handleClose }) => { return () => window.removeEventListener("keydown", listener); }, []); - const _handleClose = useCallback(() => { - reset(); - handleClose(); - }); - const showHideClassName = visible ? classes.displayBlock : classes.displayNone; From 1e900baab976763182b78f33e287849ba3d95a13 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 20 Sep 2020 20:34:42 -0400 Subject: [PATCH 06/44] add check to make sure the image is valid --- .../src/apps/twitter/components/AddTweetModal.js | 16 ++++++++-------- phone/src/apps/twitter/components/MediaImage.js | 2 +- phone/src/apps/twitter/components/MediaPrompt.js | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index bf0bd1c..49a6b48 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -115,8 +115,6 @@ const TEMP_MEDIA = [ }, ]; -const URL_REGEX = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/; - export const AddTweetModal = ({ visible, handleClose }) => { const [showEmoji, setShowEmoji] = useState(false); @@ -170,14 +168,16 @@ export const AddTweetModal = ({ visible, handleClose }) => { const addMedia = useCallback(() => { setMediaType(null); setMediaLink(null); + // only add the media if it's a valid URL - // TODO - can we test that it's a valid image in JS? - if (mediaLink.match(URL_REGEX)) { - // we add an ID here so that we can have a distinct identifier on the - // client before it is added to the database. This ID is NOT what used - // or contained in the database. + const image = new Image(); + image.onload = () => { setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])); - } + }; + image.onerror = () => { + console.warn("Invalid image: ", mediaLink); + }; + image.src = mediaLink; }, [mediaType, mediaLink]); const _removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); const removeMedia = useCallback(_removeMedia, [media]); diff --git a/phone/src/apps/twitter/components/MediaImage.js b/phone/src/apps/twitter/components/MediaImage.js index 9c90065..c3d313e 100644 --- a/phone/src/apps/twitter/components/MediaImage.js +++ b/phone/src/apps/twitter/components/MediaImage.js @@ -26,7 +26,7 @@ const useStyles = makeStyles((theme) => ({ }, img: { maxHeight: "125px", // constrain images so we don't overwhelm the UI - maxWidth: "500px", + maxWidth: "300px", padding: "0px 3px 3px 0px", }, })); diff --git a/phone/src/apps/twitter/components/MediaPrompt.js b/phone/src/apps/twitter/components/MediaPrompt.js index a5b670a..2bec2b0 100644 --- a/phone/src/apps/twitter/components/MediaPrompt.js +++ b/phone/src/apps/twitter/components/MediaPrompt.js @@ -26,6 +26,7 @@ export const MediaPrompt = ({ visible, value, handleChange }) => { className={classes.textField} onChange={handleChange} multiline + size="small" placeholder={t("APPS_TWITTER_MEDIA_PLACEHOLDER")} /> ); From ba0f12293813366db0351d7b4d7908172ac32d2f Mon Sep 17 00:00:00 2001 From: erik-sn Date: Thu, 24 Sep 2020 23:25:35 -0400 Subject: [PATCH 07/44] Working database interactions and NUI callbacks --- phone/src/Phone.js | 2 + .../apps/twitter/components/AddTweetModal.js | 159 ++++-------------- .../apps/twitter/components/AddTweetStatus.js | 23 +++ .../apps/twitter/components/ControlButtons.js | 59 +++++++ .../apps/twitter/components/IconButtons.js | 34 ++++ .../apps/twitter/components/MediaDisplay.js | 2 +- phone/src/apps/twitter/components/Tweet.js | 50 ++++++ .../src/apps/twitter/components/TweetList.js | 21 +++ .../src/apps/twitter/components/TwitterApp.js | 4 +- phone/src/apps/twitter/hooks/state.js | 16 ++ .../src/apps/twitter/hooks/useTweetStatus.js | 9 + phone/src/apps/twitter/hooks/useTweets.js | 7 + .../apps/twitter/hooks/useTwitterService.js | 23 +++ phone/src/apps/twitter/types.js | 2 + phone/src/apps/twitter/utils/media.js | 9 + phone/src/locale/en.json | 3 +- resources/client/cl_main.lua | 1 + resources/client/cl_twitter.lua | 43 +++++ resources/server/sv_twitter.lua | 32 ++++ 19 files changed, 372 insertions(+), 127 deletions(-) create mode 100644 phone/src/apps/twitter/components/AddTweetStatus.js create mode 100644 phone/src/apps/twitter/components/ControlButtons.js create mode 100644 phone/src/apps/twitter/components/IconButtons.js create mode 100644 phone/src/apps/twitter/components/Tweet.js create mode 100644 phone/src/apps/twitter/components/TweetList.js create mode 100644 phone/src/apps/twitter/hooks/state.js create mode 100644 phone/src/apps/twitter/hooks/useTweetStatus.js create mode 100644 phone/src/apps/twitter/hooks/useTweets.js create mode 100644 phone/src/apps/twitter/hooks/useTwitterService.js create mode 100644 phone/src/apps/twitter/utils/media.js create mode 100644 resources/client/cl_twitter.lua create mode 100644 resources/server/sv_twitter.lua diff --git a/phone/src/Phone.js b/phone/src/Phone.js index 335036e..0b77e0c 100644 --- a/phone/src/Phone.js +++ b/phone/src/Phone.js @@ -17,6 +17,7 @@ import { usePhoneService } from "./os/phone/hooks/usePhoneService"; import { useApps } from "./os/apps/hooks/useApps"; import { useContactsService } from "./apps/contacts/hooks/useContactsService"; +import { useTwitterService } from "./apps/twitter/hooks/useTwitterService"; // These events are just for testing. Comment it out before building. //setTimeout(() => { @@ -73,6 +74,7 @@ function Phone() { const { allApps } = useApps(); useSimcardService(); useContactsService(); + useTwitterService(); useInitKeyboard(); if (visibility === false) { diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index 49a6b48..59dd419 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -1,19 +1,21 @@ import React, { useState, useCallback, useEffect } from "react"; import { useTranslation } from "react-i18next"; -import Picker from "emoji-picker-react"; -import { v4 as uuidv4 } from "uuid"; import { makeStyles } from "@material-ui/core/styles"; import { Button, Paper } from "@material-ui/core"; -import InsertPhotoIcon from "@material-ui/icons/InsertPhoto"; import CloseIcon from "@material-ui/icons/Close"; -import EmojiIcon from "@material-ui/icons/SentimentSatisfied"; +import { v4 as uuidv4 } from "uuid"; +import Nui from "../../../os/nui-events/utils/Nui"; import types from "../types"; +import { withValidMedia } from "../utils/media"; import "./emoji.css"; import EmojiSelect from "./EmojiSelect"; import MediaDisplay from "./MediaDisplay"; import MediaPrompt from "./MediaPrompt"; import TweetText from "./TweetText"; +import ControlButtons from "./ControlButtons"; +import IconButtons from "./IconButtons"; +import AddTweetStatus from "./AddTweetStatus"; const useStyles = makeStyles((theme) => ({ button: { @@ -41,29 +43,6 @@ const useStyles = makeStyles((theme) => ({ justifyContent: "space-between", flex: "1 0 45px", }, - leftButtons: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-start", - paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing - }, - rightButtons: { - display: "flex", - flexFlow: "row nowrap", - justifyContent: "flex-end", - alignItems: "justify-content", - marginRight: "15px", - }, - button: { - background: "transparent", - minWidth: "45px", // override default material-ui spacing between buttons - }, - buttonHidden: { - display: "none", - }, - closeMedia: { - marginLeft: "8px", - }, displayBlock: { /*Sets modal to center*/ display: "flex", @@ -82,44 +61,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -const TEMP_MEDIA = [ - { - id: uuidv4(), - mediaType: "image", - mediaLink: - "http://www.freedigitalphotos.net/images/thumbs/city-10011901.jpg", - }, - { - id: uuidv4(), - mediaType: "image", - mediaLink: - "https://images.unsplash.com/photo-1541963463532-d68292c34b19?ixlib=rb-1.2.1&w=1000&q=80", - }, - { - id: uuidv4(), - mediaType: "image", - mediaLink: - "https://static01.nyt.com/images/2020/07/17/business/00virus-cities1/00virus-cities1-mediumSquareAt3X.jpg", - }, - { - id: uuidv4(), - mediaType: "image", - mediaLink: - "https://image.cnbcfm.com/api/v1/image/105066394-GettyImages-498350103_1.jpg?v=1591858410", - }, - { - id: uuidv4(), - mediaType: "image", - mediaLink: - "https://www.cbre.us/-/media/cbre/countryunitedkingdom/images/our-cities/231_what_makes_a_successful_city_image2_1024x576.jpg", - }, -]; - export const AddTweetModal = ({ visible, handleClose }) => { const [showEmoji, setShowEmoji] = useState(false); const [text, setText] = useState(""); - const [media, setMedia] = useState(TEMP_MEDIA); + const [media, setMedia] = useState([]); const [mediaType, setMediaType] = useState(null); const [mediaLink, setMediaLink] = useState(null); const classes = useStyles(); @@ -157,57 +103,41 @@ export const AddTweetModal = ({ visible, handleClose }) => { : classes.displayNone; const submitTweet = () => { - const data = { text, media }; - - console.log("submitting tweet"); - console.log(data); + const data = { message: text, media, realUser: "testUser" }; + Nui.send("phone:createTweet", data); }; - const handleTextChange = useCallback((e) => setText(e.target.value), []); + const handleTextChange = (e) => setText(e.target.value); - const addMedia = useCallback(() => { + const addMedia = () => { setMediaType(null); setMediaLink(null); - // only add the media if it's a valid URL - const image = new Image(); - image.onload = () => { - setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])); - }; - image.onerror = () => { - console.warn("Invalid image: ", mediaLink); - }; - image.src = mediaLink; - }, [mediaType, mediaLink]); - const _removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); - const removeMedia = useCallback(_removeMedia, [media]); - const _handleMediaChange = (e) => setMediaLink(e.target.value); - const handleMediaChange = useCallback(_handleMediaChange, []); - const setMediaTypeImage = useCallback(() => { + withValidMedia(mediaLink, () => + setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])) + ); + }; + const removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); + const handleMediaChange = (e) => setMediaLink(e.target.value); + const setMediaTypeImage = () => { setShowEmoji(false); // clear the emoji so we can switch between emoji/media setMediaType(types.IMAGE); - }); - const closeMediaPrompt = useCallback(() => { + }; + const closeMediaPrompt = () => { setMediaType(null); setMediaLink(null); - }, []); + }; - const toggleShowEmoji = useCallback(() => { + const toggleShowEmoji = () => { // clear the media items so we can seemlessly toggle between emoji/media setMediaType(null); setMediaLink(null); setShowEmoji(!showEmoji); - }); - const _handleEmojiClick = (emojiObject, e) => { + }; + const handleEmojiClick = (emojiObject, e) => { setText(text.concat(emojiObject.native)); }; - const handleEmojiClick = useCallback(_handleEmojiClick, [text]); - const mediaPromptVisible = mediaType && !showEmoji; - const primaryButtonText = mediaPromptVisible - ? t("APPS_TWITTER_SUBMIT_MEDIA") - : t("APPS_TWITTER_TWEET"); - const showCloseButton = mediaType || showEmoji; return (
@@ -216,6 +146,7 @@ export const AddTweetModal = ({ visible, handleClose }) => { + { removeMedia={removeMedia} />
-
- - -
-
- - {showCloseButton && ( - - )} -
+ +
diff --git a/phone/src/apps/twitter/components/AddTweetStatus.js b/phone/src/apps/twitter/components/AddTweetStatus.js new file mode 100644 index 0000000..501e24d --- /dev/null +++ b/phone/src/apps/twitter/components/AddTweetStatus.js @@ -0,0 +1,23 @@ +import React, { useEffect } from "react"; +import { useRecoilState } from "recoil"; +import { useTranslation } from "react-i18next"; + +import { useTweetStatus } from "../hooks/useTweetStatus"; + +const HIDE_SUCCESS_TIMEOUT = 5000; + +function AddTweetStatus() { + const { isSuccessful } = useTweetStatus(); + const { t } = useTranslation(); + + console.log(isSuccessful); + + // on the "true" case the tweet was created and the user should + // see their tweet at the top of the list, so there's no need + // to directly prompt them that it was successful. + if (isSuccessful === null || isSuccessful === true) return null; + + return
{t("APPS_TWITTER_CREATE_FAILED")}
; +} + +export default AddTweetStatus; diff --git a/phone/src/apps/twitter/components/ControlButtons.js b/phone/src/apps/twitter/components/ControlButtons.js new file mode 100644 index 0000000..9255299 --- /dev/null +++ b/phone/src/apps/twitter/components/ControlButtons.js @@ -0,0 +1,59 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { makeStyles } from "@material-ui/core/styles"; +import { Button } from "@material-ui/core"; + +import { useTweetStatus } from "../hooks/useTweetStatus"; + +const useStyles = makeStyles((theme) => ({ + buttons: { + display: "flex", + flexFlow: "row nowrap", + justifyContent: "flex-end", + alignItems: "justify-content", + marginRight: "15px", + }, + closeMedia: { + marginLeft: "8px", + }, +})); + +export const ControlButtons = ({ + mediaType, + showEmoji, + onCloseClick, + onPrimaryClick, +}) => { + const { isLoading } = useTweetStatus(); + + const classes = useStyles(); + const { t } = useTranslation(); + + const mediaPromptVisible = mediaType && !showEmoji; + const primaryButtonText = mediaPromptVisible + ? t("APPS_TWITTER_SUBMIT_MEDIA") + : t("APPS_TWITTER_TWEET"); + const showCloseButton = mediaType || showEmoji; + + if (isLoading) return

!!!

; + + return ( +
+ + {showCloseButton && ( + + )} +
+ ); +}; + +export default ControlButtons; diff --git a/phone/src/apps/twitter/components/IconButtons.js b/phone/src/apps/twitter/components/IconButtons.js new file mode 100644 index 0000000..90d1094 --- /dev/null +++ b/phone/src/apps/twitter/components/IconButtons.js @@ -0,0 +1,34 @@ +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import { Button } from "@material-ui/core"; +import InsertPhotoIcon from "@material-ui/icons/InsertPhoto"; +import EmojiIcon from "@material-ui/icons/SentimentSatisfied"; + +const useStyles = makeStyles((theme) => ({ + buttons: { + display: "flex", + flexFlow: "row nowrap", + justifyContent: "flex-start", + paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing + }, + button: { + background: "transparent", + minWidth: "45px", // override default material-ui spacing between buttons + }, +})); + +export const IconButtons = ({ onMediaClick, onEmojiClick }) => { + const classes = useStyles(); + return ( +
+ + +
+ ); +}; + +export default IconButtons; diff --git a/phone/src/apps/twitter/components/MediaDisplay.js b/phone/src/apps/twitter/components/MediaDisplay.js index ae6c21d..f0a46f6 100644 --- a/phone/src/apps/twitter/components/MediaDisplay.js +++ b/phone/src/apps/twitter/components/MediaDisplay.js @@ -29,7 +29,7 @@ export const MediaDisplay = ({ visible, media, removeMedia }) => {
{media.map((mediaItem) => ( removeMedia(mediaItem.id)} {...mediaItem} /> diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js new file mode 100644 index 0000000..184a2aa --- /dev/null +++ b/phone/src/apps/twitter/components/Tweet.js @@ -0,0 +1,50 @@ +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import ListItemText from "@material-ui/core/ListItemText"; +import { Button } from "@material-ui/core"; +import FavoriteIcon from "@material-ui/icons/Favorite"; +import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; +import ReplyIcon from "@material-ui/icons/Reply"; +import QuoteIcon from "@material-ui/icons/FormatQuote"; + +import { ListItem } from "../../../ui/components/ListItem"; + +const useStyles = makeStyles((theme) => ({ + root: { + overflowX: "hidden", + display: "flex", + flexFlow: "column nowrap", + alignItems: "flex-start", + width: "100%", + }, + text: { + width: "100%", + }, + buttonContainer: { + display: "flex", + flexFlow: "row nowrap", + justifyContent: "flex-start", + }, +})); + +export const Tweet = ({ message, media }) => { + const classes = useStyles(); + return ( + + +
+ + + +
+
+ ); +}; + +export default Tweet; diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js new file mode 100644 index 0000000..709e196 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetList.js @@ -0,0 +1,21 @@ +import React from "react"; + +import { List } from "../../../ui/components/List"; +import { useTweets } from "../hooks/useTweets"; +import Tweet from "./Tweet"; + +export function TweetList() { + const { tweets } = useTweets(); + console.log(tweets); + return ( + + {tweets + .filter((t) => t.visible) + .map((tweet) => ( + + ))} + + ); +} + +export default TweetList; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 7d1f54f..065af41 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -8,6 +8,7 @@ import { AppContent } from "../../../ui/components/AppContent"; import { useTranslation } from "react-i18next"; import { useApp } from "../../../os/apps/hooks/useApps"; +import TweetList from "./TweetList"; import AddTweetModal from "./AddTweetModal"; const useStyles = makeStyles((theme) => ({ @@ -26,7 +27,7 @@ const useStyles = makeStyles((theme) => ({ })); export const TwitterApp = () => { - const [modalVisible, setModalVisible] = useState(true); + const [modalVisible, setModalVisible] = useState(false); const { t } = useTranslation(); const classes = useStyles(); const twitter = useApp("TWITTER"); @@ -46,6 +47,7 @@ export const TwitterApp = () => { + ); diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js new file mode 100644 index 0000000..e660759 --- /dev/null +++ b/phone/src/apps/twitter/hooks/state.js @@ -0,0 +1,16 @@ +import { atom } from "recoil"; + +export const twitterState = { + tweets: atom({ + key: "tweets", + default: [], + }), + createTweetLoading: atom({ + key: "createTweetLoading", + default: false, + }), + createTweetSuccess: atom({ + key: "createTweetSuccess", + default: null, + }), +}; diff --git a/phone/src/apps/twitter/hooks/useTweetStatus.js b/phone/src/apps/twitter/hooks/useTweetStatus.js new file mode 100644 index 0000000..323928a --- /dev/null +++ b/phone/src/apps/twitter/hooks/useTweetStatus.js @@ -0,0 +1,9 @@ +import { useRecoilValue } from "recoil"; + +import { twitterState } from "./state"; + +export const useTweetStatus = () => { + const isLoading = useRecoilValue(twitterState.createTweetLoading); + const isSuccessful = useRecoilValue(twitterState.createTweetSuccess); + return { isLoading, isSuccessful }; +}; diff --git a/phone/src/apps/twitter/hooks/useTweets.js b/phone/src/apps/twitter/hooks/useTweets.js new file mode 100644 index 0000000..7b24c1c --- /dev/null +++ b/phone/src/apps/twitter/hooks/useTweets.js @@ -0,0 +1,7 @@ +import { useRecoilValue, useSetRecoilState } from "recoil"; +import { twitterState } from "./state"; + +export const useTweets = () => { + const tweets = useRecoilValue(twitterState.tweets); + return { tweets }; +}; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js new file mode 100644 index 0000000..b5b847a --- /dev/null +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -0,0 +1,23 @@ +import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; +import { useSetRecoilState } from "recoil"; + +import types from "../types"; +import { twitterState } from "./state"; +import { useTweets } from "./useTweets"; + +export const useTwitterService = () => { + const setTweets = useSetRecoilState(twitterState.tweets); + const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); + const setCreateSuccess = useSetRecoilState(twitterState.createTweetSuccess); + + const _setCreateSuccess = (isSuccessful) => { + setCreateSuccess(isSuccessful === 1); // numeric 1 is returned by MySQL on successful query + setCreateLoading(false); // on any result we should set loading to false + }; + + useNuiEvent(types.APP_TWITTER, "fetchTweets", setTweets); + useNuiEvent(types.APP_TWITTER, "createTweetLoading", setCreateLoading); + useNuiEvent(types.APP_TWITTER, "createTweetResult", _setCreateSuccess); + + return useTweets(); +}; diff --git a/phone/src/apps/twitter/types.js b/phone/src/apps/twitter/types.js index 77963c2..666ff85 100644 --- a/phone/src/apps/twitter/types.js +++ b/phone/src/apps/twitter/types.js @@ -2,4 +2,6 @@ export default { IMAGE: "image", GIF: "gif", VIDEO: "video", + + APP_TWITTER: "TWITTER", }; diff --git a/phone/src/apps/twitter/utils/media.js b/phone/src/apps/twitter/utils/media.js new file mode 100644 index 0000000..3ea36be --- /dev/null +++ b/phone/src/apps/twitter/utils/media.js @@ -0,0 +1,9 @@ +export function withValidMedia(link, onSuccess) { + // only add the media if it's a valid URL + const image = new Image(); + image.onload = onSuccess; + image.onerror = () => { + console.warn(`Invalid image submitted: ${link}`); + }; + image.src = link; +} diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 52629b1..f52ab85 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -18,6 +18,7 @@ "APPS_TWITTER_SUBMIT_MEDIA": "Add Media", "APPS_TWITTER_CLOSE_MEDIA": "Close", "APPS_TWITTER_TWEET": "Tweet", - "APPS_TWITTER_CLOSE": "Close" + "APPS_TWITTER_CLOSE": "Close", + "APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet" } } diff --git a/resources/client/cl_main.lua b/resources/client/cl_main.lua index c898e8d..d42de4a 100644 --- a/resources/client/cl_main.lua +++ b/resources/client/cl_main.lua @@ -238,6 +238,7 @@ end, false) RegisterNetEvent('phone:send') AddEventHandler('phone:send', function() TriggerEvent('phone:sendContacts') + TriggerEvent('phone:fetchTweets') end) RegisterNUICallback('phone:close', function() -- Called for when the phone is closed via the UI. diff --git a/resources/client/cl_twitter.lua b/resources/client/cl_twitter.lua new file mode 100644 index 0000000..ec7793f --- /dev/null +++ b/resources/client/cl_twitter.lua @@ -0,0 +1,43 @@ +ESX = nil + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +local APP_NAME = 'TWITTER' + + +function sendMessage(method, data) + SendNUIMessage( + { + app = APP_NAME, + method = method, + data = data + } + ) +end + +RegisterNetEvent('phone:fetchTweets') +AddEventHandler('phone:fetchTweets', function() + print('RegisterNetEvent: phone:fetchTweets') + ESX.TriggerServerCallback('phone:fetchTweets', function(tweets) + sendMessage('fetchTweets', tweets) + end) +end) + + +RegisterNUICallback('phone:fetchTweets', function() + print('RegisterNUICallback: phone:fetchTweets') + TriggerEvent('phone:fetchTweets') + end) + +RegisterNUICallback('phone:createTweet', function(data) + sendMessage('createTweetLoading', true) + ESX.TriggerServerCallback('phone:createTweet', function(isSuccessful) + sendMessage('createTweetResult', isSuccessful) + TriggerEvent('phone:fetchTweets') + end, data) +end) diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua new file mode 100644 index 0000000..5d215fb --- /dev/null +++ b/resources/server/sv_twitter.lua @@ -0,0 +1,32 @@ +ESX = nil + +TriggerEvent('esx:getSharedObject', function(obj) + ESX = obj +end) + +ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) + print('RegisterServerCallback: phone:fetchTweets') + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local _identifier = xPlayer.getIdentifier() + MySQL.Async.fetchAll('SELECT * FROM npwd_twitter_tweets WHERE visible = 1 ORDER BY updatedAt DESC', {}, function(tweets) + cb(tweets) + end) +end) + + +ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data) + print('RegisterServerEvent: phone:createTweet') + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local _identifier = xPlayer.getIdentifier() + + MySQL.Async.execute('INSERT INTO npwd_twitter_tweets (`identifier`, `realUser`, `message`) VALUES (@identifier, @realUser, @message)', + { + ['identifier'] = _identifier, + ['realUser'] = data.realUser, + ['message'] = data.message + }, function(result) + cb(result) + end) +end) From 997f550aabc167958dd28eb032ee971e671cc250 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Thu, 24 Sep 2020 23:33:28 -0400 Subject: [PATCH 08/44] auto refresh working --- phone/src/apps/twitter/components/Tweet.js | 1 - phone/src/apps/twitter/components/TweetList.js | 15 +++++++++++++-- phone/src/apps/twitter/components/TwitterApp.js | 4 +--- resources/client/cl_main.lua | 1 - 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 184a2aa..57076fe 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -2,7 +2,6 @@ import React from "react"; import { makeStyles } from "@material-ui/core/styles"; import ListItemText from "@material-ui/core/ListItemText"; import { Button } from "@material-ui/core"; -import FavoriteIcon from "@material-ui/icons/Favorite"; import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; import ReplyIcon from "@material-ui/icons/Reply"; import QuoteIcon from "@material-ui/icons/FormatQuote"; diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index 709e196..3329f39 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -1,12 +1,23 @@ -import React from "react"; +import React, { useEffect } from "react"; +import Nui from "../../../os/nui-events/utils/Nui"; import { List } from "../../../ui/components/List"; import { useTweets } from "../hooks/useTweets"; import Tweet from "./Tweet"; +const TWEETS_REFRESH_RATE = 5000; + export function TweetList() { const { tweets } = useTweets(); - console.log(tweets); + + useEffect(() => { + Nui.send("phone:fetchTweets", {}); + const timeout = window.setTimeout(() => { + Nui.send("phone:fetchTweets", {}); + }, TWEETS_REFRESH_RATE); + return () => window.clearTimeout(timeout); + }, []); + return ( {tweets diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 065af41..96630b8 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -1,11 +1,10 @@ -import React, { useState, useCallback, useEffect } from "react"; +import React, { useState, useCallback } from "react"; import { blue } from "@material-ui/core/colors"; import { makeStyles, Button } from "@material-ui/core"; import AddCircleIcon from "@material-ui/icons/AddCircle"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; -import { useTranslation } from "react-i18next"; import { useApp } from "../../../os/apps/hooks/useApps"; import TweetList from "./TweetList"; @@ -28,7 +27,6 @@ const useStyles = makeStyles((theme) => ({ export const TwitterApp = () => { const [modalVisible, setModalVisible] = useState(false); - const { t } = useTranslation(); const classes = useStyles(); const twitter = useApp("TWITTER"); diff --git a/resources/client/cl_main.lua b/resources/client/cl_main.lua index d42de4a..c898e8d 100644 --- a/resources/client/cl_main.lua +++ b/resources/client/cl_main.lua @@ -238,7 +238,6 @@ end, false) RegisterNetEvent('phone:send') AddEventHandler('phone:send', function() TriggerEvent('phone:sendContacts') - TriggerEvent('phone:fetchTweets') end) RegisterNUICallback('phone:close', function() -- Called for when the phone is closed via the UI. From 9e40fb8010cf45c4bb19334621381cbc17b453d6 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Fri, 25 Sep 2020 02:56:54 -0400 Subject: [PATCH 09/44] working images in the database --- .../apps/twitter/components/AddTweetModal.js | 90 ++++++++++--------- .../apps/twitter/components/ControlButtons.js | 16 ++-- .../apps/twitter/components/IconButtons.js | 4 +- .../components/{MediaImage.js => Image.js} | 31 ++++--- .../apps/twitter/components/ImageDisplay.js | 35 ++++++++ .../{MediaPrompt.js => ImagePrompt.js} | 6 +- .../apps/twitter/components/MediaDisplay.js | 41 --------- phone/src/apps/twitter/components/Tweet.js | 6 +- .../src/apps/twitter/components/TweetList.js | 3 +- .../apps/twitter/hooks/useTwitterService.js | 16 +++- phone/src/apps/twitter/utils/images.js | 16 ++++ phone/src/apps/twitter/utils/media.js | 9 -- phone/src/locale/en.json | 6 +- resources/client/cl_twitter.lua | 1 - resources/server/sv_twitter.lua | 5 +- 15 files changed, 157 insertions(+), 128 deletions(-) rename phone/src/apps/twitter/components/{MediaImage.js => Image.js} (63%) create mode 100644 phone/src/apps/twitter/components/ImageDisplay.js rename phone/src/apps/twitter/components/{MediaPrompt.js => ImagePrompt.js} (82%) delete mode 100644 phone/src/apps/twitter/components/MediaDisplay.js create mode 100644 phone/src/apps/twitter/utils/images.js delete mode 100644 phone/src/apps/twitter/utils/media.js diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index 59dd419..673d234 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -6,12 +6,12 @@ import CloseIcon from "@material-ui/icons/Close"; import { v4 as uuidv4 } from "uuid"; import Nui from "../../../os/nui-events/utils/Nui"; -import types from "../types"; -import { withValidMedia } from "../utils/media"; +import { IMAGE_DELIMITER } from "../utils/images"; +import { withValidImage } from "../utils/images"; import "./emoji.css"; import EmojiSelect from "./EmojiSelect"; -import MediaDisplay from "./MediaDisplay"; -import MediaPrompt from "./MediaPrompt"; +import ImageDisplay from "./ImageDisplay"; +import ImagePrompt from "./ImagePrompt"; import TweetText from "./TweetText"; import ControlButtons from "./ControlButtons"; import IconButtons from "./IconButtons"; @@ -61,21 +61,27 @@ const useStyles = makeStyles((theme) => ({ }, })); +const IMAGES = [ + "https://assets.simpleviewinc.com/simpleview/image/upload/c_limit,h_1200,q_75,w_1200/v1/clients/boston/c07044da_9483_4fd5_8e37_5b75513dcc80_6b058b6f-7bdc-4f11-b217-4561c07901f3.jpg", + "https://www.hiusa.org/wp-content/uploads/2020/04/Aerial-View-Boston-Osman-Rana-Unsplash-1000x550-compressor-778x446.jpg", + "https://www.mccarter.com/wp-content/uploads/2019/10/Location-Boston.png", +]; + export const AddTweetModal = ({ visible, handleClose }) => { const [showEmoji, setShowEmoji] = useState(false); + const [showImagePrompt, setShowImagePrompt] = useState(false); + const [image, setimage] = useState(""); const [text, setText] = useState(""); - const [media, setMedia] = useState([]); - const [mediaType, setMediaType] = useState(null); - const [mediaLink, setMediaLink] = useState(null); + const [images, setImages] = useState(IMAGES); const classes = useStyles(); - const { t } = useTranslation(); const reset = useCallback(() => { - setMediaType(null); - setMediaLink(null); + setShowImagePrompt(null); setShowEmoji(false); - setMedia([]); + + setimage(""); + setImages([]); setText(""); }, []); @@ -103,41 +109,37 @@ export const AddTweetModal = ({ visible, handleClose }) => { : classes.displayNone; const submitTweet = () => { - const data = { message: text, media, realUser: "testUser" }; + const data = { + message: text, + images: images.join(IMAGE_DELIMITER), + realUser: "testUser", + }; Nui.send("phone:createTweet", data); }; const handleTextChange = (e) => setText(e.target.value); - const addMedia = () => { - setMediaType(null); - setMediaLink(null); + const addImage = () => { + withValidImage(image, () => setImages([...images, image])); - withValidMedia(mediaLink, () => - setMedia(media.concat([{ id: uuidv4(), mediaType, mediaLink }])) - ); + setShowImagePrompt(false); + setimage(""); }; - const removeMedia = (id) => setMedia(media.filter((m) => m.id !== id)); - const handleMediaChange = (e) => setMediaLink(e.target.value); - const setMediaTypeImage = () => { - setShowEmoji(false); // clear the emoji so we can switch between emoji/media - setMediaType(types.IMAGE); + const removeImage = (image) => setImages(images.filter((i) => i !== image)); + const handleimageChange = (e) => setimage(e.target.value); + const toggleShowImagePrompt = () => { + setShowEmoji(false); // clear the emoji so we can switch between emoji/images + setShowImagePrompt(!showImagePrompt); }; - const closeMediaPrompt = () => { - setMediaType(null); - setMediaLink(null); - }; - const toggleShowEmoji = () => { - // clear the media items so we can seemlessly toggle between emoji/media - setMediaType(null); - setMediaLink(null); + // clear the images so we can seemlessly toggle between emoji/images + setShowImagePrompt(false); + setImages(""); setShowEmoji(!showEmoji); }; const handleEmojiClick = (emojiObject, e) => { setText(text.concat(emojiObject.native)); }; - const mediaPromptVisible = mediaType && !showEmoji; return (
@@ -147,27 +149,27 @@ export const AddTweetModal = ({ visible, handleClose }) => { - - 0} + images={images} + removeImage={removeImage} />
diff --git a/phone/src/apps/twitter/components/ControlButtons.js b/phone/src/apps/twitter/components/ControlButtons.js index 9255299..4165c29 100644 --- a/phone/src/apps/twitter/components/ControlButtons.js +++ b/phone/src/apps/twitter/components/ControlButtons.js @@ -13,13 +13,13 @@ const useStyles = makeStyles((theme) => ({ alignItems: "justify-content", marginRight: "15px", }, - closeMedia: { + close: { marginLeft: "8px", }, })); export const ControlButtons = ({ - mediaType, + showImagePrompt, showEmoji, onCloseClick, onPrimaryClick, @@ -29,11 +29,11 @@ export const ControlButtons = ({ const classes = useStyles(); const { t } = useTranslation(); - const mediaPromptVisible = mediaType && !showEmoji; - const primaryButtonText = mediaPromptVisible - ? t("APPS_TWITTER_SUBMIT_MEDIA") + const imagePromptVisible = showImagePrompt && !showEmoji; + const primaryButtonText = imagePromptVisible + ? t("APPS_TWITTER_SUBMIT_IMAGE") : t("APPS_TWITTER_TWEET"); - const showCloseButton = mediaType || showEmoji; + const showCloseButton = showImagePrompt || showEmoji; if (isLoading) return

!!!

; @@ -44,12 +44,12 @@ export const ControlButtons = ({ {showCloseButton && ( )}
diff --git a/phone/src/apps/twitter/components/IconButtons.js b/phone/src/apps/twitter/components/IconButtons.js index 90d1094..473148c 100644 --- a/phone/src/apps/twitter/components/IconButtons.js +++ b/phone/src/apps/twitter/components/IconButtons.js @@ -17,11 +17,11 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const IconButtons = ({ onMediaClick, onEmojiClick }) => { +export const IconButtons = ({ onImageClick, onEmojiClick }) => { const classes = useStyles(); return (
- - + - + 0} images={images} diff --git a/phone/src/apps/twitter/components/TweetText.js b/phone/src/apps/twitter/components/TweetMessage.js similarity index 86% rename from phone/src/apps/twitter/components/TweetText.js rename to phone/src/apps/twitter/components/TweetMessage.js index 3d39326..888f1a8 100644 --- a/phone/src/apps/twitter/components/TweetText.js +++ b/phone/src/apps/twitter/components/TweetMessage.js @@ -17,12 +17,12 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const TweetText = ({ text, handleChange }) => { +export const TweetMessage = ({ message, handleChange }) => { const classes = useStyles(); const { t } = useTranslation(); return ( { ); }; -export default TweetText; +export default TweetMessage; diff --git a/phone/src/apps/twitter/utils/images.js b/phone/src/apps/twitter/utils/images.js index 8cd3ebc..a06b0b9 100644 --- a/phone/src/apps/twitter/utils/images.js +++ b/phone/src/apps/twitter/utils/images.js @@ -5,8 +5,12 @@ // here we'll use to join and split these strings export const IMAGE_DELIMITER = "||!||"; +/** + * Validate that the URL successfully loads in the browser + * @param {string} link - a URL we are trying to validate + * @param {func} onSuccess - callback if the link is valid + */ export function withValidImage(link, onSuccess) { - // only add the media if it's a valid URL const image = new Image(); image.onload = onSuccess; image.onerror = () => { From a01993e178346df1064eeb7e22c0d04ede6b5179 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Fri, 25 Sep 2020 03:30:52 -0400 Subject: [PATCH 12/44] re-added ids to images to handle edge case --- .../apps/twitter/components/AddTweetModal.js | 34 +++++++++++++------ .../apps/twitter/components/ImageDisplay.js | 8 ++--- phone/src/apps/twitter/components/Tweet.js | 2 +- .../src/apps/twitter/components/TweetList.js | 10 +++++- .../apps/twitter/hooks/useTwitterService.js | 30 ++++++++++------ 5 files changed, 56 insertions(+), 28 deletions(-) diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index a40204c..373050c 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -1,5 +1,4 @@ -import React, { useState, useCallback, useEffect } from "react"; -import { useTranslation } from "react-i18next"; +import React, { useState, useEffect } from "react"; import { makeStyles } from "@material-ui/core/styles"; import { Button, Paper } from "@material-ui/core"; import CloseIcon from "@material-ui/icons/Close"; @@ -8,7 +7,6 @@ import { v4 as uuidv4 } from "uuid"; import Nui from "../../../os/nui-events/utils/Nui"; import { IMAGE_DELIMITER } from "../utils/images"; import { withValidImage } from "../utils/images"; -import "./emoji.css"; import EmojiSelect from "./EmojiSelect"; import ImageDisplay from "./ImageDisplay"; import ImagePrompt from "./ImagePrompt"; @@ -65,7 +63,7 @@ export const AddTweetModal = ({ visible, handleClose }) => { const classes = useStyles(); const [showEmoji, setShowEmoji] = useState(false); const [showImagePrompt, setShowImagePrompt] = useState(false); - const [image, setimage] = useState(""); + const [link, setLink] = useState(""); const [message, setMessage] = useState(""); const [images, setImages] = useState([]); @@ -74,7 +72,7 @@ export const AddTweetModal = ({ visible, handleClose }) => { setShowImagePrompt(null); setShowEmoji(false); - setimage(""); + setLink(""); setImages([]); setMessage(""); }; @@ -104,7 +102,10 @@ export const AddTweetModal = ({ visible, handleClose }) => { const submitTweet = () => { const data = { message, - images: images && images.length > 0 ? images.join(IMAGE_DELIMITER) : "", + images: + images && images.length > 0 + ? images.map((image) => image.link).join(IMAGE_DELIMITER) + : "", realUser: "testUser", }; Nui.send("phone:createTweet", data); @@ -114,18 +115,29 @@ export const AddTweetModal = ({ visible, handleClose }) => { const handleMessageChange = (e) => setMessage(e.target.value); const addImage = () => { + // strip any whitespace from the link in case the user + // added some spaces/returns accidentally + const cleanedLink = link.replace("/ /g", ""); + // because we're only storing strings in the database we need + // to give this an arbirtrary (but unique) id so that we can + // correctly filter an array of images when the user wants to + // delete them. This handles an edge case where the user adds + // two of the same image. + const image = { id: uuidv4(), link: cleanedLink }; // it's worth noting that we only perform this validation on // the client of the user who is submitting the image. When // other users see this image on their TweetList it will be // from the database and should already have passed through // this logic - withValidImage(image, () => setImages([...images, image])); + withValidImage(cleanedLink, () => setImages([...images, image])); setShowImagePrompt(false); - setimage(""); + setLink(""); }; - const removeImage = (image) => setImages(images.filter((i) => i !== image)); - const handleimageChange = (e) => setimage(e.target.value); + const removeImage = (id) => + setImages(images.filter((image) => id !== image.id)); + const handleimageChange = (e) => setLink(e.target.value); + const toggleShowImagePrompt = () => { setShowEmoji(false); // clear the emoji so we can switch between emoji/images setShowImagePrompt(!showImagePrompt); @@ -153,7 +165,7 @@ export const AddTweetModal = ({ visible, handleClose }) => { diff --git a/phone/src/apps/twitter/components/ImageDisplay.js b/phone/src/apps/twitter/components/ImageDisplay.js index d8ff9a5..966548c 100644 --- a/phone/src/apps/twitter/components/ImageDisplay.js +++ b/phone/src/apps/twitter/components/ImageDisplay.js @@ -15,11 +15,11 @@ export const ImageDisplay = ({ visible, images, removeImage, small }) => { return (
- {images.map((link) => ( + {images.map((image) => ( removeImage(link) : null} + key={image.id} + link={image.link} + handleClick={removeImage ? () => removeImage(image.id) : null} small={small} /> ))} diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 32c8548..550414f 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -9,7 +9,7 @@ import QuoteIcon from "@material-ui/icons/FormatQuote"; import { ListItem } from "../../../ui/components/ListItem"; import ImageDisplay from "./ImageDisplay"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ root: { overflowX: "hidden", display: "flex", diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index 87b025e..4e290a9 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -9,15 +9,23 @@ const TWEETS_REFRESH_RATE = 5000; // TODO move this to twitter config export function TweetList() { const { tweets } = useTweets(); + console.log(tweets); useEffect(() => { Nui.send("phone:fetchTweets", {}); + + // 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 + // be accomplished this is naive but robust. + // + // TODO don't call fetchTweets - implement a function that only + // returns tweets that we don't already have const timeout = window.setTimeout(() => { Nui.send("phone:fetchTweets", {}); }, TWEETS_REFRESH_RATE); return () => window.clearTimeout(timeout); }, []); - console.log(tweets); return ( diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index f1137b9..46c94e2 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -1,11 +1,28 @@ -import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; import { useSetRecoilState } from "recoil"; +import { v4 as uuidv4 } from "uuid"; +import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent"; import { IMAGE_DELIMITER } from "../utils/images"; import types from "../types"; import { twitterState } from "./state"; import { useTweets } from "./useTweets"; +/** + * Perform all necessary processing/transforms from the raw database + * data to what the frontend expects + * @param {object} tweet - full JSON returned from the server/database + */ +function processTweet(tweet) { + // we store images in the database as a varchar field with + // comma separated links to images, so here we split them + // back into their distinct members + console.log(tweet); + const imageLinks = tweet.images ? tweet.images.split(IMAGE_DELIMITER) : []; + console.log(imageLinks); + const images = imageLinks.map((link) => ({ id: uuidv4(), link })); + return { ...tweet, images }; +} + export const useTwitterService = () => { const setTweets = useSetRecoilState(twitterState.tweets); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); @@ -17,16 +34,7 @@ export const useTwitterService = () => { }; const _setTweets = (tweets) => { - setTweets( - tweets.map((tweet) => { - return { - ...tweet, - // we store images in the database as a varchar field with - // comma separated links to images - images: tweet.images ? tweet.images.split(IMAGE_DELIMITER) : [], - }; - }) - ); + setTweets(tweets.map(processTweet)); }; useNuiEvent(types.APP_TWITTER, "fetchTweets", _setTweets); From 5072a31aabc577123df1d863a96ad94942ebba84 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Fri, 25 Sep 2020 19:57:19 -0400 Subject: [PATCH 13/44] working profile creation and deletion, app loader --- .../apps/twitter/components/AddTweetStatus.js | 2 - .../src/apps/twitter/components/TweetList.js | 3 +- .../src/apps/twitter/components/TwitterApp.js | 41 ++++++++-- phone/src/apps/twitter/hooks/state.js | 4 + phone/src/apps/twitter/hooks/useProfile.js | 7 ++ .../apps/twitter/hooks/useTwitterService.js | 17 +++- phone/src/os/nui-events/hooks/useNuiEvent.js | 3 +- phone/src/ui/components/AppLoader.js | 27 +++++++ resources/client/cl_twitter.lua | 8 +- resources/server/sv_twitter.lua | 77 ++++++++++++++++++- 10 files changed, 171 insertions(+), 18 deletions(-) create mode 100644 phone/src/apps/twitter/hooks/useProfile.js create mode 100644 phone/src/ui/components/AppLoader.js diff --git a/phone/src/apps/twitter/components/AddTweetStatus.js b/phone/src/apps/twitter/components/AddTweetStatus.js index 501e24d..20b44f7 100644 --- a/phone/src/apps/twitter/components/AddTweetStatus.js +++ b/phone/src/apps/twitter/components/AddTweetStatus.js @@ -10,8 +10,6 @@ function AddTweetStatus() { const { isSuccessful } = useTweetStatus(); const { t } = useTranslation(); - console.log(isSuccessful); - // on the "true" case the tweet was created and the user should // see their tweet at the top of the list, so there's no need // to directly prompt them that it was successful. diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index 4e290a9..6b4ad94 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -5,11 +5,10 @@ import { List } from "../../../ui/components/List"; import { useTweets } from "../hooks/useTweets"; import Tweet from "./Tweet"; -const TWEETS_REFRESH_RATE = 5000; // TODO move this to twitter config +const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config export function TweetList() { const { tweets } = useTweets(); - console.log(tweets); useEffect(() => { Nui.send("phone:fetchTweets", {}); diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 96630b8..ac73464 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -1,12 +1,15 @@ -import React, { useState, useCallback } from "react"; +import React, { useState, useCallback, useEffect } from "react"; import { blue } from "@material-ui/core/colors"; import { makeStyles, Button } from "@material-ui/core"; import AddCircleIcon from "@material-ui/icons/AddCircle"; + +import Nui from "../../../os/nui-events/utils/Nui"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; +import { AppLoader } from "../../../ui/components/AppLoader"; import { useApp } from "../../../os/apps/hooks/useApps"; - +import { useProfile } from "../hooks/useProfile"; import TweetList from "./TweetList"; import AddTweetModal from "./AddTweetModal"; @@ -25,13 +28,33 @@ const useStyles = makeStyles((theme) => ({ }, })); +const MINIMUM_LOAD_TIME = 750; + export const TwitterApp = () => { const [modalVisible, setModalVisible] = useState(false); + const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); const classes = useStyles(); const twitter = useApp("TWITTER"); + const { profile } = useProfile(); - const openModal = useCallback(() => setModalVisible(true), []); - const hideModal = useCallback(() => setModalVisible(false), []); + useEffect(() => { + Nui.send("phone:getOrCreateTwitterProfile", {}); + }, []); + + useEffect(() => { + const timeout = window.setTimeout(() => { + setMimimumLoadPassed(true); + }, MINIMUM_LOAD_TIME); + return () => window.clearTimeout(timeout); + }); + + const openModal = () => setModalVisible(true); + const hideModal = () => setModalVisible(false); + + // we add a minimum (but short) load time here so that + // there isn't a quick flash of loading and immediately + // another flash to the tweets screen. + const hasLoaded = profile && minimumLoadPassed; return ( @@ -44,8 +67,14 @@ export const TwitterApp = () => { - - + {hasLoaded ? ( + <> + + + + ) : ( + + )} ); diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index e660759..afb81ee 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -1,6 +1,10 @@ import { atom } from "recoil"; export const twitterState = { + profile: atom({ + key: "profile", + default: null, + }), tweets: atom({ key: "tweets", default: [], diff --git a/phone/src/apps/twitter/hooks/useProfile.js b/phone/src/apps/twitter/hooks/useProfile.js new file mode 100644 index 0000000..234977a --- /dev/null +++ b/phone/src/apps/twitter/hooks/useProfile.js @@ -0,0 +1,7 @@ +import { useRecoilValue } from "recoil"; +import { twitterState } from "./state"; + +export const useProfile = () => { + const profile = useRecoilValue(twitterState.profile); + return { profile }; +}; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index 46c94e2..09a5e6a 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -16,18 +16,28 @@ function processTweet(tweet) { // we store images in the database as a varchar field with // comma separated links to images, so here we split them // back into their distinct members - console.log(tweet); const imageLinks = tweet.images ? tweet.images.split(IMAGE_DELIMITER) : []; - console.log(imageLinks); const images = imageLinks.map((link) => ({ id: uuidv4(), link })); return { ...tweet, images }; } +/** + * Service to handle all NUI <> client interactions. We take + * this opportunity to act as a middleware layer between the + * client and the react components. Because I'm terrible with lua + * I have given up on parsing/cleaning database query results there + * there and have moved that logic here instead. + */ export const useTwitterService = () => { + const setProfile = useSetRecoilState(twitterState.profile); const setTweets = useSetRecoilState(twitterState.tweets); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); const setCreateSuccess = useSetRecoilState(twitterState.createTweetSuccess); + const _setProfile = (profile) => { + setProfile(profile[0]); // server returns an array of 1 profile + }; + const _setCreateSuccess = (isSuccessful) => { setCreateSuccess(isSuccessful === 1); // numeric 1 is returned by MySQL on successful query setCreateLoading(false); // on any result we should set loading to false @@ -37,9 +47,8 @@ export const useTwitterService = () => { setTweets(tweets.map(processTweet)); }; + useNuiEvent(types.APP_TWITTER, "getOrCreateTwitterProfile", _setProfile); useNuiEvent(types.APP_TWITTER, "fetchTweets", _setTweets); useNuiEvent(types.APP_TWITTER, "createTweetLoading", setCreateLoading); useNuiEvent(types.APP_TWITTER, "createTweetResult", _setCreateSuccess); - - return useTweets(); }; diff --git a/phone/src/os/nui-events/hooks/useNuiEvent.js b/phone/src/os/nui-events/hooks/useNuiEvent.js index 0d5469b..f56b73d 100644 --- a/phone/src/os/nui-events/hooks/useNuiEvent.js +++ b/phone/src/os/nui-events/hooks/useNuiEvent.js @@ -10,14 +10,15 @@ export const useNuiEvent = (app, method, handler, options = {}) => { }, [handler]); useEffect(() => { + const eventName = eventNameFactory(app, method); const eventListener = (event) => { if (savedHandler.current && savedHandler.current.call) { const { data } = event; + console.log(eventName, data); savedHandler.current(data); } }; const opts = { capture, passive, once }; - const eventName = eventNameFactory(app, method); window.addEventListener(eventName, eventListener, opts); return () => window.removeEventListener(eventName, eventListener, opts); }, [app, method, capture, passive, once]); diff --git a/phone/src/ui/components/AppLoader.js b/phone/src/ui/components/AppLoader.js new file mode 100644 index 0000000..287c171 --- /dev/null +++ b/phone/src/ui/components/AppLoader.js @@ -0,0 +1,27 @@ +// intended for use on initial application loads +import React from "react"; +import { makeStyles, CircularProgress } from "@material-ui/core"; + +const useStyles = makeStyles((theme) => ({ + root: { + height: "400px", + width: "100%", + display: "flex", + flexFlow: "row nowrap", + justifyContent: "center", + alignItems: "center", + }, + progress: { + color: "white", + }, +})); + +export const AppLoader = () => { + const classes = useStyles(); + + return ( +
+ +
+ ); +}; diff --git a/resources/client/cl_twitter.lua b/resources/client/cl_twitter.lua index b591363..2fbb95d 100644 --- a/resources/client/cl_twitter.lua +++ b/resources/client/cl_twitter.lua @@ -9,7 +9,6 @@ end) local APP_NAME = 'TWITTER' - function sendMessage(method, data) SendNUIMessage( { @@ -40,3 +39,10 @@ RegisterNUICallback('phone:createTweet', function(data) TriggerEvent('phone:fetchTweets') end, data) end) + +RegisterNUICallback('phone:getOrCreateTwitterProfile', function() + print('phone:getOrCreateTwitterProfile') + ESX.TriggerServerCallback('phone:getOrCreateTwitterProfile', function(profile) + sendMessage('getOrCreateTwitterProfile', profile) + end) +end) diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index ba6a57c..5f93053 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -1,11 +1,16 @@ ESX = nil +function printO(o) + for key, value in pairs(o) do + print(key, value) + end +end + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) - print('RegisterServerCallback: phone:fetchTweets') local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local _identifier = xPlayer.getIdentifier() @@ -16,7 +21,6 @@ end) ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data) - print('RegisterServerEvent: phone:createTweet') local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local _identifier = xPlayer.getIdentifier() @@ -31,3 +35,72 @@ ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data) cb(result) end) end) + +function getProfile(identifier, cb) + MySQL.Async.fetchAll('SELECT * FROM npwd_twitter_profiles WHERE identifier = @identifier', + { + ['identifier'] = identifier, + }, function(result) + cb(result) + end) +end + +function getProfileName(identifier, cb) + local defaultProfileName = '' -- handle any edge cases where the user does not exist or their name isn't populated + MySQL.Async.fetchAll('SELECT first_name, last_name FROM users WHERE identifier = @identifier LIMIT 1', {['identifier'] = identifier }, function(users) + -- no user found with this identifier + if next(users) == nil then + cb(defaultProfileName) + return + end + + local first_name = users[1].first_name + local last_name = users[1].last_name + if (first_name == "" and last_name == "") then + cb(defaultProfileName) + else + local profileName = first_name .. '_' .. last_name + cb(profileName) + end + end) +end + +function createDefaultProfile(identifier, cb) + getProfileName(identifier, function(profileName) + MySQL.Async.execute('INSERT INTO npwd_twitter_profiles (`identifier`, `profile_name`) VALUES (@identifier, @profile_name)', + { + ['identifier'] = identifier, + ['profile_name'] = profileName, + }, function(result) + if result == 1 then -- if we created the profile then return it + getProfile(identifier, cb) + else -- otherwise just give back the failed result + cb(result) + end + end) + end) +end + +-- Retrieve a twitter profile by identifier. If it does not exist then +-- create and return it +function getOrCreateProfile(identifier, cb) + getProfile(identifier, function(retrieveResult) + if next(retrieveResult) == nil then -- profile does not exist, attempt to create it + createDefaultProfile(identifier, function(createResult) + cb(createResult) + end) + else -- profile does exist + cb(retrieveResult) + end + end) +end + +ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, cb) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local _identifier = xPlayer.getIdentifier() + + getOrCreateProfile(_identifier, function(result) + cb(result) + end) +end) From 9fe4cf01883705516ee812dc81080592086f7e8a Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 16:29:33 -0400 Subject: [PATCH 14/44] working profile and editing of profile --- fxmanifest.lua | 3 +- phone/.vscode/settings.json | 3 + phone/src/Phone.js | 3 +- phone/src/apps/twitter/components/Avatar.js | 58 ++++++++++++ .../twitter/components/BottomNavigation.js | 31 +++++++ phone/src/apps/twitter/components/Image.js | 4 +- .../apps/twitter/components/TweetButton.js | 29 ++++++ .../src/apps/twitter/components/TwitterApp.js | 74 +++++++-------- .../apps/twitter/components/TwitterTitle.js | 32 +++++++ .../components/profile/ProfileField.js | 38 ++++++++ .../components/profile/ProfileUpdateButton.js | 50 ++++++++++ .../components/profile/TwitterProfile.js | 86 ++++++++++++++++++ phone/src/apps/twitter/components/twitter.css | 3 + phone/src/apps/twitter/hooks/state.js | 8 ++ phone/src/apps/twitter/hooks/useProfile.js | 4 +- .../apps/twitter/hooks/useTwitterService.js | 24 ++++- phone/src/apps/twitter/utils/constants.js | 2 + phone/src/locale/en.json | 7 +- phone/src/ui/components/AppContent.js | 2 + resources/client/cl_main.lua | 8 +- resources/client/cl_twitter.lua | 9 +- resources/config.lua | 2 + resources/html/media/twitter/egg.jpg | Bin 0 -> 3570 bytes resources/html/media/twitter/egg.png | Bin 0 -> 16499 bytes resources/html/media/twitter/egg_sm.png | Bin 0 -> 4279 bytes resources/html/media/twitter/invalid.png | Bin 0 -> 152428 bytes resources/server/sv_twitter.lua | 30 ++++++ 27 files changed, 459 insertions(+), 51 deletions(-) create mode 100644 phone/.vscode/settings.json create mode 100644 phone/src/apps/twitter/components/Avatar.js create mode 100644 phone/src/apps/twitter/components/BottomNavigation.js create mode 100644 phone/src/apps/twitter/components/TweetButton.js create mode 100644 phone/src/apps/twitter/components/TwitterTitle.js create mode 100644 phone/src/apps/twitter/components/profile/ProfileField.js create mode 100644 phone/src/apps/twitter/components/profile/ProfileUpdateButton.js create mode 100644 phone/src/apps/twitter/components/profile/TwitterProfile.js create mode 100644 phone/src/apps/twitter/components/twitter.css create mode 100644 phone/src/apps/twitter/utils/constants.js create mode 100644 resources/html/media/twitter/egg.jpg create mode 100644 resources/html/media/twitter/egg.png create mode 100644 resources/html/media/twitter/egg_sm.png create mode 100644 resources/html/media/twitter/invalid.png diff --git a/fxmanifest.lua b/fxmanifest.lua index 6d23a81..8cf45c4 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -27,5 +27,6 @@ files { 'resources/html/*.js', 'resources/html/media/frames/*.png', 'resources/html/media/backgrounds/*.png', - 'resources/html/media/backgrounds/*.jpg' + 'resources/html/media/backgrounds/*.jpg', + 'resources/html/media/twitter/*' } \ No newline at end of file diff --git a/phone/.vscode/settings.json b/phone/.vscode/settings.json new file mode 100644 index 0000000..23fd35f --- /dev/null +++ b/phone/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.formatOnSave": true +} \ No newline at end of file diff --git a/phone/src/Phone.js b/phone/src/Phone.js index 0b77e0c..4734295 100644 --- a/phone/src/Phone.js +++ b/phone/src/Phone.js @@ -18,6 +18,7 @@ import { useApps } from "./os/apps/hooks/useApps"; import { useContactsService } from "./apps/contacts/hooks/useContactsService"; import { useTwitterService } from "./apps/twitter/hooks/useTwitterService"; +import { TwitterApp } from "./apps/twitter/components/TwitterApp"; // These events are just for testing. Comment it out before building. //setTimeout(() => { @@ -109,7 +110,7 @@ function Phone() { ]} />
- + {allApps.map((App) => ( ))} diff --git a/phone/src/apps/twitter/components/Avatar.js b/phone/src/apps/twitter/components/Avatar.js new file mode 100644 index 0000000..0509428 --- /dev/null +++ b/phone/src/apps/twitter/components/Avatar.js @@ -0,0 +1,58 @@ +import React, { useState } from "react"; +import { makeStyles } from "@material-ui/core/styles"; + +import { IMG_DEFAULT_AVATAR, IMG_INVALID_AVATAR } from "../utils/constants"; + +const useStyles = makeStyles({ + root: { + width: "100%", + }, + imgContainer: {}, + button: { + background: "none", + border: "none", + }, + img: { + height: "125px", + width: "125px", + borderRadius: "50%", + objectFit: "cover", + }, +}); + +function Avatar({ avatarUrl, showInvalidImage }) { + const classes = useStyles(); + const [showImageError, setShowImageError] = useState(false); + + const handleImageError = () => setShowImageError(true); + const handleImageLoad = () => setShowImageError(false); + + return ( +
+
+ {showImageError && ( + Invalid avatar image + )} + Your profile avatar +
+
+ ); +} + +Avatar.defaultProps = { + avatarUrl: null, + showInvalidImage: false, +}; + +export default Avatar; diff --git a/phone/src/apps/twitter/components/BottomNavigation.js b/phone/src/apps/twitter/components/BottomNavigation.js new file mode 100644 index 0000000..9b68f8f --- /dev/null +++ b/phone/src/apps/twitter/components/BottomNavigation.js @@ -0,0 +1,31 @@ +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import BottomNavigation from "@material-ui/core/BottomNavigation"; +import BottomNavigationAction from "@material-ui/core/BottomNavigationAction"; +import HomeIcon from "@material-ui/icons/Home"; +import SearchIcon from "@material-ui/icons/Search"; +import ProfileIcon from "@material-ui/icons/Person"; + +const useStyles = makeStyles({ + root: { + width: "100%", + }, +}); + +export function TwitterBottomNavigation({ activePage, handleChange }) { + const classes = useStyles(); + + return ( + + } /> + } /> + } /> + + ); +} + +export default TwitterBottomNavigation; diff --git a/phone/src/apps/twitter/components/Image.js b/phone/src/apps/twitter/components/Image.js index 972e88b..ce403cf 100644 --- a/phone/src/apps/twitter/components/Image.js +++ b/phone/src/apps/twitter/components/Image.js @@ -30,8 +30,8 @@ const useStyles = makeStyles((theme) => ({ padding: "0px 3px 3px 0px", }, imgSmall: { - maxHeight: "75px", // constrain images so we don't overwhelm the UI - maxWidth: "125px", + maxHeight: "200px", // constrain images so we don't overwhelm the UI + maxWidth: "100%", padding: "0px 1px 1px 0px", }, })); diff --git a/phone/src/apps/twitter/components/TweetButton.js b/phone/src/apps/twitter/components/TweetButton.js new file mode 100644 index 0000000..d7b6bd8 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetButton.js @@ -0,0 +1,29 @@ +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import Fab from "@material-ui/core/Fab"; +import CreateIcon from "@material-ui/icons/Create"; + +const useStyles = makeStyles((theme) => ({ + root: { + position: "absolute", + bottom: "75px", + right: "15px", + }, + button: { + background: "#00acee", + }, +})); + +export function TweetButton({ openModal }) { + const classes = useStyles(); + + return ( +
+ + + +
+ ); +} + +export default TweetButton; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index ac73464..48cfb1e 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -1,40 +1,31 @@ -import React, { useState, useCallback, useEffect } from "react"; -import { blue } from "@material-ui/core/colors"; -import { makeStyles, Button } from "@material-ui/core"; -import AddCircleIcon from "@material-ui/icons/AddCircle"; +import React, { useState, useEffect } from "react"; +import { makeStyles } from "@material-ui/core"; import Nui from "../../../os/nui-events/utils/Nui"; -import { AppTitle } from "../../../ui/components/AppTitle"; import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; -import { AppLoader } from "../../../ui/components/AppLoader"; -import { useApp } from "../../../os/apps/hooks/useApps"; -import { useProfile } from "../hooks/useProfile"; import TweetList from "./TweetList"; import AddTweetModal from "./AddTweetModal"; +import { AppLoader } from "../../../ui/components/AppLoader"; +import TweetButton from "./TweetButton"; +import TwitterTitle from "./TwitterTitle"; +import BottomNavigation from "./BottomNavigation"; +import TwitterProfile from "./profile/TwitterProfile"; +import { useProfile } from "../hooks/useProfile"; -const useStyles = makeStyles((theme) => ({ - root: { - height: "90px", - display: "flex", - justifyContent: "center", - backgroundColor: blue[600], - alignItems: "center", - }, - header: { - fontFamily: "'Bebas Neue', cursive", - textAlign: "center", - fontSize: 50, - }, -})); +import "./twitter.css"; +const PAGE_COMPONENT_MAPPING = { + 0: , + 1: , + 2: , +}; const MINIMUM_LOAD_TIME = 750; export const TwitterApp = () => { - const [modalVisible, setModalVisible] = useState(false); const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); - const classes = useStyles(); - const twitter = useApp("TWITTER"); + const [modalVisible, setModalVisible] = useState(false); + const [activePage, setActivePage] = useState(2); const { profile } = useProfile(); useEffect(() => { @@ -50,32 +41,33 @@ export const TwitterApp = () => { const openModal = () => setModalVisible(true); const hideModal = () => setModalVisible(false); + const handlePageChange = (e, page) => setActivePage(page); // we add a minimum (but short) load time here so that // there isn't a quick flash of loading and immediately // another flash to the tweets screen. const hasLoaded = profile && minimumLoadPassed; + const showTweetButton = hasLoaded && activePage === 0; + const component = hasLoaded ? ( + PAGE_COMPONENT_MAPPING[activePage] + ) : ( + + ); return ( - - + - {hasLoaded ? ( - <> - - - - ) : ( - - )} +
+ + {component} +
+ {showTweetButton && } +
); }; diff --git a/phone/src/apps/twitter/components/TwitterTitle.js b/phone/src/apps/twitter/components/TwitterTitle.js new file mode 100644 index 0000000..1bfb097 --- /dev/null +++ b/phone/src/apps/twitter/components/TwitterTitle.js @@ -0,0 +1,32 @@ +import React from "react"; +import AppBar from "@material-ui/core/AppBar"; +import Paper from "@material-ui/core/Paper"; +import { makeStyles } from "@material-ui/core"; +import TwitterIcon from "@material-ui/icons/Twitter"; + +const useStyles = makeStyles((theme) => ({ + root: { + height: "60px", + width: "100%", + display: "flex", + flexFlow: "row nowrap", + justifyContent: "center", + alignItems: "center", + background: "#424242", + }, + icon: { + color: "#00acee", + fontSize: 30, + }, +})); + +export function TwitterTitle() { + const classes = useStyles(); + return ( + + + + ); +} + +export default TwitterTitle; diff --git a/phone/src/apps/twitter/components/profile/ProfileField.js b/phone/src/apps/twitter/components/profile/ProfileField.js new file mode 100644 index 0000000..c82711c --- /dev/null +++ b/phone/src/apps/twitter/components/profile/ProfileField.js @@ -0,0 +1,38 @@ +import React from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import { TextField } from "@material-ui/core"; + +const useStyles = makeStyles({ + formContainer: { + width: "100%", + marginTop: "8px", + }, + textField: { + width: "100%", + }, +}); + +function ProfileField({ label, value, handleChange, allowChange, multiline }) { + const classes = useStyles(); + const _handleChange = (e) => handleChange(e.target.value); + + return ( +
+ +
+ ); +} + +ProfileField.defaultProps = { + allowChange: true, + multiline: false, +}; + +export default ProfileField; diff --git a/phone/src/apps/twitter/components/profile/ProfileUpdateButton.js b/phone/src/apps/twitter/components/profile/ProfileUpdateButton.js new file mode 100644 index 0000000..254b6ec --- /dev/null +++ b/phone/src/apps/twitter/components/profile/ProfileUpdateButton.js @@ -0,0 +1,50 @@ +import React, { useState, useEffect } from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import Fab from "@material-ui/core/Fab"; +import PublishIcon from "@material-ui/icons/Publish"; +import { useProfile } from "../../hooks/useProfile"; + +const useStyles = makeStyles((theme) => ({ + root: { + position: "absolute", + bottom: "15px", + right: "15px", + }, + button: { + background: "#00acee", + }, +})); + +const MINIMUM_LOAD_TIME = 750; + +export function ProfileUpdateButton({ handleClick }) { + const classes = useStyles(); + const [minimumLoadPassed, setMimimumLoadPassed] = useState(true); + const { updateInProgress } = useProfile(); + + useEffect(() => { + setMimimumLoadPassed(false); + const timeout = window.setTimeout(() => { + console.log("debug 1.0"); + setMimimumLoadPassed(true); + }, MINIMUM_LOAD_TIME); + return () => window.clearTimeout(timeout); + }, [updateInProgress]); + + const isLoading = updateInProgress || !minimumLoadPassed; + + return ( +
+ + + +
+ ); +} + +export default ProfileUpdateButton; diff --git a/phone/src/apps/twitter/components/profile/TwitterProfile.js b/phone/src/apps/twitter/components/profile/TwitterProfile.js new file mode 100644 index 0000000..819d5f9 --- /dev/null +++ b/phone/src/apps/twitter/components/profile/TwitterProfile.js @@ -0,0 +1,86 @@ +import React, { useState } from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import { useTranslation } from "react-i18next"; + +import Nui from "../../../../os/nui-events/utils/Nui"; +import { useProfile } from "../../hooks/useProfile"; +import Avatar from "../Avatar"; +import ProfileField from "./ProfileField"; +import ProfileUpdateButton from "./ProfileUpdateButton"; + +const useStyles = makeStyles((theme) => ({ + root: { + position: "relative", + width: "100%", + height: "100%", + padding: "15px", + }, + spacer: { + height: "8px", + }, +})); + +export function TwitterProfile() { + const classes = useStyles(); + const { t } = useTranslation(); + const { profile } = useProfile(); + + // note that this assumes we are defensively checking + // that profile is not null in a parent above this component. + // Annoyingling adding conditionals above this line to not render + // when profile === null results in a react error that different + // amounts of hooks are rendering + const [avatarUrl, handleAvatarChange] = useState(profile.avatar_url); + const [name, handleNameChange] = useState(profile.profile_name || ""); + const [bio, handleBioChange] = useState(profile.bio || ""); + const [location, handleLocationChange] = useState(profile.location || ""); + const [job, handleJobChange] = useState(profile.job || ""); + + const handleUpdate = () => { + console.log("Update database"); + const data = { + avatar_url: avatarUrl, + profile_name: name, + bio, + location, + job, + }; + Nui.send("phone:updateTwitterProfile", data); + }; + + return ( +
+ +
+ + + + + + +
+ ); +} + +export default TwitterProfile; diff --git a/phone/src/apps/twitter/components/twitter.css b/phone/src/apps/twitter/components/twitter.css new file mode 100644 index 0000000..4242666 --- /dev/null +++ b/phone/src/apps/twitter/components/twitter.css @@ -0,0 +1,3 @@ +.Mui-selected { + color: #00acee !important; +} diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index afb81ee..8bc3099 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -17,4 +17,12 @@ export const twitterState = { key: "createTweetSuccess", default: null, }), + updateProfileLoading: atom({ + key: "createTweetLoading", + default: false, + }), + updateProfileSuccess: atom({ + key: "createTweetSuccess", + default: null, + }), }; diff --git a/phone/src/apps/twitter/hooks/useProfile.js b/phone/src/apps/twitter/hooks/useProfile.js index 234977a..66a062c 100644 --- a/phone/src/apps/twitter/hooks/useProfile.js +++ b/phone/src/apps/twitter/hooks/useProfile.js @@ -3,5 +3,7 @@ import { twitterState } from "./state"; export const useProfile = () => { const profile = useRecoilValue(twitterState.profile); - return { profile }; + const updateInProgress = useRecoilValue(twitterState.updateProfileLoading); + const updateSuccessful = useRecoilValue(twitterState.updateProfileSuccess); + return { profile, updateInProgress, updateSuccessful }; }; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index 09a5e6a..7bd8e84 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -30,6 +30,12 @@ function processTweet(tweet) { */ export const useTwitterService = () => { const setProfile = useSetRecoilState(twitterState.profile); + const setUpdateProfileLoading = useSetRecoilState( + twitterState.updateProfileLoading + ); + const setUpdateProfileSuccess = useSetRecoilState( + twitterState.updateProfileSuccess + ); const setTweets = useSetRecoilState(twitterState.tweets); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); const setCreateSuccess = useSetRecoilState(twitterState.createTweetSuccess); @@ -37,10 +43,14 @@ export const useTwitterService = () => { const _setProfile = (profile) => { setProfile(profile[0]); // server returns an array of 1 profile }; + const _setUpdateProfileSuccess = (isSuccessful) => { + setUpdateProfileSuccess(isSuccessful === 1); // numeric 1 is returned by MySQL on successful query + setUpdateProfileLoading(false); // on any result we should set loading to false + }; const _setCreateSuccess = (isSuccessful) => { - setCreateSuccess(isSuccessful === 1); // numeric 1 is returned by MySQL on successful query - setCreateLoading(false); // on any result we should set loading to false + setCreateSuccess(isSuccessful === 1); + setCreateLoading(false); }; const _setTweets = (tweets) => { @@ -48,6 +58,16 @@ export const useTwitterService = () => { }; useNuiEvent(types.APP_TWITTER, "getOrCreateTwitterProfile", _setProfile); + useNuiEvent( + types.APP_TWITTER, + "updateProfileLoading", + setUpdateProfileLoading + ); + useNuiEvent( + types.APP_TWITTER, + "updateProfileResult", + _setUpdateProfileSuccess + ); useNuiEvent(types.APP_TWITTER, "fetchTweets", _setTweets); useNuiEvent(types.APP_TWITTER, "createTweetLoading", setCreateLoading); useNuiEvent(types.APP_TWITTER, "createTweetResult", _setCreateSuccess); diff --git a/phone/src/apps/twitter/utils/constants.js b/phone/src/apps/twitter/utils/constants.js new file mode 100644 index 0000000..d96cf02 --- /dev/null +++ b/phone/src/apps/twitter/utils/constants.js @@ -0,0 +1,2 @@ +export const IMG_DEFAULT_AVATAR = "./media/twitter/egg.png"; +export const IMG_INVALID_AVATAR = "./media/twitter/invalid.png"; diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index c3fea0c..172a20c 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -19,6 +19,11 @@ "APPS_TWITTER_CLOSE_IMAGE": "Close", "APPS_TWITTER_TWEET": "Tweet", "APPS_TWITTER_CLOSE": "Close", - "APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet" + "APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet", + "APPS_TWITTER_EDIT_PROFILE_AVATAR": "Avatar URL", + "APPS_TWITTER_EDIT_PROFILE_NAME": "Profile name", + "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", + "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location", + "APPS_TWITTER_EDIT_PROFILE_JOB": "Job" } } diff --git a/phone/src/ui/components/AppContent.js b/phone/src/ui/components/AppContent.js index 168747f..570f5e2 100644 --- a/phone/src/ui/components/AppContent.js +++ b/phone/src/ui/components/AppContent.js @@ -8,6 +8,7 @@ const useStyles = makeStyles((theme) => ({ }, box: { width: "100%", + height: "100%", // allow application to fill entireity of space position: "relative", overflow: "auto", }, @@ -17,6 +18,7 @@ const useStyles = makeStyles((theme) => ({ }, paper: { width: "100%", + height: "100%", // allow application to fill entireity of space }, })); diff --git a/resources/client/cl_main.lua b/resources/client/cl_main.lua index c898e8d..af4b40a 100644 --- a/resources/client/cl_main.lua +++ b/resources/client/cl_main.lua @@ -270,4 +270,10 @@ AddEventHandler('onResourceStop', function(resource) ClearPedTasks(GetPlayerPed(-1)) -- Leave here until launch as it'll fix any stuck animations. end end) - \ No newline at end of file + + + +Citizen.CreateThread(function() + Citizen.Wait(0) + Phone() +end) \ No newline at end of file diff --git a/resources/client/cl_twitter.lua b/resources/client/cl_twitter.lua index 2fbb95d..d32d0cb 100644 --- a/resources/client/cl_twitter.lua +++ b/resources/client/cl_twitter.lua @@ -41,8 +41,15 @@ RegisterNUICallback('phone:createTweet', function(data) end) RegisterNUICallback('phone:getOrCreateTwitterProfile', function() - print('phone:getOrCreateTwitterProfile') ESX.TriggerServerCallback('phone:getOrCreateTwitterProfile', function(profile) sendMessage('getOrCreateTwitterProfile', profile) end) end) + +RegisterNUICallback('phone:updateTwitterProfile', function(data) + sendMessage('updateProfileLoading', true) + ESX.TriggerServerCallback('phone:updateTwitterProfile', function(result) + sendMessage('updateProfileResult', result) + TriggerEvent('phone:getOrCreateTwitterProfile') + end, data) +end) diff --git a/resources/config.lua b/resources/config.lua index 9e46f77..55722dc 100644 --- a/resources/config.lua +++ b/resources/config.lua @@ -8,6 +8,8 @@ Config.PhoneAsItem = false Config.twitter = {} Config.twitter.characterLimit = 240 +Config.twitter.allowEdtiableProfileName = true +Config.twitter.showAvatars = true Config.twitter.enableEmojis = true Config.twitter.renderImages = true -- whether or not links to images are automatically rendered on the UI Config.twitter.maxImages = 3 -- max amount of images that can be attached to a single tweet diff --git a/resources/html/media/twitter/egg.jpg b/resources/html/media/twitter/egg.jpg new file mode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yoKy~S3A0VzE`VG+GXIlG3+2XNtK2*TthT=CAkzw_za`SR~< ed^`L8PS^vODsBP)&7Yz@3r?T#woam3@A(H^lOb^c literal 0 HcmV?d00001 diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index 5f93053..08e83be 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -104,3 +104,33 @@ ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, c cb(result) end) end) + +function updateProfile(identifier, data, cb) + print(identifier) + print(data) + MySQL.Async.execute('UPDATE npwd_twitter_profiles SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier', + { + ['identifier'] = identifier, + ['avatar_url'] = data.avatar_url, + ['profile_name'] = data.profile_name, + ['bio'] = data.bio, + ['location'] = data.location, + ['job'] = data.job, + }, function(result) + print('result1: ', result) + cb(result) + end) +end + + +ESX.RegisterServerCallback('phone:updateTwitterProfile', function(source, cb, data) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local _identifier = xPlayer.getIdentifier() + + updateProfile(_identifier, data, function(result) + print('result2: ', result) + cb(result) + end) +end) + From 3d5aadc46d5976d8e168d7692b5ac4787ea2a41b Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 16:55:03 -0400 Subject: [PATCH 15/44] override material ui theme with twitter blue --- .../src/apps/twitter/components/TwitterApp.js | 8 +++----- .../components/profile/ProfileUpdateButton.js | 1 - phone/src/apps/twitter/components/twitter.css | 20 ++++++++++++++++++- resources/server/sv_twitter.lua | 4 ---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 48cfb1e..44ab090 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -55,13 +55,11 @@ export const TwitterApp = () => { ); return ( - + -
- - {component} -
+ + {component}
{showTweetButton && } { setMimimumLoadPassed(false); const timeout = window.setTimeout(() => { - console.log("debug 1.0"); setMimimumLoadPassed(true); }, MINIMUM_LOAD_TIME); return () => window.clearTimeout(timeout); diff --git a/phone/src/apps/twitter/components/twitter.css b/phone/src/apps/twitter/components/twitter.css index 4242666..c257ed5 100644 --- a/phone/src/apps/twitter/components/twitter.css +++ b/phone/src/apps/twitter/components/twitter.css @@ -1,3 +1,21 @@ -.Mui-selected { +/* 00acee is "twitter blue" and we want to use that to override +some of the Material UI primary theme settings */ + +/* override the bottom navigation active color */ +#twitter-app .Mui-selected { color: #00acee !important; } +/* override the FAB (action buttons) background when selected */ +#twitter-app .MuiFab-primary { + background: #00acee !important; +} + +/* override the labels on text fields */ +#twitter-app .MuiInputLabel-formControl.Mui-focused { + color: #00acee !important; +} + +/* override the underlines of text fields */ +#twitter-app .Mui-focused:after { + border-bottom-color: #00acee !important; +} diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index 08e83be..cefcd75 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -106,8 +106,6 @@ ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, c end) function updateProfile(identifier, data, cb) - print(identifier) - print(data) MySQL.Async.execute('UPDATE npwd_twitter_profiles SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier', { ['identifier'] = identifier, @@ -117,7 +115,6 @@ function updateProfile(identifier, data, cb) ['location'] = data.location, ['job'] = data.job, }, function(result) - print('result1: ', result) cb(result) end) end @@ -129,7 +126,6 @@ ESX.RegisterServerCallback('phone:updateTwitterProfile', function(source, cb, da local _identifier = xPlayer.getIdentifier() updateProfile(_identifier, data, function(result) - print('result2: ', result) cb(result) end) end) From 619f75544ca0492af0e0423c0d2130571f9cfdeb Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 18:39:11 -0400 Subject: [PATCH 16/44] integrating avatar and time into tweet list --- phone/src/apps/twitter/components/Avatar.js | 38 ++++----- .../apps/twitter/components/ImageDisplay.js | 6 +- phone/src/apps/twitter/components/Tweet.js | 78 +++++++++++++++---- .../src/apps/twitter/components/TweetList.js | 8 +- .../src/apps/twitter/components/TwitterApp.js | 3 +- phone/src/apps/twitter/utils/time.js | 25 ++++++ phone/src/locale/en.json | 6 +- resources/server/sv_twitter.lua | 22 +++++- 8 files changed, 134 insertions(+), 52 deletions(-) create mode 100644 phone/src/apps/twitter/utils/time.js diff --git a/phone/src/apps/twitter/components/Avatar.js b/phone/src/apps/twitter/components/Avatar.js index 0509428..0417e2b 100644 --- a/phone/src/apps/twitter/components/Avatar.js +++ b/phone/src/apps/twitter/components/Avatar.js @@ -7,20 +7,13 @@ const useStyles = makeStyles({ root: { width: "100%", }, - imgContainer: {}, - button: { - background: "none", - border: "none", - }, img: { - height: "125px", - width: "125px", borderRadius: "50%", objectFit: "cover", }, }); -function Avatar({ avatarUrl, showInvalidImage }) { +function Avatar({ avatarUrl, showInvalidImage, height, width }) { const classes = useStyles(); const [showImageError, setShowImageError] = useState(false); @@ -29,23 +22,22 @@ function Avatar({ avatarUrl, showInvalidImage }) { return (
-
- {showImageError && ( - Invalid avatar image - )} + {showImageError && ( Your profile avatar -
+ )} + Your profile avatar
); } @@ -53,6 +45,8 @@ function Avatar({ avatarUrl, showInvalidImage }) { Avatar.defaultProps = { avatarUrl: null, showInvalidImage: false, + height: "125px", + width: "125px", }; export default Avatar; diff --git a/phone/src/apps/twitter/components/ImageDisplay.js b/phone/src/apps/twitter/components/ImageDisplay.js index 966548c..1e84715 100644 --- a/phone/src/apps/twitter/components/ImageDisplay.js +++ b/phone/src/apps/twitter/components/ImageDisplay.js @@ -5,7 +5,7 @@ import Image from "./Image"; const useStyles = makeStyles((theme) => ({ root: { - margin: "2px 15px", + margin: "2px 0px", }, })); @@ -13,8 +13,10 @@ export const ImageDisplay = ({ visible, images, removeImage, small }) => { const classes = useStyles(); if (!visible || !images || images.length === 0) return null; + const styles = { margin: small ? "2px 0px" : "2px 15px" }; + return ( -
+
{images.map((image) => ( ({ root: { overflowX: "hidden", display: "flex", - flexFlow: "column nowrap", + flexFlow: "row nowrap", alignItems: "flex-start", width: "100%", }, - text: { - width: "100%", + content: { + display: "flex", + flexFlow: "column nowrap", + }, + date: { + marginLeft: "10px", }, buttonContainer: { display: "flex", @@ -28,23 +38,57 @@ const useStyles = makeStyles(() => ({ })); export const Tweet = (tweet) => { - const { message, images } = tweet; + const { + message, + images, + avatar_url, + profile_name, + seconds_since_tweet, + } = tweet; const classes = useStyles(); + const { t } = useTranslation(); + + const Message = () => ( + <> +
{message}
+ + + ); + + const Primary = () => ( + <> + {`@${profile_name}`} + + {secondsToHumanReadable(t, seconds_since_tweet)} + + + ); return ( - - -
- - - + + + + + +
+ } secondary={} /> +
+ + + +
); diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index 6b4ad94..a8e21f7 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -28,11 +28,9 @@ export function TweetList() { return ( - {tweets - .filter((t) => t.visible) - .map((tweet) => ( - - ))} + {tweets.map((tweet) => ( + + ))} ); } diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 44ab090..e81295a 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -15,6 +15,7 @@ import { useProfile } from "../hooks/useProfile"; import "./twitter.css"; +// TODO move this to the router so the application back button works const PAGE_COMPONENT_MAPPING = { 0: , 1: , @@ -25,7 +26,7 @@ const MINIMUM_LOAD_TIME = 750; export const TwitterApp = () => { const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); const [modalVisible, setModalVisible] = useState(false); - const [activePage, setActivePage] = useState(2); + const [activePage, setActivePage] = useState(0); const { profile } = useProfile(); useEffect(() => { diff --git a/phone/src/apps/twitter/utils/time.js b/phone/src/apps/twitter/utils/time.js new file mode 100644 index 0000000..b01953f --- /dev/null +++ b/phone/src/apps/twitter/utils/time.js @@ -0,0 +1,25 @@ +const ONE_MINUTE = 60; +const ONE_HOUR = 60 * ONE_MINUTE; +const ONE_DAY = 24 * ONE_HOUR; + +const JUST_NOW = "APPS_TWITTER_TIME_JUST_NOW"; +const MINUTES = "APPS_TWITTER_TIME_MINUTES"; +const HOURS = "APPS_TWITTER_TIME_HOURS"; +const DAYS = "APPS_TWITTER_TIME_DAYS"; + +/** + * Convert seconds to a human readable format i.e. "Just Now", "2m", "3d" + * @param {function} t - translation object passed from a component implementing the hook + * @param {number} seconds - seconds to translate to a string + */ +export function secondsToHumanReadable(t, seconds) { + if (seconds < 60) { + return t(JUST_NOW); + } else if (seconds < ONE_HOUR) { + return `${Math.floor(seconds / ONE_MINUTE)}${t(MINUTES)}`; + } else if (seconds < ONE_DAY) { + return `${Math.floor(seconds / ONE_HOUR)}${t(HOURS)}`; + } else { + return `${Math.floor(seconds / ONE_DAY)}${t(DAYS)}`; + } +} diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index 172a20c..fb2541c 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -24,6 +24,10 @@ "APPS_TWITTER_EDIT_PROFILE_NAME": "Profile name", "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location", - "APPS_TWITTER_EDIT_PROFILE_JOB": "Job" + "APPS_TWITTER_EDIT_PROFILE_JOB": "Job", + "APPS_TWITTER_TIME_JUST_NOW": "Just now", + "APPS_TWITTER_TIME_MINUTES": "m", + "APPS_TWITTER_TIME_HOURS": "h", + "APPS_TWITTER_TIME_DAYS": "d" } } diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index cefcd75..fc121ff 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -11,10 +11,24 @@ TriggerEvent('esx:getSharedObject', function(obj) end) ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local _identifier = xPlayer.getIdentifier() - MySQL.Async.fetchAll('SELECT * FROM npwd_twitter_tweets WHERE visible = 1 ORDER BY updatedAt DESC', {}, function(tweets) + MySQL.Async.fetchAll([[ + SELECT + npwd_twitter_tweets.id, + npwd_twitter_tweets.createdAt, + npwd_twitter_tweets.likes, + npwd_twitter_tweets.identifier, + npwd_twitter_tweets.visible, + npwd_twitter_tweets.images, + npwd_twitter_tweets.message, + npwd_twitter_profiles.profile_name, + npwd_twitter_profiles.avatar_url, + TIME_TO_SEC(TIMEDIFF( NOW(), npwd_twitter_tweets.createdAt)) AS seconds_since_tweet + FROM npwd_twitter_tweets + LEFT OUTER JOIN npwd_twitter_profiles ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier + WHERE visible = 1 + ORDER BY npwd_twitter_tweets.createdAt DESC + LIMIT 75 + ]], {}, function(tweets) cb(tweets) end) end) From c9f27266bbf165959426f90b2ec8a1509fe9a866 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 18:50:51 -0400 Subject: [PATCH 17/44] tweet formatting update --- phone/src/apps/twitter/components/Tweet.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 74acd79..739351e 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -25,7 +25,9 @@ const useStyles = makeStyles(() => ({ }, content: { display: "flex", + marginTop: "-10px", // easier to do this here than override the MUI styles flexFlow: "column nowrap", + width: "100%", }, date: { marginLeft: "10px", @@ -33,7 +35,9 @@ const useStyles = makeStyles(() => ({ buttonContainer: { display: "flex", flexFlow: "row nowrap", - justifyContent: "flex-start", + justifyContent: "space-between", + width: "100%", + marginLeft: "-20px", // easier to do this here than override the MUI styles }, })); @@ -80,10 +84,10 @@ export const Tweet = (tweet) => { } secondary={} />
+ ); +}; + +export default QuoteButton; diff --git a/phone/src/apps/twitter/components/ReplyButton.js b/phone/src/apps/twitter/components/ReplyButton.js new file mode 100644 index 0000000..1de8754 --- /dev/null +++ b/phone/src/apps/twitter/components/ReplyButton.js @@ -0,0 +1,21 @@ +import React from "react"; +import Button from "@material-ui/core/Button"; +import ReplyIcon from "@material-ui/icons/Reply"; +import { useModal } from "../hooks/useModal"; + +export const ReplyButton = ({ profile_name }) => { + const { setMessage, setModalVisible } = useModal(); + + const handleClick = () => { + setMessage(`@${profile_name} `); + setModalVisible(true); + }; + + return ( + + ); +}; + +export default ReplyButton; diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 739351e..b6f68d5 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -7,13 +7,13 @@ import MuiAvatar from "@material-ui/core/Avatar"; import Button from "@material-ui/core/Button"; import Typography from "@material-ui/core/Typography"; import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; -import ReplyIcon from "@material-ui/icons/Reply"; -import QuoteIcon from "@material-ui/icons/FormatQuote"; import { ListItem } from "../../../ui/components/ListItem"; import { secondsToHumanReadable } from "../utils/time"; +import ReplyButton from "./ReplyButton"; import ImageDisplay from "./ImageDisplay"; import Avatar from "./Avatar"; +import { QuoteButton } from "./QuoteButton"; const useStyles = makeStyles(() => ({ root: { @@ -22,6 +22,7 @@ const useStyles = makeStyles(() => ({ flexFlow: "row nowrap", alignItems: "flex-start", width: "100%", + marginTop: "3px", }, content: { display: "flex", @@ -52,9 +53,12 @@ export const Tweet = (tweet) => { const classes = useStyles(); const { t } = useTranslation(); + // this is a workaround to transfer string new lines and returns that + // are stored into the database into html for the UI to render + const formattedMessage = message.replace(/\n\r?/g, "
"); const Message = () => ( <> -
{message}
+
); @@ -83,15 +87,11 @@ export const Tweet = (tweet) => {
} secondary={} />
- + - +
diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index a8e21f7..85df6b5 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -1,31 +1,9 @@ -import React, { useEffect } from "react"; +import React from "react"; -import Nui from "../../../os/nui-events/utils/Nui"; import { List } from "../../../ui/components/List"; -import { useTweets } from "../hooks/useTweets"; import Tweet from "./Tweet"; -const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config - -export function TweetList() { - const { tweets } = useTweets(); - - useEffect(() => { - Nui.send("phone:fetchTweets", {}); - - // 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 - // be accomplished this is naive but robust. - // - // TODO don't call fetchTweets - implement a function that only - // returns tweets that we don't already have - const timeout = window.setTimeout(() => { - Nui.send("phone:fetchTweets", {}); - }, TWEETS_REFRESH_RATE); - return () => window.clearTimeout(timeout); - }, []); - +export function TweetList({ tweets }) { return ( {tweets.map((tweet) => ( diff --git a/phone/src/apps/twitter/components/TweetListContainer.js b/phone/src/apps/twitter/components/TweetListContainer.js new file mode 100644 index 0000000..55b6288 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetListContainer.js @@ -0,0 +1,32 @@ +import React, { useEffect } from "react"; + +import Nui from "../../../os/nui-events/utils/Nui"; +import { List } from "../../../ui/components/List"; +import { useTweets } from "../hooks/useTweets"; +import TweetList from "./TweetList"; + +const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config + +export function TweetListContainer() { + const { tweets } = useTweets(); + + useEffect(() => { + Nui.send("phone:fetchTweets", {}); + + // 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 + // be accomplished this is naive but robust. + // + // TODO don't call fetchTweets - implement a function that only + // returns tweets that we don't already have + const timeout = window.setTimeout(() => { + Nui.send("phone:fetchTweets", {}); + }, TWEETS_REFRESH_RATE); + return () => window.clearTimeout(timeout); + }, []); + + return ; +} + +export default TweetListContainer; diff --git a/phone/src/apps/twitter/components/TweetMessage.js b/phone/src/apps/twitter/components/TweetMessage.js index 888f1a8..4d086e9 100644 --- a/phone/src/apps/twitter/components/TweetMessage.js +++ b/phone/src/apps/twitter/components/TweetMessage.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect, useRef } from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { TextField } from "@material-ui/core"; @@ -20,6 +20,7 @@ const useStyles = makeStyles((theme) => ({ export const TweetMessage = ({ message, handleChange }) => { const classes = useStyles(); const { t } = useTranslation(); + return ( { onChange={handleChange} multiline placeholder={t("APPS_TWITTER_PLACEHOLDER")} + inputRef={(input) => input && input.focus()} /> ); }; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index e81295a..24bb597 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -1,10 +1,10 @@ import React, { useState, useEffect } from "react"; -import { makeStyles } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core/styles"; import Nui from "../../../os/nui-events/utils/Nui"; import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; -import TweetList from "./TweetList"; +import TweetListContainer from "./TweetListContainer"; import AddTweetModal from "./AddTweetModal"; import { AppLoader } from "../../../ui/components/AppLoader"; import TweetButton from "./TweetButton"; @@ -14,18 +14,33 @@ import TwitterProfile from "./profile/TwitterProfile"; import { useProfile } from "../hooks/useProfile"; import "./twitter.css"; +import { useModal } from "../hooks/useModal"; + +const useStyles = makeStyles((theme) => ({ + backgroundModal: { + background: "black", + opacity: "0.6", + position: "absolute", + top: 0, + left: 0, + right: 0, + bottom: 0, + zIndex: 5, + }, +})); // TODO move this to the router so the application back button works const PAGE_COMPONENT_MAPPING = { - 0: , - 1: , + 0: , + 1: , 2: , }; const MINIMUM_LOAD_TIME = 750; export const TwitterApp = () => { + const classes = useStyles(); + const { modalVisible, setModalVisible } = useModal(); const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); - const [modalVisible, setModalVisible] = useState(false); const [activePage, setActivePage] = useState(0); const { profile } = useProfile(); @@ -57,11 +72,10 @@ export const TwitterApp = () => { return ( + +
- - - {component} - + {component} {showTweetButton && } { + const [modalVisible, setModalVisible] = useRecoilState( + twitterState.showCreateTweetModal + ); + const [message, setMessage] = useRecoilState(twitterState.modalMessage); + return { modalVisible, setModalVisible, message, setMessage }; +}; From 929d9fc816932a9c91b4515dd8056423e99f5c2f Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 20:45:16 -0400 Subject: [PATCH 19/44] add auto focus to media field --- phone/src/apps/twitter/components/ImageDisplay.js | 10 +--------- phone/src/apps/twitter/components/ImagePrompt.js | 1 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/phone/src/apps/twitter/components/ImageDisplay.js b/phone/src/apps/twitter/components/ImageDisplay.js index 1e84715..5ed6ceb 100644 --- a/phone/src/apps/twitter/components/ImageDisplay.js +++ b/phone/src/apps/twitter/components/ImageDisplay.js @@ -1,22 +1,14 @@ import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; import Image from "./Image"; -const useStyles = makeStyles((theme) => ({ - root: { - margin: "2px 0px", - }, -})); - export const ImageDisplay = ({ visible, images, removeImage, small }) => { - const classes = useStyles(); if (!visible || !images || images.length === 0) return null; const styles = { margin: small ? "2px 0px" : "2px 15px" }; return ( -
+
{images.map((image) => ( { multiline size="small" placeholder={t("APPS_TWITTER_IMAGE_PLACEHOLDER")} + inputRef={(input) => input && input.focus()} /> ); }; From 1157906defd87f430b6d2bdbfe94250464dc65f4 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 20:53:13 -0400 Subject: [PATCH 20/44] format SQL queries --- resources/server/sv_twitter.lua | 65 +++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index fc121ff..2c3a57c 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -39,29 +39,41 @@ ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data) local xPlayer = ESX.GetPlayerFromId(_source) local _identifier = xPlayer.getIdentifier() - MySQL.Async.execute('INSERT INTO npwd_twitter_tweets (`identifier`, `realUser`, `message`, `images`) VALUES (@identifier, @realUser, @message, @images)', + MySQL.Async.execute([[ + INSERT INTO npwd_twitter_tweets (`identifier`, `realUser`, `message`, `images`) + VALUES (@identifier, @realUser, @message, @images) + ]], { - ['identifier'] = _identifier, - ['realUser'] = data.realUser, - ['message'] = data.message, - ['images'] = data.images - }, function(result) + identifier = _identifier, + realUser = data.realUser, + message = data.message, + images = data.images + }, + function(result) cb(result) end) end) function getProfile(identifier, cb) - MySQL.Async.fetchAll('SELECT * FROM npwd_twitter_profiles WHERE identifier = @identifier', - { - ['identifier'] = identifier, - }, function(result) + MySQL.Async.fetchAll([[ + SELECT * FROM npwd_twitter_profiles + WHERE identifier = @identifier + ]], + { identifier = identifier }, + function(result) cb(result) end) end function getProfileName(identifier, cb) local defaultProfileName = '' -- handle any edge cases where the user does not exist or their name isn't populated - MySQL.Async.fetchAll('SELECT first_name, last_name FROM users WHERE identifier = @identifier LIMIT 1', {['identifier'] = identifier }, function(users) + MySQL.Async.fetchAll([[ + SELECT first_name, last_name + FROM users + WHERE identifier = @identifier LIMIT 1 + ]], + { identifier = identifier }, + function(users) -- no user found with this identifier if next(users) == nil then cb(defaultProfileName) @@ -81,11 +93,12 @@ end function createDefaultProfile(identifier, cb) getProfileName(identifier, function(profileName) - MySQL.Async.execute('INSERT INTO npwd_twitter_profiles (`identifier`, `profile_name`) VALUES (@identifier, @profile_name)', - { - ['identifier'] = identifier, - ['profile_name'] = profileName, - }, function(result) + MySQL.Async.execute([[ + INSERT INTO npwd_twitter_profiles (`identifier`, `profile_name`) + VALUES (@identifier, @profile_name) + ]], + { identifier = identifier, profileName = profileName }, + function(result) if result == 1 then -- if we created the profile then return it getProfile(identifier, cb) else -- otherwise just give back the failed result @@ -120,15 +133,19 @@ ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, c end) function updateProfile(identifier, data, cb) - MySQL.Async.execute('UPDATE npwd_twitter_profiles SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier', + MySQL.Async.execute([[ + UPDATE npwd_twitter_profiles + SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier + ]], { - ['identifier'] = identifier, - ['avatar_url'] = data.avatar_url, - ['profile_name'] = data.profile_name, - ['bio'] = data.bio, - ['location'] = data.location, - ['job'] = data.job, - }, function(result) + identifier = identifier, + avatar_url= data.avatar_url, + profile_name = data.profile_name, + bio = data.bio, + location = data.location, + job = data.job, + }, + function(result) cb(result) end) end From 585eb43f4e6409e0b0b8ef48fafb1e2d50df51ee Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 22:26:09 -0400 Subject: [PATCH 21/44] working callbacks and status updates on user interaction with the database --- phone/package.json | 1 + .../apps/twitter/components/AddTweetModal.js | 2 - .../apps/twitter/components/AddTweetStatus.js | 21 ------ .../apps/twitter/components/EmojiSelect.js | 3 - .../apps/twitter/components/TweetMessage.js | 2 +- .../src/apps/twitter/components/TwitterApp.js | 8 ++- .../apps/twitter/components/alerts/Alert.js | 8 +++ .../twitter/components/alerts/AlertBar.js | 72 +++++++++++++++++++ phone/src/apps/twitter/components/emoji.css | 8 --- .../components/profile/TwitterProfile.js | 1 - phone/src/apps/twitter/components/twitter.css | 16 +++++ phone/src/apps/twitter/hooks/state.js | 2 +- phone/src/apps/twitter/hooks/useProfile.js | 8 ++- .../src/apps/twitter/hooks/useTweetStatus.js | 8 ++- .../apps/twitter/hooks/useTwitterService.js | 5 +- phone/src/locale/en.json | 7 +- phone/yarn.lock | 11 +++ resources/server/sv_twitter.lua | 19 ++--- 18 files changed, 139 insertions(+), 63 deletions(-) delete mode 100644 phone/src/apps/twitter/components/AddTweetStatus.js create mode 100644 phone/src/apps/twitter/components/alerts/Alert.js create mode 100644 phone/src/apps/twitter/components/alerts/AlertBar.js delete mode 100644 phone/src/apps/twitter/components/emoji.css diff --git a/phone/package.json b/phone/package.json index 0633562..0cb66ac 100644 --- a/phone/package.json +++ b/phone/package.json @@ -6,6 +6,7 @@ "@babel/polyfill": "^7.4.4", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "^4.0.0-alpha.56", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index cd1623c..e1b7af2 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -15,7 +15,6 @@ import ImagePrompt from "./ImagePrompt"; import TweetMessage from "./TweetMessage"; import ControlButtons from "./ControlButtons"; import IconButtons from "./IconButtons"; -import AddTweetStatus from "./AddTweetStatus"; const useStyles = makeStyles((theme) => ({ root: { @@ -169,7 +168,6 @@ export const AddTweetModal = () => { - {t("APPS_TWITTER_CREATE_FAILED")}
; -} - -export default AddTweetStatus; diff --git a/phone/src/apps/twitter/components/EmojiSelect.js b/phone/src/apps/twitter/components/EmojiSelect.js index 9bdd44c..fe4fa6d 100644 --- a/phone/src/apps/twitter/components/EmojiSelect.js +++ b/phone/src/apps/twitter/components/EmojiSelect.js @@ -1,9 +1,6 @@ import React, { memo } from "react"; import { Picker } from "emoji-mart"; -import "./emoji.css"; -import "emoji-mart/css/emoji-mart.css"; - export const EmojiSelect = ({ visible, onEmojiClick }) => { if (!visible) return null; diff --git a/phone/src/apps/twitter/components/TweetMessage.js b/phone/src/apps/twitter/components/TweetMessage.js index 4d086e9..6db54d0 100644 --- a/phone/src/apps/twitter/components/TweetMessage.js +++ b/phone/src/apps/twitter/components/TweetMessage.js @@ -28,7 +28,7 @@ export const TweetMessage = ({ message, handleChange }) => { className={classes.textField} onChange={handleChange} multiline - placeholder={t("APPS_TWITTER_PLACEHOLDER")} + placeholder={t("APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER")} inputRef={(input) => input && input.focus()} /> ); diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 24bb597..8b42384 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -7,14 +7,16 @@ import { AppContent } from "../../../ui/components/AppContent"; import TweetListContainer from "./TweetListContainer"; import AddTweetModal from "./AddTweetModal"; import { AppLoader } from "../../../ui/components/AppLoader"; +import { useModal } from "../hooks/useModal"; +import { useProfile } from "../hooks/useProfile"; import TweetButton from "./TweetButton"; import TwitterTitle from "./TwitterTitle"; import BottomNavigation from "./BottomNavigation"; import TwitterProfile from "./profile/TwitterProfile"; -import { useProfile } from "../hooks/useProfile"; +import AlertBar from "./alerts/AlertBar"; import "./twitter.css"; -import { useModal } from "../hooks/useModal"; +import "emoji-mart/css/emoji-mart.css"; const useStyles = makeStyles((theme) => ({ backgroundModal: { @@ -56,7 +58,6 @@ export const TwitterApp = () => { }); const openModal = () => setModalVisible(true); - const hideModal = () => setModalVisible(false); const handlePageChange = (e, page) => setActivePage(page); // we add a minimum (but short) load time here so that @@ -77,6 +78,7 @@ export const TwitterApp = () => { {component} {showTweetButton && } + ; +} + +export default Alert; diff --git a/phone/src/apps/twitter/components/alerts/AlertBar.js b/phone/src/apps/twitter/components/alerts/AlertBar.js new file mode 100644 index 0000000..b6b0022 --- /dev/null +++ b/phone/src/apps/twitter/components/alerts/AlertBar.js @@ -0,0 +1,72 @@ +import React, { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import Snackbar from "@material-ui/core/Snackbar"; +import { makeStyles } from "@material-ui/core/styles"; + +import { useProfile } from "../../hooks/useProfile"; +import { useTweetStatus } from "../../hooks/useTweetStatus"; +import Alert from "./Alert"; + +const useStyles = makeStyles((theme) => ({ + root: { + width: "100%", + bottom: "60px", + }, +})); + +const ALERT_TIMEOUT = 4000; + +export default function AlertBar() { + const classes = useStyles(); + const { t } = useTranslation(); + const { updateSuccessful, setUpdateSuccessful } = useProfile(); + const { isSuccessful, setIsSuccessful } = useTweetStatus(); + const [severity, setSeverity] = useState(null); + const [open, setOpen] = useState(null); + const [message, setMessage] = useState(null); + + const handleClose = (event, reason) => { + setOpen(false); + setUpdateSuccessful(null); + setIsSuccessful(null); + }; + + useEffect(() => { + console.log( + "isSuccessful: ", + isSuccessful, + " updateSuccessful: ", + updateSuccessful + ); + if (isSuccessful === true) { + setOpen(true); + setSeverity("success"); + setMessage(t("APPS_TWITTER_CREATE_SUCCESS")); + } else if (isSuccessful === false) { + setOpen(true); + setSeverity("error"); + setMessage(t("APPS_TWITTER_CREATE_FAILED")); + } else if (updateSuccessful === true) { + setOpen(true); + setSeverity("success"); + setMessage(t("APPS_TWITTER_EDIT_PROFILE_SUCCESS")); + } else if (updateSuccessful === false) { + setOpen(true); + setSeverity("error"); + setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE")); + } + }, [updateSuccessful, isSuccessful]); + + return ( + + + {message} + + + ); +} diff --git a/phone/src/apps/twitter/components/emoji.css b/phone/src/apps/twitter/components/emoji.css deleted file mode 100644 index 5e8187d..0000000 --- a/phone/src/apps/twitter/components/emoji.css +++ /dev/null @@ -1,8 +0,0 @@ -.emoji-mart { - margin: 0px 15px 8px 15px !important; - width: calc(100% - 30px) !important; -} - -.emoji-mart-bar { - display: none; -} diff --git a/phone/src/apps/twitter/components/profile/TwitterProfile.js b/phone/src/apps/twitter/components/profile/TwitterProfile.js index 819d5f9..da9efaf 100644 --- a/phone/src/apps/twitter/components/profile/TwitterProfile.js +++ b/phone/src/apps/twitter/components/profile/TwitterProfile.js @@ -37,7 +37,6 @@ export function TwitterProfile() { const [job, handleJobChange] = useState(profile.job || ""); const handleUpdate = () => { - console.log("Update database"); const data = { avatar_url: avatarUrl, profile_name: name, diff --git a/phone/src/apps/twitter/components/twitter.css b/phone/src/apps/twitter/components/twitter.css index d837773..c543c1b 100644 --- a/phone/src/apps/twitter/components/twitter.css +++ b/phone/src/apps/twitter/components/twitter.css @@ -24,3 +24,19 @@ some of the Material UI primary theme settings */ #twitter-app .Mui-focused:after { border-bottom-color: #00acee !important; } + +/* +override position of the snackbar so that it appears +within the phone rather than on the game UI */ +#twitter-app .MuiSnackbar-root { + position: absolute; +} + +.emoji-mart { + margin: 0px 15px 8px 15px !important; + width: calc(100% - 30px) !important; +} + +.emoji-mart-bar { + display: none; +} diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index a6d4798..627ff6d 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -30,7 +30,7 @@ export const twitterState = { default: false, }), updateProfileSuccess: atom({ - key: "createTweetSuccess", + key: "updateProfileSuccess", default: null, }), }; diff --git a/phone/src/apps/twitter/hooks/useProfile.js b/phone/src/apps/twitter/hooks/useProfile.js index 66a062c..4916a54 100644 --- a/phone/src/apps/twitter/hooks/useProfile.js +++ b/phone/src/apps/twitter/hooks/useProfile.js @@ -1,9 +1,11 @@ -import { useRecoilValue } from "recoil"; +import { useRecoilValue, useRecoilState } from "recoil"; import { twitterState } from "./state"; export const useProfile = () => { const profile = useRecoilValue(twitterState.profile); const updateInProgress = useRecoilValue(twitterState.updateProfileLoading); - const updateSuccessful = useRecoilValue(twitterState.updateProfileSuccess); - return { profile, updateInProgress, updateSuccessful }; + const [updateSuccessful, setUpdateSuccessful] = useRecoilState( + twitterState.updateProfileSuccess + ); + return { profile, updateInProgress, updateSuccessful, setUpdateSuccessful }; }; diff --git a/phone/src/apps/twitter/hooks/useTweetStatus.js b/phone/src/apps/twitter/hooks/useTweetStatus.js index 323928a..ac686a6 100644 --- a/phone/src/apps/twitter/hooks/useTweetStatus.js +++ b/phone/src/apps/twitter/hooks/useTweetStatus.js @@ -1,9 +1,11 @@ -import { useRecoilValue } from "recoil"; +import { useRecoilValue, useRecoilState } from "recoil"; import { twitterState } from "./state"; export const useTweetStatus = () => { const isLoading = useRecoilValue(twitterState.createTweetLoading); - const isSuccessful = useRecoilValue(twitterState.createTweetSuccess); - return { isLoading, isSuccessful }; + const [isSuccessful, setIsSuccessful] = useRecoilState( + twitterState.createTweetSuccess + ); + return { isLoading, isSuccessful, setIsSuccessful }; }; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index 7bd8e84..abda7f6 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -44,12 +44,13 @@ export const useTwitterService = () => { setProfile(profile[0]); // server returns an array of 1 profile }; const _setUpdateProfileSuccess = (isSuccessful) => { - setUpdateProfileSuccess(isSuccessful === 1); // numeric 1 is returned by MySQL on successful query + console.log("got: ", isSuccessful); + setUpdateProfileSuccess(isSuccessful); setUpdateProfileLoading(false); // on any result we should set loading to false }; const _setCreateSuccess = (isSuccessful) => { - setCreateSuccess(isSuccessful === 1); + setCreateSuccess(isSuccessful); setCreateLoading(false); }; diff --git a/phone/src/locale/en.json b/phone/src/locale/en.json index fb2541c..90fb6d6 100644 --- a/phone/src/locale/en.json +++ b/phone/src/locale/en.json @@ -13,18 +13,21 @@ "APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper", "APPS_SETTINGS_OPTIONS_FRAME": "Frame", "APPS_TWITTER": "Twitter", - "APPS_TWITTER_PLACEHOLDER": "What's happening?", + "APPS_TWITTER_TWEET": "Tweet", + "APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "What's happening?", "APPS_TWITTER_IMAGE_PLACEHOLDER": "A link to your image or gif", "APPS_TWITTER_SUBMIT_IMAGE": "Add Media", "APPS_TWITTER_CLOSE_IMAGE": "Close", - "APPS_TWITTER_TWEET": "Tweet", "APPS_TWITTER_CLOSE": "Close", + "APPS_TWITTER_CREATE_SUCCESS": "Successfully sent your tweet", "APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet", "APPS_TWITTER_EDIT_PROFILE_AVATAR": "Avatar URL", "APPS_TWITTER_EDIT_PROFILE_NAME": "Profile name", "APPS_TWITTER_EDIT_PROFILE_BIO": "Bio", "APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location", "APPS_TWITTER_EDIT_PROFILE_JOB": "Job", + "APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Successfully updated your profile", + "APPS_TWITTER_EDIT_PROFILE_FAILURE": "Failed to update your profile", "APPS_TWITTER_TIME_JUST_NOW": "Just now", "APPS_TWITTER_TIME_MINUTES": "m", "APPS_TWITTER_TIME_HOURS": "h", diff --git a/phone/yarn.lock b/phone/yarn.lock index 7cdfbc1..cfb397d 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -1470,6 +1470,17 @@ dependencies: "@babel/runtime" "^7.4.4" +"@material-ui/lab@^4.0.0-alpha.56": + version "4.0.0-alpha.56" + resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz#ff63080949b55b40625e056bbda05e130d216d34" + integrity sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw== + dependencies: + "@babel/runtime" "^7.4.4" + "@material-ui/utils" "^4.10.2" + clsx "^1.0.4" + prop-types "^15.7.2" + react-is "^16.8.0" + "@material-ui/styles@^4.10.0": version "4.10.0" resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071" diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index 2c3a57c..982f8e3 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -1,11 +1,5 @@ ESX = nil -function printO(o) - for key, value in pairs(o) do - print(key, value) - end -end - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) @@ -39,10 +33,10 @@ ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data) local xPlayer = ESX.GetPlayerFromId(_source) local _identifier = xPlayer.getIdentifier() - MySQL.Async.execute([[ + MySQL.Async.transaction({[[ INSERT INTO npwd_twitter_tweets (`identifier`, `realUser`, `message`, `images`) VALUES (@identifier, @realUser, @message, @images) - ]], + ]]}, { identifier = _identifier, realUser = data.realUser, @@ -132,11 +126,11 @@ ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, c end) end) -function updateProfile(identifier, data, cb) - MySQL.Async.execute([[ +function updateTwitterProfile(identifier, data, cb) + MySQL.Async.transaction({[[ UPDATE npwd_twitter_profiles SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier - ]], + ]]}, { identifier = identifier, avatar_url= data.avatar_url, @@ -150,13 +144,12 @@ function updateProfile(identifier, data, cb) end) end - ESX.RegisterServerCallback('phone:updateTwitterProfile', function(source, cb, data) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local _identifier = xPlayer.getIdentifier() - updateProfile(_identifier, data, function(result) + updateTwitterProfile(_identifier, data, function(result) cb(result) end) end) From fb6ce054fcedd9e3b6ddee9ec0f4110b7593ed27 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 26 Sep 2020 22:51:38 -0400 Subject: [PATCH 22/44] fix optimization issue in reply and quote buttons --- .../apps/twitter/components/ControlButtons.js | 4 +-- .../apps/twitter/components/QuoteButton.js | 6 +++-- .../apps/twitter/components/ReplyButton.js | 7 +++-- .../twitter/components/alerts/AlertBar.js | 26 +++++++------------ .../components/profile/ProfileUpdateButton.js | 6 ++--- phone/src/apps/twitter/hooks/state.js | 6 ++--- phone/src/apps/twitter/hooks/useProfile.js | 13 +++++++--- .../src/apps/twitter/hooks/useTweetStatus.js | 12 ++++++--- .../apps/twitter/hooks/useTwitterService.js | 5 ++-- 9 files changed, 48 insertions(+), 37 deletions(-) diff --git a/phone/src/apps/twitter/components/ControlButtons.js b/phone/src/apps/twitter/components/ControlButtons.js index 4165c29..9b5bdf0 100644 --- a/phone/src/apps/twitter/components/ControlButtons.js +++ b/phone/src/apps/twitter/components/ControlButtons.js @@ -24,7 +24,7 @@ export const ControlButtons = ({ onCloseClick, onPrimaryClick, }) => { - const { isLoading } = useTweetStatus(); + const { createTweetLoading } = useTweetStatus(); const classes = useStyles(); const { t } = useTranslation(); @@ -35,7 +35,7 @@ export const ControlButtons = ({ : t("APPS_TWITTER_TWEET"); const showCloseButton = showImagePrompt || showEmoji; - if (isLoading) return

!!!

; + if (createTweetLoading) return

!!!

; return (
diff --git a/phone/src/apps/twitter/components/QuoteButton.js b/phone/src/apps/twitter/components/QuoteButton.js index e05020f..0cd6cef 100644 --- a/phone/src/apps/twitter/components/QuoteButton.js +++ b/phone/src/apps/twitter/components/QuoteButton.js @@ -1,11 +1,13 @@ import React from "react"; +import { useSetRecoilState } from "recoil"; import Button from "@material-ui/core/Button"; import QuoteIcon from "@material-ui/icons/FormatQuote"; -import { useModal } from "../hooks/useModal"; +import { twitterState } from "../hooks/state"; export const QuoteButton = ({ message }) => { - const { setMessage, setModalVisible } = useModal(); + const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); + const setMessage = useSetRecoilState(twitterState.modalMessage); const handleClick = () => { setMessage(`> ${message} diff --git a/phone/src/apps/twitter/components/ReplyButton.js b/phone/src/apps/twitter/components/ReplyButton.js index 1de8754..f457531 100644 --- a/phone/src/apps/twitter/components/ReplyButton.js +++ b/phone/src/apps/twitter/components/ReplyButton.js @@ -1,10 +1,13 @@ import React from "react"; +import { useSetRecoilState } from "recoil"; import Button from "@material-ui/core/Button"; import ReplyIcon from "@material-ui/icons/Reply"; -import { useModal } from "../hooks/useModal"; + +import { twitterState } from "../hooks/state"; export const ReplyButton = ({ profile_name }) => { - const { setMessage, setModalVisible } = useModal(); + const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); + const setMessage = useSetRecoilState(twitterState.modalMessage); const handleClick = () => { setMessage(`@${profile_name} `); diff --git a/phone/src/apps/twitter/components/alerts/AlertBar.js b/phone/src/apps/twitter/components/alerts/AlertBar.js index b6b0022..6d36364 100644 --- a/phone/src/apps/twitter/components/alerts/AlertBar.js +++ b/phone/src/apps/twitter/components/alerts/AlertBar.js @@ -19,43 +19,37 @@ const ALERT_TIMEOUT = 4000; export default function AlertBar() { const classes = useStyles(); const { t } = useTranslation(); - const { updateSuccessful, setUpdateSuccessful } = useProfile(); - const { isSuccessful, setIsSuccessful } = useTweetStatus(); + const { updateProfileSuccessful, setUpdateProfileSuccessful } = useProfile(); + const { createTweetSuccessful, setCreateTweetSuccessful } = useTweetStatus(); const [severity, setSeverity] = useState(null); const [open, setOpen] = useState(null); const [message, setMessage] = useState(null); - const handleClose = (event, reason) => { + const handleClose = () => { setOpen(false); - setUpdateSuccessful(null); - setIsSuccessful(null); + setUpdateProfileSuccessful(null); + setCreateTweetSuccessful(null); }; useEffect(() => { - console.log( - "isSuccessful: ", - isSuccessful, - " updateSuccessful: ", - updateSuccessful - ); - if (isSuccessful === true) { + if (createTweetSuccessful === true) { setOpen(true); setSeverity("success"); setMessage(t("APPS_TWITTER_CREATE_SUCCESS")); - } else if (isSuccessful === false) { + } else if (createTweetSuccessful === false) { setOpen(true); setSeverity("error"); setMessage(t("APPS_TWITTER_CREATE_FAILED")); - } else if (updateSuccessful === true) { + } else if (updateProfileSuccessful === true) { setOpen(true); setSeverity("success"); setMessage(t("APPS_TWITTER_EDIT_PROFILE_SUCCESS")); - } else if (updateSuccessful === false) { + } else if (updateProfileSuccessful === false) { setOpen(true); setSeverity("error"); setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE")); } - }, [updateSuccessful, isSuccessful]); + }, [updateProfileSuccessful, createTweetSuccessful]); return ( { setMimimumLoadPassed(false); @@ -28,9 +28,9 @@ export function ProfileUpdateButton({ handleClick }) { setMimimumLoadPassed(true); }, MINIMUM_LOAD_TIME); return () => window.clearTimeout(timeout); - }, [updateInProgress]); + }, [updateProfileLoading]); - const isLoading = updateInProgress || !minimumLoadPassed; + const isLoading = updateProfileLoading || !minimumLoadPassed; return (
diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index 627ff6d..5e049cf 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -21,12 +21,12 @@ export const twitterState = { key: "createTweetLoading", default: false, }), - createTweetSuccess: atom({ - key: "createTweetSuccess", + createTweetSuccessful: atom({ + key: "createTweetSuccessful", default: null, }), updateProfileLoading: atom({ - key: "createTweetLoading", + key: "updateProfileLoading", default: false, }), updateProfileSuccess: atom({ diff --git a/phone/src/apps/twitter/hooks/useProfile.js b/phone/src/apps/twitter/hooks/useProfile.js index 4916a54..a8982e5 100644 --- a/phone/src/apps/twitter/hooks/useProfile.js +++ b/phone/src/apps/twitter/hooks/useProfile.js @@ -3,9 +3,16 @@ import { twitterState } from "./state"; export const useProfile = () => { const profile = useRecoilValue(twitterState.profile); - const updateInProgress = useRecoilValue(twitterState.updateProfileLoading); - const [updateSuccessful, setUpdateSuccessful] = useRecoilState( + const updateProfileLoading = useRecoilValue( + twitterState.updateProfileLoading + ); + const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState( twitterState.updateProfileSuccess ); - return { profile, updateInProgress, updateSuccessful, setUpdateSuccessful }; + return { + profile, + updateProfileLoading, + updateProfileSuccessful, + setUpdateProfileSuccessful, + }; }; diff --git a/phone/src/apps/twitter/hooks/useTweetStatus.js b/phone/src/apps/twitter/hooks/useTweetStatus.js index ac686a6..f8116da 100644 --- a/phone/src/apps/twitter/hooks/useTweetStatus.js +++ b/phone/src/apps/twitter/hooks/useTweetStatus.js @@ -3,9 +3,13 @@ import { useRecoilValue, useRecoilState } from "recoil"; import { twitterState } from "./state"; export const useTweetStatus = () => { - const isLoading = useRecoilValue(twitterState.createTweetLoading); - const [isSuccessful, setIsSuccessful] = useRecoilState( - twitterState.createTweetSuccess + const createTweetLoading = useRecoilValue(twitterState.createTweetLoading); + const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState( + twitterState.createTweetSuccessful ); - return { isLoading, isSuccessful, setIsSuccessful }; + return { + createTweetLoading, + createTweetSuccessful, + setCreateTweetSuccessful, + }; }; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index abda7f6..46a7265 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -38,13 +38,14 @@ export const useTwitterService = () => { ); const setTweets = useSetRecoilState(twitterState.tweets); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); - const setCreateSuccess = useSetRecoilState(twitterState.createTweetSuccess); + const setCreateSuccess = useSetRecoilState( + twitterState.createTweetSuccessful + ); const _setProfile = (profile) => { setProfile(profile[0]); // server returns an array of 1 profile }; const _setUpdateProfileSuccess = (isSuccessful) => { - console.log("got: ", isSuccessful); setUpdateProfileSuccess(isSuccessful); setUpdateProfileLoading(false); // on any result we should set loading to false }; From c414116b49c17e47846f241b1e047c340715d5b0 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 27 Sep 2020 00:55:25 -0400 Subject: [PATCH 23/44] working app loader --- phone/src/apps/twitter/components/Tweet.js | 15 ++++++-- .../twitter/components/TweetListContainer.js | 23 +----------- .../src/apps/twitter/components/TwitterApp.js | 28 +++++++++++---- .../apps/twitter/components/TwitterLoader.js | 36 +++++++++++++++++++ phone/src/apps/twitter/hooks/state.js | 2 +- 5 files changed, 72 insertions(+), 32 deletions(-) create mode 100644 phone/src/apps/twitter/components/TwitterLoader.js diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index b6f68d5..f7ed254 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -30,8 +30,16 @@ const useStyles = makeStyles(() => ({ flexFlow: "column nowrap", width: "100%", }, + profile: { + fontSize: "24px", + fontWeight: "bold", + }, date: { marginLeft: "10px", + fontSize: "16px", + }, + message: { + fontSize: "22px", }, buttonContainer: { display: "flex", @@ -58,14 +66,17 @@ export const Tweet = (tweet) => { const formattedMessage = message.replace(/\n\r?/g, "
"); const Message = () => ( <> -
+
); const Primary = () => ( <> - {`@${profile_name}`} + {`@${profile_name}`} { - Nui.send("phone:fetchTweets", {}); - - // 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 - // be accomplished this is naive but robust. - // - // TODO don't call fetchTweets - implement a function that only - // returns tweets that we don't already have - const timeout = window.setTimeout(() => { - Nui.send("phone:fetchTweets", {}); - }, TWEETS_REFRESH_RATE); - return () => window.clearTimeout(timeout); - }, []); - return ; } diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 8b42384..6edaf9e 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -14,9 +14,11 @@ import TwitterTitle from "./TwitterTitle"; import BottomNavigation from "./BottomNavigation"; import TwitterProfile from "./profile/TwitterProfile"; import AlertBar from "./alerts/AlertBar"; +import TwitterLoader from "./TwitterLoader"; import "./twitter.css"; import "emoji-mart/css/emoji-mart.css"; +import { useTweets } from "../hooks/useTweets"; const useStyles = makeStyles((theme) => ({ backgroundModal: { @@ -38,6 +40,7 @@ const PAGE_COMPONENT_MAPPING = { 2: , }; const MINIMUM_LOAD_TIME = 750; +const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config export const TwitterApp = () => { const classes = useStyles(); @@ -45,9 +48,23 @@ export const TwitterApp = () => { const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); const [activePage, setActivePage] = useState(0); const { profile } = useProfile(); + const { tweets } = useTweets(); useEffect(() => { Nui.send("phone:getOrCreateTwitterProfile", {}); + Nui.send("phone:fetchTweets", {}); + + // 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 + // be accomplished this is naive but robust. + // + // TODO don't call fetchTweets - implement a function that only + // returns tweets that we don't already have + const timeout = window.setTimeout(() => { + Nui.send("phone:fetchTweets", {}); + }, TWEETS_REFRESH_RATE); + return () => window.clearTimeout(timeout); }, []); useEffect(() => { @@ -63,20 +80,17 @@ export const TwitterApp = () => { // we add a minimum (but short) load time here so that // there isn't a quick flash of loading and immediately // another flash to the tweets screen. - const hasLoaded = profile && minimumLoadPassed; + const hasLoaded = tweets && profile && minimumLoadPassed; const showTweetButton = hasLoaded && activePage === 0; - const component = hasLoaded ? ( - PAGE_COMPONENT_MAPPING[activePage] - ) : ( - - ); + + if (!hasLoaded) return ; return (
- {component} + {PAGE_COMPONENT_MAPPING[activePage]} {showTweetButton && } ({ + root: { + height: "100%", + width: "100%", + display: "flex", + flexFlow: "row nowrap", + justifyContent: "center", + alignItems: "center", + }, + icon: { + color: "#00acee", + fontSize: "100px", + }, +})); + +export const TwitterLoader = () => { + const classes = useStyles(); + return ( + + +
+ +
+
+
+ ); +}; + +export default TwitterLoader; diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index 5e049cf..860e502 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -7,7 +7,7 @@ export const twitterState = { }), tweets: atom({ key: "tweets", - default: [], + default: null, }), showCreateTweetModal: atom({ key: "showCreateTweetModal", From 660f53417630df063048ecaaa0c8590fd10ea521 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 27 Sep 2020 01:26:11 -0400 Subject: [PATCH 24/44] added search field --- .../apps/twitter/components/SearchButton.js | 29 +++++++++ phone/src/apps/twitter/components/Tweet.js | 28 ++++---- .../src/apps/twitter/components/TwitterApp.js | 4 +- .../apps/twitter/components/TwitterSearch.js | 65 +++++++++++++++++++ .../components/profile/ProfileField.js | 11 +++- .../components/profile/TwitterProfile.js | 1 + phone/src/locale/en.json | 2 + phone/src/os/apps/hooks/useApps.js | 4 +- resources/server/sv_twitter.lua | 2 +- 9 files changed, 126 insertions(+), 20 deletions(-) create mode 100644 phone/src/apps/twitter/components/SearchButton.js create mode 100644 phone/src/apps/twitter/components/TwitterSearch.js diff --git a/phone/src/apps/twitter/components/SearchButton.js b/phone/src/apps/twitter/components/SearchButton.js new file mode 100644 index 0000000..606ba0f --- /dev/null +++ b/phone/src/apps/twitter/components/SearchButton.js @@ -0,0 +1,29 @@ +import React, { useState, useEffect } from "react"; +import { makeStyles } from "@material-ui/core/styles"; +import Fab from "@material-ui/core/Fab"; +import SearchIcon from "@material-ui/icons/Search"; + +const useStyles = makeStyles((theme) => ({ + root: { + position: "absolute", + bottom: "15px", + right: "15px", + }, + button: { + background: "#00acee", + }, +})); + +export function ProfileUpdateButton({ handleClick }) { + const classes = useStyles(); + + return ( +
+ + + +
+ ); +} + +export default ProfileUpdateButton; diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index f7ed254..5b5dcdd 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -39,7 +39,7 @@ const useStyles = makeStyles(() => ({ fontSize: "16px", }, message: { - fontSize: "22px", + fontSize: "20px", }, buttonContainer: { display: "flex", @@ -61,19 +61,6 @@ export const Tweet = (tweet) => { const classes = useStyles(); const { t } = useTranslation(); - // this is a workaround to transfer string new lines and returns that - // are stored into the database into html for the UI to render - const formattedMessage = message.replace(/\n\r?/g, "
"); - const Message = () => ( - <> -
- - - ); - const Primary = () => ( <> {`@${profile_name}`} @@ -88,6 +75,19 @@ export const Tweet = (tweet) => { ); + // this is a workaround to transfer string new lines and returns that + // are stored into the database into html for the UI to render + const formattedMessage = message.replace(/\n\r?/g, "
"); + const Message = () => ( + <> +
+ + + ); + return ( diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index 6edaf9e..c00e668 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -6,7 +6,6 @@ import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; import TweetListContainer from "./TweetListContainer"; import AddTweetModal from "./AddTweetModal"; -import { AppLoader } from "../../../ui/components/AppLoader"; import { useModal } from "../hooks/useModal"; import { useProfile } from "../hooks/useProfile"; import TweetButton from "./TweetButton"; @@ -15,6 +14,7 @@ import BottomNavigation from "./BottomNavigation"; import TwitterProfile from "./profile/TwitterProfile"; import AlertBar from "./alerts/AlertBar"; import TwitterLoader from "./TwitterLoader"; +import TwitterSearch from "./TwitterSearch"; import "./twitter.css"; import "emoji-mart/css/emoji-mart.css"; @@ -36,7 +36,7 @@ const useStyles = makeStyles((theme) => ({ // TODO move this to the router so the application back button works const PAGE_COMPONENT_MAPPING = { 0: , - 1: , + 1: , 2: , }; const MINIMUM_LOAD_TIME = 750; diff --git a/phone/src/apps/twitter/components/TwitterSearch.js b/phone/src/apps/twitter/components/TwitterSearch.js new file mode 100644 index 0000000..17e1cb0 --- /dev/null +++ b/phone/src/apps/twitter/components/TwitterSearch.js @@ -0,0 +1,65 @@ +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { makeStyles } from "@material-ui/core/styles"; +import { TextField } from "@material-ui/core"; +import TweetList from "./TweetList"; + +import SearchButton from "./SearchButton"; +import { useTweets } from "../hooks/useTweets"; + +const useStyles = makeStyles({ + root: { + width: "100%", + }, + searchContainer: { + padding: "15px", + }, + search: { + width: "100%", + }, +}); + +function TwitterSearch() { + const classes = useStyles(); + const { t } = useTranslation(); + const { tweets } = useTweets(); + const [searchValue, setSearchValue] = useState(""); + const [filteredTweets, setFilteredTweets] = useState(tweets); + const handleChange = (e) => setSearchValue(e.target.value); + + const handleSubmit = () => { + if (!searchValue.trim()) return; + + setFilteredTweets( + tweets.filter((tweet) => { + const v = searchValue.toLowerCase(); + return ( + tweet.profile_name.toLowerCase().includes(v) || + tweet.message.toLowerCase().includes(v) + ); + }) + ); + }; + + return ( + <> +
+
+ input && input.focus()} + /> +
+ +
+ + + ); +} + +export default TwitterSearch; diff --git a/phone/src/apps/twitter/components/profile/ProfileField.js b/phone/src/apps/twitter/components/profile/ProfileField.js index c82711c..da7150c 100644 --- a/phone/src/apps/twitter/components/profile/ProfileField.js +++ b/phone/src/apps/twitter/components/profile/ProfileField.js @@ -12,7 +12,14 @@ const useStyles = makeStyles({ }, }); -function ProfileField({ label, value, handleChange, allowChange, multiline }) { +function ProfileField({ + label, + value, + handleChange, + allowChange, + multiline, + inputRef, +}) { const classes = useStyles(); const _handleChange = (e) => handleChange(e.target.value); @@ -25,6 +32,7 @@ function ProfileField({ label, value, handleChange, allowChange, multiline }) { onChange={_handleChange} disabled={!allowChange} multiline={multiline} + inputRef={inputRef} />
); @@ -33,6 +41,7 @@ function ProfileField({ label, value, handleChange, allowChange, multiline }) { ProfileField.defaultProps = { allowChange: true, multiline: false, + inputRef: null, }; export default ProfileField; diff --git a/phone/src/apps/twitter/components/profile/TwitterProfile.js b/phone/src/apps/twitter/components/profile/TwitterProfile.js index da9efaf..fd75d42 100644 --- a/phone/src/apps/twitter/components/profile/TwitterProfile.js +++ b/phone/src/apps/twitter/components/profile/TwitterProfile.js @@ -66,6 +66,7 @@ export function TwitterProfile() { value={bio} handleChange={handleBioChange} multiline + inputRef={(input) => input && input.focus()} /> , + icon: , backgroundColor: blue[600], color: common.white, path: "/twitter", diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index 982f8e3..cb74dcd 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -21,7 +21,7 @@ ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) LEFT OUTER JOIN npwd_twitter_profiles ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier WHERE visible = 1 ORDER BY npwd_twitter_tweets.createdAt DESC - LIMIT 75 + LIMIT 100 ]], {}, function(tweets) cb(tweets) end) From 7955fa301773080b8323957041c1e58f7c5503c4 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 27 Sep 2020 11:24:07 -0400 Subject: [PATCH 25/44] working search functionality --- .../apps/twitter/components/AddTweetModal.js | 2 +- phone/src/apps/twitter/components/Tweet.js | 55 ++++++++++--------- .../twitter/components/TweetListContainer.js | 2 + .../apps/twitter/components/TweetSkeleton.js | 12 ++++ .../twitter/components/TweetSkeletonList.js | 16 ++++++ .../src/apps/twitter/components/TwitterApp.js | 8 +-- .../apps/twitter/components/TwitterSearch.js | 27 +++++---- phone/src/apps/twitter/hooks/state.js | 4 ++ .../apps/twitter/hooks/useFilteredTweets.js | 7 +++ .../apps/twitter/hooks/useTwitterService.js | 5 ++ resources/client/cl_twitter.lua | 18 +++++- resources/server/sv_twitter.lua | 44 ++++++++++++++- 12 files changed, 149 insertions(+), 51 deletions(-) create mode 100644 phone/src/apps/twitter/components/TweetSkeleton.js create mode 100644 phone/src/apps/twitter/components/TweetSkeletonList.js create mode 100644 phone/src/apps/twitter/hooks/useFilteredTweets.js diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index e1b7af2..cd75644 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -25,7 +25,7 @@ const useStyles = makeStyles((theme) => ({ display: "flex", flexFlow: "column nowrap", position: "absolute", - top: "35px", + top: "80px", }, button: { margin: 5, diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 5b5dcdd..3f56a52 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -1,12 +1,12 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; -import ListItemText from "@material-ui/core/ListItemText"; import ListItemAvatar from "@material-ui/core/ListItemAvatar"; import MuiAvatar from "@material-ui/core/Avatar"; import Button from "@material-ui/core/Button"; import Typography from "@material-ui/core/Typography"; import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; +import MoreIcon from "@material-ui/icons/MoreVert"; import { ListItem } from "../../../ui/components/ListItem"; import { secondsToHumanReadable } from "../utils/time"; @@ -30,8 +30,14 @@ const useStyles = makeStyles(() => ({ flexFlow: "column nowrap", width: "100%", }, + primary: { + display: "flex", + flexFlow: "row nowrap", + width: "100%", + alignItems: "flex-end", + }, profile: { - fontSize: "24px", + fontSize: "22px", fontWeight: "bold", }, date: { @@ -40,6 +46,7 @@ const useStyles = makeStyles(() => ({ }, message: { fontSize: "20px", + color: "rgba(255, 255, 255, 0.7)", }, buttonContainer: { display: "flex", @@ -47,6 +54,7 @@ const useStyles = makeStyles(() => ({ justifyContent: "space-between", width: "100%", marginLeft: "-20px", // easier to do this here than override the MUI styles + marginTop: "3px", }, })); @@ -61,32 +69,9 @@ export const Tweet = (tweet) => { const classes = useStyles(); const { t } = useTranslation(); - const Primary = () => ( - <> - {`@${profile_name}`} - - {secondsToHumanReadable(t, seconds_since_tweet)} - - - ); - // this is a workaround to transfer string new lines and returns that // are stored into the database into html for the UI to render const formattedMessage = message.replace(/\n\r?/g, "
"); - const Message = () => ( - <> -
- - - ); return ( @@ -96,13 +81,31 @@ export const Tweet = (tweet) => {
- } secondary={} /> +
+
{`@${profile_name}`}
+ + {secondsToHumanReadable(t, seconds_since_tweet)} + +
+
+
+
diff --git a/phone/src/apps/twitter/components/TweetListContainer.js b/phone/src/apps/twitter/components/TweetListContainer.js index 19b842d..bd31a93 100644 --- a/phone/src/apps/twitter/components/TweetListContainer.js +++ b/phone/src/apps/twitter/components/TweetListContainer.js @@ -2,9 +2,11 @@ import React from "react"; import { useTweets } from "../hooks/useTweets"; import TweetList from "./TweetList"; +import TweetSkeletonList from "./TweetSkeletonList"; export function TweetListContainer() { const { tweets } = useTweets(); + if (1 || !tweets) return ; return ; } diff --git a/phone/src/apps/twitter/components/TweetSkeleton.js b/phone/src/apps/twitter/components/TweetSkeleton.js new file mode 100644 index 0000000..2749229 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetSkeleton.js @@ -0,0 +1,12 @@ +import React from "react"; +import Skeleton from "@material-ui/lab/Skeleton"; + +export default function TweetSkeleton() { + return ( +
+ + + +
+ ); +} diff --git a/phone/src/apps/twitter/components/TweetSkeletonList.js b/phone/src/apps/twitter/components/TweetSkeletonList.js new file mode 100644 index 0000000..2baaf55 --- /dev/null +++ b/phone/src/apps/twitter/components/TweetSkeletonList.js @@ -0,0 +1,16 @@ +import React from "react"; + +import { List } from "../../../ui/components/List"; +import TweetSkeleton from "./TweetSkeleton"; + +export function TweetSkeletonList() { + return ( + + {new Array(10).map(() => ( + + ))} + + ); +} + +export default TweetSkeletonList; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index c00e668..ed6df07 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -39,7 +39,7 @@ const PAGE_COMPONENT_MAPPING = { 1: , 2: , }; -const MINIMUM_LOAD_TIME = 750; +const MINIMUM_LOAD_TIME = 500; const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config export const TwitterApp = () => { @@ -48,8 +48,6 @@ export const TwitterApp = () => { const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); const [activePage, setActivePage] = useState(0); const { profile } = useProfile(); - const { tweets } = useTweets(); - useEffect(() => { Nui.send("phone:getOrCreateTwitterProfile", {}); Nui.send("phone:fetchTweets", {}); @@ -80,11 +78,9 @@ export const TwitterApp = () => { // we add a minimum (but short) load time here so that // there isn't a quick flash of loading and immediately // another flash to the tweets screen. - const hasLoaded = tweets && profile && minimumLoadPassed; + const hasLoaded = profile && minimumLoadPassed; const showTweetButton = hasLoaded && activePage === 0; - if (!hasLoaded) return ; - return ( diff --git a/phone/src/apps/twitter/components/TwitterSearch.js b/phone/src/apps/twitter/components/TwitterSearch.js index 17e1cb0..61de6a7 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.js +++ b/phone/src/apps/twitter/components/TwitterSearch.js @@ -1,11 +1,13 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { TextField } from "@material-ui/core"; import TweetList from "./TweetList"; +import Nui from "../../../os/nui-events/utils/Nui"; import SearchButton from "./SearchButton"; import { useTweets } from "../hooks/useTweets"; +import { useFilteredTweets } from "../hooks/useFilteredTweets"; const useStyles = makeStyles({ root: { @@ -22,23 +24,20 @@ const useStyles = makeStyles({ function TwitterSearch() { const classes = useStyles(); const { t } = useTranslation(); - const { tweets } = useTweets(); const [searchValue, setSearchValue] = useState(""); - const [filteredTweets, setFilteredTweets] = useState(tweets); + const { tweets, setTweets } = useFilteredTweets(); + + useEffect(() => { + setTweets(null); // clear the filtered tweets on app load + }); + const handleChange = (e) => setSearchValue(e.target.value); const handleSubmit = () => { - if (!searchValue.trim()) return; + const cleanedSearchValue = searchValue.trim(); + if (!cleanedSearchValue) return; - setFilteredTweets( - tweets.filter((tweet) => { - const v = searchValue.toLowerCase(); - return ( - tweet.profile_name.toLowerCase().includes(v) || - tweet.message.toLowerCase().includes(v) - ); - }) - ); + Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue); }; return ( @@ -55,7 +54,7 @@ function TwitterSearch() { inputRef={(input) => input && input.focus()} />
- +
diff --git a/phone/src/apps/twitter/hooks/state.js b/phone/src/apps/twitter/hooks/state.js index 860e502..130a509 100644 --- a/phone/src/apps/twitter/hooks/state.js +++ b/phone/src/apps/twitter/hooks/state.js @@ -9,6 +9,10 @@ export const twitterState = { key: "tweets", default: null, }), + filteredTweets: atom({ + key: "filteredTweets", + default: null, + }), showCreateTweetModal: atom({ key: "showCreateTweetModal", default: false, diff --git a/phone/src/apps/twitter/hooks/useFilteredTweets.js b/phone/src/apps/twitter/hooks/useFilteredTweets.js new file mode 100644 index 0000000..e1fbebe --- /dev/null +++ b/phone/src/apps/twitter/hooks/useFilteredTweets.js @@ -0,0 +1,7 @@ +import { useRecoilState } from "recoil"; +import { twitterState } from "./state"; + +export const useFilteredTweets = () => { + const [tweets, setTweets] = useRecoilState(twitterState.filteredTweets); + return { tweets, setTweets }; +}; diff --git a/phone/src/apps/twitter/hooks/useTwitterService.js b/phone/src/apps/twitter/hooks/useTwitterService.js index 46a7265..d257ee8 100644 --- a/phone/src/apps/twitter/hooks/useTwitterService.js +++ b/phone/src/apps/twitter/hooks/useTwitterService.js @@ -37,6 +37,7 @@ export const useTwitterService = () => { twitterState.updateProfileSuccess ); const setTweets = useSetRecoilState(twitterState.tweets); + const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets); const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading); const setCreateSuccess = useSetRecoilState( twitterState.createTweetSuccessful @@ -58,6 +59,9 @@ export const useTwitterService = () => { const _setTweets = (tweets) => { setTweets(tweets.map(processTweet)); }; + const _setFilteredTweets = (tweets) => { + setFilteredTweets(tweets.map(processTweet)); + }; useNuiEvent(types.APP_TWITTER, "getOrCreateTwitterProfile", _setProfile); useNuiEvent( @@ -71,6 +75,7 @@ export const useTwitterService = () => { _setUpdateProfileSuccess ); useNuiEvent(types.APP_TWITTER, "fetchTweets", _setTweets); + useNuiEvent(types.APP_TWITTER, "fetchTweetsFiltered", _setFilteredTweets); useNuiEvent(types.APP_TWITTER, "createTweetLoading", setCreateLoading); useNuiEvent(types.APP_TWITTER, "createTweetResult", _setCreateSuccess); }; diff --git a/resources/client/cl_twitter.lua b/resources/client/cl_twitter.lua index d32d0cb..2dc5028 100644 --- a/resources/client/cl_twitter.lua +++ b/resources/client/cl_twitter.lua @@ -27,10 +27,24 @@ AddEventHandler('phone:fetchTweets', function() end) end) +RegisterNetEvent('phone:fetchTweetsFiltered') +AddEventHandler('phone:fetchTweetsFiltered', function(searchValue) + print('fetchTweetsFiltered', searchValue) + ESX.TriggerServerCallback('phone:fetchTweetsFiltered', function(tweets) + sendMessage('fetchTweetsFiltered', tweets) + end, searchValue) +end) + RegisterNUICallback('phone:fetchTweets', function() - TriggerEvent('phone:fetchTweets') - end) + TriggerEvent('phone:fetchTweets') +end) + + +RegisterNUICallback('phone:fetchTweetsFiltered', function(searchValue) + TriggerEvent('phone:fetchTweetsFiltered', searchValue) +end) + RegisterNUICallback('phone:createTweet', function(data) sendMessage('createTweetLoading', true) diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index cb74dcd..98b886c 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -4,7 +4,7 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) +function fetchAllTweets(cb) MySQL.Async.fetchAll([[ SELECT npwd_twitter_tweets.id, @@ -22,9 +22,49 @@ ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) WHERE visible = 1 ORDER BY npwd_twitter_tweets.createdAt DESC LIMIT 100 - ]], {}, function(tweets) + ]], + {}, + function(tweets) cb(tweets) end) +end + +function fetchTweetsFiltered(searchValue, cb) + local searchValueParameterized = '%' .. searchValue .. '%' + MySQL.Async.fetchAll([[ + SELECT + npwd_twitter_tweets.id, + npwd_twitter_tweets.createdAt, + npwd_twitter_tweets.likes, + npwd_twitter_tweets.identifier, + npwd_twitter_tweets.visible, + npwd_twitter_tweets.images, + npwd_twitter_tweets.message, + npwd_twitter_profiles.profile_name, + npwd_twitter_profiles.avatar_url, + TIME_TO_SEC(TIMEDIFF( NOW(), npwd_twitter_tweets.createdAt)) AS seconds_since_tweet + FROM npwd_twitter_tweets + LEFT OUTER JOIN npwd_twitter_profiles ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier + WHERE visible = 1 AND (npwd_twitter_profiles.profile_name LIKE @profile_name OR npwd_twitter_tweets.message LIKE @message) + ORDER BY npwd_twitter_tweets.createdAt DESC + LIMIT 100 + ]], + { + profile_name = searchValueParameterized, + message = searchValueParameterized + }, + function(tweets) + cb(tweets) + end) +end + +ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb) + fetchAllTweets(cb) +end) + + -- search value expected to be lower case +ESX.RegisterServerCallback('phone:fetchTweetsFiltered', function(source, cb, searchValue) + fetchTweetsFiltered(searchValue, cb) end) From 2f525796352bc9fea5c462fcd29d278f57b20891 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 27 Sep 2020 11:41:03 -0400 Subject: [PATCH 26/44] minor styling changes --- phone/src/apps/twitter/components/Tweet.js | 6 +++--- phone/src/apps/twitter/components/TweetListContainer.js | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/Tweet.js index 3f56a52..e4eb530 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/Tweet.js @@ -37,15 +37,15 @@ const useStyles = makeStyles(() => ({ alignItems: "flex-end", }, profile: { - fontSize: "22px", + fontSize: "18px", fontWeight: "bold", }, date: { marginLeft: "10px", - fontSize: "16px", + fontSize: "14px", }, message: { - fontSize: "20px", + fontSize: "18px", color: "rgba(255, 255, 255, 0.7)", }, buttonContainer: { diff --git a/phone/src/apps/twitter/components/TweetListContainer.js b/phone/src/apps/twitter/components/TweetListContainer.js index bd31a93..19b842d 100644 --- a/phone/src/apps/twitter/components/TweetListContainer.js +++ b/phone/src/apps/twitter/components/TweetListContainer.js @@ -2,11 +2,9 @@ import React from "react"; import { useTweets } from "../hooks/useTweets"; import TweetList from "./TweetList"; -import TweetSkeletonList from "./TweetSkeletonList"; export function TweetListContainer() { const { tweets } = useTweets(); - if (1 || !tweets) return ; return ; } From b2b69365ba040dfffaace87d2f57d2133326d86f Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sun, 27 Sep 2020 14:42:14 -0400 Subject: [PATCH 27/44] working tweets skeleton --- .../src/apps/twitter/components/TweetList.js | 2 + .../apps/twitter/components/TweetSkeleton.js | 37 ++++++++++++++++--- .../twitter/components/TweetSkeletonList.js | 13 +++++-- .../apps/twitter/components/TwitterSearch.js | 7 +--- resources/config.lua | 2 + 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/TweetList.js index 85df6b5..467e90a 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/TweetList.js @@ -2,8 +2,10 @@ import React from "react"; import { List } from "../../../ui/components/List"; import Tweet from "./Tweet"; +import TweetSkeletonList from "./TweetSkeletonList"; export function TweetList({ tweets }) { + if (!tweets) return ; return ( {tweets.map((tweet) => ( diff --git a/phone/src/apps/twitter/components/TweetSkeleton.js b/phone/src/apps/twitter/components/TweetSkeleton.js index 2749229..2154e88 100644 --- a/phone/src/apps/twitter/components/TweetSkeleton.js +++ b/phone/src/apps/twitter/components/TweetSkeleton.js @@ -1,12 +1,39 @@ import React from "react"; +import Divider from "@material-ui/core/Divider"; +import { makeStyles } from "@material-ui/core/styles"; import Skeleton from "@material-ui/lab/Skeleton"; +const useStyles = makeStyles({ + root: { + width: "100%", + padding: "15px", + display: "flex", + flexFlow: "row nowrap", + marginTop: "3px", + marginBottom: "3px", + }, + left: {}, + right: { + marginLeft: "15px", + marginTop: "-5px", + }, +}); + export default function TweetSkeleton() { + const classes = useStyles(); return ( -
- - - -
+ <> +
+
+ +
+
+ + +
+
+ + + ); } diff --git a/phone/src/apps/twitter/components/TweetSkeletonList.js b/phone/src/apps/twitter/components/TweetSkeletonList.js index 2baaf55..27274e9 100644 --- a/phone/src/apps/twitter/components/TweetSkeletonList.js +++ b/phone/src/apps/twitter/components/TweetSkeletonList.js @@ -6,9 +6,16 @@ import TweetSkeleton from "./TweetSkeleton"; export function TweetSkeletonList() { return ( - {new Array(10).map(() => ( - - ))} + + + + + + + + + + ); } diff --git a/phone/src/apps/twitter/components/TwitterSearch.js b/phone/src/apps/twitter/components/TwitterSearch.js index 61de6a7..f42db9f 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.js +++ b/phone/src/apps/twitter/components/TwitterSearch.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { TextField } from "@material-ui/core"; @@ -6,7 +6,6 @@ import TweetList from "./TweetList"; import Nui from "../../../os/nui-events/utils/Nui"; import SearchButton from "./SearchButton"; -import { useTweets } from "../hooks/useTweets"; import { useFilteredTweets } from "../hooks/useFilteredTweets"; const useStyles = makeStyles({ @@ -27,10 +26,6 @@ function TwitterSearch() { const [searchValue, setSearchValue] = useState(""); const { tweets, setTweets } = useFilteredTweets(); - useEffect(() => { - setTweets(null); // clear the filtered tweets on app load - }); - const handleChange = (e) => setSearchValue(e.target.value); const handleSubmit = () => { diff --git a/resources/config.lua b/resources/config.lua index 55722dc..812f36b 100644 --- a/resources/config.lua +++ b/resources/config.lua @@ -7,6 +7,8 @@ Config.KeyTakeCall = 38 -- E Config.PhoneAsItem = false Config.twitter = {} +Config.twitter.registerByName = true -- if users can register by first_name and last_name from the users table +Config.twitter.registerByPhoneNumber = true -- if users can register by phone_number from the users table Config.twitter.characterLimit = 240 Config.twitter.allowEdtiableProfileName = true Config.twitter.showAvatars = true From 11977c48efbdc344ae21cd95a483e4f7bab3a086 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 3 Oct 2020 10:35:22 -0400 Subject: [PATCH 28/44] moved modal to standalone component --- phone/src/Phone.js | 3 +- .../apps/twitter/components/AddTweetModal.js | 68 ++++++++----------- .../components/profile/TwitterProfile.js | 1 - phone/src/ui/components/Modal.js | 56 +++++++++++++++ 4 files changed, 85 insertions(+), 43 deletions(-) diff --git a/phone/src/Phone.js b/phone/src/Phone.js index 4734295..0b77e0c 100644 --- a/phone/src/Phone.js +++ b/phone/src/Phone.js @@ -18,7 +18,6 @@ import { useApps } from "./os/apps/hooks/useApps"; import { useContactsService } from "./apps/contacts/hooks/useContactsService"; import { useTwitterService } from "./apps/twitter/hooks/useTwitterService"; -import { TwitterApp } from "./apps/twitter/components/TwitterApp"; // These events are just for testing. Comment it out before building. //setTimeout(() => { @@ -110,7 +109,7 @@ function Phone() { ]} />
- + {allApps.map((App) => ( ))} diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index cd75644..27fb934 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -6,6 +6,7 @@ import CloseIcon from "@material-ui/icons/Close"; import { v4 as uuidv4 } from "uuid"; import Nui from "../../../os/nui-events/utils/Nui"; +import Modal from "../../../ui/components/Modal"; import { IMAGE_DELIMITER } from "../utils/images"; import { withValidImage } from "../utils/images"; import { useModal } from "../hooks/useModal"; @@ -44,17 +45,6 @@ const useStyles = makeStyles((theme) => ({ justifyContent: "space-between", flex: "1 0 45px", }, - displayBlock: { - /*Sets modal to center*/ - display: "flex", - flexFlow: "column nowrap", - justifyContent: "center", - alignItems: "center", - position: "relative", - }, - displayNone: { - display: "none", - }, emojiPicker: { background: "none", border: "none", @@ -162,37 +152,35 @@ export const AddTweetModal = () => { }; return ( -
- - - - + + + + + 0} + images={images} + removeImage={removeImage} + /> +
+ - - 0} - images={images} - removeImage={removeImage} + -
- - -
- -
+
+ ); }; diff --git a/phone/src/apps/twitter/components/profile/TwitterProfile.js b/phone/src/apps/twitter/components/profile/TwitterProfile.js index fd75d42..da9efaf 100644 --- a/phone/src/apps/twitter/components/profile/TwitterProfile.js +++ b/phone/src/apps/twitter/components/profile/TwitterProfile.js @@ -66,7 +66,6 @@ export function TwitterProfile() { value={bio} handleChange={handleBioChange} multiline - inputRef={(input) => input && input.focus()} /> ({ + root: { + zIndex: 10, + background: "#424242", + marginTop: "15px", + width: "90%", + display: "flex", + flexFlow: "column nowrap", + position: "absolute", + top: "80px", + }, + displayBlock: { + /*Sets modal to center*/ + display: "flex", + flexFlow: "column nowrap", + justifyContent: "center", + alignItems: "center", + position: "relative", + }, + displayNone: { + display: "none", + }, +})); + +export const Modal = ({ children, visible, handleClose }) => { + const classes = useStyles(); + + // when the user presses escape we should close the modal + const _handleEscape = (e) => { + const isEscapeKey = e.key == "Escape" || e.key == "Esc"; + if (isEscapeKey) { + e.preventDefault(); + handleClose(); + } + }; + useEffect(() => { + const listener = window.addEventListener("keydown", _handleEscape, true); + return () => window.removeEventListener("keydown", listener); + }, []); + + const showHideClassName = visible + ? classes.displayBlock + : classes.displayNone; + + return ( +
+ {children} +
+ ); +}; + +export default Modal; From 2a6429c446c1356ddd51d18119d11fa959f660a6 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 3 Oct 2020 10:50:13 -0400 Subject: [PATCH 29/44] reorganization --- .../apps/twitter/components/AddTweetModal.js | 19 ++++------ .../twitter/components/BottomNavigation.js | 3 +- .../src/apps/twitter/components/TwitterApp.js | 8 ++--- .../apps/twitter/components/TwitterLoader.js | 36 ------------------- .../apps/twitter/components/TwitterSearch.js | 4 +-- .../apps/twitter/components/TwitterTitle.js | 1 - .../twitter/components/alerts/AlertBar.js | 2 +- .../{ => buttons}/ControlButtons.js | 2 +- .../components/{ => buttons}/IconButtons.js | 0 .../ProfileUpdateButton.js | 3 +- .../components/{ => buttons}/QuoteButton.js | 4 +-- .../components/{ => buttons}/ReplyButton.js | 4 +-- .../components/{ => buttons}/SearchButton.js | 4 +-- .../components/{ => buttons}/TweetButton.js | 4 +-- .../twitter/components/{ => images}/Image.js | 2 +- .../components/{ => images}/ImageDisplay.js | 0 .../components/{ => images}/ImagePrompt.js | 0 .../profile/{TwitterProfile.js => Profile.js} | 4 +-- .../twitter/components/{ => tweet}/Tweet.js | 22 ++++++------ .../components/{ => tweet}/TweetList.js | 2 +- .../{ => tweet}/TweetListContainer.js | 2 +- .../components/{ => tweet}/TweetMessage.js | 0 .../components/{ => tweet}/TweetSkeleton.js | 0 .../{ => tweet}/TweetSkeletonList.js | 2 +- 24 files changed, 43 insertions(+), 85 deletions(-) delete mode 100644 phone/src/apps/twitter/components/TwitterLoader.js rename phone/src/apps/twitter/components/{ => buttons}/ControlButtons.js (95%) rename phone/src/apps/twitter/components/{ => buttons}/IconButtons.js (100%) rename phone/src/apps/twitter/components/{profile => buttons}/ProfileUpdateButton.js (96%) rename phone/src/apps/twitter/components/{ => buttons}/QuoteButton.js (85%) rename phone/src/apps/twitter/components/{ => buttons}/ReplyButton.js (85%) rename phone/src/apps/twitter/components/{ => buttons}/SearchButton.js (86%) rename phone/src/apps/twitter/components/{ => buttons}/TweetButton.js (86%) rename phone/src/apps/twitter/components/{ => images}/Image.js (97%) rename phone/src/apps/twitter/components/{ => images}/ImageDisplay.js (100%) rename phone/src/apps/twitter/components/{ => images}/ImagePrompt.js (100%) rename phone/src/apps/twitter/components/profile/{TwitterProfile.js => Profile.js} (97%) rename phone/src/apps/twitter/components/{ => tweet}/Tweet.js (84%) rename phone/src/apps/twitter/components/{ => tweet}/TweetList.js (86%) rename phone/src/apps/twitter/components/{ => tweet}/TweetListContainer.js (80%) rename phone/src/apps/twitter/components/{ => tweet}/TweetMessage.js (100%) rename phone/src/apps/twitter/components/{ => tweet}/TweetSkeleton.js (100%) rename phone/src/apps/twitter/components/{ => tweet}/TweetSkeletonList.js (88%) diff --git a/phone/src/apps/twitter/components/AddTweetModal.js b/phone/src/apps/twitter/components/AddTweetModal.js index 27fb934..673970e 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.js +++ b/phone/src/apps/twitter/components/AddTweetModal.js @@ -1,7 +1,6 @@ import React, { useState, useEffect } from "react"; -import { useRecoilState } from "recoil"; import { makeStyles } from "@material-ui/core/styles"; -import { Button, Paper } from "@material-ui/core"; +import { Button } from "@material-ui/core"; import CloseIcon from "@material-ui/icons/Close"; import { v4 as uuidv4 } from "uuid"; @@ -11,11 +10,11 @@ import { IMAGE_DELIMITER } from "../utils/images"; import { withValidImage } from "../utils/images"; import { useModal } from "../hooks/useModal"; import EmojiSelect from "./EmojiSelect"; -import ImageDisplay from "./ImageDisplay"; -import ImagePrompt from "./ImagePrompt"; -import TweetMessage from "./TweetMessage"; -import ControlButtons from "./ControlButtons"; -import IconButtons from "./IconButtons"; +import ImageDisplay from "./images/ImageDisplay"; +import ImagePrompt from "./images/ImagePrompt"; +import TweetMessage from "./tweet/TweetMessage"; +import ControlButtons from "./buttons/ControlButtons"; +import IconButtons from "./buttons/IconButtons"; const useStyles = makeStyles((theme) => ({ root: { @@ -89,10 +88,6 @@ export const AddTweetModal = () => { return () => window.removeEventListener("keydown", listener); }, []); - const showHideClassName = modalVisible - ? classes.displayBlock - : classes.displayNone; - const submitTweet = () => { if (message.trim().length === 0) return; @@ -128,7 +123,7 @@ export const AddTweetModal = () => { withValidImage(cleanedLink, () => setImages([...images, image])); setShowImagePrompt(false); - setLink(""); + setImages([]); }; const removeImage = (id) => setImages(images.filter((image) => id !== image.id)); diff --git a/phone/src/apps/twitter/components/BottomNavigation.js b/phone/src/apps/twitter/components/BottomNavigation.js index 9b68f8f..50d6353 100644 --- a/phone/src/apps/twitter/components/BottomNavigation.js +++ b/phone/src/apps/twitter/components/BottomNavigation.js @@ -1,7 +1,6 @@ import React from "react"; import { makeStyles } from "@material-ui/core/styles"; -import BottomNavigation from "@material-ui/core/BottomNavigation"; -import BottomNavigationAction from "@material-ui/core/BottomNavigationAction"; +import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; import HomeIcon from "@material-ui/icons/Home"; import SearchIcon from "@material-ui/icons/Search"; import ProfileIcon from "@material-ui/icons/Person"; diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index ed6df07..e3c9aee 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -4,21 +4,19 @@ import { makeStyles } from "@material-ui/core/styles"; import Nui from "../../../os/nui-events/utils/Nui"; import { AppWrapper } from "../../../ui/components"; import { AppContent } from "../../../ui/components/AppContent"; -import TweetListContainer from "./TweetListContainer"; +import TweetListContainer from "./tweet/TweetListContainer"; import AddTweetModal from "./AddTweetModal"; import { useModal } from "../hooks/useModal"; import { useProfile } from "../hooks/useProfile"; -import TweetButton from "./TweetButton"; +import TweetButton from "./buttons/TweetButton"; import TwitterTitle from "./TwitterTitle"; import BottomNavigation from "./BottomNavigation"; -import TwitterProfile from "./profile/TwitterProfile"; +import TwitterProfile from "./profile/Profile"; import AlertBar from "./alerts/AlertBar"; -import TwitterLoader from "./TwitterLoader"; import TwitterSearch from "./TwitterSearch"; import "./twitter.css"; import "emoji-mart/css/emoji-mart.css"; -import { useTweets } from "../hooks/useTweets"; const useStyles = makeStyles((theme) => ({ backgroundModal: { diff --git a/phone/src/apps/twitter/components/TwitterLoader.js b/phone/src/apps/twitter/components/TwitterLoader.js deleted file mode 100644 index 344bc28..0000000 --- a/phone/src/apps/twitter/components/TwitterLoader.js +++ /dev/null @@ -1,36 +0,0 @@ -// intended for use on initial application loads -import React from "react"; -import { makeStyles } from "@material-ui/core"; -import TwitterIcon from "@material-ui/icons/Twitter"; -import { AppWrapper } from "../../../ui/components"; -import { AppContent } from "../../../ui/components/AppContent"; - -const useStyles = makeStyles((theme) => ({ - root: { - height: "100%", - width: "100%", - display: "flex", - flexFlow: "row nowrap", - justifyContent: "center", - alignItems: "center", - }, - icon: { - color: "#00acee", - fontSize: "100px", - }, -})); - -export const TwitterLoader = () => { - const classes = useStyles(); - return ( - - -
- -
-
-
- ); -}; - -export default TwitterLoader; diff --git a/phone/src/apps/twitter/components/TwitterSearch.js b/phone/src/apps/twitter/components/TwitterSearch.js index f42db9f..68c9f9d 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.js +++ b/phone/src/apps/twitter/components/TwitterSearch.js @@ -2,10 +2,10 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { TextField } from "@material-ui/core"; -import TweetList from "./TweetList"; +import TweetList from "./tweet/TweetList"; import Nui from "../../../os/nui-events/utils/Nui"; -import SearchButton from "./SearchButton"; +import SearchButton from "./buttons/SearchButton"; import { useFilteredTweets } from "../hooks/useFilteredTweets"; const useStyles = makeStyles({ diff --git a/phone/src/apps/twitter/components/TwitterTitle.js b/phone/src/apps/twitter/components/TwitterTitle.js index 1bfb097..1182c4e 100644 --- a/phone/src/apps/twitter/components/TwitterTitle.js +++ b/phone/src/apps/twitter/components/TwitterTitle.js @@ -1,5 +1,4 @@ import React from "react"; -import AppBar from "@material-ui/core/AppBar"; import Paper from "@material-ui/core/Paper"; import { makeStyles } from "@material-ui/core"; import TwitterIcon from "@material-ui/icons/Twitter"; diff --git a/phone/src/apps/twitter/components/alerts/AlertBar.js b/phone/src/apps/twitter/components/alerts/AlertBar.js index 6d36364..10dbce5 100644 --- a/phone/src/apps/twitter/components/alerts/AlertBar.js +++ b/phone/src/apps/twitter/components/alerts/AlertBar.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import Snackbar from "@material-ui/core/Snackbar"; +import { Snackbar } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; import { useProfile } from "../../hooks/useProfile"; diff --git a/phone/src/apps/twitter/components/ControlButtons.js b/phone/src/apps/twitter/components/buttons/ControlButtons.js similarity index 95% rename from phone/src/apps/twitter/components/ControlButtons.js rename to phone/src/apps/twitter/components/buttons/ControlButtons.js index 9b5bdf0..dc5ed31 100644 --- a/phone/src/apps/twitter/components/ControlButtons.js +++ b/phone/src/apps/twitter/components/buttons/ControlButtons.js @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { Button } from "@material-ui/core"; -import { useTweetStatus } from "../hooks/useTweetStatus"; +import { useTweetStatus } from "../../hooks/useTweetStatus"; const useStyles = makeStyles((theme) => ({ buttons: { diff --git a/phone/src/apps/twitter/components/IconButtons.js b/phone/src/apps/twitter/components/buttons/IconButtons.js similarity index 100% rename from phone/src/apps/twitter/components/IconButtons.js rename to phone/src/apps/twitter/components/buttons/IconButtons.js diff --git a/phone/src/apps/twitter/components/profile/ProfileUpdateButton.js b/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.js similarity index 96% rename from phone/src/apps/twitter/components/profile/ProfileUpdateButton.js rename to phone/src/apps/twitter/components/buttons/ProfileUpdateButton.js index 26d3250..efc5347 100644 --- a/phone/src/apps/twitter/components/profile/ProfileUpdateButton.js +++ b/phone/src/apps/twitter/components/buttons/ProfileUpdateButton.js @@ -1,7 +1,8 @@ import React, { useState, useEffect } from "react"; import { makeStyles } from "@material-ui/core/styles"; -import Fab from "@material-ui/core/Fab"; +import { Fab } from "@material-ui/core"; import PublishIcon from "@material-ui/icons/Publish"; + import { useProfile } from "../../hooks/useProfile"; const useStyles = makeStyles((theme) => ({ diff --git a/phone/src/apps/twitter/components/QuoteButton.js b/phone/src/apps/twitter/components/buttons/QuoteButton.js similarity index 85% rename from phone/src/apps/twitter/components/QuoteButton.js rename to phone/src/apps/twitter/components/buttons/QuoteButton.js index 0cd6cef..a1008ce 100644 --- a/phone/src/apps/twitter/components/QuoteButton.js +++ b/phone/src/apps/twitter/components/buttons/QuoteButton.js @@ -1,9 +1,9 @@ import React from "react"; import { useSetRecoilState } from "recoil"; -import Button from "@material-ui/core/Button"; +import { Button } from "@material-ui/core"; import QuoteIcon from "@material-ui/icons/FormatQuote"; -import { twitterState } from "../hooks/state"; +import { twitterState } from "../../hooks/state"; export const QuoteButton = ({ message }) => { const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); diff --git a/phone/src/apps/twitter/components/ReplyButton.js b/phone/src/apps/twitter/components/buttons/ReplyButton.js similarity index 85% rename from phone/src/apps/twitter/components/ReplyButton.js rename to phone/src/apps/twitter/components/buttons/ReplyButton.js index f457531..ee1fd13 100644 --- a/phone/src/apps/twitter/components/ReplyButton.js +++ b/phone/src/apps/twitter/components/buttons/ReplyButton.js @@ -1,9 +1,9 @@ import React from "react"; import { useSetRecoilState } from "recoil"; -import Button from "@material-ui/core/Button"; +import { Button } from "@material-ui/core"; import ReplyIcon from "@material-ui/icons/Reply"; -import { twitterState } from "../hooks/state"; +import { twitterState } from "../../hooks/state"; export const ReplyButton = ({ profile_name }) => { const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal); diff --git a/phone/src/apps/twitter/components/SearchButton.js b/phone/src/apps/twitter/components/buttons/SearchButton.js similarity index 86% rename from phone/src/apps/twitter/components/SearchButton.js rename to phone/src/apps/twitter/components/buttons/SearchButton.js index 606ba0f..c01456a 100644 --- a/phone/src/apps/twitter/components/SearchButton.js +++ b/phone/src/apps/twitter/components/buttons/SearchButton.js @@ -1,6 +1,6 @@ -import React, { useState, useEffect } from "react"; +import React from "react"; import { makeStyles } from "@material-ui/core/styles"; -import Fab from "@material-ui/core/Fab"; +import { Fab } from "@material-ui/core"; import SearchIcon from "@material-ui/icons/Search"; const useStyles = makeStyles((theme) => ({ diff --git a/phone/src/apps/twitter/components/TweetButton.js b/phone/src/apps/twitter/components/buttons/TweetButton.js similarity index 86% rename from phone/src/apps/twitter/components/TweetButton.js rename to phone/src/apps/twitter/components/buttons/TweetButton.js index d7b6bd8..3c96214 100644 --- a/phone/src/apps/twitter/components/TweetButton.js +++ b/phone/src/apps/twitter/components/buttons/TweetButton.js @@ -1,9 +1,9 @@ import React from "react"; import { makeStyles } from "@material-ui/core/styles"; -import Fab from "@material-ui/core/Fab"; +import { Fab } from "@material-ui/core"; import CreateIcon from "@material-ui/icons/Create"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ root: { position: "absolute", bottom: "75px", diff --git a/phone/src/apps/twitter/components/Image.js b/phone/src/apps/twitter/components/images/Image.js similarity index 97% rename from phone/src/apps/twitter/components/Image.js rename to phone/src/apps/twitter/components/images/Image.js index ce403cf..2e5c860 100644 --- a/phone/src/apps/twitter/components/Image.js +++ b/phone/src/apps/twitter/components/images/Image.js @@ -3,7 +3,7 @@ import { IconButton } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; import CloseIcon from "@material-ui/icons/Close"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ root: { margin: "2px 15px", }, diff --git a/phone/src/apps/twitter/components/ImageDisplay.js b/phone/src/apps/twitter/components/images/ImageDisplay.js similarity index 100% rename from phone/src/apps/twitter/components/ImageDisplay.js rename to phone/src/apps/twitter/components/images/ImageDisplay.js diff --git a/phone/src/apps/twitter/components/ImagePrompt.js b/phone/src/apps/twitter/components/images/ImagePrompt.js similarity index 100% rename from phone/src/apps/twitter/components/ImagePrompt.js rename to phone/src/apps/twitter/components/images/ImagePrompt.js diff --git a/phone/src/apps/twitter/components/profile/TwitterProfile.js b/phone/src/apps/twitter/components/profile/Profile.js similarity index 97% rename from phone/src/apps/twitter/components/profile/TwitterProfile.js rename to phone/src/apps/twitter/components/profile/Profile.js index da9efaf..ec45e8d 100644 --- a/phone/src/apps/twitter/components/profile/TwitterProfile.js +++ b/phone/src/apps/twitter/components/profile/Profile.js @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export function TwitterProfile() { +export function Profile() { const classes = useStyles(); const { t } = useTranslation(); const { profile } = useProfile(); @@ -82,4 +82,4 @@ export function TwitterProfile() { ); } -export default TwitterProfile; +export default Profile; diff --git a/phone/src/apps/twitter/components/Tweet.js b/phone/src/apps/twitter/components/tweet/Tweet.js similarity index 84% rename from phone/src/apps/twitter/components/Tweet.js rename to phone/src/apps/twitter/components/tweet/Tweet.js index e4eb530..cadcd8b 100644 --- a/phone/src/apps/twitter/components/Tweet.js +++ b/phone/src/apps/twitter/components/tweet/Tweet.js @@ -1,19 +1,21 @@ import React from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; -import ListItemAvatar from "@material-ui/core/ListItemAvatar"; -import MuiAvatar from "@material-ui/core/Avatar"; -import Button from "@material-ui/core/Button"; -import Typography from "@material-ui/core/Typography"; +import { + ListItemAvatar, + Avatar as MuiAvatar, + Button, + Typography, +} from "@material-ui/core"; import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder"; import MoreIcon from "@material-ui/icons/MoreVert"; -import { ListItem } from "../../../ui/components/ListItem"; -import { secondsToHumanReadable } from "../utils/time"; -import ReplyButton from "./ReplyButton"; -import ImageDisplay from "./ImageDisplay"; -import Avatar from "./Avatar"; -import { QuoteButton } from "./QuoteButton"; +import { ListItem } from "../../../../ui/components/ListItem"; +import { secondsToHumanReadable } from "../../utils/time"; +import ReplyButton from "../buttons/ReplyButton"; +import ImageDisplay from "../images/ImageDisplay"; +import Avatar from "../Avatar"; +import { QuoteButton } from "../buttons/QuoteButton"; const useStyles = makeStyles(() => ({ root: { diff --git a/phone/src/apps/twitter/components/TweetList.js b/phone/src/apps/twitter/components/tweet/TweetList.js similarity index 86% rename from phone/src/apps/twitter/components/TweetList.js rename to phone/src/apps/twitter/components/tweet/TweetList.js index 467e90a..b3b2130 100644 --- a/phone/src/apps/twitter/components/TweetList.js +++ b/phone/src/apps/twitter/components/tweet/TweetList.js @@ -1,6 +1,6 @@ import React from "react"; -import { List } from "../../../ui/components/List"; +import { List } from "../../../../ui/components/List"; import Tweet from "./Tweet"; import TweetSkeletonList from "./TweetSkeletonList"; diff --git a/phone/src/apps/twitter/components/TweetListContainer.js b/phone/src/apps/twitter/components/tweet/TweetListContainer.js similarity index 80% rename from phone/src/apps/twitter/components/TweetListContainer.js rename to phone/src/apps/twitter/components/tweet/TweetListContainer.js index 19b842d..9c511b2 100644 --- a/phone/src/apps/twitter/components/TweetListContainer.js +++ b/phone/src/apps/twitter/components/tweet/TweetListContainer.js @@ -1,6 +1,6 @@ import React from "react"; -import { useTweets } from "../hooks/useTweets"; +import { useTweets } from "../../hooks/useTweets"; import TweetList from "./TweetList"; export function TweetListContainer() { diff --git a/phone/src/apps/twitter/components/TweetMessage.js b/phone/src/apps/twitter/components/tweet/TweetMessage.js similarity index 100% rename from phone/src/apps/twitter/components/TweetMessage.js rename to phone/src/apps/twitter/components/tweet/TweetMessage.js diff --git a/phone/src/apps/twitter/components/TweetSkeleton.js b/phone/src/apps/twitter/components/tweet/TweetSkeleton.js similarity index 100% rename from phone/src/apps/twitter/components/TweetSkeleton.js rename to phone/src/apps/twitter/components/tweet/TweetSkeleton.js diff --git a/phone/src/apps/twitter/components/TweetSkeletonList.js b/phone/src/apps/twitter/components/tweet/TweetSkeletonList.js similarity index 88% rename from phone/src/apps/twitter/components/TweetSkeletonList.js rename to phone/src/apps/twitter/components/tweet/TweetSkeletonList.js index 27274e9..b35be9e 100644 --- a/phone/src/apps/twitter/components/TweetSkeletonList.js +++ b/phone/src/apps/twitter/components/tweet/TweetSkeletonList.js @@ -1,6 +1,6 @@ import React from "react"; -import { List } from "../../../ui/components/List"; +import { List } from "../../../../ui/components/List"; import TweetSkeleton from "./TweetSkeleton"; export function TweetSkeletonList() { From 1d4faa4bf9e2f3bc559e2f2413c593c62879139b Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 3 Oct 2020 10:59:52 -0400 Subject: [PATCH 30/44] moved twitter skeleton to TweetList --- .../src/apps/twitter/components/TwitterApp.js | 20 +++---------------- .../apps/twitter/components/TwitterSearch.js | 2 +- .../twitter/components/profile/Profile.js | 2 +- .../twitter/components/tweet/TweetList.js | 20 +++++++++++++++++-- resources/server/sv_twitter.lua | 3 ++- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index e3c9aee..bc1daa8 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -37,15 +37,13 @@ const PAGE_COMPONENT_MAPPING = { 1: , 2: , }; -const MINIMUM_LOAD_TIME = 500; -const TWEETS_REFRESH_RATE = 50000000; // TODO move this to twitter config +const TWEETS_REFRESH_RATE = 15000; // TODO move this to twitter config export const TwitterApp = () => { const classes = useStyles(); const { modalVisible, setModalVisible } = useModal(); - const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); const [activePage, setActivePage] = useState(0); - const { profile } = useProfile(); + useEffect(() => { Nui.send("phone:getOrCreateTwitterProfile", {}); Nui.send("phone:fetchTweets", {}); @@ -63,21 +61,9 @@ export const TwitterApp = () => { return () => window.clearTimeout(timeout); }, []); - useEffect(() => { - const timeout = window.setTimeout(() => { - setMimimumLoadPassed(true); - }, MINIMUM_LOAD_TIME); - return () => window.clearTimeout(timeout); - }); - const openModal = () => setModalVisible(true); const handlePageChange = (e, page) => setActivePage(page); - - // we add a minimum (but short) load time here so that - // there isn't a quick flash of loading and immediately - // another flash to the tweets screen. - const hasLoaded = profile && minimumLoadPassed; - const showTweetButton = hasLoaded && activePage === 0; + const showTweetButton = activePage === 0; return ( diff --git a/phone/src/apps/twitter/components/TwitterSearch.js b/phone/src/apps/twitter/components/TwitterSearch.js index 68c9f9d..8e033bf 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.js +++ b/phone/src/apps/twitter/components/TwitterSearch.js @@ -49,7 +49,7 @@ function TwitterSearch() { inputRef={(input) => input && input.focus()} />
- + {tweets && tweets.length > 0 && }
diff --git a/phone/src/apps/twitter/components/profile/Profile.js b/phone/src/apps/twitter/components/profile/Profile.js index ec45e8d..b8b6ecd 100644 --- a/phone/src/apps/twitter/components/profile/Profile.js +++ b/phone/src/apps/twitter/components/profile/Profile.js @@ -6,7 +6,7 @@ import Nui from "../../../../os/nui-events/utils/Nui"; import { useProfile } from "../../hooks/useProfile"; import Avatar from "../Avatar"; import ProfileField from "./ProfileField"; -import ProfileUpdateButton from "./ProfileUpdateButton"; +import ProfileUpdateButton from "../buttons/ProfileUpdateButton"; const useStyles = makeStyles((theme) => ({ root: { diff --git a/phone/src/apps/twitter/components/tweet/TweetList.js b/phone/src/apps/twitter/components/tweet/TweetList.js index b3b2130..9b1e119 100644 --- a/phone/src/apps/twitter/components/tweet/TweetList.js +++ b/phone/src/apps/twitter/components/tweet/TweetList.js @@ -1,11 +1,27 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import { List } from "../../../../ui/components/List"; import Tweet from "./Tweet"; import TweetSkeletonList from "./TweetSkeletonList"; +const MINIMUM_LOAD_TIME = 700; + export function TweetList({ tweets }) { - if (!tweets) return ; + const [minimumLoadPassed, setMimimumLoadPassed] = useState(false); + + useEffect(() => { + const timeout = window.setTimeout(() => { + setMimimumLoadPassed(true); + }, MINIMUM_LOAD_TIME); + return () => window.clearTimeout(timeout); + }); + + // we add a minimum (but short) load time here so that + // there isn't a quick flash of loading and immediately + // another flash to the tweets screen. + const hasLoaded = tweets && minimumLoadPassed; + + if (!hasLoaded) return ; return ( {tweets.map((tweet) => ( diff --git a/resources/server/sv_twitter.lua b/resources/server/sv_twitter.lua index 98b886c..88b9c3b 100644 --- a/resources/server/sv_twitter.lua +++ b/resources/server/sv_twitter.lua @@ -169,7 +169,8 @@ end) function updateTwitterProfile(identifier, data, cb) MySQL.Async.transaction({[[ UPDATE npwd_twitter_profiles - SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job WHERE identifier = @identifier + SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job + WHERE identifier = @identifier ]]}, { identifier = identifier, From 23e4da200757db311b838d564b9d45a54a36bc38 Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 3 Oct 2020 11:07:21 -0400 Subject: [PATCH 31/44] moved navigation to use react router dom --- .../twitter/components/BottomNavigation.js | 19 ++++++++++++++++--- .../src/apps/twitter/components/TwitterApp.js | 9 ++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/phone/src/apps/twitter/components/BottomNavigation.js b/phone/src/apps/twitter/components/BottomNavigation.js index 50d6353..91cd2b8 100644 --- a/phone/src/apps/twitter/components/BottomNavigation.js +++ b/phone/src/apps/twitter/components/BottomNavigation.js @@ -1,4 +1,5 @@ import React from "react"; +import { Link } from "react-router-dom"; import { makeStyles } from "@material-ui/core/styles"; import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; import HomeIcon from "@material-ui/icons/Home"; @@ -20,9 +21,21 @@ export function TwitterBottomNavigation({ activePage, handleChange }) { onChange={handleChange} className={classes.root} > - } /> - } /> - } /> + } + /> + } + /> + } + />
); } diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index bc1daa8..d4b5fdb 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from "react"; +import { Switch, Route } from "react-router-dom"; import { makeStyles } from "@material-ui/core/styles"; import Nui from "../../../os/nui-events/utils/Nui"; @@ -70,7 +71,13 @@ export const TwitterApp = () => {
- {PAGE_COMPONENT_MAPPING[activePage]} + + + + + + + {showTweetButton && } Date: Sat, 3 Oct 2020 13:25:23 -0400 Subject: [PATCH 32/44] tests --- .../apps/twitter/components/__tests__/TwitterApp.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 phone/src/apps/twitter/components/__tests__/TwitterApp.test.js diff --git a/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js b/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js new file mode 100644 index 0000000..311fac6 --- /dev/null +++ b/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js @@ -0,0 +1,8 @@ +import React from "react"; +import ReactDOM from "react-dom"; +import { TwitterApp } from "../TwitterApp"; + +it("renders without crashing", () => { + const div = document.createElement("div"); + ReactDOM.render(, div); +}); From 345f591670a991c91a268f59f50204e23e355e6c Mon Sep 17 00:00:00 2001 From: erik-sn Date: Sat, 3 Oct 2020 13:52:51 -0400 Subject: [PATCH 33/44] PR review #1 --- .gitignore | 1 + .vscode/settings.json | 3 -- phone/.vscode/settings.json | 3 -- .../src/apps/twitter/components/TwitterApp.js | 6 --- .../components/__tests__/TwitterApp.test.js | 8 ---- .../components/buttons/ControlButtons.js | 2 - .../apps/twitter/hooks/useTwitterService.js | 25 ++++------- phone/src/apps/twitter/types.js | 7 --- phone/src/apps/twitter/utils/constants.js | 1 + phone/src/ui/components/AppLoader.js | 27 ----------- resources/client/cl_main.lua | 8 +--- resources/html/index.html | 45 +------------------ 12 files changed, 12 insertions(+), 124 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 phone/.vscode/settings.json delete mode 100644 phone/src/apps/twitter/components/__tests__/TwitterApp.test.js delete mode 100644 phone/src/apps/twitter/types.js delete mode 100644 phone/src/ui/components/AppLoader.js diff --git a/.gitignore b/.gitignore index e69de29..8b13789 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ + diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 23fd35f..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "editor.formatOnSave": true -} \ No newline at end of file diff --git a/phone/.vscode/settings.json b/phone/.vscode/settings.json deleted file mode 100644 index 23fd35f..0000000 --- a/phone/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "editor.formatOnSave": true -} \ No newline at end of file diff --git a/phone/src/apps/twitter/components/TwitterApp.js b/phone/src/apps/twitter/components/TwitterApp.js index d4b5fdb..e36853b 100644 --- a/phone/src/apps/twitter/components/TwitterApp.js +++ b/phone/src/apps/twitter/components/TwitterApp.js @@ -32,12 +32,6 @@ const useStyles = makeStyles((theme) => ({ }, })); -// TODO move this to the router so the application back button works -const PAGE_COMPONENT_MAPPING = { - 0: , - 1: , - 2: , -}; const TWEETS_REFRESH_RATE = 15000; // TODO move this to twitter config export const TwitterApp = () => { diff --git a/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js b/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js deleted file mode 100644 index 311fac6..0000000 --- a/phone/src/apps/twitter/components/__tests__/TwitterApp.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import { TwitterApp } from "../TwitterApp"; - -it("renders without crashing", () => { - const div = document.createElement("div"); - ReactDOM.render(, div); -}); diff --git a/phone/src/apps/twitter/components/buttons/ControlButtons.js b/phone/src/apps/twitter/components/buttons/ControlButtons.js index dc5ed31..d419e81 100644 --- a/phone/src/apps/twitter/components/buttons/ControlButtons.js +++ b/phone/src/apps/twitter/components/buttons/ControlButtons.js @@ -35,8 +35,6 @@ export const ControlButtons = ({ : t("APPS_TWITTER_TWEET"); const showCloseButton = showImagePrompt || showEmoji; - if (createTweetLoading) return

!!!

; - return (
- )} + {enableEmojis && ( + )}
); }; diff --git a/phone/src/apps/twitter/components/profile/Profile.js b/phone/src/apps/twitter/components/profile/Profile.js index b8b6ecd..f14690c 100644 --- a/phone/src/apps/twitter/components/profile/Profile.js +++ b/phone/src/apps/twitter/components/profile/Profile.js @@ -7,6 +7,7 @@ import { useProfile } from "../../hooks/useProfile"; import Avatar from "../Avatar"; import ProfileField from "./ProfileField"; import ProfileUpdateButton from "../buttons/ProfileUpdateButton"; +import { usePhone } from "../../../../os/phone/hooks/usePhone"; const useStyles = makeStyles((theme) => ({ root: { @@ -24,6 +25,8 @@ export function Profile() { const classes = useStyles(); const { t } = useTranslation(); const { profile } = useProfile(); + const { config } = usePhone(); + // note that this assumes we are defensively checking // that profile is not null in a parent above this component. @@ -47,19 +50,26 @@ export function Profile() { Nui.send("phone:updateTwitterProfile", data); }; + // fetching the config is an asynchronous call so defend against it + if (!config) return null; + + const { enableAvatars, allowEdtiableProfileName } = config.twitter; + return (
- + {enableAvatars && }
({ 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 ( - - - - - + {enableAvatars && ( + + + + + + )}
{`@${profile_name}`}
@@ -98,7 +107,7 @@ export const Tweet = (tweet) => { className={classes.message} dangerouslySetInnerHTML={{ __html: formattedMessage }} /> - + {enableImages && }