feat(#3,#4,#7): add backup/restore, polish labels, and rename bulk actions
This commit is contained in:
23
src/utils/labels.js
Normal file
23
src/utils/labels.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export function toTitleWords(value) {
|
||||
if (!value) return '';
|
||||
return value
|
||||
.toString()
|
||||
.split('-')
|
||||
.map((part) => (part ? part[0].toUpperCase() + part.slice(1) : part))
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
export function formatStatusLabel(status, lentTo = '') {
|
||||
if (!status) return '';
|
||||
if (status === 'lent-to') {
|
||||
const name = lentTo?.trim();
|
||||
return name ? `Lent To ${name}` : 'Lent To';
|
||||
}
|
||||
return toTitleWords(status);
|
||||
}
|
||||
|
||||
export function formatFilterLabel(value) {
|
||||
if (!value) return '';
|
||||
if (value === 'all') return 'All';
|
||||
return toTitleWords(value);
|
||||
}
|
||||
Reference in New Issue
Block a user