Merge pull request #218 from BillionClaw/clawoss/fix/dark-mode-and-search

This commit is contained in:
Dionisio Pozo
2026-03-17 07:59:02 +01:00
committed by GitHub
2 changed files with 50 additions and 16 deletions
+7 -3
View File
@@ -27,12 +27,16 @@ async function performSearch(query, sortBy) {
};
if (!app.isTrashView) {
options.folder_id = app.currentPath;
if (!options.folder_id || options.folder_id === '') {
// Ensure we have a valid folder_id before searching
if (!app.currentPath || app.currentPath === '') {
await window.resolveHomeFolder();
}
// Only set folder_id if we have a valid value
if (app.currentPath && app.currentPath !== '') {
options.folder_id = app.currentPath;
}
// If still no valid folder_id, search will be global (without folder_id)
}
const searchResults = await window.search.searchFiles(query, options);
+41 -11
View File
@@ -52,24 +52,54 @@ function setupUserMenu() {
if (themeBtn) {
const pill = document.getElementById('theme-toggle-pill');
// Sync pill UI with current theme state
function syncThemePill() {
const isDark = localStorage.getItem('oxicloud_theme') === 'dark';
if (pill) {
if (isDark) {
if (pill) pill.classList.add('active');
document.documentElement.setAttribute('data-theme', 'dark');
pill.classList.add('active');
} else {
pill.classList.remove('active');
}
}
// Ensure document theme matches localStorage
if (isDark) {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute('data-theme');
}
}
// Initialize pill state on load
syncThemePill();
themeBtn.addEventListener('click', (e) => {
e.stopPropagation();
if (pill) {
pill.classList.toggle('active');
const dark = pill.classList.contains('active');
localStorage.setItem('oxicloud_theme', dark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light');
window.ui.showNotification(
dark ? '🌙' : '☀️',
dark ? 'Dark mode enabled' : 'Light mode enabled'
);
// Toggle theme based on current state, not pill state
const currentIsDark = localStorage.getItem('oxicloud_theme') === 'dark';
const newIsDark = !currentIsDark;
localStorage.setItem('oxicloud_theme', newIsDark ? 'dark' : 'light');
if (newIsDark) {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute('data-theme');
}
if (pill) {
if (newIsDark) {
pill.classList.add('active');
} else {
pill.classList.remove('active');
}
}
window.ui.showNotification(
newIsDark ? '🌙' : '☀️',
newIsDark ? 'Dark mode enabled' : 'Light mode enabled'
);
});
}