Aleksmorshen commited on
Commit
56f94bb
·
verified ·
1 Parent(s): 0ecac03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -16
app.py CHANGED
@@ -31,19 +31,19 @@ HTML_TEMPLATE = """
31
  <title>ПУ Android</title>
32
  <style>
33
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; padding: 0; background-color: #f0f2f5; color: #333; display: flex; flex-direction: column; min-height: 100vh; font-size: 16px; -webkit-text-size-adjust: 100%; }
34
- header { background-color: #333; color: white; padding: 10px 15px; display: flex; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
35
  .menu-toggle { font-size: 1.5em; background: none; border: none; color: white; cursor: pointer; margin-right: 15px; padding: 5px; }
36
  header h1 { font-size: 1.2em; margin: 0; flex-grow: 1; text-align: center; }
37
- .main-container { display: flex; flex-grow: 1; overflow: hidden; }
38
- .sidebar { width: 250px; background-color: #3f3f3f; color: white; padding: 15px; box-sizing: border-box; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease-in-out; position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000; overflow-y: auto; }
39
  .sidebar.open { transform: translateX(0); box-shadow: 3px 0 6px rgba(0,0,0,0.2); }
40
- .sidebar h2 { margin-top: 40px; font-size: 1.1em; border-bottom: 1px solid #555; padding-bottom: 10px; }
41
  .sidebar ul { list-style: none; padding: 0; margin: 0; }
42
  .sidebar ul li a { color: #ddd; text-decoration: none; display: block; padding: 12px 10px; border-radius: 4px; margin-bottom: 5px; font-size:0.95em; }
43
  .sidebar ul li a:hover, .sidebar ul li a.active { background-color: #555; color: white; }
44
  .content-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
45
  .content-overlay.active { display: block; }
46
- .content { flex-grow: 1; padding: 15px; box-sizing: border-box; overflow-y: auto; margin-top: 50px; /* Height of header */ }
47
  .container { background-color: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom:15px; }
48
  .control-section { margin-bottom: 15px; padding: 10px; border: 1px solid #e0e0e0; border-radius: 6px; background-color: #f9f9f9; }
49
  label { display: block; margin-bottom: 6px; font-weight: bold; color: #555; font-size: 0.9em; }
@@ -77,12 +77,11 @@ HTML_TEMPLATE = """
77
  .notification-item span, .contact-item span { font-size: 0.9em; color: #777; display: block; }
78
  .contact-item .contact-number { font-weight: normal; }
79
 
80
- @media (min-width: 768px) { /* Desktop styles */
81
- body { flex-direction: row; }
82
- header { display: none; } /* Hide mobile header on desktop */
83
- .sidebar { transform: translateX(0); position: static; height: 100vh; box-shadow: none; }
84
- .content { margin-top: 0; }
85
- .content-overlay { display: none !important; } /* Never show overlay on desktop */
86
  }
87
  </style>
88
  <script>
@@ -101,7 +100,7 @@ HTML_TEMPLATE = """
101
  if (activeLink) activeLink.classList.add('active');
102
  currentView = sectionId;
103
 
104
- if (document.querySelector('.sidebar').classList.contains('open')) { // Close menu on mobile after selection
105
  toggleMenu();
106
  }
107
 
@@ -365,7 +364,6 @@ HTML_TEMPLATE = """
365
  showSection('dashboard');
366
  setInterval(refreshOutput, 4000);
367
  refreshOutput();
368
- // Add event listener for the menu toggle on mobile
369
  document.querySelector('.menu-toggle').addEventListener('click', toggleMenu);
370
  document.querySelector('.content-overlay').addEventListener('click', toggleMenu);
371
  };
@@ -482,7 +480,6 @@ HTML_TEMPLATE = """
482
  </div>
483
  <div class="content-overlay"></div>
484
  <div class="content">
485
- <!-- Client Status (visible on all pages potentially) -->
486
  <div id="clientStatus" class="status offline">Статус клиента неизвестен</div>
487
 
488
  <div id="dashboard" class="container">
@@ -634,8 +631,8 @@ HTML_TEMPLATE = """
634
  </ul>
635
  </div>
636
  </div>
637
- </div> <!-- .content -->
638
- </div> <!-- .main-container -->
639
  <script>
640
  document.addEventListener('DOMContentLoaded', () => {
641
  const outputArea = document.getElementById('outputArea');
 
31
  <title>ПУ Android</title>
32
  <style>
33
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; padding: 0; background-color: #f0f2f5; color: #333; display: flex; flex-direction: column; min-height: 100vh; font-size: 16px; -webkit-text-size-adjust: 100%; }
34
+ header { background-color: #333; color: white; padding: 10px 15px; display: flex; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.2); position: fixed; top: 0; left: 0; width: 100%; z-index: 1001;}
35
  .menu-toggle { font-size: 1.5em; background: none; border: none; color: white; cursor: pointer; margin-right: 15px; padding: 5px; }
36
  header h1 { font-size: 1.2em; margin: 0; flex-grow: 1; text-align: center; }
37
+ .main-container { display: flex; flex-grow: 1; overflow: hidden; margin-top: 50px; /* Adjusted for fixed header */ }
38
+ .sidebar { width: 250px; background-color: #3f3f3f; color: white; padding: 15px; box-sizing: border-box; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease-in-out; position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000; overflow-y: auto; padding-top: 60px; /* Ensure content starts below header */ }
39
  .sidebar.open { transform: translateX(0); box-shadow: 3px 0 6px rgba(0,0,0,0.2); }
40
+ .sidebar h2 { margin-top: 0px; font-size: 1.1em; border-bottom: 1px solid #555; padding-bottom: 10px; }
41
  .sidebar ul { list-style: none; padding: 0; margin: 0; }
42
  .sidebar ul li a { color: #ddd; text-decoration: none; display: block; padding: 12px 10px; border-radius: 4px; margin-bottom: 5px; font-size:0.95em; }
43
  .sidebar ul li a:hover, .sidebar ul li a.active { background-color: #555; color: white; }
44
  .content-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
45
  .content-overlay.active { display: block; }
46
+ .content { flex-grow: 1; padding: 15px; box-sizing: border-box; overflow-y: auto; /* margin-top: 50px; Removed, handled by main-container */ }
47
  .container { background-color: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom:15px; }
48
  .control-section { margin-bottom: 15px; padding: 10px; border: 1px solid #e0e0e0; border-radius: 6px; background-color: #f9f9f9; }
49
  label { display: block; margin-bottom: 6px; font-weight: bold; color: #555; font-size: 0.9em; }
 
77
  .notification-item span, .contact-item span { font-size: 0.9em; color: #777; display: block; }
78
  .contact-item .contact-number { font-weight: normal; }
79
 
80
+ @media (min-width: 768px) {
81
+ header { display: none; }
82
+ .sidebar { transform: translateX(0); position: static; height: 100vh; box-shadow: none; padding-top: 15px; /* Reset padding for desktop */ }
83
+ .main-container { margin-top: 0; }
84
+ .content-overlay { display: none !important; }
 
85
  }
86
  </style>
87
  <script>
 
100
  if (activeLink) activeLink.classList.add('active');
101
  currentView = sectionId;
102
 
103
+ if (window.innerWidth < 768 && document.querySelector('.sidebar').classList.contains('open')) {
104
  toggleMenu();
105
  }
106
 
 
364
  showSection('dashboard');
365
  setInterval(refreshOutput, 4000);
366
  refreshOutput();
 
367
  document.querySelector('.menu-toggle').addEventListener('click', toggleMenu);
368
  document.querySelector('.content-overlay').addEventListener('click', toggleMenu);
369
  };
 
480
  </div>
481
  <div class="content-overlay"></div>
482
  <div class="content">
 
483
  <div id="clientStatus" class="status offline">Статус клиента неизвестен</div>
484
 
485
  <div id="dashboard" class="container">
 
631
  </ul>
632
  </div>
633
  </div>
634
+ </div>
635
+ </div>
636
  <script>
637
  document.addEventListener('DOMContentLoaded', () => {
638
  const outputArea = document.getElementById('outputArea');