[ai] improved look&feel
This commit is contained in:
parent
00048face4
commit
ce863f4d02
|
|
@ -96,12 +96,12 @@ void DirectoryNode::buildDirectoryTree(const char *currentPath)
|
|||
subdirectories.clear();
|
||||
mp3Files.clear();
|
||||
ids.clear();
|
||||
|
||||
|
||||
// Reserve memory to reduce heap fragmentation (optimization 3)
|
||||
subdirectories.reserve(8); // Reserve space for 8 subdirectories
|
||||
mp3Files.reserve(16); // Reserve space for 16 MP3 files
|
||||
ids.reserve(16); // Reserve space for 16 IDs
|
||||
|
||||
subdirectories.reserve(8); // Reserve space for 8 subdirectories
|
||||
mp3Files.reserve(16); // Reserve space for 16 MP3 files
|
||||
ids.reserve(16); // Reserve space for 16 IDs
|
||||
|
||||
File rootDir = SD.open(currentPath);
|
||||
while (true)
|
||||
{
|
||||
|
|
@ -117,10 +117,11 @@ void DirectoryNode::buildDirectoryTree(const char *currentPath)
|
|||
subdirectories.push_back(newNode);
|
||||
newNode->buildDirectoryTree((String(currentPath) + entry.name()).c_str());
|
||||
}
|
||||
else if (String(entry.name()).endsWith(".mp3")||String(entry.name()).endsWith(".MP3"))
|
||||
else if (String(entry.name()).endsWith(".mp3") || String(entry.name()).endsWith(".MP3"))
|
||||
{
|
||||
String fullPath = String(currentPath);
|
||||
if (!fullPath.endsWith("/")) fullPath += "/";
|
||||
if (!fullPath.endsWith("/"))
|
||||
fullPath += "/";
|
||||
fullPath += entry.name();
|
||||
mp3Files.push_back(fullPath);
|
||||
ids.push_back(getNextId());
|
||||
|
|
@ -130,8 +131,6 @@ void DirectoryNode::buildDirectoryTree(const char *currentPath)
|
|||
rootDir.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DirectoryNode::printDirectoryTree(int level) const
|
||||
{
|
||||
for (int i = 0; i < level; i++)
|
||||
|
|
@ -210,7 +209,7 @@ DirectoryNode *DirectoryNode::advanceToMP3(const uint16_t id)
|
|||
}
|
||||
|
||||
// Recursively search in subdirectory
|
||||
DirectoryNode* result = subdir->advanceToMP3(id);
|
||||
DirectoryNode *result = subdir->advanceToMP3(id);
|
||||
if (result != nullptr && result->getCurrentPlaying() != nullptr)
|
||||
{
|
||||
return result;
|
||||
|
|
@ -222,10 +221,10 @@ DirectoryNode *DirectoryNode::advanceToMP3(const uint16_t id)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
DirectoryNode *DirectoryNode::advanceToMP3(const String *songName)
|
||||
{
|
||||
if (songName == nullptr) {
|
||||
if (songName == nullptr)
|
||||
{
|
||||
Serial.println("advanceToMP3: songName is null");
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -236,12 +235,15 @@ DirectoryNode *DirectoryNode::advanceToMP3(const String *songName)
|
|||
// First, search in the current directory's MP3 files
|
||||
for (size_t i = 0; i < mp3Files.size(); i++)
|
||||
{
|
||||
if (isAbsolutePath) {
|
||||
if (*songName == mp3Files[i]) {
|
||||
if (isAbsolutePath)
|
||||
{
|
||||
if (*songName == mp3Files[i])
|
||||
{
|
||||
setCurrentPlaying(&mp3Files[i]);
|
||||
return this;
|
||||
}
|
||||
} else if (mp3Files[i].endsWith(*songName))
|
||||
}
|
||||
else if (mp3Files[i].endsWith(*songName))
|
||||
{
|
||||
setCurrentPlaying(&mp3Files[i]);
|
||||
return this;
|
||||
|
|
@ -259,14 +261,17 @@ DirectoryNode *DirectoryNode::advanceToMP3(const String *songName)
|
|||
|
||||
// Search all files within subdir:
|
||||
for (size_t i = 0; i < subdir->mp3Files.size(); i++)
|
||||
{
|
||||
|
||||
if (isAbsolutePath) {
|
||||
if (*songName == subdir->mp3Files[i]) {
|
||||
subdir->setCurrentPlaying(&subdir->mp3Files[i]);
|
||||
return subdir;
|
||||
{
|
||||
|
||||
if (isAbsolutePath)
|
||||
{
|
||||
if (*songName == subdir->mp3Files[i])
|
||||
{
|
||||
subdir->setCurrentPlaying(&subdir->mp3Files[i]);
|
||||
return subdir;
|
||||
}
|
||||
}
|
||||
} else if (subdir->mp3Files[i].endsWith(*songName))
|
||||
else if (subdir->mp3Files[i].endsWith(*songName))
|
||||
{
|
||||
subdir->setCurrentPlaying(&subdir->mp3Files[i]);
|
||||
return subdir;
|
||||
|
|
@ -322,7 +327,7 @@ DirectoryNode *DirectoryNode::goToPreviousMP3(uint32_t thresholdSeconds)
|
|||
setCurrentPlaying(&mp3Files[currentIndex - 1]);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// If we're at the first song or song not found in current directory,
|
||||
// we need to find the previous song globally
|
||||
Serial.println("goToPreviousMP3: At first song or song not found, looking for previous globally");
|
||||
|
|
@ -338,14 +343,14 @@ DirectoryNode *DirectoryNode::findPreviousMP3Globally(const String *currentGloba
|
|||
}
|
||||
|
||||
// Build a flat list of all MP3 files in order
|
||||
std::vector<std::pair<DirectoryNode*, int>> allMP3s;
|
||||
std::vector<std::pair<DirectoryNode *, int>> allMP3s;
|
||||
buildFlatMP3List(allMP3s);
|
||||
|
||||
// Find current song in the flat list
|
||||
int currentGlobalIndex = -1;
|
||||
for (size_t i = 0; i < allMP3s.size(); i++)
|
||||
{
|
||||
DirectoryNode* node = allMP3s[i].first;
|
||||
DirectoryNode *node = allMP3s[i].first;
|
||||
int fileIndex = allMP3s[i].second;
|
||||
if (node->mp3Files[fileIndex] == *currentGlobal)
|
||||
{
|
||||
|
|
@ -357,12 +362,12 @@ DirectoryNode *DirectoryNode::findPreviousMP3Globally(const String *currentGloba
|
|||
// If current song found and not the first globally, move to previous
|
||||
if (currentGlobalIndex > 0)
|
||||
{
|
||||
DirectoryNode* prevNode = allMP3s[currentGlobalIndex - 1].first;
|
||||
DirectoryNode *prevNode = allMP3s[currentGlobalIndex - 1].first;
|
||||
int prevFileIndex = allMP3s[currentGlobalIndex - 1].second;
|
||||
|
||||
|
||||
Serial.print("findPreviousMP3Globally: Moving to previous song globally: ");
|
||||
Serial.println(prevNode->mp3Files[prevFileIndex]);
|
||||
|
||||
|
||||
prevNode->setCurrentPlaying(&prevNode->mp3Files[prevFileIndex]);
|
||||
return prevNode;
|
||||
}
|
||||
|
|
@ -371,7 +376,7 @@ DirectoryNode *DirectoryNode::findPreviousMP3Globally(const String *currentGloba
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void DirectoryNode::buildFlatMP3List(std::vector<std::pair<DirectoryNode*, int>>& allMP3s)
|
||||
void DirectoryNode::buildFlatMP3List(std::vector<std::pair<DirectoryNode *, int>> &allMP3s)
|
||||
{
|
||||
// Add all MP3 files from this directory
|
||||
for (size_t i = 0; i < mp3Files.size(); i++)
|
||||
|
|
@ -380,7 +385,7 @@ void DirectoryNode::buildFlatMP3List(std::vector<std::pair<DirectoryNode*, int>>
|
|||
}
|
||||
|
||||
// Recursively add MP3 files from subdirectories
|
||||
for (DirectoryNode* subdir : subdirectories)
|
||||
for (DirectoryNode *subdir : subdirectories)
|
||||
{
|
||||
subdir->buildFlatMP3List(allMP3s);
|
||||
}
|
||||
|
|
@ -449,41 +454,79 @@ DirectoryNode *DirectoryNode::advanceToNextMP3(const String *currentGlobal)
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
String DirectoryNode::getDirectoryStructureHTML() const
|
||||
{
|
||||
String DirectoryNode::getDirectoryStructureHTML() const {
|
||||
// Calculate required size first (prevents reallocations)
|
||||
size_t htmlSize = calculateHTMLSize();
|
||||
String html;
|
||||
html.reserve(512);
|
||||
|
||||
if (name == "/")
|
||||
{
|
||||
html += "<ul>\n";
|
||||
html.reserve(htmlSize); // Precise allocation - no wasted RAM
|
||||
|
||||
// Helper lambda to append without temporary Strings
|
||||
auto append = [&html](const __FlashStringHelper* fstr) {
|
||||
html += fstr;
|
||||
};
|
||||
auto appendId = [&html](uint32_t id) {
|
||||
html += id; // Direct numeric append (NO temporary String)
|
||||
};
|
||||
|
||||
if (name == "/") {
|
||||
append(F("<ul>\n"));
|
||||
}
|
||||
|
||||
if (name != "/")
|
||||
{
|
||||
html += "<li data-id=\"" + String(id) + "\"><b>" + name + "</b></li>\n";
|
||||
if (name != "/") {
|
||||
append(F("<li data-id=\""));
|
||||
appendId(id);
|
||||
append(F("\"><b>"));
|
||||
html += name; // Still uses String, but unavoidable for dynamic content
|
||||
append(F("</b></li>\n"));
|
||||
}
|
||||
|
||||
for (int i = 0; i < mp3Files.size(); i++)
|
||||
{
|
||||
html += "<li data-id=\"" + String(ids[i]) + "\">" + mp3Files[i] + "</li>\n";
|
||||
for (size_t i = 0; i < mp3Files.size(); i++) {
|
||||
append(F("<li data-id=\""));
|
||||
appendId(ids[i]);
|
||||
append(F("\">"));
|
||||
html += mp3Files[i]; // Dynamic file name
|
||||
append(F("</li>\n"));
|
||||
}
|
||||
|
||||
for (DirectoryNode *childNode : subdirectories)
|
||||
{
|
||||
html += childNode->getDirectoryStructureHTML();
|
||||
for (DirectoryNode* child : subdirectories) {
|
||||
html += child->getDirectoryStructureHTML();
|
||||
}
|
||||
if (name == "/")
|
||||
{
|
||||
html += "</ul>\n";
|
||||
|
||||
if (name == "/") {
|
||||
append(F("</ul>\n"));
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
// NEW: Calculate exact required size first
|
||||
size_t DirectoryNode::calculateHTMLSize() const {
|
||||
size_t size = 0;
|
||||
|
||||
// Opening/closing tags
|
||||
if (name == "/") size += 6; // <ul>\n
|
||||
|
||||
// Current directory entry
|
||||
if (name != "/") {
|
||||
size += 22 + name.length() + 10; // <li...><b></b></li>\n + ID digits (est)
|
||||
}
|
||||
|
||||
// MP3 files
|
||||
for (size_t i = 0; i < mp3Files.size(); i++) {
|
||||
size += 16 + mp3Files[i].length() + 10; // <li...></li>\n + ID digits
|
||||
}
|
||||
|
||||
// Subdirectories
|
||||
for (DirectoryNode* child : subdirectories) {
|
||||
size += child->calculateHTMLSize();
|
||||
}
|
||||
|
||||
// Closing tag
|
||||
if (name == "/") size += 7; // </ul>\n
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void DirectoryNode::appendIndentation(String &html, int level) const
|
||||
{
|
||||
for (int i = 0; i < level; i++)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public:
|
|||
DirectoryNode* advanceToMP3(const uint16_t id);
|
||||
void advanceToFirstMP3InThisNode();
|
||||
String getDirectoryStructureHTML() const;
|
||||
size_t calculateHTMLSize() const;
|
||||
void appendIndentation(String& html, int level) const;
|
||||
DirectoryNode* findFirstDirectoryWithMP3s();
|
||||
String getCurrentPlayingFilePath() const;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
245
web/index.html
245
web/index.html
|
|
@ -1,93 +1,178 @@
|
|||
<!DOCTYPE HTML><html>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HannaBox</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel='stylesheet' href='/style.css' type='text/css' media='all' />
|
||||
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>🎵 HannaBox 🎵</h1>
|
||||
<span id="state"></span><br/><br/>
|
||||
|
||||
|
||||
<div>
|
||||
<button class="prev-button" onclick="simpleGetCall('previous');"></button>
|
||||
<button class="play-button" onclick="simpleGetCall('toggleplaypause');"></button>
|
||||
<button class="next-button" onclick="simpleGetCall('next');"></button><br/><br/>
|
||||
</div>
|
||||
<div class="slidecontainer">
|
||||
|
||||
<input name="progress" type="range" min="0" max="100" value="0" class="slider" id="progressSlider"
|
||||
onchange="postValue('progress',document.getElementById('progressSlider').value);lastChange = Date.now();userIsInteracting = false;"
|
||||
oninput="userIsInteracting = true;"
|
||||
>
|
||||
<label for="progress" id="progressLabel"></label>
|
||||
</div>
|
||||
<div class="slidecontainer">
|
||||
<input name="volume" type="range" min="0" max="15" value="7" class="slider" id="volumeSlider"
|
||||
onchange="postValue('volume',document.getElementById('volumeSlider').value);lastChange = Date.now()"
|
||||
>
|
||||
<label for="volume">Vol</label>
|
||||
</div>
|
||||
<!--
|
||||
<button onmouseup="simpleGetCall('stop');" ontouchend="simpleGetCall('stop');">Stop</button>
|
||||
-->
|
||||
|
||||
<p class="playlist-container">
|
||||
<h2>🎶 Playlist 🎶</h2>
|
||||
%DIRECTORY%
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<button id="toggleFileManagerButton" class="action-btn" onclick="toggleFileManager()">Toggle Manager</button>
|
||||
|
||||
<div id="fileManager" style="display:none; margin-top:20px;">
|
||||
<h2>Manager</h2>
|
||||
<span id="voltage"></span><br/>
|
||||
<span id="uid"></span><br/>
|
||||
<span id="heap"></span><br/>
|
||||
<h3>Upload File</h3>
|
||||
<form id="uploadForm" class="form" method="POST" action="/upload" enctype="multipart/form-data">
|
||||
<input type="file" name="data" id="uploadFile" accept=".mp3,.wav,.flac,.m4a,.ogg"/>
|
||||
<input type="submit" name="upload" value="Upload" title="Upload Audio File" id="uploadButton" class="action-btn"/>
|
||||
<div id="uploadStatus"></div>
|
||||
<div id="uploadProgress" style="display: none;">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="progressFill"></div>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<div>
|
||||
<h1>HannaBox</h1>
|
||||
</div>
|
||||
<span id="progressText">0</span>
|
||||
</div>
|
||||
</form>
|
||||
<div class="status" id="state">—</div>
|
||||
</header>
|
||||
|
||||
<h3>Edit RFID Mapping</h3>
|
||||
Hint: Use a folder or filename, not the absolute file path!
|
||||
<div class="form">%MAPPING%</div>
|
||||
<form id="editMappingForm" class="form">
|
||||
<label for="rfid">RFID:</label>
|
||||
<input type="text" id="rfid" name="rfid" required><br>
|
||||
<label for="song">Song:</label>
|
||||
<input type="text" id="song" name="song" required><br>
|
||||
<button type="button" class="action-btn" onclick="editMapping()">Update Mapping</button>
|
||||
</form>
|
||||
<main class="container">
|
||||
<section class="player-card">
|
||||
<div class="artwork" id="artwork">
|
||||
<!-- Placeholder artwork -->
|
||||
<svg viewBox="0 0 100 100" class="art-svg" aria-hidden="true">
|
||||
<rect x="0" y="0" width="100" height="100" fill="#e9f0ff"></rect>
|
||||
<circle cx="50" cy="40" r="18" fill="#cfe0ff"></circle>
|
||||
<rect x="20" y="65" width="60" height="8" rx="2" fill="#cfe0ff"></rect>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h3>Move / Rename File</h3>
|
||||
<form class="form">
|
||||
<label for="moveFrom">From:</label>
|
||||
<input type="text" id="moveFrom" placeholder="/oldname.mp3"/>
|
||||
<label for="moveTo">To:</label>
|
||||
<input type="text" id="moveTo" placeholder="/newname.mp3"/>
|
||||
<button type="button" class="action-btn" onclick="moveFile()">Move/Rename</button>
|
||||
</form>
|
||||
|
||||
<h3>Delete File</h3>
|
||||
<form class="form">
|
||||
<label for="deleteFileName">Filename:</label>
|
||||
<input type="text" id="deleteFileName" placeholder="/song.mp3"/>
|
||||
<button type="button" class="action-btn" onclick="deleteFileOnServer()">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="big-title" id="stateTitle">—</div>
|
||||
|
||||
<script src="/script.js"></script>
|
||||
<div class="control-row">
|
||||
<button class="icon-btn prev-button" title="Previous" onclick="simpleGetCall('previous');">
|
||||
<svg width="36" height="36" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
||||
<path d="M11 19V5L4 12l7 7zM20 5v14h-2V5h2z"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button class="icon-btn play-button" title="Play / Pause" onclick="simpleGetCall('toggleplaypause');">
|
||||
<svg class="play-icon" width="40" height="40" viewBox="0 0 24 24" fill="currentColor"><path d="M5 3v18l15-9L5 3z"/></svg>
|
||||
<svg class="pause-icon" width="40" height="40" viewBox="0 0 24 24" fill="currentColor" style="display:none"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
||||
</button>
|
||||
|
||||
<button class="icon-btn next-button" title="Next" onclick="simpleGetCall('next');">
|
||||
<svg width="36" height="36" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
||||
<path d="M13 5v14l7-7-7-7zM4 5v14h2V5H4z"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="slider-row">
|
||||
<div class="slidecontainer">
|
||||
<input name="progress" type="range" min="0" max="100" value="0" class="slider" id="progressSlider"
|
||||
onchange="postValue('progress',document.getElementById('progressSlider').value);lastChange = Date.now();userIsInteracting = false;"
|
||||
oninput="userIsInteracting = true;">
|
||||
<div class="time-row">
|
||||
<span id="progressLabel">0</span>
|
||||
<span class="time-sep">/</span>
|
||||
<span id="progressMax">0</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="volumecontainer">
|
||||
<label for="volumeSlider">Vol</label>
|
||||
<input name="volume" type="range" min="0" max="15" value="7" class="slider" id="volumeSlider"
|
||||
onchange="postValue('volume',document.getElementById('volumeSlider').value);lastChange = Date.now()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<aside class="playlist">
|
||||
<div class="playlist-header">
|
||||
<h2>Playlist</h2>
|
||||
<button class="action-btn small" onclick="location.reload()">Refresh</button>
|
||||
</div>
|
||||
<div class="playlist-container">
|
||||
%DIRECTORY%
|
||||
</div>
|
||||
|
||||
<div class="manager-toggle">
|
||||
<button id="toggleFileManagerButton" class="action-btn" onclick="toggleFileManager()">Toggle Manager</button>
|
||||
</div>
|
||||
|
||||
<div id="fileManager" class="file-manager" style="display:none;">
|
||||
<h3>Manager</h3>
|
||||
<div class="info-row">
|
||||
<div id="voltage"></div>
|
||||
<div id="uid"></div>
|
||||
<div id="heap"></div>
|
||||
</div>
|
||||
|
||||
<h4>Upload File</h4>
|
||||
<form id="uploadForm" class="form" method="POST" action="/upload" enctype="multipart/form-data">
|
||||
<input type="file" name="data" id="uploadFile" accept=".mp3,.wav,.flac,.m4a,.ogg"/>
|
||||
<input type="submit" name="upload" value="Upload" title="Upload Audio File" id="uploadButton" class="action-btn"/>
|
||||
<div id="uploadStatus"></div>
|
||||
<div id="uploadProgress" style="display: none;">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="progressFill"></div>
|
||||
</div>
|
||||
<span id="progressText">0</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h4>Edit RFID Mapping</h4>
|
||||
<p class="hint">Hint: Use a folder or filename, not the absolute file path!</p>
|
||||
<div class="mapping-list">%MAPPING%</div>
|
||||
|
||||
<form id="editMappingForm" class="form form-grid">
|
||||
<div>
|
||||
<label for="rfid">RFID:</label>
|
||||
<input type="text" id="rfid" name="rfid" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="song">Song:</label>
|
||||
<input type="text" id="song" name="song" required>
|
||||
</div>
|
||||
<button type="button" class="action-btn" style="grid-column: 1 / -1;" onclick="editMapping()">Update Mapping</button>
|
||||
</form>
|
||||
|
||||
<h4>Move / Rename File</h4>
|
||||
<form class="form form-grid">
|
||||
<div>
|
||||
<label for="moveFrom">From:</label>
|
||||
<input type="text" id="moveFrom" placeholder="/oldname.mp3"/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="moveTo">To:</label>
|
||||
<input type="text" id="moveTo" placeholder="/newname.mp3"/>
|
||||
</div>
|
||||
<button type="button" class="action-btn" style="grid-column: 1 / -1;" onclick="moveFile()">Move/Rename</button>
|
||||
</form>
|
||||
|
||||
<h4>Delete File</h4>
|
||||
<form class="form form-grid">
|
||||
<div>
|
||||
<label for="deleteFileName">Filename:</label>
|
||||
<input type="text" id="deleteFileName" placeholder="/song.mp3"/>
|
||||
</div>
|
||||
<button type="button" class="action-btn" style="grid-column: 1 / -1;" onclick="deleteFileOnServer()">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</aside>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<div>Built on ESP32 • hannabox</div>
|
||||
</footer>
|
||||
|
||||
<script src="script.js"></script>
|
||||
<script>
|
||||
// Keep play/pause icon in sync with the existing class-based logic
|
||||
// Toggle visibility of play/pause SVGs based on .paused class from displayState()
|
||||
function syncPlayIcon() {
|
||||
var btn = document.querySelector('.play-button');
|
||||
if (!btn) return;
|
||||
var playIcon = btn.querySelector('.play-icon');
|
||||
var pauseIcon = btn.querySelector('.pause-icon');
|
||||
if (btn.classList.contains('paused')) {
|
||||
playIcon.style.display = 'none';
|
||||
pauseIcon.style.display = '';
|
||||
} else {
|
||||
playIcon.style.display = '';
|
||||
pauseIcon.style.display = 'none';
|
||||
}
|
||||
}
|
||||
// Observe mutations to class attribute on play-button to update icons
|
||||
var observer = new MutationObserver(syncPlayIcon);
|
||||
var playBtn = document.querySelector('.play-button');
|
||||
if (playBtn) observer.observe(playBtn, { attributes: true, attributeFilter: ['class'] });
|
||||
|
||||
// Also call regularly to catch updates
|
||||
setInterval(syncPlayIcon, 800);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -79,38 +79,60 @@ function updateProgress() {
|
|||
}
|
||||
|
||||
function displayState(state) {
|
||||
document.getElementById("state").innerHTML = state['title'];
|
||||
document.getElementById("progressLabel").innerHTML = state['time'];
|
||||
document.getElementById("voltage").innerHTML = state['voltage']+' mV';
|
||||
document.getElementById("heap").innerHTML = state['heap']+' bytes free heap';
|
||||
document.getElementById("uid").innerHTML = 'Last NFC ID: '+state['uid'];
|
||||
var title = state['title'] || '—';
|
||||
var titleEl = document.getElementById("state");
|
||||
if (titleEl) titleEl.innerHTML = title;
|
||||
var bigTitleEl = document.getElementById("stateTitle");
|
||||
if (bigTitleEl) bigTitleEl.innerText = title;
|
||||
|
||||
var progressLabel = document.getElementById("progressLabel");
|
||||
if (progressLabel) progressLabel.innerHTML = state['time'];
|
||||
|
||||
var progressMax = document.getElementById("progressMax");
|
||||
if (progressMax) progressMax.innerHTML = state['length'] || 0;
|
||||
|
||||
var voltageEl = document.getElementById("voltage");
|
||||
if (voltageEl) voltageEl.innerHTML = (state['voltage'] || '') + ' mV';
|
||||
|
||||
var heapEl = document.getElementById("heap");
|
||||
if (heapEl) heapEl.innerHTML = (state['heap'] || '') + ' bytes free heap';
|
||||
|
||||
var uidEl = document.getElementById("uid");
|
||||
if (uidEl) uidEl.innerHTML = 'Last NFC ID: ' + (state['uid'] || '');
|
||||
|
||||
/* ==== Autofill convenience fields ==== */
|
||||
var fm = document.getElementById('fileManager');
|
||||
if (state['filepath'] && fm.style.display == 'none') {
|
||||
document.getElementById('moveFrom').value = state['filepath'];
|
||||
document.getElementById('deleteFileName').value = state['filepath'];
|
||||
document.getElementById('song').value = state['filepath'];
|
||||
if (state['filepath'] && fm && fm.style.display == 'none') {
|
||||
var moveFrom = document.getElementById('moveFrom');
|
||||
var deleteFileName = document.getElementById('deleteFileName');
|
||||
var song = document.getElementById('song');
|
||||
if (moveFrom) moveFrom.value = state['filepath'];
|
||||
if (deleteFileName) deleteFileName.value = state['filepath'];
|
||||
if (song) song.value = state['filepath'];
|
||||
}
|
||||
if (state['uid']) {
|
||||
document.getElementById('rfid').value = state['uid'];
|
||||
var rfidEl = document.getElementById('rfid');
|
||||
if (rfidEl) rfidEl.value = state['uid'];
|
||||
}
|
||||
var elements = document.getElementsByClassName('play-button');
|
||||
var btn = elements[0];
|
||||
|
||||
if (state['playing']) {
|
||||
btn.classList.add('paused');
|
||||
} else {
|
||||
btn.classList.remove('paused');
|
||||
var btn = document.querySelector('.play-button');
|
||||
if (btn) {
|
||||
if (state['playing']) {
|
||||
btn.classList.add('paused');
|
||||
} else {
|
||||
btn.classList.remove('paused');
|
||||
}
|
||||
}
|
||||
|
||||
if (Date.now()-lastChange>1200) {
|
||||
var progress = document.getElementById('progressSlider');
|
||||
progress.value = state['time'];
|
||||
progress.max = state['length'];
|
||||
if (progress) {
|
||||
progress.value = state['time'];
|
||||
progress.max = state['length'];
|
||||
}
|
||||
|
||||
var volume = document.getElementById('volumeSlider');
|
||||
volume.value = state['volume'];
|
||||
if (volume) volume.value = state['volume'];
|
||||
}
|
||||
updateProgress();
|
||||
}
|
||||
|
|
|
|||
602
web/style.css
602
web/style.css
|
|
@ -1,211 +1,495 @@
|
|||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
text-align: center; /* Center align elements */
|
||||
background-color: #f4f4f4; /* Light background */
|
||||
/* Theme variables */
|
||||
:root{
|
||||
--bg: #f4f6fb;
|
||||
--card: #ffffff;
|
||||
--muted: #6b7280;
|
||||
--accent: #2563eb;
|
||||
--accent-dark: #1649b0;
|
||||
--glass: rgba(255,255,255,0.6);
|
||||
--radius: 12px;
|
||||
--shadow: 0 6px 18px rgba(18, 38, 63, 0.08);
|
||||
--max-width: 1100px;
|
||||
}
|
||||
|
||||
.playlist-container {
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
text-align: left; /* Align playlist text to the left */
|
||||
/* Page basics */
|
||||
* { box-sizing: border-box; }
|
||||
html,body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
background: linear-gradient(180deg, var(--bg), #eef3fb 120%);
|
||||
color: #1f2937;
|
||||
-webkit-font-smoothing:antialiased;
|
||||
-moz-osx-font-smoothing:grayscale;
|
||||
}
|
||||
|
||||
li {
|
||||
cursor: pointer;
|
||||
list-style-type: none;
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
|
||||
.topbar {
|
||||
max-width: var(--max-width);
|
||||
margin: 18px auto 0 auto;
|
||||
padding: 12px 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.play-button, .next-button, .prev-button {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease; /* Smooth transition for hover */
|
||||
.brand {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
object-fit: contain;
|
||||
filter: drop-shadow(0 4px 10px rgba(37,99,235,0.12));
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.topbar h1 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
|
||||
.topbar .sub {
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* Status (current song) */
|
||||
.status {
|
||||
color: var(--muted);
|
||||
font-weight: 600;
|
||||
font-size: 0.95rem;
|
||||
text-align: right;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
/* Main layout */
|
||||
.container {
|
||||
max-width: var(--max-width);
|
||||
margin: 18px auto;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr; /* single column layout: player spans full width, playlist below */
|
||||
gap: 20px;
|
||||
padding: 12px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
/* Player card - grid with fixed artwork column and a fluid content column */
|
||||
.player-card {
|
||||
background: linear-gradient(180deg, rgba(255,255,255,0.9), var(--card));
|
||||
border-radius: var(--radius);
|
||||
padding: 18px;
|
||||
display: grid;
|
||||
grid-template-columns: 180px 1fr;
|
||||
grid-auto-rows: min-content;
|
||||
gap: 20px;
|
||||
align-items: start;
|
||||
box-shadow: var(--shadow);
|
||||
min-height: 150px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Artwork */
|
||||
.artwork {
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(180deg,#e9f3ff,#dbefff);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 6px 18px rgba(37,99,235,0.06);
|
||||
grid-column: 1 / 2;
|
||||
grid-row: 1 / 3; /* span both rows so artwork stays aligned to left */
|
||||
}
|
||||
|
||||
.art-svg { width: 100%; height: 100%; }
|
||||
|
||||
/* Controls column - use a predictable flex column so controls center nicely */
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
grid-column: 2 / 3;
|
||||
grid-row: 1 / 3;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.big-title {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Buttons row - span full width of controls grid */
|
||||
.control-row {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Icon button */
|
||||
.icon-btn {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 14px;
|
||||
border: none;
|
||||
background: linear-gradient(180deg, #ffffff, #f6fbff);
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
cursor: pointer;
|
||||
transition: transform .14s ease, box-shadow .14s ease;
|
||||
box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.icon-btn:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
|
||||
/* slightly different styling for play (primary) */
|
||||
.play-button {
|
||||
box-sizing: border-box;
|
||||
margin: 5% auto;
|
||||
height: 50px; /* Consistent size for play button */
|
||||
border-color: transparent transparent transparent #007bff;
|
||||
border-style: solid;
|
||||
border-width: 25px 0 25px 40px; /* Adjusted size */
|
||||
width: 86px;
|
||||
height: 86px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(180deg, var(--accent), var(--accent-dark));
|
||||
color: white;
|
||||
box-shadow: 0 10px 30px rgba(37,99,235,0.18);
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
/* Icon colors inside play */
|
||||
.play-button .play-icon,
|
||||
.play-button .pause-icon {
|
||||
fill: currentColor;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
/* Play/pause toggle class (keeps JS compatibility) */
|
||||
.play-button.paused {
|
||||
border-style: double;
|
||||
border-width: 25px 0 25px 40px; /* Same size for pause button */
|
||||
height: 50px; /* Consistent height */
|
||||
background: linear-gradient(180deg, #f3f4f6, #e5e7eb);
|
||||
color: #111827;
|
||||
box-shadow: 0 4px 10px rgba(2,6,23,0.06);
|
||||
}
|
||||
|
||||
.play-button:hover {
|
||||
border-color: transparent transparent transparent #0056b3; /* Darker blue on hover */
|
||||
/* Prev / Next buttons - larger and visually consistent with play button */
|
||||
.prev-button, .next-button {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 14px;
|
||||
color: var(--accent);
|
||||
background: linear-gradient(180deg,#ffffff,#f6fbff);
|
||||
box-shadow: 0 8px 20px rgba(37,99,235,0.06);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: transform .14s ease, box-shadow .14s ease;
|
||||
}
|
||||
|
||||
.next-button, .prev-button {
|
||||
padding: 0;
|
||||
margin: 10px;
|
||||
border-color: transparent #007bff transparent #007bff;
|
||||
border-style: solid;
|
||||
/* Slider row - kept simple; placement is handled by the .controls grid */
|
||||
.slider-row {
|
||||
display:block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.next-button {
|
||||
border-width: 15px 0 15px 25px;
|
||||
box-shadow: 8px 0 0 0 #007bff;
|
||||
/* Desktop: keep internal grid placement but ensure small screens revert */
|
||||
@media (min-width: 921px) {
|
||||
.slider-row {
|
||||
display:block;
|
||||
}
|
||||
}
|
||||
|
||||
.next-button:hover {
|
||||
border-color: transparent #0056b3 transparent #0056b3;
|
||||
box-shadow: 8px 0 0 0 #0056b3;
|
||||
/* Small screens: fallback to stacked layout */
|
||||
@media (max-width: 920px) {
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.prev-button {
|
||||
border-width: 15px 25px 15px 0;
|
||||
box-shadow: -8px 0 0 0 #007bff;
|
||||
}
|
||||
|
||||
.prev-button:hover {
|
||||
border-color: transparent #0056b3 transparent #0056b3;
|
||||
box-shadow: -8px 0 0 0 #0056b3;
|
||||
/* Progress slider - ensure full width inside controls */
|
||||
.slidecontainer {
|
||||
width: 100%;
|
||||
max-width: 820px;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.slider {
|
||||
width: 90%; /* Make slider wider for easier interaction */
|
||||
margin: 10px auto; /* Center align the slider */
|
||||
width: 100%;
|
||||
appearance: none;
|
||||
height: 8px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, rgba(37,99,235,0.2), rgba(37,99,235,0.1));
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.slidecontainer {
|
||||
margin: 20px 0; /* Space out elements */
|
||||
.slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: white;
|
||||
border: 4px solid var(--accent);
|
||||
box-shadow: 0 4px 14px rgba(37,99,235,0.2);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Upload progress bar styles */
|
||||
.slider::-moz-range-thumb {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
background: white;
|
||||
border: 4px solid var(--accent);
|
||||
}
|
||||
|
||||
/* time row */
|
||||
.time-row {
|
||||
display:flex;
|
||||
gap: 8px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
/* Volume container - on desktop keep it compact and aligned under the progress; on small screens it expands */
|
||||
.volumecontainer {
|
||||
width: 70%;
|
||||
max-width: 420px;
|
||||
min-width: 140px;
|
||||
margin-top: 6px;
|
||||
padding-left: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
/* Ensure the volume label sits above the slider and is aligned */
|
||||
.volumecontainer label {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* Small screens: make volume full width under the progress slider */
|
||||
@media (max-width: 920px) {
|
||||
.volumecontainer {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
/* On wide screens keep a compact volume control to the right */
|
||||
@media (min-width: 921px) {
|
||||
.volumecontainer {
|
||||
width: 180px;
|
||||
min-width: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Playlist aside */
|
||||
.playlist {
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
gap: 12px;
|
||||
align-self: start; /* ensure sidebar aligns to top of the player card on wide screens */
|
||||
}
|
||||
|
||||
.playlist-header {
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
gap:8px;
|
||||
}
|
||||
|
||||
.playlist-container {
|
||||
background: var(--card);
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--shadow);
|
||||
max-height: 420px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid rgba(15,23,42,0.04);
|
||||
position: relative; /* keep content contained */
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
/* Assuming server injects <ul><li data-id="...">Song</li> */
|
||||
.playlist-container ul { margin: 0; padding: 0; list-style: none; }
|
||||
.playlist-container li {
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 6px;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
gap:10px;
|
||||
cursor: pointer;
|
||||
transition: background .12s ease, transform .08s ease;
|
||||
background: transparent;
|
||||
z-index: 1;
|
||||
}
|
||||
.playlist-container li:hover {
|
||||
background: linear-gradient(90deg, rgba(37,99,235,0.04), rgba(37,99,235,0.02));
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.playlist-container li .title { flex:1; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||||
.playlist-container li .meta { color: var(--muted); font-size: 0.85rem; }
|
||||
|
||||
/* Manager toggle & file manager */
|
||||
.manager-toggle { margin-top: 8px; text-align: center; }
|
||||
.file-manager {
|
||||
margin-top: 12px;
|
||||
background: var(--card);
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
box-shadow: var(--shadow);
|
||||
border: 1px solid rgba(15,23,42,0.04);
|
||||
}
|
||||
|
||||
/* A dedicated mapping list container so injected HTML doesn't inherit .form styling */
|
||||
.mapping-list {
|
||||
background: #fbfdff;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(37,99,235,0.06);
|
||||
margin-bottom: 8px;
|
||||
color: #0f172a;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
/* Align info row */
|
||||
.info-row { display:flex; gap:8px; font-weight:600; color:var(--muted); margin-bottom:8px; flex-wrap:wrap; }
|
||||
|
||||
/* Forms & progress bar (preserve earlier styles) */
|
||||
.form {
|
||||
background-color: white;
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 6px rgba(2,6,23,0.04);
|
||||
margin: 10px 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Grid helper for multi-field forms (move/rename/delete) */
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Make .form-grid single-column on small screens */
|
||||
@media (max-width: 520px) {
|
||||
.form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.form-grid label {
|
||||
margin: 0;
|
||||
font-weight:600;
|
||||
color: var(--muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.form-grid input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #eef4ff;
|
||||
}
|
||||
|
||||
/* Ensure labels are block and inputs full width across all forms */
|
||||
.form label { display:block; margin: 8px 0 6px 0; font-weight:600; color: #334155; }
|
||||
.form input[type="text"],
|
||||
.form input[type="file"],
|
||||
.form input[type="range"] { width: 100%; padding: 8px; border: 1px solid #e6eefc; border-radius: 6px; }
|
||||
|
||||
/* Upload progress bar */
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background-color: #e0e0e0;
|
||||
border-radius: 10px;
|
||||
height: 12px;
|
||||
background-color: #eef3ff;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin: 10px 0;
|
||||
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #007bff, #0056b3);
|
||||
background: linear-gradient(90deg, var(--accent), var(--accent-dark));
|
||||
width: 0%;
|
||||
transition: width 0.3s ease;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
#uploadProgress {
|
||||
margin: 15px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#progressText {
|
||||
font-weight: bold;
|
||||
color: #007bff;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#uploadStatus {
|
||||
margin: 10px 0;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#uploadStatus:not(:empty) {
|
||||
background-color: #e7f3ff;
|
||||
border: 1px solid #007bff;
|
||||
color: #0056b3;
|
||||
}
|
||||
|
||||
/* Form styling improvements */
|
||||
.form {
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
margin: 20px 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#uploadFile {
|
||||
padding: 8px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ====== General mobile-friendly input & button styling ====== */
|
||||
input[type="text"],
|
||||
input[type="file"],
|
||||
input[type="range"] {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
margin: 8px 0;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin: 10px 0 5px 0;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* Buttons (action-btn) */
|
||||
.action-btn {
|
||||
background-color: #007bff;
|
||||
background-color: var(--accent);
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: background-color 0.3s ease;
|
||||
margin: 5px 0;
|
||||
font-size: 14px;
|
||||
transition: background-color 0.18s ease, transform 0.12s ease;
|
||||
}
|
||||
|
||||
.action-btn:hover:not(:disabled) {
|
||||
background-color: #0056b3;
|
||||
.action-btn.small { padding:6px 10px; font-size:13px; }
|
||||
.action-btn:hover:not(:disabled) { background-color: var(--accent-dark); transform: translateY(-2px); }
|
||||
.action-btn:disabled { background-color: #9aa4b2; cursor:not-allowed; }
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
max-width: var(--max-width);
|
||||
margin: 18px auto 36px auto;
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.action-btn:disabled {
|
||||
background-color: #6c757d;
|
||||
cursor: not-allowed;
|
||||
/* Responsive tweaks */
|
||||
@media (max-width: 920px) {
|
||||
.container {
|
||||
grid-template-columns: 1fr;
|
||||
padding: 8px;
|
||||
}
|
||||
.player-card { flex-direction: row; gap: 14px; padding: 14px; }
|
||||
.artwork { width: 120px; height: 120px; }
|
||||
.play-button { width: 72px; height: 72px; }
|
||||
.playlist { order: 2; }
|
||||
.playlist-container { max-height: 320px; }
|
||||
}
|
||||
|
||||
/* Responsive design improvements */
|
||||
@media (max-width: 600px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.slider {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
#uploadForm, #editMappingForm {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
#uploadButton, #editMappingForm button {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
#uploadFile {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
@media (max-width: 520px) {
|
||||
.topbar { padding: 10px; }
|
||||
.brand h1 { font-size: 1rem; }
|
||||
.artwork { width: 96px; height: 96px; }
|
||||
.play-button { width: 64px; height: 64px; }
|
||||
.control-row { gap: 8px; }
|
||||
.time-row { font-size: 0.9rem; }
|
||||
.volumecontainer { width: 100%; }
|
||||
.slider-row { flex-direction: column; align-items: stretch; gap: 8px; }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue