Poprawa mobilnego UI

This commit is contained in:
Andus 2025-06-23 16:29:33 +02:00
parent 07c9522444
commit a661f8222d
3 changed files with 62 additions and 19 deletions

View file

@ -115,9 +115,9 @@ def start_server(username):
f"{ports[1]}/tcp": ports[1], f"{ports[1]}/tcp": ports[1],
f"{ports[2]}/tcp": ports[2], f"{ports[2]}/tcp": ports[2],
}, },
volumes={ volumes=[
os.path.abspath(path): {'bind': '/data', 'mode': 'rw'} f"{os.path.abspath(path)}:/data"
}, ],
environment=environment, environment=environment,
restart_policy={"Name": "unless-stopped"} restart_policy={"Name": "unless-stopped"}
) )

View file

@ -105,8 +105,9 @@ h2 {
/* Tabs */ /* Tabs */
.tabs { .tabs {
/* Desktop default layout */
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr); /* Original desktop layout */
gap: 14px; gap: 14px;
margin-bottom: 26px; margin-bottom: 26px;
} }
@ -121,6 +122,11 @@ h2 {
color: #ccc; color: #ccc;
transition: background-color 0.25s, transform 0.2s; transition: background-color 0.25s, transform 0.2s;
box-shadow: 0 0 8px transparent; box-shadow: 0 0 8px transparent;
/* Flexbox for text and icon alignment */
display: flex;
align-items: center;
justify-content: center; /* Center content horizontally */
gap: 8px; /* Space between text and icon */
} }
.tab-button:hover { .tab-button:hover {
@ -134,6 +140,16 @@ h2 {
box-shadow: 0 0 14px #4a5aef99; box-shadow: 0 0 14px #4a5aef99;
} }
.tab-button .tab-icon {
font-size: 1.2em; /* Adjust icon size as needed */
}
.tab-button .tab-text {
/* By default, text is visible on desktop */
display: block;
}
.square-button { .square-button {
aspect-ratio: 1 / 1; aspect-ratio: 1 / 1;
width: 200px; width: 200px;
@ -666,18 +682,28 @@ a.non-link:hover {
box-sizing: border-box; box-sizing: border-box;
} }
/* Tabs on Mobile: Single row, icons only */
.tabs { .tabs {
display: grid; display: flex; /* Use flexbox for a single row */
grid-template-columns: repeat(2, 1fr); grid-template-columns: unset; /* Override grid for mobile */
gap: 10px; justify-content: space-around; /* Distribute items evenly */
margin-bottom: 12px; flex-wrap: nowrap; /* Keep tabs in a single row */
overflow-x: auto; /* Enable horizontal scrolling if buttons exceed screen width */
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
padding-bottom: 5px; /* Add some padding for scrollbar if present */
gap: 8px; /* Slightly smaller gap on mobile */
} }
.tab-button { .tab-button {
padding: 12px; flex-shrink: 0; /* Prevent buttons from shrinking */
font-size: 0.95rem; padding: 10px 15px; /* Adjust padding for icon-only buttons */
width: 100%; /* Center content for icon-only */
box-sizing: border-box; justify-content: center;
width: auto; /* Allow buttons to size to content */
}
.tab-button .tab-text {
display: none; /* Hide the text on mobile */
} }
.square-button { .square-button {

View file

@ -3,12 +3,24 @@
<h2>Twój serwer Minecraft</h2> <h2>Twój serwer Minecraft</h2>
<div class="tabs"> <div class="tabs">
<button class="tab-button" onclick="showTab('controls')">Sterowanie 🎛️</button> <button class="tab-button" onclick="showTab('controls')">
<button class="tab-button" onclick="showTab('console')">Konsola 📟</button> <span class="tab-text">Sterowanie</span> <span class="tab-icon">🎛️</span>
<button class="tab-button" onclick="showTab('files')">Pliki 📁</button> </button>
<button class="tab-button" onclick="showTab('config')">Konfiguracja 🛠️</button> <button class="tab-button" onclick="showTab('console')">
<button class="tab-button" onclick="showTab('mods')">Mody/Pluginy 🧩</button> <span class="tab-text">Konsola</span> <span class="tab-icon">📟</span>
<button class="tab-button" onclick="showTab('statistics')">Statystyki 📈</button> </button>
<button class="tab-button" onclick="showTab('files')">
<span class="tab-text">Pliki</span> <span class="tab-icon">📁</span>
</button>
<button class="tab-button" onclick="showTab('config')">
<span class="tab-text">Konfiguracja</span> <span class="tab-icon">🛠️</span>
</button>
<button class="tab-button" onclick="showTab('mods')">
<span class="tab-text">Mody/Pluginy</span> <span class="tab-icon">🧩</span>
</button>
<button class="tab-button" onclick="showTab('statistics')">
<span class="tab-text">Statystyki</span> <span class="tab-icon">📈</span>
</button>
</div> </div>
<div class="tab-content"> <div class="tab-content">
@ -141,6 +153,11 @@
function showTab(id) { function showTab(id) {
document.querySelectorAll('.tab-panel').forEach(p => p.classList.remove('active')); document.querySelectorAll('.tab-panel').forEach(p => p.classList.remove('active'));
$(id).classList.add('active'); $(id).classList.add('active');
// Close the mobile menu if it's open (optional, depending on your menu implementation)
const tabsContainer = document.querySelector('.tabs');
if (tabsContainer.classList.contains('mobile-active')) {
tabsContainer.classList.remove('mobile-active');
}
} }
let currentPath = ''; let currentPath = '';
@ -267,4 +284,4 @@
setInterval(checkServerStatus, 5000); setInterval(checkServerStatus, 5000);
</script> </script>
{% endblock %} {% endblock %}