mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
34 lines
817 B
JavaScript
34 lines
817 B
JavaScript
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; // TODO move this to twitter config
|
|
|
|
export function TweetList() {
|
|
const { tweets } = useTweets();
|
|
|
|
useEffect(() => {
|
|
Nui.send("phone:fetchTweets", {});
|
|
const timeout = window.setTimeout(() => {
|
|
Nui.send("phone:fetchTweets", {});
|
|
}, TWEETS_REFRESH_RATE);
|
|
return () => window.clearTimeout(timeout);
|
|
}, []);
|
|
console.log(tweets);
|
|
|
|
return (
|
|
<List>
|
|
{tweets
|
|
.filter((t) => t.visible)
|
|
.map((tweet) => (
|
|
<Tweet key={tweet.id} {...tweet} />
|
|
))}
|
|
</List>
|
|
);
|
|
}
|
|
|
|
export default TweetList;
|