mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
working reporting system
This commit is contained in:
1 parent
8c1f823bcb
commit
ea77114da6
19 files changed
+264
-43
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Button,
|
||||
CircularProgress,
|
||||
MenuItem
|
||||
} from "@material-ui/core";
|
||||
import DoneIcon from '@material-ui/icons/Done';
|
||||
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
|
||||
const LOADING_TIME = 1250;
|
||||
|
||||
function ReportButton({ handleClose, tweetId, isReported }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const handleClick = () => {
|
||||
Nui.send("phone:reportTweet", tweetId);
|
||||
setLoading(true);
|
||||
window.setTimeout(() => {
|
||||
setLoading(false);
|
||||
handleClose();
|
||||
}, LOADING_TIME);
|
||||
};
|
||||
|
||||
if (isReported) {
|
||||
return (
|
||||
<MenuItem onClick={handleClose}>
|
||||
<DoneIcon />
|
||||
<span style={{ marginLeft: '5px' }}>{t('APPS_TWITTER_REPORTED')}</span>
|
||||
</MenuItem >
|
||||
);
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<Button disabled>
|
||||
<CircularProgress id="twitter-report-progress" size={22} />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<MenuItem onClick={handleClick}>{t('APPS_TWITTER_REPORT')}</MenuItem >
|
||||
);
|
||||
}
|
||||
|
||||
export default ReportButton;
|
||||
Reference in new issue
Block a user