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 (