-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp preview
More file actions
71 lines (61 loc) · 1.42 KB
/
app preview
File metadata and controls
71 lines (61 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// src/CryptoMiningBot.js
import React, { useState } from 'react';
import './App.css'; // Make sure to import the CSS file
const CryptoMiningBot = () => {
const [cryptoMined, setCryptoMined] = useState(0);
const [isMining, setIsMining] = useState(false);
let interval;
const startMining = () => {
setIsMining(true);
interval = setInterval(() => {
const newCrypto = Math.floor(Math.random() * 10) + 1;
setCryptoMined(prevCrypto => prevCrypto + newCrypto);
}, 1000);
};
const stopMining = () => {
clearInterval(interval);
setIsMining(false);
};
return (
<div>
<h1>Crypto Mining Bot</h1>
<p>Crypto Mined: {cryptoMined}</p>
<div className="wheel"></div>
<button onClick={startMining} disabled={isMining}>
Start Mining
</button>
<button onClick={stopMining} disabled={!isMining}>
Stop Mining
</button>
</div>
);
};
export default CryptoMiningBot;
// src/App.js
import React from 'react';
import CryptoMiningBot from './CryptoMiningBot';
function App() {
return (
<div className="App">
<CryptoMiningBot />
</div>
);
}
export default App;
// src/App.css
.wheel {
width: 100px;
height: 100px;
border: 10px solid #000;
border-radius: 50%;
position: relative;
animation: rotate 5s linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}