Bug fixes
This commit is contained in:
@@ -160,7 +160,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
<input type="checkbox" class="selection-checkbox">
|
||||
</div>
|
||||
<img src="${ensureImagePath(selection.image_path)}" alt="Selected image" loading="lazy" class="${blurClass}">
|
||||
<div class="selection-action action-${actionClass(selection.action)}"><img src="/static/icons/${actionIconMap[selection.action]}" alt="${selection.action}" class="selection-action"></div>
|
||||
<div class="selection-action action-${actionClass(selection.action)}"><img src="/static/icons/${getActionIcon(selection.action)}" alt="${selection.action}" class="selection-action"></div>
|
||||
<div class="selection-info">
|
||||
<p>${selection.image_path.split('/').pop()}</p>
|
||||
<p>Resolution: ${selection.resolution}</p>
|
||||
@@ -183,8 +183,23 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
const actionClass = (action) => {
|
||||
// Direct mapping for full action names
|
||||
const map = { 'Discarded':'discard', 'Kept':'keep', 'Favourited':'favorite', 'Reviewing':'review' };
|
||||
return map[action] || 'discard';
|
||||
|
||||
// Check direct mapping first
|
||||
if (map[action]) {
|
||||
return map[action];
|
||||
}
|
||||
|
||||
// Backwards compatibility: check first letter for single-letter actions and legacy actions
|
||||
const firstLetter = action ? action.charAt(0).toUpperCase() : '';
|
||||
switch (firstLetter) {
|
||||
case 'K': return 'keep'; // Keep/Kept
|
||||
case 'D': return 'discard'; // Discard/Discarded
|
||||
case 'F': return 'favorite'; // Favorite/Favourited
|
||||
case 'R': return 'review'; // Review/Reviewed/Reviewing
|
||||
default: return 'discard'; // Default fallback
|
||||
}
|
||||
};
|
||||
|
||||
// Map action names to icon filenames for display
|
||||
@@ -194,6 +209,24 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
'Favourited': 'fav.svg',
|
||||
'Reviewing': 'review.svg'
|
||||
};
|
||||
|
||||
// Get appropriate icon with backwards compatibility
|
||||
const getActionIcon = (action) => {
|
||||
// Check direct mapping first
|
||||
if (actionIconMap[action]) {
|
||||
return actionIconMap[action];
|
||||
}
|
||||
|
||||
// Backwards compatibility: check first letter
|
||||
const firstLetter = action ? action.charAt(0).toUpperCase() : '';
|
||||
switch (firstLetter) {
|
||||
case 'K': return 'keep.svg'; // Keep/Kept
|
||||
case 'D': return 'discard.svg'; // Discard/Discarded
|
||||
case 'F': return 'fav.svg'; // Favorite/Favourited
|
||||
case 'R': return 'review.svg'; // Review/Reviewed/Reviewing
|
||||
default: return 'discard.svg'; // Default fallback
|
||||
}
|
||||
};
|
||||
const getActionName = (action) => action;
|
||||
|
||||
const formatDate = (ts) => {
|
||||
|
||||
Reference in New Issue
Block a user