📚 Added volume card stacks to the dashboard
This commit is contained in:
@@ -5,6 +5,9 @@ import { API_BASE_URI, SOCKET_BASE_URI } from "../constants/endpoints";
|
|||||||
import {
|
import {
|
||||||
IMS_COMICBOOK_METADATA_FETCHED,
|
IMS_COMICBOOK_METADATA_FETCHED,
|
||||||
IMS_SOCKET_CONNECTION_CONNECTED,
|
IMS_SOCKET_CONNECTION_CONNECTED,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_FETCHED,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_CALL_FAILED,
|
||||||
IMS_RECENT_COMICS_FETCHED,
|
IMS_RECENT_COMICS_FETCHED,
|
||||||
CV_API_CALL_IN_PROGRESS,
|
CV_API_CALL_IN_PROGRESS,
|
||||||
CV_SEARCH_SUCCESS,
|
CV_SEARCH_SUCCESS,
|
||||||
@@ -144,6 +147,30 @@ export const importToDB = (payload?: any) => (dispatch) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
export const fetchVolumeGroups = () => (dispatch) => {
|
||||||
|
try {
|
||||||
|
dispatch({
|
||||||
|
type: IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS,
|
||||||
|
});
|
||||||
|
axios
|
||||||
|
.request({
|
||||||
|
url: "http://localhost:3000/api/import/getComicBookGroups",
|
||||||
|
method: "GET",
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
console.log(data);
|
||||||
|
dispatch({
|
||||||
|
type: IMS_COMIC_BOOK_GROUPS_FETCHED,
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
dispatch({
|
||||||
|
type: IMS_COMIC_BOOK_GROUPS_CALL_FAILED,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
export const fetchComicVineMatches = (searchPayload) => (dispatch) => {
|
export const fetchComicVineMatches = (searchPayload) => (dispatch) => {
|
||||||
try {
|
try {
|
||||||
const issueString = searchPayload.rawFileDetails.name;
|
const issueString = searchPayload.rawFileDetails.name;
|
||||||
|
|||||||
@@ -26,27 +26,38 @@ $border-color: red;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dashboard
|
// Dashboard
|
||||||
.paper {
|
.stack-card-container {
|
||||||
background: #fff;
|
display: grid;
|
||||||
width: 200px;
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
border-radius: 0.3rem;
|
column-gap: 0.5em;
|
||||||
box-shadow:
|
row-gap: 1.2em;
|
||||||
/* The top layer shadow */
|
.stack {
|
||||||
0 -1px 1px rgba(0,0,0,0.15),
|
width: 200px;
|
||||||
/* The second layer */
|
border-radius: 0.3rem;
|
||||||
0 -10px 0 -5px #eee,
|
box-shadow:
|
||||||
/* The second layer shadow */
|
/* The top layer shadow */ 0 -1px 1px rgba(0, 0, 0, 0.15),
|
||||||
0 -10px 1px -4px rgba(0,0,0,0.15),
|
/* The second layer */ 0 -10px 0 -5px #eee,
|
||||||
/* The third layer */
|
/* The second layer shadow */ 0 -10px 1px -4px rgba(0, 0, 0, 0.15),
|
||||||
0 -20px 0 -10px #eee,
|
/* The third layer */ 0 -20px 0 -10px #eee,
|
||||||
/* The third layer shadow */
|
/* The third layer shadow */ 0 -20px 1px -9px rgba(0, 0, 0, 0.15);
|
||||||
0 -20px 1px -9px rgba(0,0,0,0.15);
|
img {
|
||||||
/* Padding for demo purposes */
|
height: auto;
|
||||||
padding: 30px;
|
border-top-left-radius: 0.3rem;
|
||||||
|
border-top-right-radius: 0.3rem;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
margin: -5px 0 0 0;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-bottom-left-radius: 0.25rem;
|
||||||
|
box-shadow: 1px 8px 23px 7px rgba(0, 0, 0, 0.12);
|
||||||
|
border-bottom-right-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.min {
|
.min {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
@@ -299,7 +310,7 @@ $border-color: red;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Library grid
|
// Library grid
|
||||||
.my-masonry-grid {
|
.my-masonry-grid {
|
||||||
display: -webkit-box; /* Not needed if autoprefixing */
|
display: -webkit-box; /* Not needed if autoprefixing */
|
||||||
display: -ms-flexbox; /* Not needed if autoprefixing */
|
display: -ms-flexbox; /* Not needed if autoprefixing */
|
||||||
@@ -312,7 +323,8 @@ $border-color: red;
|
|||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-masonry-grid_column > div { /* change div to reference your elements you put in <Masonry> */
|
.my-masonry-grid_column > div {
|
||||||
|
/* change div to reference your elements you put in <Masonry> */
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { ReactElement, useEffect } from "react";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import ZeroState from "./ZeroState";
|
import ZeroState from "./ZeroState";
|
||||||
import { RecentlyImported } from "./RecentlyImported";
|
import { RecentlyImported } from "./RecentlyImported";
|
||||||
|
import { VolumeGroups } from "./VolumeGroups";
|
||||||
import { getComicBooks } from "../actions/fileops.actions";
|
import { getComicBooks } from "../actions/fileops.actions";
|
||||||
import { isEmpty } from "lodash";
|
import { isEmpty } from "lodash";
|
||||||
|
|
||||||
@@ -28,11 +29,8 @@ export const Dashboard = (): ReactElement => {
|
|||||||
|
|
||||||
{!isEmpty(recentComics) && !isEmpty(recentComics.docs) ? (
|
{!isEmpty(recentComics) && !isEmpty(recentComics.docs) ? (
|
||||||
<>
|
<>
|
||||||
<h2 className="subtitle">Recently Imported</h2>
|
|
||||||
<RecentlyImported comicBookCovers={recentComics} />
|
<RecentlyImported comicBookCovers={recentComics} />
|
||||||
<section>
|
<VolumeGroups />
|
||||||
<div className="paper">asdas</div>
|
|
||||||
</section>
|
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ZeroState
|
<ZeroState
|
||||||
|
|||||||
@@ -16,53 +16,56 @@ type RecentlyImportedProps = {
|
|||||||
export const RecentlyImported = ({
|
export const RecentlyImported = ({
|
||||||
comicBookCovers,
|
comicBookCovers,
|
||||||
}: RecentlyImportedProps): ReactElement => (
|
}: RecentlyImportedProps): ReactElement => (
|
||||||
<section className="card-container">
|
<>
|
||||||
{map(comicBookCovers.docs, ({ _id, rawFileDetails, sourcedMetadata }) => {
|
<h2 className="subtitle">Recently Imported</h2>
|
||||||
let imagePath = "";
|
<section className="card-container">
|
||||||
let comicName = "";
|
{map(comicBookCovers.docs, ({ _id, rawFileDetails, sourcedMetadata }) => {
|
||||||
if (!isNil(rawFileDetails)) {
|
let imagePath = "";
|
||||||
const encodedFilePath = encodeURI(
|
let comicName = "";
|
||||||
"http://localhost:3000" + removeLeadingPeriod(rawFileDetails.path),
|
if (!isNil(rawFileDetails)) {
|
||||||
|
const encodedFilePath = encodeURI(
|
||||||
|
"http://localhost:3000" + removeLeadingPeriod(rawFileDetails.path),
|
||||||
|
);
|
||||||
|
imagePath = escapePoundSymbol(encodedFilePath);
|
||||||
|
comicName = rawFileDetails.name;
|
||||||
|
} else if (!isNil(sourcedMetadata)) {
|
||||||
|
imagePath = sourcedMetadata.comicvine.image.small_url;
|
||||||
|
comicName = sourcedMetadata.comicvine.name;
|
||||||
|
}
|
||||||
|
const titleElement = (
|
||||||
|
<Link to={"/comic/details/" + _id}>{ellipsize(comicName, 18)}</Link>
|
||||||
);
|
);
|
||||||
imagePath = escapePoundSymbol(encodedFilePath);
|
return (
|
||||||
comicName = rawFileDetails.name;
|
<Card
|
||||||
} else if (!isNil(sourcedMetadata)) {
|
key={_id}
|
||||||
imagePath = sourcedMetadata.comicvine.image.small_url;
|
orientation={"vertical"}
|
||||||
comicName = sourcedMetadata.comicvine.name;
|
imageUrl={imagePath}
|
||||||
}
|
hasDetails
|
||||||
const titleElement = (
|
title={comicName ? titleElement : null}
|
||||||
<Link to={"/comic/details/" + _id}>{ellipsize(comicName, 18)}</Link>
|
>
|
||||||
);
|
<div className="content is-flex is-flex-direction-row">
|
||||||
return (
|
{!isNil(sourcedMetadata.comicvine) && (
|
||||||
<Card
|
<span className="icon cv-icon is-small">
|
||||||
key={_id}
|
<img src="/dist/img/cvlogo.svg" />
|
||||||
orientation={"vertical"}
|
</span>
|
||||||
imageUrl={imagePath}
|
)}
|
||||||
hasDetails
|
{isNil(rawFileDetails) && (
|
||||||
title={comicName ? titleElement : null}
|
<span className="icon has-text-info">
|
||||||
>
|
<i className="fas fa-adjust" />
|
||||||
<div className="content is-flex is-flex-direction-row">
|
</span>
|
||||||
{!isNil(sourcedMetadata.comicvine) && (
|
)}
|
||||||
<span className="icon cv-icon is-small">
|
{!isNil(sourcedMetadata.comicvine) &&
|
||||||
<img src="/dist/img/cvlogo.svg" />
|
!isEmpty(
|
||||||
</span>
|
detectTradePaperbacks(
|
||||||
)}
|
sourcedMetadata.comicvine.volumeInformation.description,
|
||||||
{isNil(rawFileDetails) && (
|
),
|
||||||
<span className="icon has-text-info">
|
) ? (
|
||||||
<i className="fas fa-adjust" />
|
<span className="tag is-warning">TPB</span>
|
||||||
</span>
|
) : null}
|
||||||
)}
|
</div>
|
||||||
{!isNil(sourcedMetadata.comicvine) &&
|
</Card>
|
||||||
!isEmpty(
|
);
|
||||||
detectTradePaperbacks(
|
})}
|
||||||
sourcedMetadata.comicvine.volumeInformation.description,
|
</section>
|
||||||
),
|
</>
|
||||||
) ? (
|
|
||||||
<span className="tag is-warning">TPB</span>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</section>
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,46 @@
|
|||||||
import React, { ReactElement } from "react";
|
import { isNil, map } from "lodash";
|
||||||
|
import React, { ReactElement, useEffect } from "react";
|
||||||
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
|
import ellipsize from "ellipsize";
|
||||||
|
import { fetchVolumeGroups } from "../actions/fileops.actions";
|
||||||
|
|
||||||
export const VolumeGroups = (): ReactElement => {
|
export const VolumeGroups = (): ReactElement => {
|
||||||
return <div className="paper"></div>;
|
const dispatch = useDispatch();
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(fetchVolumeGroups());
|
||||||
|
}, [dispatch]);
|
||||||
|
const volumeGroups = useSelector(
|
||||||
|
(state: RootState) => state.fileOps.comicVolumeGroups,
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h2 className="subtitle">Volumes</h2>
|
||||||
|
<div className="stack-card-container">
|
||||||
|
{!isNil(volumeGroups) &&
|
||||||
|
volumeGroups &&
|
||||||
|
map(volumeGroups.data, (group) => {
|
||||||
|
if (!isNil(group)) {
|
||||||
|
return (
|
||||||
|
<div className="stack">
|
||||||
|
<img src={group.results.image.small_url} />
|
||||||
|
<div className="content">
|
||||||
|
{ellipsize(group.results.name, 18)}
|
||||||
|
<div className="control">
|
||||||
|
<span className="tags has-addons">
|
||||||
|
<span className="tag is-primary is-light">Issues</span>
|
||||||
|
<span className="tag">
|
||||||
|
{group.results.count_of_issues}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default VolumeGroups;
|
export default VolumeGroups;
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ export const IMS_COMIC_BOOK_DB_OBJECT_CALL_IN_PROGRESS =
|
|||||||
export const IMS_COMIC_BOOK_DB_OBJECT_CALL_FAILED =
|
export const IMS_COMIC_BOOK_DB_OBJECT_CALL_FAILED =
|
||||||
"IMS_COMIC_BOOK_DB_OBJECT_CALL_FAILED";
|
"IMS_COMIC_BOOK_DB_OBJECT_CALL_FAILED";
|
||||||
|
|
||||||
|
// volume groups
|
||||||
|
export const IMS_COMIC_BOOK_GROUPS_FETCHED = "IMS_COMIC_BOOK_GROUPS_FETCHED";
|
||||||
|
export const IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS =
|
||||||
|
"IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS";
|
||||||
|
export const IMS_COMIC_BOOK_GROUPS_CALL_FAILED =
|
||||||
|
"IMS_COMIC_BOOK_GROUPS_CALL_FAILED";
|
||||||
|
|
||||||
export const AIRDCPP_SEARCH_IN_PROGRESS = "AIRDCPP_SEARCH_IN_PROGRESS";
|
export const AIRDCPP_SEARCH_IN_PROGRESS = "AIRDCPP_SEARCH_IN_PROGRESS";
|
||||||
export const AIRDCPP_SEARCH_RESULTS_RECEIVED =
|
export const AIRDCPP_SEARCH_RESULTS_RECEIVED =
|
||||||
"AIRDCPP_SEARCH_RESULTS_RECEIVED";
|
"AIRDCPP_SEARCH_RESULTS_RECEIVED";
|
||||||
|
|||||||
@@ -10,10 +10,14 @@ import {
|
|||||||
IMS_CV_METADATA_IMPORT_SUCCESSFUL,
|
IMS_CV_METADATA_IMPORT_SUCCESSFUL,
|
||||||
IMS_CV_METADATA_IMPORT_FAILED,
|
IMS_CV_METADATA_IMPORT_FAILED,
|
||||||
IMS_CV_METADATA_IMPORT_CALL_IN_PROGRESS,
|
IMS_CV_METADATA_IMPORT_CALL_IN_PROGRESS,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_FETCHED,
|
||||||
|
IMS_COMIC_BOOK_GROUPS_CALL_FAILED,
|
||||||
} from "../constants/action-types";
|
} from "../constants/action-types";
|
||||||
const initialState = {
|
const initialState = {
|
||||||
IMSCallInProgress: false,
|
IMSCallInProgress: false,
|
||||||
comicBookMetadata: [],
|
comicBookMetadata: [],
|
||||||
|
comicVolumeGroups: [],
|
||||||
isSocketConnected: false,
|
isSocketConnected: false,
|
||||||
isComicVineMetadataImportInProgress: false,
|
isComicVineMetadataImportInProgress: false,
|
||||||
comicVineMetadataImportError: {},
|
comicVineMetadataImportError: {},
|
||||||
@@ -68,6 +72,26 @@ function fileOpsReducer(state = initialState, action) {
|
|||||||
isComicVineMetadataImportInProgress: false,
|
isComicVineMetadataImportInProgress: false,
|
||||||
comicVineMetadataImportError: action.importError,
|
comicVineMetadataImportError: action.importError,
|
||||||
};
|
};
|
||||||
|
case IMS_COMIC_BOOK_GROUPS_CALL_IN_PROGRESS: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
IMSCallInProgress: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case IMS_COMIC_BOOK_GROUPS_FETCHED: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
comicVolumeGroups: action.data,
|
||||||
|
IMSCallInProgress: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
case IMS_COMIC_BOOK_GROUPS_CALL_FAILED: {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
IMSCallInProgress: false,
|
||||||
|
error: action.error,
|
||||||
|
};
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user