Skip to content

Commit

Permalink
🔧 Fixed spelling && format
Browse files Browse the repository at this point in the history
  • Loading branch information
nwrenger committed May 26, 2024
1 parent 76c0493 commit fe78c63
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
20 changes: 11 additions & 9 deletions lib-view/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Partial<User>> = {
optionalProperties: {
Expand Down Expand Up @@ -232,7 +232,7 @@ namespace api {
book: Book;
user: User;
}
const parse_overdues = ajv.compileParser<{book: Book, user: Partial<User>}[]>({
const parse_overdues = ajv.compileParser<{ book: Book; user: Partial<User> }[]>({
elements: {
properties: {
book: schema_book,
Expand Down Expand Up @@ -300,9 +300,9 @@ namespace api {
// -------------------------------------------------------------------------

export async function user_search(query: UserSearch): Promise<Limited<User>> {
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) {
Expand Down Expand Up @@ -371,10 +371,12 @@ namespace api {
// -------------------------------------------------------------------------

export async function overdues(): Promise<Overdue[]> {
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 */
Expand Down
16 changes: 8 additions & 8 deletions lib-view/src/routes/books/BookDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,40 @@
<div class="border-b pb-3">
<h2 class="text-xl font-semibold">{book.title}</h2>
<p class="text-md">
<span class="text-muted-foreground text-sm">{$_('.book.id')}:</span>
<span class="text-sm text-muted-foreground">{$_('.book.id')}:</span>
{book.id || $_('.action.empty')}
</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.isbn')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.isbn')}</h3>
<p class="text-md font-medium">{book.isbn || $_('.action.empty')}</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.authors')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.authors')}</h3>
<p class="text-md font-medium">{book.authors || $_('.action.empty')}</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.publisher')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.publisher')}</h3>
<p class="text-md font-medium">{book.publisher || $_('.action.empty')}</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.costs')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.costs')}</h3>
<p class="text-md font-medium">{book.costs || $_('.action.empty')}</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.year')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.year')}</h3>
<p class="text-md font-medium">{book.year || $_('.action.empty')}</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.category')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.category')}</h3>
<p class="text-md font-medium">
{category
? `${category.id} - ${category.name} - ${category.section}`
: book.category || $_('.action.empty')}
</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.book.note')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.book.note')}</h3>
<p class="text-md font-medium">{book.note || $_('.action.empty')}</p>
</div>
<div class="flex items-center space-x-2">
Expand Down
8 changes: 5 additions & 3 deletions lib-view/src/routes/books/BookItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,20 @@
</script>

<button
class="hover:bg-accent flex h-[66px] w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all"
class="flex h-[66px] w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
class:bg-muted={active}
id={book.id}
on:click={onClick}
>
<div class="grid w-full grid-cols-[1fr_auto] gap-1">
<div class="truncate font-semibold">{book.title}</div>
<div class="text-muted-foreground ml-auto text-nowrap text-xs">{book.id}</div>
<div class="ml-auto text-nowrap text-xs text-muted-foreground">{book.id}</div>
<div class="truncate text-xs font-medium">{book.authors}</div>
<div
class="ml-auto text-nowrap text-xs"
class:text-destructive={!book.borrowable || book.borrower || book.reservation}
>{tr_borrow_state(book)}</div>
>
{tr_borrow_state(book)}
</div>
</div>
</button>
2 changes: 1 addition & 1 deletion lib-view/src/routes/overdues/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{#await loadOverdues() then data}
{#each data as { book, user } (book.id)}
<a
class={'hover:bg-accent flex w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all'}
class={'flex w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent'}
href={`books?${new URLSearchParams({ search: book.id })}`}
>
<div class="grid w-full grid-cols-[1fr_auto] gap-1">
Expand Down
2 changes: 1 addition & 1 deletion lib-view/src/routes/users/UserDisplay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</p>
</div>
<div>
<h3 class="text-muted-foreground text-sm">{$_('.user.role')}</h3>
<h3 class="text-sm text-muted-foreground">{$_('.user.role')}</h3>
<p class="text-md font-medium">{user.role || $_('.action.empty')}</p>
</div>
<div class="flex items-center space-x-2">
Expand Down
4 changes: 2 additions & 2 deletions lib-view/src/routes/users/UserItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
</script>

<button
class="hover:bg-accent flex h-[62px] w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all"
class="flex h-[62px] w-full flex-col items-start gap-2 rounded-lg border p-3 text-left text-sm transition-all hover:bg-accent"
class:bg-muted={active}
id={user.account}
on:click={onClick}
>
<div class="grid w-full grid-cols-[1fr_auto] gap-1">
<div class="w-full overflow-hidden">
<div class="truncate font-semibold">{user.forename} {user.surname}</div>
<div class="text-muted-foreground ml-auto text-nowrap text-xs">{user.account}</div>
<div class="ml-auto text-nowrap text-xs text-muted-foreground">{user.account}</div>
</div>
<div class="flex items-center truncate text-xs font-medium">{user.role}</div>
</div>
Expand Down

0 comments on commit fe78c63

Please sign in to comment.