diff --git a/apps/web/src/App.vue b/apps/web/src/App.vue
index 397b47671..516a12998 100644
--- a/apps/web/src/App.vue
+++ b/apps/web/src/App.vue
@@ -26,11 +26,11 @@ getCurrentInstance()!.appContext.app.provide(
},
}),
);
-console.log("provided");
+
const { loadUser } = collection();
const { isLoadingUser, user } = storeToRefs(collection());
-// loadUser();
+loadUser();
diff --git a/apps/whattheduck/src/views/IssueList.vue b/apps/whattheduck/src/views/IssueList.vue
index 59dac24b8..70442f11f 100644
--- a/apps/whattheduck/src/views/IssueList.vue
+++ b/apps/whattheduck/src/views/IssueList.vue
@@ -1,6 +1,6 @@
{
});
const { issues, user, purchasesById } = storeToRefs(wtdcollection());
-const { publicationcode, currentNavigationItem, isCoaView, currentIssueViewMode, selectedIssuecodes } =
+const { publicationcode, currentNavigationItem, isCoaView, currentIssueViewMode, selectedIssuecodes, currentFilter } =
storeToRefs(app());
-const { issuesWithTitles, issuecodeDetails } = storeToRefs(webStores.coa());
-const { fetchCoverUrls, fetchIssueNumbersWithTitles } = webStores.coa();
+const { issuecodeDetails, issuecodesByPublicationcode } = storeToRefs(webStores.coa());
+const { fetchCoverUrls, fetchIssuecodesByPublicationcode, fetchIssuecodeDetails } = webStores.coa();
const { bookcaseOptions, bookcaseUsername } = storeToRefs(bookcase());
const { loadBookcaseOptions, loadBookcaseOrder } = bookcase();
@@ -107,8 +107,7 @@ const getIssueDate = (issue: issue) => {
return !date ? date : (typeof date === 'string' ? date : date.toISOString()).split('T')?.[0];
};
-const coaIssues = computed(() => issuesWithTitles.value[publicationcode.value!]);
-const coaIssuecodes = computed(() => coaIssues.value?.map(({ issuecode }) => issuecode));
+const coaIssuecodes = computed(() => issuecodesByPublicationcode.value[publicationcode.value!]);
const coaIssuecodeDetails = computed(() =>
Object.entries(issuecodeDetails.value)
.filter(([issuecode]) => coaIssuecodes.value.includes(issuecode))
@@ -117,6 +116,11 @@ const coaIssuecodeDetails = computed(() =>
const userIssues = computed(() =>
(issues.value || [])
.filter((issue) => issue.publicationcode === publicationcode.value)
+ .filter(
+ currentFilter.value.id === 'all'
+ ? () => true
+ : ({ isToRead }) => isToRead === (currentFilter.value.id === 'unreadBooksOnly'),
+ )
.map((issue) => ({
...issue,
issueDate: getIssueDate(issue),
@@ -132,26 +136,28 @@ type Item =
| IssueWithIssuecodeOnly;
const items = computed(() =>
- coaIssues.value
+ coaIssuecodes.value
? isCoaView.value
- ? coaIssues.value.reduce<
+ ? coaIssuecodes.value.reduce<
{
key: string;
inducksItem: (typeof coaIssuecodeDetails.value)[string];
item: Item;
}[]
- >((acc, item) => {
+ >((acc, issuecode) => {
const userIssuesForThisIssue = userIssues.value.filter(
- ({ issuecode: userIssuecode }) => item.issuecode === userIssuecode,
+ ({ issuecode: userIssuecode }) => issuecode === userIssuecode,
);
return [
...acc,
- ...(userIssuesForThisIssue.length ? userIssuesForThisIssue : [item]).map((itemOrUserItem) => ({
- key: itemOrUserItem.issuecode,
- inducksItem: coaIssuecodeDetails.value[itemOrUserItem.issuecode],
- item: itemOrUserItem,
- })),
+ ...(userIssuesForThisIssue.length ? userIssuesForThisIssue : [issuecodeDetails.value[issuecode]]).map(
+ (itemOrUserItem) => ({
+ key: issuecode,
+ inducksItem: coaIssuecodeDetails.value[issuecode],
+ item: itemOrUserItem,
+ }),
+ ),
];
}, [])
: (userIssues.value || []).map((issue) => ({
@@ -233,7 +239,8 @@ watch(
watch(
[isCoaView, publicationcode],
async () => {
- await fetchIssueNumbersWithTitles([publicationcode.value!]);
+ await fetchIssuecodesByPublicationcode([publicationcode.value!]);
+ await fetchIssuecodeDetails(coaIssuecodes.value);
},
{ immediate: true },
);
diff --git a/apps/whattheduck/src/views/Login.vue b/apps/whattheduck/src/views/Login.vue
index db5b32391..c8d11f4bf 100644
--- a/apps/whattheduck/src/views/Login.vue
+++ b/apps/whattheduck/src/views/Login.vue
@@ -58,7 +58,7 @@
-
+
{{ t('Mot de passe oublié ?') }}
diff --git a/apps/whattheduck/src/views/Suggestions.vue b/apps/whattheduck/src/views/Suggestions.vue
index 79d323861..bbb4eada2 100644
--- a/apps/whattheduck/src/views/Suggestions.vue
+++ b/apps/whattheduck/src/views/Suggestions.vue
@@ -47,7 +47,7 @@
:classes="['issue-title', 'ion-no-padding']"
/>
diff --git a/apps/whattheduck/translations/en.json b/apps/whattheduck/translations/en.json
index 0a361cc51..4a61338f8 100644
--- a/apps/whattheduck/translations/en.json
+++ b/apps/whattheduck/translations/en.json
@@ -136,6 +136,7 @@
"Retirer de la collection": "Remove from collection",
"Retirer ces {numberOfIssues} numéros de la collection": "Remove these {numberOfIssues} issues from collection",
"Retour à ma collection": "Back to my collection",
+ "Retour aux résultats d'histoire": "Back to story search results",
"Résultat": "Result",
"Résultats de la recherche": "Search results",
"Sans titre": "No title",
diff --git a/apps/whattheduck/translations/sv.json b/apps/whattheduck/translations/sv.json
index 417e391f8..499b26f0a 100644
--- a/apps/whattheduck/translations/sv.json
+++ b/apps/whattheduck/translations/sv.json
@@ -128,6 +128,7 @@
"Progression de la collection": "Samlingens framfart",
"Quelque chose ne fonctionne pas sur l'application ?\nDétaillez votre problème et nous essaierons de le résoudre dans une prochaine version :-)": "Är det något som inte fungerar i appen? Beskriv ditt problem så ska vi försöka lösa det i nästa version :-)",
"Rechercher une histoire": "Hitta en berättelse",
+ "Retour aux résultats d'histoire": "Tillbaka till berättelsens sökresultat",
"Résultat": "Resultat",
"Sans titre": "Ingen titel",
"Si l'adresse e-mail entrée correspond à un compte DucksManager, nous venons d'y envoyer un lien permettant la réinitialisation du mot de passe. Si l'e-mail ne vous parvient pas d'ici quelques minutes, veuillez vérifier votre dossier Spam.": "Om emailadressen överensstämmer med ett DucksManager konto skickas en länk för att återställa ditt lösenord. Om du inte får ett email inom några minter, kolla din Spam mapp.",
diff --git a/packages/api/services/coa/index.ts b/packages/api/services/coa/index.ts
index ae2fed88c..1c62f12b0 100644
--- a/packages/api/services/coa/index.ts
+++ b/packages/api/services/coa/index.ts
@@ -25,13 +25,14 @@ export default (io: Server) => {
});
};
-const getInducksIssueData = (issuecodes: string[]) =>
+const getInducksIssueData = (issuecodes: string[], withTitle: boolean) =>
prismaCoa.inducks_issue
.findMany({
select: {
publicationcode: true,
issuenumber: true,
issuecode: true,
+ title: withTitle,
},
where: {
issuecode: {
@@ -45,8 +46,9 @@ export const augmentIssueObjectWithInducksData = <
Entity extends { issuecode: string },
>(
issues: Record,
+ withTitle: boolean = false,
) =>
- getInducksIssueData(Object.keys(issues)).then((inducksIssues) =>
+ getInducksIssueData(Object.keys(issues), withTitle).then((inducksIssues) =>
Object.entries(issues).reduce(
(acc, [issuecode, issue]) => ({
...acc,
@@ -60,10 +62,12 @@ export const augmentIssueArrayWithInducksData = async <
Entity extends { issuecode: string },
>(
issues: Entity[],
+ withTitle: boolean = false,
) =>
- getInducksIssueData([
- ...new Set(issues.map(({ issuecode }) => issuecode)),
- ]).then((inducksIssues) =>
+ getInducksIssueData(
+ [...new Set(issues.map(({ issuecode }) => issuecode))],
+ withTitle,
+ ).then((inducksIssues) =>
issues.map((issue) => ({
...issue,
...inducksIssues[issue.issuecode],
diff --git a/packages/api/services/coa/issue-details/index.ts b/packages/api/services/coa/issue-details/index.ts
index 19b15771d..2770041fa 100644
--- a/packages/api/services/coa/issue-details/index.ts
+++ b/packages/api/services/coa/issue-details/index.ts
@@ -29,42 +29,6 @@ export const getPopularityByIssuecodes = async (issuecodes: string[]) =>
.then((data) => data.groupBy("issuecode"));
export default (socket: Socket) => {
- socket.on("getIssuesWithTitles", async (publicationcodes, callback) =>
- prismaCoa.inducks_issue
- .findMany({
- select: {
- publicationcode: true,
- issuecode: true,
- issuenumber: true,
- title: true,
- },
- where: {
- publicationcode: {
- in: publicationcodes,
- },
- },
- })
- .then((data) => {
- callback(
- data.reduce[0]>(
- (acc, { publicationcode, issuenumber, title, issuecode }) => ({
- ...acc,
- [publicationcode!]: [
- ...(acc[publicationcode!] || []),
- {
- issuecode,
- publicationcode: publicationcode!,
- issuenumber: issuenumber!,
- title,
- },
- ],
- }),
- {},
- ),
- );
- }),
- );
-
socket.on("getIssueDetails", async (issuecode, callback) => {
const entries = await getEntries(issuecode);
callback({
diff --git a/packages/api/services/coa/issues/index.ts b/packages/api/services/coa/issues/index.ts
index 5f0384740..6435d7d4b 100644
--- a/packages/api/services/coa/issues/index.ts
+++ b/packages/api/services/coa/issues/index.ts
@@ -4,20 +4,14 @@ import type { IssueWithIssuecodeOnly } from "~dm-types/IssueWithIssuecodeOnly";
import { prismaClient as prismaCoa } from "~prisma-schemas/schemas/coa/client";
import type Events from "../types";
+import { augmentIssueArrayWithInducksData } from "..";
export default (socket: Socket) => {
- socket.on("getIssues", (issuecodes, callback) =>
+ socket.on("getIssues", (issuecodes, withTitles, callback) =>
issuecodes.length
- ? prismaCoa.inducks_issue
- .findMany({
- select: {
- publicationcode: true,
- issuenumber: true,
- issuecode: true,
- },
- where: {
- issuecode: { in: issuecodes.filter((issuecode) => issuecode) },
- },
- })
+ ? augmentIssueArrayWithInducksData(
+ issuecodes.map((issuecode) => ({ issuecode })),
+ withTitles,
+ )
.then((data) => data.groupBy("issuecode"))
.then(callback)
: callback({}),
diff --git a/packages/api/services/coa/stories/index.ts b/packages/api/services/coa/stories/index.ts
index 55d67de93..a16ede22d 100644
--- a/packages/api/services/coa/stories/index.ts
+++ b/packages/api/services/coa/stories/index.ts
@@ -77,9 +77,10 @@ export default (socket: Socket) => {
if (withIssues) {
const resultsWithIssues: StorySearchResults["results"] = [];
for (const idx of results.keys()) {
- resultsWithIssues[idx].issues = await listIssuesFromStoryCode(
- results[idx].storycode,
- );
+ resultsWithIssues[idx] = {
+ ...results[idx],
+ issues: await listIssuesFromStoryCode(results[idx].storycode),
+ };
}
callback({
diff --git a/packages/api/services/coa/types.ts b/packages/api/services/coa/types.ts
index 7c7a2835c..972d71c3e 100644
--- a/packages/api/services/coa/types.ts
+++ b/packages/api/services/coa/types.ts
@@ -30,20 +30,6 @@ export default abstract class {
callback: (value: Record) => void,
) => void;
- abstract getIssuesWithTitles: (
- publicationcodes: string[],
- callback: (
- value: Record<
- string,
- {
- issuecode: string;
- publicationcode: string;
- issuenumber: string;
- title: string | null;
- }[]
- >,
- ) => void,
- ) => void;
abstract getIssueDetails: (
issuecode: string,
callback: (value: { releaseDate?: string; entries: SimpleEntry[] }) => void,
@@ -74,6 +60,7 @@ export default abstract class {
) => void;
abstract getIssues: (
issuecodes: string[],
+ withTitles: boolean,
callback: (value: Record) => void,
) => void;