import NovelCover from "components/NovelCover"; import { delHistoryItem, putHistoryItem } from "libs/db/history"; import Link from "next/link"; import styles from "./index.module.scss"; interface ItemProps { type: string; data: HistoryItem; onRemoved: () => void; } export default function Item({ type, data, onRemoved }: ItemProps) { const isHistory = type === "History"; const url = `/novel/${data.uri}`; const chapterUrl = `/novel/${data.chapterUri}`; const handleRemoveItem = () => { const item = { ...data }; if (isHistory) { item.isReading = 0; } else { item.isFavorite = 0; } (!item.isReading && !item.isFavorite ? delHistoryItem(item.uri) : putHistoryItem(item) ).then(onRemoved); }; return (
  • {data.name}
    You have read {data.chapterIndex}/{data.chapterCount}
    {data.isReading ? "Continue Reading" : "Start Reading"}
  • ); }