diff --git a/phone/src/apps/twitter/components/buttons/LikeButton.js b/phone/src/apps/twitter/components/buttons/LikeButton.js
index 6b72e65..d93bc49 100644
--- a/phone/src/apps/twitter/components/buttons/LikeButton.js
+++ b/phone/src/apps/twitter/components/buttons/LikeButton.js
@@ -1,18 +1,33 @@
-import React, { useState, useEffect } from "react";
-import { Button } from "@material-ui/core";
+import React, { useState } from "react";
+import { Button, CircularProgress } from "@material-ui/core";
import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder";
import FavoriteIcon from "@material-ui/icons/Favorite";
import Nui from "../../../../os/nui-events/utils/Nui";
+const LOADING_TIME = 1250;
+
function LikeButton({ tweetId, isLiked }) {
const [liked, setLiked] = useState(isLiked);
+ const [loading, setLoading] = useState(false);
const handleClick = () => {
Nui.send("phone:toggleLike", tweetId);
- setLiked(!liked);
+ setLoading(true);
+ window.setTimeout(() => {
+ setLiked(!liked);
+ setLoading(false);
+ }, LOADING_TIME);
};
+ if (loading) {
+ return (
+
+ );
+ }
+
return (