better genre handling
This commit is contained in:
@@ -135,9 +135,7 @@ export default function MangaDetails(props: IProps) {
|
|||||||
const { setAction } = useContext(NavbarContext);
|
const { setAction } = useContext(NavbarContext);
|
||||||
|
|
||||||
const { manga } = props;
|
const { manga } = props;
|
||||||
if (manga.genre == null) {
|
|
||||||
manga.genre = '';
|
|
||||||
}
|
|
||||||
const [inLibrary, setInLibrary] = useState<string>(
|
const [inLibrary, setInLibrary] = useState<string>(
|
||||||
manga.inLibrary ? 'In Library' : 'Add To Library',
|
manga.inLibrary ? 'In Library' : 'Add To Library',
|
||||||
);
|
);
|
||||||
@@ -249,7 +247,7 @@ export default function MangaDetails(props: IProps) {
|
|||||||
<p>{manga.description}</p>
|
<p>{manga.description}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.genre}>
|
<div className={classes.genre}>
|
||||||
{manga.genre.split(', ').map((g) => <h5 key={g}>{g}</h5>)}
|
{manga.genre?.split(', ').map((g) => <h5 key={g}>{g}</h5>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
2
src/typings.d.ts
vendored
2
src/typings.d.ts
vendored
@@ -46,7 +46,7 @@ interface IManga {
|
|||||||
artist: string
|
artist: string
|
||||||
author: string
|
author: string
|
||||||
description: string
|
description: string
|
||||||
genre: string
|
genre: string | null
|
||||||
status: string
|
status: string
|
||||||
|
|
||||||
inLibrary: boolean
|
inLibrary: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user