fix(revert-confusion): cleaning up mess made in reverts earlier

This commit is contained in:
Aditya
2024-02-16 15:29:21 +05:30
parent d73989d821
commit 52583c0eff
+58 -1
View File
@@ -13,6 +13,11 @@ import {
//import { useAlert
import { ToastContainer, toast } from "react-toastify"
import { FileCopy, Visibility, VisibilityOff } from "@mui/icons-material";
import IconButton from "@mui/material/IconButton";
import { Tooltip } from "@mui/material";
const Settings = (props) => {
const { globalUrl, isLoaded, userdata, setUserData } = props;
//const alert = useAlert();
@@ -44,6 +49,17 @@ const Settings = (props) => {
const [userSettings, setUserSettings] = useState({});
const [showApiKey, setShowApiKey] = useState(false);
const [apiKeyCopied, setApiKeyCopied] = useState(false);
const handleCopyApiKey = () => {
navigator.clipboard.writeText(userSettings.apikey);
setApiKeyCopied(true);
setTimeout(() => {
setApiKeyCopied(false);
}, 2000);
}
/*
const [userdata.eth_info, setEthInfo] = useState(userdata.eth_info !== undefined && userdata.eth_info.account !== undefined && userdata.eth_info.account.length > 0 ? userdata.eth_info : {
"account": "",
@@ -467,7 +483,7 @@ const Settings = (props) => {
>
What is the API key used for?
</a>
<TextField
{/* <TextField
style={{ backgroundColor: theme.palette.inputColor, flex: "1" }}
InputProps={{
style: {
@@ -484,6 +500,42 @@ const Settings = (props) => {
id="standard-required"
margin="normal"
variant="outlined"
/> */}
<TextField
style={{ backgroundColor: theme.palette.inputColor, flex: "1" }}
InputProps={{
style: {
height: "50px",
color: "white",
},
endAdornment: (
<>
<Tooltip title={showApiKey ? "Hide API Key" : "Show API Key"}>
<IconButton
onClick={() => setShowApiKey(!showApiKey)}
>
{showApiKey ? <VisibilityOff /> : <Visibility />}
</IconButton>
</Tooltip>
<Tooltip title={apiKeyCopied ? "API Key copied!" : "Copy API Key"}>
<IconButton
onClick={handleCopyApiKey}
>
<FileCopy />
</IconButton>
</Tooltip>
</>
),
}}
color="primary"
value={showApiKey ? userSettings.apikey : '*'.repeat(36)} // Show API key if showApiKey is true, else show asterisks
required
disabled
fullWidth
placeholder="APIKEY"
id="standard-required"
margin="normal"
variant="outlined"
/>
<Button
style={{ width: "100%", height: "40px", marginTop: "10px" }}
@@ -676,8 +728,13 @@ const Settings = (props) => {
Submit password change
</Button>
<h3>{passwordFormMessage}</h3>
{isCloud && (
<>
<Divider style={{ marginTop: "40px" }} />
<h2>Creator Incentive Program</h2>
</>
)}
<div style={{ display: runFlex ? "flex" : "", width: "100%" }}>
<div>
{isCloud ?