Skip to content

Commit 2b7f0c6

Browse files
committed
feat: rename "Albums" to "Libraries" across the app, add library visibility toggling, and refine keyboard shortcuts
1 parent fe0a555 commit 2b7f0c6

File tree

25 files changed

+144
-69
lines changed

25 files changed

+144
-69
lines changed

src-tauri/icons/icon.icns

336 KB
Binary file not shown.

src-tauri/src/t_config.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,12 @@ pub fn switch_library(id: &str) -> Result<(), String> {
349349

350350
/// Get library info
351351
#[derive(Debug, Serialize)]
352+
#[serde(rename_all = "camelCase")]
352353
pub struct LibraryInfo {
353354
pub db_file_size: i64,
354355
pub db_file_path: String,
356+
pub file_count: i64,
357+
pub total_size: i64,
355358
}
356359

357360
pub fn get_library_info(id: &str) -> Result<LibraryInfo, String> {
@@ -364,9 +367,23 @@ pub fn get_library_info(id: &str) -> Result<LibraryInfo, String> {
364367
0
365368
};
366369

370+
// Open connection to the library's DB to get file stats
371+
let conn = rusqlite::Connection::open(&db_path)
372+
.map_err(|e| format!("Failed to open library DB: {}", e))?;
373+
374+
let (file_count, total_size): (i64, i64) = conn
375+
.query_row(
376+
"SELECT COUNT(id), COALESCE(SUM(size), 0) FROM afiles",
377+
[],
378+
|row| Ok((row.get(0)?, row.get(1)?)),
379+
)
380+
.unwrap_or((0, 0));
381+
367382
Ok(LibraryInfo {
368383
db_file_size,
369384
db_file_path: db_path,
385+
file_count,
386+
total_size,
370387
})
371388
}
372389

@@ -405,9 +422,9 @@ pub fn hide_library(id: &str, hidden: bool) -> Result<(), String> {
405422
let mut config = load_app_config()?;
406423

407424
// Cannot hide the current library
408-
if config.current_library_id == id && hidden {
409-
return Err("Cannot hide the current library".to_string());
410-
}
425+
// if config.current_library_id == id && hidden {
426+
// return Err("Cannot hide the current library".to_string());
427+
// }
411428

412429
if let Some(lib) = config.libraries.iter_mut().find(|l| l.id == id) {
413430
lib.hidden = hidden;

src-vite/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Lap</title>
7+
<script>
8+
(function() {
9+
try {
10+
var config = JSON.parse(localStorage.getItem('configStore'));
11+
var isDark = true;
12+
if (config && config.settings && config.settings.appearance === 0) {
13+
isDark = false;
14+
}
15+
16+
var color = isDark ? '#1d232a' : '#ffffff';
17+
document.documentElement.style.backgroundColor = color;
18+
} catch (e) {
19+
document.documentElement.style.backgroundColor = '#1d232a';
20+
}
21+
})();
22+
</script>
723
</head>
824
<body>
925
<div id="app"></div>
164 KB
Loading

src-vite/src/common/icons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export { default as IconScrollDown } from '@/assets/icons/scroll-down.svg';
1414
// FILE/FOLDER OPERATIONS
1515
// ======================
1616
export { default as IconStack } from '@/assets/icons/stack.svg';
17-
export { default as IconAlbums } from '@/assets/icons/albums.svg';
17+
export { default as IconFolders } from '@/assets/icons/folders.svg';
1818
export { default as IconFolder } from '@/assets/icons/folder.svg';
1919
export { default as IconFolderExpanded } from '@/assets/icons/folder-expanded.svg';
2020
export { default as IconFolderCollapsed } from '@/assets/icons/folder-collapsed.svg';

src-vite/src/components/AlbumFolder.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
:disabled="true"
5353
:buttonSize="'small'"
5454
/>
55-
<ContextMenu v-if="isMainPane && !isRenamingFolder"
55+
<ContextMenu v-if="allowContextMenu && !isRenamingFolder"
5656
:class="[
5757
selection.folderPath.value != child.path ? 'invisible group-hover:visible' : ''
5858
]"
@@ -68,6 +68,7 @@
6868
:children="child.children"
6969
:albumId="albumId"
7070
:rootPath="rootPath"
71+
:allowContextMenu="allowContextMenu"
7172
/>
7273
</li>
7374
</ul>
@@ -160,14 +161,12 @@ const props = defineProps<{
160161
children?: Folder[]; // subfolders
161162
albumId: number; // album id for this folder tree
162163
rootPath: string; // root folder path (album path)
164+
allowContextMenu?: boolean; // whether to show context menu
163165
}>();
164166
165167
// Inject selection context from AlbumList
166168
const selection = useAlbumSelection();
167169
168-
// Computed to check if we're in main album pane (not MoveTo dialog)
169-
const isMainPane = computed(() => selection.albumId.value !== undefined);
170-
171170
/// i18n
172171
const { locale, messages } = useI18n();
173172
const localeMsg = computed(() => messages.value[locale.value] as any);

src-vite/src/components/AlbumList.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
:children="album.children"
101101
:albumId="album.id"
102102
:rootPath="album.path"
103+
:allowContextMenu="isMainPane"
103104
/>
104105
</div>
105106
</transition>

src-vite/src/components/Calendar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
</div>
1717

1818
<template v-if="Object.keys(calendar_dates).length > 0" >
19-
<div class="px-2 h-10 flex items-center text-sm text-base-content/30 cursor-default whitespace-nowrap">
19+
<div class="px-2 h-10 flex items-center text-sm text-base-content/30 cursor-default whitespace-nowrap">
2020
{{ $t('calendar.title') }}
21-
</div>
21+
</div>
2222
<!-- calendar -->
2323
<div ref="scrollable"
2424
class="flex-1 flex flex-col overflow-x-hidden overflow-y-auto"

src-vite/src/components/Content.vue

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,32 @@ function handleLocalKeyDown(event: KeyboardEvent) {
10661066
return;
10671067
}
10681068
1069+
// Check if there are modal dialogs
1070+
if (uiStore.inputStack.length > 0) {
1071+
return;
1072+
}
1073+
1074+
if (event.key === 'Escape') {
1075+
if (uiStore.isFullScreen) {
1076+
uiStore.isFullScreen = false;
1077+
event.preventDefault();
1078+
return;
1079+
} else if (showQuickView.value) {
1080+
showQuickView.value = false;
1081+
stopSlideShow();
1082+
event.preventDefault();
1083+
return;
1084+
} else if (selectMode.value) {
1085+
handleSelectMode(false);
1086+
event.preventDefault();
1087+
return;
1088+
} else if (tempViewMode.value !== 'none') {
1089+
exitTempViewMode();
1090+
event.preventDefault();
1091+
return;
1092+
}
1093+
}
1094+
10691095
if (selectedItemIndex.value < 0 || fileList.value.length === 0) {
10701096
return;
10711097
}
@@ -1081,7 +1107,7 @@ function handleLocalKeyDown(event: KeyboardEvent) {
10811107
10821108
const handledKeys = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'Enter', 'Space', ' '];
10831109
1084-
if (event.key === 'Enter') {
1110+
if (event.key === 'Enter' && !event.metaKey && !event.ctrlKey) {
10851111
if (!showQuickView.value && !config.content.showFilmStrip) {
10861112
showQuickView.value = true;
10871113
quickViewZoomFit.value = true;
@@ -1095,14 +1121,6 @@ function handleLocalKeyDown(event: KeyboardEvent) {
10951121
quickViewZoomFit.value = true;
10961122
}
10971123
}
1098-
else if (event.key === 'Escape' && showQuickView.value) {
1099-
if (uiStore.isFullScreen) {
1100-
uiStore.isFullScreen = false;
1101-
} else {
1102-
showQuickView.value = false;
1103-
stopSlideShow();
1104-
}
1105-
}
11061124
11071125
if (handledKeys.includes(event.key)) {
11081126
event.preventDefault();
@@ -1148,10 +1166,6 @@ const handleKeyDown = (e: any) => {
11481166
showTrashMsgbox.value = true;
11491167
} else if ((keyActions as any)[key]) {
11501168
(keyActions as any)[key]();
1151-
} else if (key === 'Escape') {
1152-
if (selectMode.value) {
1153-
handleSelectMode(false);
1154-
}
11551169
}
11561170
};
11571171

0 commit comments

Comments
 (0)