mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-02 22:17:39 +00:00
auto refresh working
This commit is contained in:
1 parent
ba0f122938
commit
997f550aab
4 files changed
+14
-7
No files matched your search
@@ -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";
|
||||
|
||||
@@ -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 (
|
||||
<List>
|
||||
{tweets
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user