Spaces:
Running
Running
rend plsu parfaot, pro, complet,
Browse files- index.html +9 -182
- script.js +198 -0
- style.css +88 -18
index.html
CHANGED
|
@@ -121,16 +121,16 @@
|
|
| 121 |
</div>
|
| 122 |
</div>
|
| 123 |
<div class="flex space-x-4">
|
| 124 |
-
<button class="text-sm text-fuchsia-500 hover:text-fuchsia-400 flex items-center">
|
| 125 |
<i data-feather="download" class="mr-1"></i>
|
| 126 |
Export Config
|
| 127 |
</button>
|
| 128 |
-
<button class="text-sm text-fuchsia-500 hover:text-fuchsia-400 flex items-center"
|
| 129 |
<i data-feather="upload" class="mr-1"></i>
|
| 130 |
Import Config
|
| 131 |
<input type="file" id="importConfig" class="hidden" accept=".json">
|
| 132 |
</button>
|
| 133 |
-
|
| 134 |
</div>
|
| 135 |
</div>
|
| 136 |
</div>
|
|
@@ -325,11 +325,11 @@
|
|
| 325 |
<p class="mt-2 text-sm text-neutral-400">List of all currently copied positions</p>
|
| 326 |
</div>
|
| 327 |
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
</div>
|
| 334 |
<div class="mt-8 flex flex-col">
|
| 335 |
<div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
@@ -818,180 +818,7 @@
|
|
| 818 |
</div>
|
| 819 |
</div>
|
| 820 |
</div>
|
| 821 |
-
|
| 822 |
-
<script>
|
| 823 |
-
// Mock data
|
| 824 |
-
const mockData = {
|
| 825 |
-
status: "running",
|
| 826 |
-
pollInterval: 2.0,
|
| 827 |
-
accounts: [
|
| 828 |
-
{
|
| 829 |
-
name: "Gold Account",
|
| 830 |
-
login: 12345678,
|
| 831 |
-
server: "MetaQuotes-Demo",
|
| 832 |
-
status: "connected",
|
| 833 |
-
multiplier: 1.5,
|
| 834 |
-
reverse: true,
|
| 835 |
-
maxLotPerTrade: 5.00,
|
| 836 |
-
maxLotPerSymbol: 10.00,
|
| 837 |
-
allowedSymbols: ["EURUSD", "GBPUSD", "XAUUSD", "US30"],
|
| 838 |
-
blockedSymbols: ["BTCUSD", "ETHUSD"]
|
| 839 |
-
},
|
| 840 |
-
{
|
| 841 |
-
name: "Silver Account",
|
| 842 |
-
login: 87654321,
|
| 843 |
-
server: "ICMarkets-Live",
|
| 844 |
-
status: "connected",
|
| 845 |
-
multiplier: 1.0,
|
| 846 |
-
reverse: false,
|
| 847 |
-
maxLotPerTrade: 2.00,
|
| 848 |
-
maxLotPerSymbol: 5.00,
|
| 849 |
-
allowedSymbols: null,
|
| 850 |
-
blockedSymbols: null
|
| 851 |
-
},
|
| 852 |
-
{
|
| 853 |
-
name: "Bronze Account",
|
| 854 |
-
login: 56781234,
|
| 855 |
-
server: "Pepperstone-Demo",
|
| 856 |
-
status: "disconnected",
|
| 857 |
-
multiplier: 0.5,
|
| 858 |
-
reverse: false,
|
| 859 |
-
maxLotPerTrade: 1.00,
|
| 860 |
-
maxLotPerSymbol: 2.00,
|
| 861 |
-
allowedSymbols: ["EURUSD", "GBPUSD"],
|
| 862 |
-
blockedSymbols: ["XAUUSD", "US30"]
|
| 863 |
-
}
|
| 864 |
-
],
|
| 865 |
-
positions: [
|
| 866 |
-
{
|
| 867 |
-
sourceTicket: 123456,
|
| 868 |
-
symbol: "EURUSD",
|
| 869 |
-
type: "buy",
|
| 870 |
-
volume: 1.50,
|
| 871 |
-
sl: 1.0850,
|
| 872 |
-
tp: 1.0950,
|
| 873 |
-
target: "Gold Account",
|
| 874 |
-
status: "active",
|
| 875 |
-
time: "10:23:45"
|
| 876 |
-
},
|
| 877 |
-
{
|
| 878 |
-
sourceTicket: 123457,
|
| 879 |
-
symbol: "GBPUSD",
|
| 880 |
-
type: "sell",
|
| 881 |
-
volume: 0.75,
|
| 882 |
-
sl: 1.2450,
|
| 883 |
-
tp: 1.2350,
|
| 884 |
-
target: "Silver Account",
|
| 885 |
-
status: "active",
|
| 886 |
-
time: "10:45:12"
|
| 887 |
-
},
|
| 888 |
-
{
|
| 889 |
-
sourceTicket: 123458,
|
| 890 |
-
symbol: "XAUUSD",
|
| 891 |
-
type: "buy",
|
| 892 |
-
volume: 0.25,
|
| 893 |
-
sl: 1950.00,
|
| 894 |
-
tp: 1980.00,
|
| 895 |
-
target: "Bronze Account",
|
| 896 |
-
status: "pending",
|
| 897 |
-
time: "11:03:27"
|
| 898 |
-
}
|
| 899 |
-
],
|
| 900 |
-
stats: {
|
| 901 |
-
targetAccounts: 3,
|
| 902 |
-
copiedTrades: 24,
|
| 903 |
-
todaysPnl: 1245.67,
|
| 904 |
-
avgLatency: 42
|
| 905 |
-
}
|
| 906 |
-
};
|
| 907 |
-
|
| 908 |
-
// Modal functions
|
| 909 |
-
function openAddAccountModal() {
|
| 910 |
-
document.getElementById('addAccountModal').classList.remove('hidden');
|
| 911 |
-
}
|
| 912 |
-
|
| 913 |
-
function openEditAccountModal(index) {
|
| 914 |
-
const account = mockData.accounts[index];
|
| 915 |
-
document.getElementById('edit-account-name').value = account.name;
|
| 916 |
-
document.getElementById('edit-account-login').value = account.login;
|
| 917 |
-
document.getElementById('edit-account-server').value = account.server;
|
| 918 |
-
document.getElementById('edit-account-multiplier').value = account.multiplier;
|
| 919 |
-
document.getElementById('edit-account-deviation').value = 20;
|
| 920 |
-
document.getElementById('edit-account-reverse').checked = account.reverse;
|
| 921 |
-
document.getElementById('editAccountModal').classList.remove('hidden');
|
| 922 |
-
}
|
| 923 |
-
|
| 924 |
-
function openEditRiskModal(index) {
|
| 925 |
-
const account = mockData.accounts[index];
|
| 926 |
-
document.getElementById('risk-max-trade').value = account.maxLotPerTrade;
|
| 927 |
-
document.getElementById('risk-max-symbol').value = account.maxLotPerSymbol;
|
| 928 |
-
document.getElementById('risk-reverse').checked = account.reverse;
|
| 929 |
-
document.getElementById('risk-allowed').value = account.allowedSymbols ? account.allowedSymbols.join(', ') : '';
|
| 930 |
-
document.getElementById('risk-blocked').value = account.blockedSymbols ? account.blockedSymbols.join(', ') : '';
|
| 931 |
-
document.getElementById('editRiskModal').classList.remove('hidden');
|
| 932 |
-
}
|
| 933 |
-
|
| 934 |
-
function closeModal(id) {
|
| 935 |
-
document.getElementById(id).classList.add('hidden');
|
| 936 |
-
}
|
| 937 |
-
|
| 938 |
-
// Toggle copier status
|
| 939 |
-
const startStopBtn = document.getElementById('startStopBtn');
|
| 940 |
-
startStopBtn.addEventListener('click', function() {
|
| 941 |
-
if (mockData.status === 'running') {
|
| 942 |
-
mockData.status = 'stopped';
|
| 943 |
-
startStopBtn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Start Copier</span>';
|
| 944 |
-
startStopBtn.classList.remove('bg-fuchsia-600', 'hover:bg-fuchsia-700');
|
| 945 |
-
startStopBtn.classList.add('bg-green-600', 'hover:bg-green-700');
|
| 946 |
-
} else {
|
| 947 |
-
mockData.status = 'running';
|
| 948 |
-
startStopBtn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Stop Copier</span>';
|
| 949 |
-
startStopBtn.classList.remove('bg-green-600', 'hover:bg-green-700');
|
| 950 |
-
startStopBtn.classList.add('bg-fuchsia-600', 'hover:bg-fuchsia-700');
|
| 951 |
-
}
|
| 952 |
-
feather.replace();
|
| 953 |
-
});
|
| 954 |
-
|
| 955 |
-
// Initialize
|
| 956 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 957 |
-
feather.replace();
|
| 958 |
-
|
| 959 |
-
// Set initial button state
|
| 960 |
-
if (mockData.status === 'running') {
|
| 961 |
-
startStopBtn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Stop Copier</span>';
|
| 962 |
-
startStopBtn.classList.add('bg-fuchsia-600', 'hover:bg-fuchsia-700');
|
| 963 |
-
} else {
|
| 964 |
-
startStopBtn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Start Copier</span>';
|
| 965 |
-
startStopBtn.classList.add('bg-green-600', 'hover:bg-green-700');
|
| 966 |
-
}
|
| 967 |
-
});
|
| 968 |
-
|
| 969 |
-
// Stub functions for future API integration
|
| 970 |
-
function loadConfig() {
|
| 971 |
-
console.log('Loading config...');
|
| 972 |
-
return mockData;
|
| 973 |
-
}
|
| 974 |
-
|
| 975 |
-
function saveConfig(config) {
|
| 976 |
-
console.log('Saving config:', config);
|
| 977 |
-
return true;
|
| 978 |
-
}
|
| 979 |
-
|
| 980 |
-
function startCopier() {
|
| 981 |
-
console.log('Starting trade copier...');
|
| 982 |
-
return true;
|
| 983 |
-
}
|
| 984 |
-
|
| 985 |
-
function stopCopier() {
|
| 986 |
-
console.log('Stopping trade copier...');
|
| 987 |
-
return true;
|
| 988 |
-
}
|
| 989 |
-
|
| 990 |
-
function refreshData() {
|
| 991 |
-
console.log('Refreshing data...');
|
| 992 |
-
return mockData;
|
| 993 |
-
}
|
| 994 |
-
</script>
|
| 995 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 996 |
</body>
|
| 997 |
</html>
|
|
|
|
| 121 |
</div>
|
| 122 |
</div>
|
| 123 |
<div class="flex space-x-4">
|
| 124 |
+
<button class="text-sm text-fuchsia-500 hover:text-fuchsia-400 flex items-center" data-action="export-config">
|
| 125 |
<i data-feather="download" class="mr-1"></i>
|
| 126 |
Export Config
|
| 127 |
</button>
|
| 128 |
+
<button class="text-sm text-fuchsia-500 hover:text-fuchsia-400 flex items-center" data-action="import-config">
|
| 129 |
<i data-feather="upload" class="mr-1"></i>
|
| 130 |
Import Config
|
| 131 |
<input type="file" id="importConfig" class="hidden" accept=".json">
|
| 132 |
</button>
|
| 133 |
+
</div>
|
| 134 |
</div>
|
| 135 |
</div>
|
| 136 |
</div>
|
|
|
|
| 325 |
<p class="mt-2 text-sm text-neutral-400">List of all currently copied positions</p>
|
| 326 |
</div>
|
| 327 |
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
|
| 328 |
+
<button type="button" class="inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-neutral-700 hover:bg-neutral-600 focus:outline-none" data-action="refresh">
|
| 329 |
+
<i data-feather="refresh-cw" class="mr-2"></i>
|
| 330 |
+
Refresh
|
| 331 |
+
</button>
|
| 332 |
+
</div>
|
| 333 |
</div>
|
| 334 |
<div class="mt-8 flex flex-col">
|
| 335 |
<div class="-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
|
|
| 818 |
</div>
|
| 819 |
</div>
|
| 820 |
</div>
|
| 821 |
+
<script src="script.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 823 |
</body>
|
| 824 |
</html>
|
script.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Trade Copier Application
|
| 2 |
+
class TradeCopierApp {
|
| 3 |
+
constructor() {
|
| 4 |
+
this.config = {
|
| 5 |
+
status: "running",
|
| 6 |
+
pollInterval: 2.0,
|
| 7 |
+
accounts: [],
|
| 8 |
+
positions: [],
|
| 9 |
+
stats: {}
|
| 10 |
+
};
|
| 11 |
+
this.init();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
async init() {
|
| 15 |
+
await this.loadConfig();
|
| 16 |
+
this.renderStats();
|
| 17 |
+
this.setupEventListeners();
|
| 18 |
+
feather.replace();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
async loadConfig() {
|
| 22 |
+
try {
|
| 23 |
+
// In a real app, this would fetch from an API
|
| 24 |
+
this.config = {
|
| 25 |
+
status: "running",
|
| 26 |
+
pollInterval: 2.0,
|
| 27 |
+
accounts: [
|
| 28 |
+
{
|
| 29 |
+
name: "Gold Account",
|
| 30 |
+
login: 12345678,
|
| 31 |
+
server: "MetaQuotes-Demo",
|
| 32 |
+
status: "connected",
|
| 33 |
+
multiplier: 1.5,
|
| 34 |
+
reverse: true,
|
| 35 |
+
maxLotPerTrade: 5.00,
|
| 36 |
+
maxLotPerSymbol: 10.00,
|
| 37 |
+
allowedSymbols: ["EURUSD", "GBPUSD", "XAUUSD", "US30"],
|
| 38 |
+
blockedSymbols: ["BTCUSD", "ETHUSD"]
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
name: "Silver Account",
|
| 42 |
+
login: 87654321,
|
| 43 |
+
server: "ICMarkets-Live",
|
| 44 |
+
status: "connected",
|
| 45 |
+
multiplier: 1.0,
|
| 46 |
+
reverse: false,
|
| 47 |
+
maxLotPerTrade: 2.00,
|
| 48 |
+
maxLotPerSymbol: 5.00,
|
| 49 |
+
allowedSymbols: null,
|
| 50 |
+
blockedSymbols: null
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
name: "Bronze Account",
|
| 54 |
+
login: 56781234,
|
| 55 |
+
server: "Pepperstone-Demo",
|
| 56 |
+
status: "disconnected",
|
| 57 |
+
multiplier: 0.5,
|
| 58 |
+
reverse: false,
|
| 59 |
+
maxLotPerTrade: 1.00,
|
| 60 |
+
maxLotPerSymbol: 2.00,
|
| 61 |
+
allowedSymbols: ["EURUSD", "GBPUSD"],
|
| 62 |
+
blockedSymbols: ["XAUUSD", "US30"]
|
| 63 |
+
}
|
| 64 |
+
],
|
| 65 |
+
positions: [
|
| 66 |
+
{
|
| 67 |
+
sourceTicket: 123456,
|
| 68 |
+
symbol: "EURUSD",
|
| 69 |
+
type: "buy",
|
| 70 |
+
volume: 1.50,
|
| 71 |
+
sl: 1.0850,
|
| 72 |
+
tp: 1.0950,
|
| 73 |
+
target: "Gold Account",
|
| 74 |
+
status: "active",
|
| 75 |
+
time: "10:23:45"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
sourceTicket: 123457,
|
| 79 |
+
symbol: "GBPUSD",
|
| 80 |
+
type: "sell",
|
| 81 |
+
volume: 0.75,
|
| 82 |
+
sl: 1.2450,
|
| 83 |
+
tp: 1.2350,
|
| 84 |
+
target: "Silver Account",
|
| 85 |
+
status: "active",
|
| 86 |
+
time: "10:45:12"
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
sourceTicket: 123458,
|
| 90 |
+
symbol: "XAUUSD",
|
| 91 |
+
type: "buy",
|
| 92 |
+
volume: 0.25,
|
| 93 |
+
sl: 1950.00,
|
| 94 |
+
tp: 1980.00,
|
| 95 |
+
target: "Bronze Account",
|
| 96 |
+
status: "pending",
|
| 97 |
+
time: "11:03:27"
|
| 98 |
+
}
|
| 99 |
+
],
|
| 100 |
+
stats: {
|
| 101 |
+
targetAccounts: 3,
|
| 102 |
+
copiedTrades: 24,
|
| 103 |
+
todaysPnl: 1245.67,
|
| 104 |
+
avgLatency: 42
|
| 105 |
+
}
|
| 106 |
+
};
|
| 107 |
+
} catch (error) {
|
| 108 |
+
console.error("Failed to load config:", error);
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
renderStats() {
|
| 113 |
+
document.querySelectorAll('[data-stat="targetAccounts"]').forEach(el => {
|
| 114 |
+
el.textContent = this.config.stats.targetAccounts;
|
| 115 |
+
});
|
| 116 |
+
document.querySelectorAll('[data-stat="copiedTrades"]').forEach(el => {
|
| 117 |
+
el.textContent = this.config.stats.copiedTrades;
|
| 118 |
+
});
|
| 119 |
+
document.querySelectorAll('[data-stat="todaysPnl"]').forEach(el => {
|
| 120 |
+
el.textContent = `$${this.config.stats.todaysPnl.toFixed(2)}`;
|
| 121 |
+
});
|
| 122 |
+
document.querySelectorAll('[data-stat="avgLatency"]').forEach(el => {
|
| 123 |
+
el.textContent = `${this.config.stats.avgLatency}ms`;
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
setupEventListeners() {
|
| 128 |
+
// Start/Stop button
|
| 129 |
+
document.getElementById('startStopBtn').addEventListener('click', () => this.toggleCopierStatus());
|
| 130 |
+
|
| 131 |
+
// Refresh button
|
| 132 |
+
document.querySelector('[data-action="refresh"]').addEventListener('click', () => this.refreshData());
|
| 133 |
+
|
| 134 |
+
// Modal controls
|
| 135 |
+
document.querySelectorAll('[data-modal-close]').forEach(btn => {
|
| 136 |
+
btn.addEventListener('click', (e) => {
|
| 137 |
+
const modalId = e.target.getAttribute('data-modal-close');
|
| 138 |
+
this.closeModal(modalId);
|
| 139 |
+
});
|
| 140 |
+
});
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
toggleCopierStatus() {
|
| 144 |
+
const btn = document.getElementById('startStopBtn');
|
| 145 |
+
if (this.config.status === 'running') {
|
| 146 |
+
this.config.status = 'stopped';
|
| 147 |
+
btn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Start Copier</span>';
|
| 148 |
+
btn.classList.remove('bg-fuchsia-600', 'hover:bg-fuchsia-700');
|
| 149 |
+
btn.classList.add('bg-green-600', 'hover:bg-green-700');
|
| 150 |
+
} else {
|
| 151 |
+
this.config.status = 'running';
|
| 152 |
+
btn.innerHTML = '<i data-feather="power" class="mr-2"></i><span>Stop Copier</span>';
|
| 153 |
+
btn.classList.remove('bg-green-600', 'hover:bg-green-700');
|
| 154 |
+
btn.classList.add('bg-fuchsia-600', 'hover:bg-fuchsia-700');
|
| 155 |
+
}
|
| 156 |
+
feather.replace();
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
openModal(modalId) {
|
| 160 |
+
document.getElementById(modalId).classList.remove('hidden');
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
closeModal(modalId) {
|
| 164 |
+
document.getElementById(modalId).classList.add('hidden');
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
async refreshData() {
|
| 168 |
+
try {
|
| 169 |
+
await this.loadConfig();
|
| 170 |
+
this.renderStats();
|
| 171 |
+
// Show notification
|
| 172 |
+
this.showToast('Data refreshed successfully', 'success');
|
| 173 |
+
} catch (error) {
|
| 174 |
+
this.showToast('Failed to refresh data', 'error');
|
| 175 |
+
console.error("Refresh error:", error);
|
| 176 |
+
}
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
showToast(message, type = 'info') {
|
| 180 |
+
const toast = document.createElement('div');
|
| 181 |
+
toast.className = `fixed top-4 right-4 px-4 py-2 rounded-md shadow-lg text-white ${
|
| 182 |
+
type === 'success' ? 'bg-green-600' :
|
| 183 |
+
type === 'error' ? 'bg-red-600' : 'bg-blue-600'
|
| 184 |
+
}`;
|
| 185 |
+
toast.textContent = message;
|
| 186 |
+
document.body.appendChild(toast);
|
| 187 |
+
|
| 188 |
+
setTimeout(() => {
|
| 189 |
+
toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
|
| 190 |
+
setTimeout(() => toast.remove(), 300);
|
| 191 |
+
}, 3000);
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
// Initialize the app when DOM is loaded
|
| 196 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 197 |
+
window.tradeCopierApp = new TradeCopierApp();
|
| 198 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,98 @@
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
}
|
|
|
|
| 1 |
+
|
| 2 |
+
/* Base styles */
|
| 3 |
body {
|
| 4 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
| 5 |
+
-webkit-font-smoothing: antialiased;
|
| 6 |
+
-moz-osx-font-smoothing: grayscale;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
/* Scrollbar styling */
|
| 10 |
+
::-webkit-scrollbar {
|
| 11 |
+
width: 8px;
|
| 12 |
+
height: 8px;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
::-webkit-scrollbar-track {
|
| 16 |
+
background: #1f2937;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
::-webkit-scrollbar-thumb {
|
| 20 |
+
background: #4b5563;
|
| 21 |
+
border-radius: 4px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
::-webkit-scrollbar-thumb:hover {
|
| 25 |
+
background: #6b7280;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/* Animations */
|
| 29 |
+
@keyframes fadeIn {
|
| 30 |
+
from { opacity: 0; }
|
| 31 |
+
to { opacity: 1; }
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.fade-in {
|
| 35 |
+
animation: fadeIn 0.3s ease-in-out;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/* Modal transitions */
|
| 39 |
+
.modal-enter {
|
| 40 |
+
opacity: 0;
|
| 41 |
+
transform: translateY(-20px);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
.modal-enter-active {
|
| 45 |
+
opacity: 1;
|
| 46 |
+
transform: translateY(0);
|
| 47 |
+
transition: opacity 200ms, transform 200ms;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.modal-exit {
|
| 51 |
+
opacity: 1;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.modal-exit-active {
|
| 55 |
+
opacity: 0;
|
| 56 |
+
transform: translateY(-20px);
|
| 57 |
+
transition: opacity 200ms, transform 200ms;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/* Responsive tables */
|
| 61 |
+
@media (max-width: 768px) {
|
| 62 |
+
.responsive-table {
|
| 63 |
+
display: block;
|
| 64 |
+
width: 100%;
|
| 65 |
+
overflow-x: auto;
|
| 66 |
+
-webkit-overflow-scrolling: touch;
|
| 67 |
+
}
|
| 68 |
}
|
| 69 |
|
| 70 |
+
/* Tooltips */
|
| 71 |
+
[data-tooltip] {
|
| 72 |
+
position: relative;
|
| 73 |
}
|
| 74 |
|
| 75 |
+
[data-tooltip]:hover::after {
|
| 76 |
+
content: attr(data-tooltip);
|
| 77 |
+
position: absolute;
|
| 78 |
+
bottom: 100%;
|
| 79 |
+
left: 50%;
|
| 80 |
+
transform: translateX(-50%);
|
| 81 |
+
background: #111827;
|
| 82 |
+
color: white;
|
| 83 |
+
padding: 4px 8px;
|
| 84 |
+
border-radius: 4px;
|
| 85 |
+
font-size: 12px;
|
| 86 |
+
white-space: nowrap;
|
| 87 |
+
z-index: 10;
|
| 88 |
}
|
| 89 |
|
| 90 |
+
/* Loading spinner */
|
| 91 |
+
.spinner {
|
| 92 |
+
animation: spin 1s linear infinite;
|
|
|
|
|
|
|
|
|
|
| 93 |
}
|
| 94 |
|
| 95 |
+
@keyframes spin {
|
| 96 |
+
from { transform: rotate(0deg); }
|
| 97 |
+
to { transform: rotate(360deg); }
|
| 98 |
}
|