📑 Added comic detail page and routes
This commit is contained in:
@@ -86,7 +86,7 @@ export const getRecentlyImportedComicBooks = (options) => async (dispatch) => {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: IMS_RECENT_COMICS_FETCHED,
|
type: IMS_RECENT_COMICS_FETCHED,
|
||||||
data: response.data.docs,
|
data: response.data,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as React from "react";
|
|||||||
import { hot } from "react-hot-loader";
|
import { hot } from "react-hot-loader";
|
||||||
import Dashboard from "./Dashboard";
|
import Dashboard from "./Dashboard";
|
||||||
import Import from "./Import";
|
import Import from "./Import";
|
||||||
|
import { ComicDetail } from "./ComicDetail";
|
||||||
|
|
||||||
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
|
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
|
||||||
import Navbar from "./Navbar";
|
import Navbar from "./Navbar";
|
||||||
@@ -20,6 +21,10 @@ class App extends React.Component<Record<string, unknown>, undefined> {
|
|||||||
<Route path="/import">
|
<Route path="/import">
|
||||||
<Import path={"./comics"} />
|
<Import path={"./comics"} />
|
||||||
</Route>
|
</Route>
|
||||||
|
<Route
|
||||||
|
path={"/comic/details/:mongoObjId"}
|
||||||
|
component={ComicDetail}
|
||||||
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { IExtractedComicBookCoverFile } from "../../server/interfaces/folder.interface";
|
import { IExtractedComicBookCoverFile } from "../../server/interfaces/folder.interface";
|
||||||
import { map, isUndefined, isEmpty } from "lodash";
|
import { isUndefined, isEmpty } from "lodash";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
comicBookCoversMetadata: IExtractedComicBookCoverFile;
|
comicBookCoversMetadata: IExtractedComicBookCoverFile;
|
||||||
|
mongoObjId?: number;
|
||||||
}
|
}
|
||||||
interface IState {}
|
interface IState {}
|
||||||
|
|
||||||
class Card extends React.Component<IProps, IState> {
|
class Card extends React.Component<IProps, IState> {
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
console.log(props);
|
||||||
}
|
}
|
||||||
private removeLeadingPeriod = (input: string): string => {
|
private removeLeadingPeriod = (input: string): string => {
|
||||||
if (!isUndefined(this.props.comicBookCoversMetadata)) {
|
if (!isUndefined(this.props.comicBookCoversMetadata)) {
|
||||||
@@ -41,7 +44,9 @@ class Card extends React.Component<IProps, IState> {
|
|||||||
</div>
|
</div>
|
||||||
<div className="card-content">
|
<div className="card-content">
|
||||||
<ul>
|
<ul>
|
||||||
<li className="has-text-weight-semibold">{metadata.name}</li>
|
<Link to={"/comic/details/" + this.props.mongoObjId}>
|
||||||
|
<li className="has-text-weight-semibold">{metadata.name}</li>
|
||||||
|
</Link>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,7 +56,6 @@ class Card extends React.Component<IProps, IState> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
console.log(this.props.comicBookCoversMetadata);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!isUndefined(this.props.comicBookCoversMetadata) &&
|
{!isUndefined(this.props.comicBookCoversMetadata) &&
|
||||||
|
|||||||
5
src/client/components/ComicDetail.tsx
Normal file
5
src/client/components/ComicDetail.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
type ComicDetailProps = {};
|
||||||
|
|
||||||
|
export const ComicDetail = ({}: ComicDetailProps) => <section>1,2,3</section>;
|
||||||
@@ -10,8 +10,14 @@ export const RecentlyImported = ({
|
|||||||
comicBookCovers,
|
comicBookCovers,
|
||||||
}: RecentlyImportedProps) => (
|
}: RecentlyImportedProps) => (
|
||||||
<section className="card-container">
|
<section className="card-container">
|
||||||
{map(comicBookCovers, (cover) => {
|
{map(comicBookCovers.docs, (doc, idx) => {
|
||||||
return <Card comicBookCoversMetadata={cover.rawFileDetails} />;
|
return (
|
||||||
|
<Card
|
||||||
|
key={idx}
|
||||||
|
comicBookCoversMetadata={doc.rawFileDetails}
|
||||||
|
mongoObjId={doc._id}
|
||||||
|
/>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user