style(ui): apply biome recos
This commit is contained in:
@@ -151,7 +151,7 @@ function setCurrentSection(section) {
|
|||||||
|
|
||||||
// Update page title
|
// Update page title
|
||||||
const titleKey = `nav.${section}`;
|
const titleKey = `nav.${section}`;
|
||||||
const defaultTitle = section.charAt(0).toUpperCase() + section.slice(1);
|
// TODO check why no more used: const defaultTitle = section.charAt(0).toUpperCase() + section.slice(1);
|
||||||
appElements.pageTitle.textContent = i18n.t(titleKey);
|
appElements.pageTitle.textContent = i18n.t(titleKey);
|
||||||
appElements.pageTitle.setAttribute('data-i18n', titleKey);
|
appElements.pageTitle.setAttribute('data-i18n', titleKey);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function addTrashItemToView(item) {
|
|||||||
iconClass = item.icon_class || (ui?.getIconClass ? ui.getIconClass(item.name) : 'fas fa-file');
|
iconClass = item.icon_class || (ui?.getIconClass ? ui.getIconClass(item.name) : 'fas fa-file');
|
||||||
iconSpecialClass = ui?.getIconSpecialClass ? ui.getIconSpecialClass(item.name) : '';
|
iconSpecialClass = ui?.getIconSpecialClass ? ui.getIconSpecialClass(item.name) : '';
|
||||||
const cat = item.category || '';
|
const cat = item.category || '';
|
||||||
typeLabel = cat ? (i18n.t(`files.file_types.${cat.toLowerCase()}`) || cat) : i18n.t('files.file_types.document');
|
typeLabel = cat ? i18n.t(`files.file_types.${cat.toLowerCase()}`) || cat : i18n.t('files.file_types.document');
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFolder = !isFile;
|
const isFolder = !isFile;
|
||||||
|
|||||||
+1
-1
@@ -1282,7 +1282,7 @@ const ui = {
|
|||||||
const iconClass = file.icon_class || this.getIconClass(file.name);
|
const iconClass = file.icon_class || this.getIconClass(file.name);
|
||||||
const iconSpecialClass = file.icon_special_class || this.getIconSpecialClass(file.name);
|
const iconSpecialClass = file.icon_special_class || this.getIconSpecialClass(file.name);
|
||||||
const cat = file.category || '';
|
const cat = file.category || '';
|
||||||
const typeLabel = cat ? (i18n.t(`files.file_types.${cat.toLowerCase()}`) || cat) : i18n.t('files.file_types.document');
|
const typeLabel = cat ? i18n.t(`files.file_types.${cat.toLowerCase()}`) || cat : i18n.t('files.file_types.document');
|
||||||
const fileSize = file.size_formatted || formatFileSize(file.size);
|
const fileSize = file.size_formatted || formatFileSize(file.size);
|
||||||
const formattedDate = formatDateTime(file.modified_at);
|
const formattedDate = formatDateTime(file.modified_at);
|
||||||
const isFav = favorites?.isFavorite(file.id, 'file');
|
const isFav = favorites?.isFavorite(file.id, 'file');
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ function showUserProfileModal() {
|
|||||||
// FIXME: use classes
|
// FIXME: use classes
|
||||||
const barColor = percentage > 90 ? '#ef4444' : percentage > 70 ? '#f59e0b' : '#22c55e';
|
const barColor = percentage > 90 ? '#ef4444' : percentage > 70 ? '#f59e0b' : '#22c55e';
|
||||||
|
|
||||||
|
|
||||||
const existing = document.getElementById('profile-modal-overlay');
|
const existing = document.getElementById('profile-modal-overlay');
|
||||||
if (existing) existing.remove();
|
if (existing) existing.remove();
|
||||||
|
|
||||||
|
|||||||
@@ -796,8 +796,7 @@ const contextMenus = {
|
|||||||
const dialogHeader = shareDialog.querySelector('.share-dialog-header');
|
const dialogHeader = shareDialog.querySelector('.share-dialog-header');
|
||||||
if (dialogHeader) {
|
if (dialogHeader) {
|
||||||
const headerSpan = dialogHeader.querySelector('span');
|
const headerSpan = dialogHeader.querySelector('span');
|
||||||
const titleText =
|
const titleText = itemType === 'file' ? i18n.t('dialogs.share_file') : i18n.t('dialogs.share_folder');
|
||||||
itemType === 'file' ? i18n.t('dialogs.share_file') : i18n.t('dialogs.share_folder');
|
|
||||||
if (headerSpan) {
|
if (headerSpan) {
|
||||||
headerSpan.textContent = titleText;
|
headerSpan.textContent = titleText;
|
||||||
} else {
|
} else {
|
||||||
@@ -995,10 +994,7 @@ const contextMenus = {
|
|||||||
ui.setSharedVisualState(item.id, item.type, true);
|
ui.setSharedVisualState(item.id, item.type, true);
|
||||||
|
|
||||||
// Show success message
|
// Show success message
|
||||||
ui.showNotification(
|
ui.showNotification(i18n.t('notifications.link_created'), i18n.t('notifications.share_success'));
|
||||||
i18n.t('notifications.link_created'),
|
|
||||||
i18n.t('notifications.share_success')
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error creating shared link:', error);
|
console.error('Error creating shared link:', error);
|
||||||
ui.showNotification('Error', error.message || 'Could not create shared link');
|
ui.showNotification('Error', error.message || 'Could not create shared link');
|
||||||
@@ -1172,10 +1168,7 @@ const contextMenus = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await resp.json();
|
await resp.json();
|
||||||
ui.showNotification(
|
ui.showNotification(i18n.t('music.added'), `${files.length} ${files.length === 1 ? 'track' : 'tracks'} ${i18n.t('music.added_to_playlist')}`);
|
||||||
i18n.t('music.added'),
|
|
||||||
`${files.length} ${files.length === 1 ? 'track' : 'tracks'} ${i18n.t('music.added_to_playlist')}`
|
|
||||||
);
|
|
||||||
|
|
||||||
this.closePlaylistDialog();
|
this.closePlaylistDialog();
|
||||||
|
|
||||||
|
|||||||
@@ -994,10 +994,7 @@ const fileOps = {
|
|||||||
console.log('Response status:', response.status);
|
console.log('Response status:', response.status);
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
ui.showNotification(
|
ui.showNotification(i18n.t('notifications.file_renamed'), i18n.t('notifications.file_renamed_to', { name: newName }));
|
||||||
i18n.t('notifications.file_renamed'),
|
|
||||||
i18n.t('notifications.file_renamed_to', { name: newName })
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
const errorText = await response.text();
|
const errorText = await response.text();
|
||||||
|
|||||||
@@ -110,10 +110,7 @@ const favorites = {
|
|||||||
|
|
||||||
// Notify user
|
// Notify user
|
||||||
if (ui?.showNotification) {
|
if (ui?.showNotification) {
|
||||||
ui.showNotification(
|
ui.showNotification(i18n.t('favorites.added_title'), `"${name}" ${i18n.t('favorites.added_msg')}`);
|
||||||
i18n.t('favorites.added_title'),
|
|
||||||
`"${name}" ${i18n.t('favorites.added_msg')}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -145,10 +142,7 @@ const favorites = {
|
|||||||
this._cache.delete(this._cacheKey(id, type));
|
this._cache.delete(this._cacheKey(id, type));
|
||||||
|
|
||||||
if (ui?.showNotification) {
|
if (ui?.showNotification) {
|
||||||
ui.showNotification(
|
ui.showNotification(i18n.t('favorites.removed_title'), `"${itemName}" ${i18n.t('favorites.removed_msg')}`);
|
||||||
i18n.t('favorites.removed_title'),
|
|
||||||
`"${itemName}" ${i18n.t('favorites.removed_msg')}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ const musicView = {
|
|||||||
const listEl = document.getElementById('music-playlist-list');
|
const listEl = document.getElementById('music-playlist-list');
|
||||||
if (!listEl) return;
|
if (!listEl) return;
|
||||||
|
|
||||||
|
|
||||||
if (this.playlists.length === 0) {
|
if (this.playlists.length === 0) {
|
||||||
listEl.innerHTML = `
|
listEl.innerHTML = `
|
||||||
<div class="music-empty">
|
<div class="music-empty">
|
||||||
@@ -342,7 +341,6 @@ const musicView = {
|
|||||||
const trackListEl = document.getElementById('music-track-list');
|
const trackListEl = document.getElementById('music-track-list');
|
||||||
if (!trackListEl) return;
|
if (!trackListEl) return;
|
||||||
|
|
||||||
|
|
||||||
if (this.currentTracks.length === 0) {
|
if (this.currentTracks.length === 0) {
|
||||||
trackListEl.innerHTML = `
|
trackListEl.innerHTML = `
|
||||||
<div class="music-empty">
|
<div class="music-empty">
|
||||||
@@ -477,7 +475,6 @@ const musicView = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async _showCreatePlaylistDialog() {
|
async _showCreatePlaylistDialog() {
|
||||||
|
|
||||||
const name = await Modal.prompt({
|
const name = await Modal.prompt({
|
||||||
title: i18n.t('music.create_playlist'),
|
title: i18n.t('music.create_playlist'),
|
||||||
label: i18n.t('music.playlist_name'),
|
label: i18n.t('music.playlist_name'),
|
||||||
@@ -531,7 +528,6 @@ const musicView = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async _deletePlaylist() {
|
async _deletePlaylist() {
|
||||||
|
|
||||||
if (!this.currentPlaylist) return;
|
if (!this.currentPlaylist) return;
|
||||||
|
|
||||||
const confirmed = await new Promise((resolve) => {
|
const confirmed = await new Promise((resolve) => {
|
||||||
@@ -1686,7 +1682,6 @@ const musicPlayer = {
|
|||||||
const queueList = document.getElementById('player-queue-list');
|
const queueList = document.getElementById('player-queue-list');
|
||||||
if (!queueList) return;
|
if (!queueList) return;
|
||||||
|
|
||||||
|
|
||||||
if (this.queue.length === 0) {
|
if (this.queue.length === 0) {
|
||||||
queueList.innerHTML = `
|
queueList.innerHTML = `
|
||||||
<div class="player-queue-empty">
|
<div class="player-queue-empty">
|
||||||
|
|||||||
Reference in New Issue
Block a user