- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
29 lines
831 B
TypeScript
29 lines
831 B
TypeScript
import {SelectBoxProps} from "@/components/form/SelectBox";
|
|
import {SyncedBook} from "@/lib/types/synced-book";
|
|
|
|
export function booksToSelectBox(books: SyncedBook[]): SelectBoxProps[] {
|
|
return books.map((book: SyncedBook): SelectBoxProps => {
|
|
return {
|
|
label: book.title,
|
|
value: book.id,
|
|
};
|
|
});
|
|
}
|
|
|
|
export function getBookTypeLabel(value: string): string {
|
|
switch (value) {
|
|
case 'short':
|
|
return 'bookTypes.short';
|
|
case 'novelette':
|
|
return 'bookTypes.novelette';
|
|
case 'long':
|
|
return 'bookTypes.novella';
|
|
case 'chapbook':
|
|
return 'bookTypes.chapbook';
|
|
case 'novel':
|
|
return 'bookTypes.novel';
|
|
default:
|
|
return 'bookTypes.novel';
|
|
}
|
|
}
|