🔽 Weekly Pull List dedicated tablulated page
This commit is contained in:
@@ -42,11 +42,7 @@ export const getWeeklyPullList = (options) => async (dispatch) => {
|
|||||||
axiosWithCache({
|
axiosWithCache({
|
||||||
url: `${COMICVINE_SERVICE_URI}/getWeeklyPullList`,
|
url: `${COMICVINE_SERVICE_URI}/getWeeklyPullList`,
|
||||||
method: "get",
|
method: "get",
|
||||||
params: {
|
params: options,
|
||||||
startDate: "2022-4-8",
|
|
||||||
pageSize: "15",
|
|
||||||
currentPage: "1",
|
|
||||||
},
|
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CV_WEEKLY_PULLLIST_FETCHED,
|
type: CV_WEEKLY_PULLLIST_FETCHED,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import LibraryGrid from "./Library/LibraryGrid";
|
|||||||
import Search from "./Search";
|
import Search from "./Search";
|
||||||
import Settings from "./Settings";
|
import Settings from "./Settings";
|
||||||
import VolumeDetail from "./VolumeDetail/VolumeDetail";
|
import VolumeDetail from "./VolumeDetail/VolumeDetail";
|
||||||
|
import PullList from "./PullList/PullList";
|
||||||
|
|
||||||
import { Routes, Route } from "react-router-dom";
|
import { Routes, Route } from "react-router-dom";
|
||||||
import Navbar from "./Navbar";
|
import Navbar from "./Navbar";
|
||||||
@@ -89,6 +90,7 @@ export const App = (): ReactElement => {
|
|||||||
element={<VolumeDetail />}
|
element={<VolumeDetail />}
|
||||||
/>
|
/>
|
||||||
<Route path="/settings" element={<Settings />} />
|
<Route path="/settings" element={<Settings />} />
|
||||||
|
<Route path="/pull-list/all" element={<PullList />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
</AirDCPPSocketContext.Provider>
|
</AirDCPPSocketContext.Provider>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import ellipsize from "ellipsize";
|
|||||||
import Slider from "react-slick";
|
import Slider from "react-slick";
|
||||||
import "slick-carousel/slick/slick.css";
|
import "slick-carousel/slick/slick.css";
|
||||||
import "slick-carousel/slick/slick-theme.css";
|
import "slick-carousel/slick/slick-theme.css";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
type PullListProps = {
|
type PullListProps = {
|
||||||
issues: any;
|
issues: any;
|
||||||
@@ -16,7 +17,13 @@ type PullListProps = {
|
|||||||
export const PullList = ({ issues }: PullListProps): ReactElement => {
|
export const PullList = ({ issues }: PullListProps): ReactElement => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(getWeeklyPullList(issues));
|
dispatch(
|
||||||
|
getWeeklyPullList({
|
||||||
|
startDate: "2022-4-8",
|
||||||
|
pageSize: "15",
|
||||||
|
currentPage: "1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const pullList = useSelector((state: RootState) => state.comicInfo.pullList);
|
const pullList = useSelector((state: RootState) => state.comicInfo.pullList);
|
||||||
@@ -80,7 +87,9 @@ export const PullList = ({ issues }: PullListProps): ReactElement => {
|
|||||||
</div>
|
</div>
|
||||||
{/* See all pull list issues */}
|
{/* See all pull list issues */}
|
||||||
<div className="control">
|
<div className="control">
|
||||||
<button className="button is-small">View all issues</button>
|
<Link to={"/pull-list/all/"}>
|
||||||
|
<button className="button is-small">View all issues</button>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="field has-addons">
|
<div className="field has-addons">
|
||||||
<div className="control">
|
<div className="control">
|
||||||
|
|||||||
@@ -147,10 +147,6 @@ export const Library = (data: IComicBookLibraryProps): ReactElement => {
|
|||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const goToNextPage = useCallback((pageIndex, pageSize) => {
|
const goToNextPage = useCallback((pageIndex, pageSize) => {
|
||||||
// incremement pageIndex
|
|
||||||
// nextPage();
|
|
||||||
console.log(pageIndex);
|
|
||||||
console.log("from", pageSize * pageIndex + 1);
|
|
||||||
dispatch(
|
dispatch(
|
||||||
searchIssue(
|
searchIssue(
|
||||||
{
|
{
|
||||||
@@ -167,7 +163,6 @@ export const Library = (data: IComicBookLibraryProps): ReactElement => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const goToPreviousPage = useCallback((pageIndex, pageSize) => {
|
const goToPreviousPage = useCallback((pageIndex, pageSize) => {
|
||||||
// previousPage();
|
|
||||||
let from = 0;
|
let from = 0;
|
||||||
if (pageIndex === 2) {
|
if (pageIndex === 2) {
|
||||||
from = (pageIndex - 1) * pageSize + 2 - 27;
|
from = (pageIndex - 1) * pageSize + 2 - 27;
|
||||||
|
|||||||
117
src/client/components/PullList/PullList.tsx
Normal file
117
src/client/components/PullList/PullList.tsx
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import React, { ReactElement, useEffect, useMemo } from "react";
|
||||||
|
import T2Table from "../shared/T2Table";
|
||||||
|
import { getWeeklyPullList } from "../../actions/comicinfo.actions";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import Card from "../Carda";
|
||||||
|
import ellipsize from "ellipsize";
|
||||||
|
|
||||||
|
export const PullList = (): ReactElement => {
|
||||||
|
const pullListComics = useSelector(
|
||||||
|
(state: RootState) => state.comicInfo.pullList,
|
||||||
|
);
|
||||||
|
console.log(pullListComics);
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(
|
||||||
|
getWeeklyPullList({
|
||||||
|
startDate: "2022-4-8",
|
||||||
|
pageSize: "100",
|
||||||
|
currentPage: "1",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}, []);
|
||||||
|
const nextPageHandler = () => {};
|
||||||
|
const previousPageHandler = () => {};
|
||||||
|
const columnData = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
Header: "Comic Information",
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
Header: "Details",
|
||||||
|
id: "comicDetails",
|
||||||
|
minWidth: 450,
|
||||||
|
accessor: (row) => {
|
||||||
|
console.log(row);
|
||||||
|
return (
|
||||||
|
<div className="columns">
|
||||||
|
<div className="column">
|
||||||
|
<div className="comic-detail issue-metadata">
|
||||||
|
<dl>
|
||||||
|
<dd>
|
||||||
|
<div className="columns mt-2">
|
||||||
|
<div className="column is-3">
|
||||||
|
<Card
|
||||||
|
imageUrl={row.cover}
|
||||||
|
orientation={"vertical"}
|
||||||
|
hasDetails={false}
|
||||||
|
// cardContainerStyle={{ maxWidth: 200 }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="column">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
<h6 className="name has-text-weight-medium mb-1">
|
||||||
|
{row.name}
|
||||||
|
</h6>
|
||||||
|
</dt>
|
||||||
|
<dd className="is-size-7">
|
||||||
|
published by{" "}
|
||||||
|
<span className="has-text-weight-semibold">
|
||||||
|
{row.publisher}
|
||||||
|
</span>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dd className="is-size-7">
|
||||||
|
<span>{ellipsize(row.description, 190)}</span>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dd className="is-size-7 mt-2">
|
||||||
|
<div className="field is-grouped is-grouped-multiline">
|
||||||
|
<div className="control">
|
||||||
|
<span className="tags">
|
||||||
|
<span className="tag is-success is-light has-text-weight-semibold">
|
||||||
|
{row.price}
|
||||||
|
</span>
|
||||||
|
<span className="tag is-success is-light">
|
||||||
|
{row.pulls}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<section className="container">
|
||||||
|
<div className="section">
|
||||||
|
<h1 className="title">Weekly Pull List</h1>
|
||||||
|
<T2Table
|
||||||
|
rowData={pullListComics}
|
||||||
|
columns={columnData}
|
||||||
|
totalPages={pullListComics.length}
|
||||||
|
paginationHandlers={{
|
||||||
|
nextPage: nextPageHandler,
|
||||||
|
previousPage: previousPageHandler,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PullList;
|
||||||
Reference in New Issue
Block a user