diff --git a/Frontend/src/App.tsx b/Frontend/src/App.tsx index 9c2e213..44eb6ef 100644 --- a/Frontend/src/App.tsx +++ b/Frontend/src/App.tsx @@ -1,22 +1,18 @@ import type { Component } from "solid-js"; import { createSignal, For, onMount } from "solid-js"; - -interface Weather { - date: string; - temperatureC: number; - temperatureF: number; - summary: string; -} +import CalibreService from "./services/calibreservice"; +import { book } from "./types/calibretypes"; +import BookCard from "./components/BookCard"; const App: Component = () => { - const [weather, setWeather] = createSignal([]); + const [books, setBooks] = createSignal([]); onMount(() => { - fetch("/api/weatherforecast") - .then((r) => r.json()) - .then(setWeather); + CalibreService.getBooks().then(setBooks); }); return (
+ +

Edit src/App.tsx and save to reload. @@ -30,14 +26,9 @@ const App: Component = () => {

- - {(item) => ( -
  • - {item.date} - {item.temperatureC}°C / {item.temperatureF}°F -{" "} - {item.summary} -
  • - )} -
    +
    + {(item) => } +
    ); }; diff --git a/Frontend/src/components/BookCard.tsx b/Frontend/src/components/BookCard.tsx new file mode 100644 index 0000000..3fa7aaa --- /dev/null +++ b/Frontend/src/components/BookCard.tsx @@ -0,0 +1,27 @@ +import type { Component } from "solid-js"; +import { book } from "../types/calibretypes"; + +const BookCard: Component<{ book: book }> = (props: { book: book }) => { + return ( +
    + {/*
    + Shoes +
    */} +
    +

    {props.book.title}

    +

    {props.book.author}

    +

    + Series: {props.book.seriesName} {props.book.seriesNumber} +

    + {/*
    + +
    */} +
    +
    + ); +}; + +export default BookCard; diff --git a/Frontend/src/services/calibreservice.ts b/Frontend/src/services/calibreservice.ts new file mode 100644 index 0000000..953284b --- /dev/null +++ b/Frontend/src/services/calibreservice.ts @@ -0,0 +1,10 @@ +import { book } from "../types/calibretypes"; + +const CalibreService = { + getBooks: async (): Promise => { + const response = await fetch("/api/calibre/books"); + return response.json(); + }, +}; + +export default CalibreService; diff --git a/Frontend/src/styles/styles.css b/Frontend/src/styles/styles.css new file mode 100644 index 0000000..5990d95 --- /dev/null +++ b/Frontend/src/styles/styles.css @@ -0,0 +1,4 @@ +@import "tailwindcss"; +@plugin "daisyui" { + themes: dim --default; +} diff --git a/Frontend/src/types/calibretypes.ts b/Frontend/src/types/calibretypes.ts new file mode 100644 index 0000000..44beb1d --- /dev/null +++ b/Frontend/src/types/calibretypes.ts @@ -0,0 +1,15 @@ +interface book { + id: number; + title: string; + authorId: number; + author: string; + comments: string; + language: string; + path: string; + hasCover: boolean; + formats: Array<{ id: number; format: string; fileName: string }>; + seriesName: string; + seriesNumber: number; +} + +export type { book };