Skip to content

Commit

Permalink
cleanup: remove Svelte code + related fns
Browse files Browse the repository at this point in the history
  • Loading branch information
phildenhoff committed Apr 21, 2024
1 parent 4e10ea9 commit 4b02a5c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 219 deletions.
200 changes: 0 additions & 200 deletions src/components/atoms/BookAsCover.svelte

This file was deleted.

20 changes: 1 addition & 19 deletions src/components/atoms/BookAsCover.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { open } from "@tauri-apps/api/shell";
import type { LibraryBook } from "../../bindings";
import { libraryClient } from "../../stores/library";
import { DeviceType } from "@/lib/services/library";

export const openBookInDefaultApp = (book: LibraryBook) => {
const bookAbsPath = libraryClient().getDefaultFilePathForBook(book.id);
Expand All @@ -10,25 +9,8 @@ export const openBookInDefaultApp = (book: LibraryBook) => {
return;
}

open(bookAbsPath);
};

export const getBookDownloadUrl = (book: LibraryBook): string | undefined => {
const bookAbsPath = libraryClient().getDefaultFilePathForBook(book.id);
if (!bookAbsPath) {
console.error("Cannot download book", book);
return;
}

return bookAbsPath;
open(bookAbsPath).catch(console.error);
};

export const shortenToChars = (str: string, maxChars: number) =>
str.length > maxChars ? `${str.substring(0, maxChars)}...` : str;

export const sendToDevice = async (book: LibraryBook, devicePath: string) => {
libraryClient().sendToDevice(book, {
type: DeviceType.externalDrive,
path: devicePath,
});
};

0 comments on commit 4b02a5c

Please sign in to comment.