feat: uiux improvements. no scroll, direct link

This commit is contained in:
2025-09-08 22:11:16 +02:00
parent cc6ae5d606
commit 510959340d
2 changed files with 79 additions and 9 deletions

View File

@@ -367,6 +367,7 @@ function displayContents(contents) {
function createParentRow(parentPath) { function createParentRow(parentPath) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
row.innerHTML = ` row.innerHTML = `
<td> <td>
<span class="icon-parent"></span> <span class="icon-parent"></span>
@@ -377,6 +378,15 @@ function createParentRow(parentPath) {
<td>-</td> <td>-</td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le double clic si on clique sur le lien
if (e.target.tagName !== 'A') {
e.preventDefault();
loadBucketContents(parentPath, true);
}
});
const link = row.querySelector(".folder-link"); const link = row.querySelector(".folder-link");
link.addEventListener("click", (e) => { link.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -388,6 +398,7 @@ function createParentRow(parentPath) {
function createFolderRow(folder) { function createFolderRow(folder) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
row.innerHTML = ` row.innerHTML = `
<td> <td>
<span class="icon-folder"></span> <span class="icon-folder"></span>
@@ -398,6 +409,15 @@ function createFolderRow(folder) {
<td>-</td> <td>-</td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le double clic si on clique sur le lien
if (e.target.tagName !== 'A') {
e.preventDefault();
loadBucketContents(folder.path, true);
}
});
const link = row.querySelector(".folder-link"); const link = row.querySelector(".folder-link");
link.addEventListener("click", (e) => { link.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -409,6 +429,7 @@ function createFolderRow(folder) {
function createFileRow(file) { function createFileRow(file) {
const row = document.createElement("tr"); const row = document.createElement("tr");
row.className = "clickable-row";
const fileUrl = `${config.baseUrl}/${file.fullKey}`; const fileUrl = `${config.baseUrl}/${file.fullKey}`;
row.innerHTML = ` row.innerHTML = `
@@ -420,9 +441,19 @@ function createFileRow(file) {
<td class="file-date">${formatDate(file.modified)}</td> <td class="file-date">${formatDate(file.modified)}</td>
<td> <td>
<button class="copy-btn" data-url="${fileUrl}">Copier lien</button> <button class="copy-btn" data-url="${fileUrl}">Copier lien</button>
<button class="open-btn" data-url="${fileUrl}">Ouvrir</button>
</td> </td>
`; `;
// Rendre toute la ligne cliquable
row.addEventListener("click", (e) => {
// Éviter le clic sur les boutons d'action et les liens
if (e.target.tagName !== 'BUTTON' && e.target.tagName !== 'A') {
e.preventDefault();
showPreview(fileUrl, file.name);
}
});
const fileLink = row.querySelector(".file-link"); const fileLink = row.querySelector(".file-link");
fileLink.addEventListener("click", (e) => { fileLink.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
@@ -430,7 +461,16 @@ function createFileRow(file) {
}); });
const copyBtn = row.querySelector(".copy-btn"); const copyBtn = row.querySelector(".copy-btn");
copyBtn.addEventListener("click", () => copyToClipboard(fileUrl)); copyBtn.addEventListener("click", (e) => {
e.stopPropagation(); // Empêcher la propagation vers le clic sur la ligne
copyToClipboard(fileUrl);
});
const openBtn = row.querySelector(".open-btn");
openBtn.addEventListener("click", (e) => {
e.stopPropagation(); // Empêcher la propagation vers le clic sur la ligne
openInNewTab(fileUrl);
});
return row; return row;
} }
@@ -480,6 +520,10 @@ async function copyToClipboard(text) {
} }
} }
function openInNewTab(fileUrl) {
window.open(fileUrl, '_blank', 'noopener,noreferrer');
}
// Variables globales pour la prévisualisation // Variables globales pour la prévisualisation
let currentPreviewFile = { let currentPreviewFile = {
url: "", url: "",

View File

@@ -133,6 +133,15 @@ tr:hover {
background-color: #e6f3ff; background-color: #e6f3ff;
} }
/* Lignes cliquables */
.clickable-row {
cursor: pointer;
}
.clickable-row:hover {
background-color: #e6f3ff !important;
}
/* Liens et dossiers */ /* Liens et dossiers */
.folder-link { .folder-link {
color: #0066cc; color: #0066cc;
@@ -157,24 +166,41 @@ tr:hover {
font-weight: bold; font-weight: bold;
} }
/* Bouton copier lien */ /* Boutons d'actions */
.copy-btn { .copy-btn,
.open-btn {
background-color: #f0f0f0; background-color: #f0f0f0;
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 2px 6px; padding: 2px 6px;
font-size: 11px; font-size: 11px;
cursor: pointer; cursor: pointer;
border-radius: 2px; border-radius: 2px;
margin-left: 2px;
} }
.copy-btn:hover { .copy-btn:hover,
.open-btn:hover {
background-color: #e0e0e0; background-color: #e0e0e0;
} }
.copy-btn:active { .copy-btn:active,
.open-btn:active {
background-color: #d0d0d0; background-color: #d0d0d0;
} }
.open-btn {
background-color: #007acc;
color: white;
}
.open-btn:hover {
background-color: #005999;
}
.open-btn:active {
background-color: #004d80;
}
/* Tailles de fichiers */ /* Tailles de fichiers */
.file-size { .file-size {
text-align: right; text-align: right;
@@ -244,8 +270,8 @@ tr:hover {
} }
#content-section { #content-section {
flex: 0 0 25%; /* Tableau prend seulement 25% de la hauteur */ flex: none; /* Tableau prend l'espace nécessaire */
overflow-y: auto; overflow-y: visible;
} }
#files-table { #files-table {
@@ -271,8 +297,8 @@ tr:hover {
} }
#content-section { #content-section {
flex: 0 0 20%; /* Encore moins d'espace pour le tableau sur mobile */ flex: none; /* Tableau prend l'espace nécessaire */
overflow-y: auto; overflow-y: visible;
} }
#files-table { #files-table {