diff --git a/README.md b/README.md index 7cfa3a7..f27fbe7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ It contains the business and handles the data. ### UI Layer -The [UI](lib-view) is developed in Svelte and TypeScript using Skeleton as a UI Framework. +The [UI](lib-view) is developed in Svelte and TypeScript using Shadcn as a UI Framework. This layer is also responsible for internationalization ([locales](lib-view/src/lib/i18n/locales/)). Currently, there are only two languages supported (English and German). diff --git a/lib-view/src/lib/api.ts b/lib-view/src/lib/api.ts index eeae2e2..6007f27 100644 --- a/lib-view/src/lib/api.ts +++ b/lib-view/src/lib/api.ts @@ -168,8 +168,8 @@ namespace api { forename: u.forename ?? '', surname: u.surname ?? '', role: u.role ?? '', - may_borrow: u.may_borrow ?? true, - } + may_borrow: u.may_borrow ?? true + }; } const schema_user: JTDSchemaType> = { optionalProperties: { @@ -232,7 +232,7 @@ namespace api { book: Book; user: User; } - const parse_overdues = ajv.compileParser<{book: Book, user: Partial}[]>({ + const parse_overdues = ajv.compileParser<{ book: Book; user: Partial }[]>({ elements: { properties: { book: schema_book, @@ -300,9 +300,9 @@ namespace api { // ------------------------------------------------------------------------- export async function user_search(query: UserSearch): Promise> { - return get('api/user', parse_limited_users, query).then(l => ({ + return get('api/user', parse_limited_users, query).then((l) => ({ total: l.total, - rows: l.rows.map(userDef), + rows: l.rows.map(userDef) })); } export async function user_add(user: User) { @@ -371,10 +371,12 @@ namespace api { // ------------------------------------------------------------------------- export async function overdues(): Promise { - return get('api/overdues', parse_overdues).then((o) => o.map((e) => ({ - book: e.book, - user: userDef(e.user), - }))); + return get('api/overdues', parse_overdues).then((o) => + o.map((e) => ({ + book: e.book, + user: userDef(e.user) + })) + ); } /** Fetches the data, throwing an exception if something went wrong */ diff --git a/lib-view/src/routes/books/BookDisplay.svelte b/lib-view/src/routes/books/BookDisplay.svelte index ba7a363..48c531a 100644 --- a/lib-view/src/routes/books/BookDisplay.svelte +++ b/lib-view/src/routes/books/BookDisplay.svelte @@ -16,32 +16,32 @@

{book.title}

- {$_('.book.id')}: + {$_('.book.id')}: {book.id || $_('.action.empty')}

-

{$_('.book.isbn')}

+

{$_('.book.isbn')}

{book.isbn || $_('.action.empty')}

-

{$_('.book.authors')}

+

{$_('.book.authors')}

{book.authors || $_('.action.empty')}

-

{$_('.book.publisher')}

+

{$_('.book.publisher')}

{book.publisher || $_('.action.empty')}

-

{$_('.book.costs')}

+

{$_('.book.costs')}

{book.costs || $_('.action.empty')}

-

{$_('.book.year')}

+

{$_('.book.year')}

{book.year || $_('.action.empty')}

-

{$_('.category')}

+

{$_('.category')}

{category ? `${category.id} - ${category.name} - ${category.section}` @@ -49,7 +49,7 @@

-

{$_('.book.note')}

+

{$_('.book.note')}

{book.note || $_('.action.empty')}

diff --git a/lib-view/src/routes/books/BookItem.svelte b/lib-view/src/routes/books/BookItem.svelte index e21d2cf..83f0cba 100644 --- a/lib-view/src/routes/books/BookItem.svelte +++ b/lib-view/src/routes/books/BookItem.svelte @@ -19,18 +19,20 @@
diff --git a/lib-view/src/routes/overdues/+page.svelte b/lib-view/src/routes/overdues/+page.svelte index b80e2a1..e58ebfb 100644 --- a/lib-view/src/routes/overdues/+page.svelte +++ b/lib-view/src/routes/overdues/+page.svelte @@ -29,7 +29,7 @@ {#await loadOverdues() then data} {#each data as { book, user } (book.id)}
diff --git a/lib-view/src/routes/users/UserDisplay.svelte b/lib-view/src/routes/users/UserDisplay.svelte index 456be3a..df514fd 100644 --- a/lib-view/src/routes/users/UserDisplay.svelte +++ b/lib-view/src/routes/users/UserDisplay.svelte @@ -14,7 +14,7 @@

-

{$_('.user.role')}

+

{$_('.user.role')}

{user.role || $_('.action.empty')}

diff --git a/lib-view/src/routes/users/UserItem.svelte b/lib-view/src/routes/users/UserItem.svelte index cec1217..ebb3292 100644 --- a/lib-view/src/routes/users/UserItem.svelte +++ b/lib-view/src/routes/users/UserItem.svelte @@ -12,7 +12,7 @@