feat: Implement main application logic and UI styling

- Added app.js to manage global state, WebSocket connections, and API interactions.
- Implemented functions for theme toggling, toast notifications, and updating UI elements.
- Created functions to fetch and display account metrics, logs, and status updates.
- Added event handlers for starting, stopping, and restarting the bot.
- Introduced WebSocket handling for real-time updates.
- Added style.css for consistent theming and responsive design across the application.
- Included styles for various UI components such as buttons, cards, logs, and empty states.
- Implemented light theme support with appropriate styles.
This commit is contained in:
2025-11-08 23:56:21 +01:00
parent 773304fc85
commit 4c5d5ef9a8
9 changed files with 5175 additions and 2019 deletions

524
public/style.css Normal file
View File

@@ -0,0 +1,524 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #0d1117;
color: #e6edf3;
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
/* Header */
.header {
background: #161b22;
padding: 24px;
border-radius: 12px;
margin-bottom: 20px;
border: 1px solid #30363d;
display: flex;
justify-content: space-between;
align-items: center;
}
.header h1 {
color: #58a6ff;
font-size: 28px;
font-weight: 600;
}
.header .status {
display: flex;
align-items: center;
gap: 12px;
}
.status-badge {
padding: 8px 16px;
border-radius: 8px;
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.status-running {
background: #238636;
color: white;
}
.status-stopped {
background: #da3633;
color: white;
}
.theme-toggle {
background: #21262d;
border: 1px solid #30363d;
color: #e6edf3;
padding: 8px 12px;
border-radius: 8px;
cursor: pointer;
font-size: 18px;
}
.theme-toggle:hover {
background: #30363d;
}
/* Stats Grid */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 16px;
margin-bottom: 20px;
}
.stat-card {
background: #161b22;
border: 1px solid #30363d;
border-radius: 12px;
padding: 20px;
transition: all 0.2s;
}
.stat-card:hover {
border-color: #58a6ff;
transform: translateY(-2px);
}
.stat-card .label {
color: #8b949e;
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 8px;
}
.stat-card .value {
color: #e6edf3;
font-size: 32px;
font-weight: 700;
}
/* Card */
.card {
background: #161b22;
border: 1px solid #30363d;
border-radius: 12px;
padding: 24px;
margin-bottom: 20px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid #30363d;
}
.card-title {
color: #e6edf3;
font-size: 18px;
font-weight: 600;
}
/* Buttons */
.btn-group {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: inline-flex;
align-items: center;
gap: 8px;
}
.btn:hover {
transform: translateY(-2px);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none !important;
}
.btn-success {
background: #238636;
color: white;
}
.btn-success:hover {
background: #2ea043;
}
.btn-danger {
background: #da3633;
color: white;
}
.btn-danger:hover {
background: #f85149;
}
.btn-primary {
background: #1f6feb;
color: white;
}
.btn-primary:hover {
background: #58a6ff;
}
/* Accounts */
.account-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
background: #0d1117;
border: 1px solid #30363d;
border-radius: 8px;
margin-bottom: 12px;
transition: all 0.2s;
}
.account-item:hover {
border-color: #58a6ff;
transform: translateX(4px);
}
.account-info {
display: flex;
align-items: center;
gap: 12px;
}
.account-avatar {
width: 40px;
height: 40px;
border-radius: 8px;
background: linear-gradient(135deg, #1f6feb, #a371f7);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: 700;
font-size: 16px;
}
.account-details {
flex: 1;
}
.account-email {
font-weight: 600;
color: #e6edf3;
margin-bottom: 4px;
}
.account-status-text {
font-size: 12px;
color: #8b949e;
}
.account-stats {
display: flex;
align-items: center;
gap: 24px;
}
.account-points {
text-align: right;
}
.account-points-value {
font-size: 24px;
font-weight: 700;
color: #58a6ff;
}
.account-points-label {
font-size: 11px;
color: #8b949e;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.account-badge {
padding: 6px 12px;
border-radius: 6px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.badge-idle {
background: #21262d;
color: #8b949e;
}
.badge-running {
background: rgba(35, 134, 54, 0.2);
color: #3fb950;
border: 1px solid #3fb950;
}
.badge-completed {
background: rgba(31, 111, 235, 0.2);
color: #58a6ff;
border: 1px solid #58a6ff;
}
.badge-error {
background: rgba(248, 81, 73, 0.2);
color: #f85149;
border: 1px solid #f85149;
}
/* Logs */
.logs-container {
background: #0d1117;
border: 1px solid #30363d;
border-radius: 8px;
padding: 16px;
max-height: 600px;
overflow-y: auto;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 13px;
line-height: 1.6;
}
.logs-container::-webkit-scrollbar {
width: 10px;
}
.logs-container::-webkit-scrollbar-track {
background: #161b22;
border-radius: 5px;
}
.logs-container::-webkit-scrollbar-thumb {
background: #30363d;
border-radius: 5px;
}
.logs-container::-webkit-scrollbar-thumb:hover {
background: #484f58;
}
.log-entry {
padding: 8px;
margin-bottom: 4px;
border-left: 2px solid transparent;
border-radius: 4px;
transition: all 0.15s;
}
.log-entry:hover {
background: #161b22;
}
.log-timestamp {
color: #8b949e;
margin-right: 8px;
}
.log-platform {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 11px;
font-weight: 700;
margin-right: 8px;
text-transform: uppercase;
}
.platform-MAIN {
background: rgba(31, 111, 235, 0.2);
color: #58a6ff;
}
.platform-DESKTOP {
background: rgba(163, 113, 247, 0.2);
color: #a371f7;
}
.platform-MOBILE {
background: rgba(63, 185, 80, 0.2);
color: #3fb950;
}
.log-title {
color: #8b949e;
margin-right: 8px;
font-weight: 700;
}
.log-level-log {
border-left-color: #3fb950;
color: #e6edf3;
}
.log-level-warn {
border-left-color: #d29922;
color: #d29922;
}
.log-level-error {
border-left-color: #f85149;
color: #f85149;
font-weight: 600;
}
/* Empty State */
.empty-state {
text-align: center;
padding: 60px 20px;
color: #8b949e;
}
.empty-state i {
font-size: 48px;
margin-bottom: 16px;
opacity: 0.3;
}
/* Loading */
.loading {
display: flex;
align-items: center;
justify-content: center;
padding: 60px;
gap: 16px;
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid #30363d;
border-top-color: #58a6ff;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Toast */
.toast {
position: fixed;
bottom: 24px;
right: 24px;
background: #161b22;
border: 1px solid #30363d;
padding: 16px 20px;
border-radius: 8px;
display: flex;
align-items: center;
gap: 12px;
min-width: 300px;
z-index: 1000;
animation: slideIn 0.3s ease;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(100px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.toast i {
font-size: 20px;
}
.toast-success {
border-left: 3px solid #3fb950;
}
.toast-success i {
color: #3fb950;
}
.toast-error {
border-left: 3px solid #f85149;
}
.toast-error i {
color: #f85149;
}
.toast-info {
border-left: 3px solid #58a6ff;
}
.toast-info i {
color: #58a6ff;
}
/* Light Theme */
body.light-theme {
background: #f6f8fa;
color: #24292f;
}
body.light-theme .header,
body.light-theme .stat-card,
body.light-theme .card {
background: #ffffff;
border-color: #d0d7de;
}
body.light-theme .card-title,
body.light-theme .stat-card .value,
body.light-theme .account-email {
color: #24292f;
}
body.light-theme .theme-toggle,
body.light-theme .account-item {
background: #f6f8fa;
border-color: #d0d7de;
}
body.light-theme .logs-container {
background: #ffffff;
border-color: #d0d7de;
}
body.light-theme .log-entry:hover {
background: #f6f8fa;
}
body.light-theme .toast {
background: #ffffff;
border-color: #d0d7de;
}