From 9209f7a582c5e867a87e4a59cf8a67bbde05f03d Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 22 May 2025 07:32:38 -0400 Subject: [PATCH] Center folder strip name, fix file share url, keep fileList wrapping tight (closes #38) --- CHANGELOG.md | 8 ++++++++ public/css/styles.css | 25 +++++++++++++++++++------ public/js/adminPanel.js | 2 +- public/js/fileListView.js | 2 +- public/js/main.js | 33 ++++++++++++--------------------- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 617742a..59eb09e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Changes 5/22/2025 v1.3.7 + +- `.folder-strip-container .folder-name` css added to center text below folder material icon. +- Override file share_url to always use current origin +- Update `fileList` css to keep file name wrapping tight. + +--- + ## Changes 5/21/2025 - **Drag & Drop to Folder Strip** diff --git a/public/css/styles.css b/public/css/styles.css index 79e7f5c..464164b 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -971,16 +971,15 @@ body.dark-mode #fileList table tr { } :root { - --file-row-height: 48px; /* default, will be overwritten by your slider */ + --file-row-height: 48px; } -/* Force each to be exactly the var() height */ #fileList table.table tbody tr { - height: var(--file-row-height) !important; + height: auto !important; + min-height: var(--file-row-height) !important; } -/* And force each to match, with no extra padding or line-height */ -#fileList table.table tbody td { +#fileList table.table tbody td:not(.file-name-cell) { height: var(--file-row-height) !important; line-height: var(--file-row-height) !important; padding-top: 0 !important; @@ -988,6 +987,13 @@ body.dark-mode #fileList table tr { vertical-align: middle; } +#fileList table.table tbody td.file-name-cell { + white-space: normal; + word-break: break-word; + line-height: 1.2em !important; + height: auto !important; +} + /* =========================================================== HEADINGS & FORM LABELS =========================================================== */ @@ -2261,13 +2267,20 @@ body.dark-mode .user-dropdown .user-menu .item:hover { align-items: center; cursor: pointer; width: 80px; - color: inherit; /* icon will pick up text color */ + color: inherit; font-size: 0.85em; } .folder-strip-container .folder-item i.material-icons { font-size: 28px; margin-bottom: 4px; } +.folder-strip-container .folder-name { + text-align: center; + white-space: normal; + word-break: break-word; + max-width: 80px; + margin-top: 4px; +} .folder-strip-container .folder-item i.material-icons { color: currentColor; diff --git a/public/js/adminPanel.js b/public/js/adminPanel.js index 1cbc8fb..399dc96 100644 --- a/public/js/adminPanel.js +++ b/public/js/adminPanel.js @@ -3,7 +3,7 @@ import { loadAdminConfigFunc } from './auth.js'; import { showToast, toggleVisibility, attachEnterKeyListener } from './domUtils.js'; import { sendRequest } from './networkUtils.js'; -const version = "v1.3.6"; +const version = "v1.3.7"; const adminTitle = `${t("admin_panel")} ${version}`; // ————— Inject updated styles ————— diff --git a/public/js/fileListView.js b/public/js/fileListView.js index 3f88203..f6e27cf 100644 --- a/public/js/fileListView.js +++ b/public/js/fileListView.js @@ -338,7 +338,7 @@ export async function loadFileList(folderParam) { - + ${currentHeight}px `; const rowSlider = document.getElementById("rowHeightSlider"); diff --git a/public/js/main.js b/public/js/main.js index 257b025..db14803 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -64,35 +64,26 @@ export function initializeApp() { } export function loadCsrfToken() { - return fetchWithCsrf('/api/auth/token.php', { - method: 'GET' - }) + return fetchWithCsrf('/api/auth/token.php', { method: 'GET' }) .then(res => { - if (!res.ok) { - throw new Error(`Token fetch failed with status ${res.status}`); - } + if (!res.ok) throw new Error(`Token fetch failed with status ${res.status}`); return res.json(); }) .then(({ csrf_token, share_url }) => { - // Update global and window.csrfToken = csrf_token; - let meta = document.querySelector('meta[name="csrf-token"]'); - if (!meta) { - meta = document.createElement('meta'); - meta.name = 'csrf-token'; - document.head.appendChild(meta); - } + + // update CSRF meta + let meta = document.querySelector('meta[name="csrf-token"]') || + Object.assign(document.head.appendChild(document.createElement('meta')), { name: 'csrf-token' }); meta.content = csrf_token; - let shareMeta = document.querySelector('meta[name="share-url"]'); - if (!shareMeta) { - shareMeta = document.createElement('meta'); - shareMeta.name = 'share-url'; - document.head.appendChild(shareMeta); - } - shareMeta.content = share_url; + // force share_url to match wherever we're browsing + const actualShare = window.location.origin; + let shareMeta = document.querySelector('meta[name="share-url"]') || + Object.assign(document.head.appendChild(document.createElement('meta')), { name: 'share-url' }); + shareMeta.content = actualShare; - return { csrf_token, share_url }; + return { csrf_token, share_url: actualShare }; }); }