🔧 Tweaked state vars for reading and analysis
This commit is contained in:
@@ -66,7 +66,7 @@ export const ComicDetail = (data: ComicDetailProps): ReactElement => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const extractedComicBook = useSelector(
|
const extractedComicBook = useSelector(
|
||||||
(state: RootState) => state.fileOps.extractedComicBookArchive,
|
(state: RootState) => state.fileOps.extractedComicBookArchive.reading,
|
||||||
);
|
);
|
||||||
const { comicObjectId } = useParams<{ comicObjectId: string }>();
|
const { comicObjectId } = useParams<{ comicObjectId: string }>();
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const ArchiveOperations = (props): ReactElement => {
|
|||||||
(state: RootState) => state.fileOps.comicBookExtractionInProgress,
|
(state: RootState) => state.fileOps.comicBookExtractionInProgress,
|
||||||
);
|
);
|
||||||
const extractedComicBookArchive = useSelector(
|
const extractedComicBookArchive = useSelector(
|
||||||
(state: RootState) => state.fileOps.extractedComicBookArchive,
|
(state: RootState) => state.fileOps.extractedComicBookArchive.analysis,
|
||||||
);
|
);
|
||||||
|
|
||||||
const imageAnalysisResult = useSelector((state: RootState) => {
|
const imageAnalysisResult = useSelector((state: RootState) => {
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ const initialState = {
|
|||||||
isComicVineMetadataImportInProgress: false,
|
isComicVineMetadataImportInProgress: false,
|
||||||
comicVineMetadataImportError: {},
|
comicVineMetadataImportError: {},
|
||||||
rawImportError: {},
|
rawImportError: {},
|
||||||
extractedComicBookArchive: [],
|
extractedComicBookArchive: {
|
||||||
|
reading: [],
|
||||||
|
analysis: [],
|
||||||
|
},
|
||||||
recentComics: [],
|
recentComics: [],
|
||||||
wantedComics: [],
|
wantedComics: [],
|
||||||
libraryComics: [],
|
libraryComics: [],
|
||||||
@@ -135,13 +138,7 @@ function fileOpsReducer(state = initialState, action) {
|
|||||||
comicBookExtractionInProgress: true,
|
comicBookExtractionInProgress: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case IMS_COMIC_BOOK_ARCHIVE_EXTRACTION_SUCCESS: {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
extractedComicBookArchive: action.extractedComicBookArchive,
|
|
||||||
comicBookExtractionInProgress: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
case LOCATION_CHANGE: {
|
case LOCATION_CHANGE: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@@ -164,15 +161,32 @@ function fileOpsReducer(state = initialState, action) {
|
|||||||
|
|
||||||
case COMICBOOK_EXTRACTION_SUCCESS: {
|
case COMICBOOK_EXTRACTION_SUCCESS: {
|
||||||
const comicBookPages: string[] = [];
|
const comicBookPages: string[] = [];
|
||||||
map(action.result, (page) => {
|
map(action.result.files, (page) => {
|
||||||
const pageFilePath = removeLeadingPeriod(page);
|
const pageFilePath = removeLeadingPeriod(page);
|
||||||
const imagePath = encodeURI(`${LIBRARY_SERVICE_HOST}${pageFilePath}`);
|
const imagePath = encodeURI(`${LIBRARY_SERVICE_HOST}${pageFilePath}`);
|
||||||
comicBookPages.push(imagePath);
|
comicBookPages.push(imagePath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
switch (action.result.purpose) {
|
||||||
|
case "reading":
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
extractedComicBookArchive: comicBookPages,
|
extractedComicBookArchive: {
|
||||||
|
reading: comicBookPages
|
||||||
|
},
|
||||||
|
comicBookExtractionInProgress: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case "analysis":
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
extractedComicBookArchive: {
|
||||||
|
analysis: comicBookPages
|
||||||
|
},
|
||||||
|
comicBookExtractionInProgress: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
case LS_QUEUE_DRAINED: {
|
case LS_QUEUE_DRAINED: {
|
||||||
console.log("drained", action);
|
console.log("drained", action);
|
||||||
|
|||||||
Reference in New Issue
Block a user