Skip to content

Commit

Permalink
whattheduck: Add "Back to collection" buttonn fix extra issues display
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Jul 5, 2024
1 parent 450d1e4 commit 03e22c6
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 26 deletions.
7 changes: 5 additions & 2 deletions apps/whattheduck/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import { buildStorage, useSocket } from '~socket.io-client-services';
import { app } from './stores/app';
import AppWithPersistedData from './views/AppWithPersistedData.vue';
import type { RouteMeta } from '~/router';
const storage = injectLocal<Storage>('storage')!;
const appStore = app();
Expand All @@ -37,6 +35,11 @@ const { isOfflineMode, token, socket, socketCache, innerTopMargin } = storeToRef
const route = useRoute();
const router = useRouter();
interface RouteMeta {
onOffline?: 'readonly' | 'unavailable';
onNoToken?: 'logout';
}
const routeMeta = computed(() => route.meta as RouteMeta);
const assignSocket = () => {
Expand Down
15 changes: 12 additions & 3 deletions apps/whattheduck/src/components/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
<ion-title
><div class="content">
<div class="title">
<div>{{ t('Ma collection') }}</div>
<ion-chip outline v-if="total !== undefined">{{ total }}</ion-chip>
<ion-button size="small" v-if="isCoaView" @click="isCoaView = false">
<ion-icon :md="arrowBackSharp" :ios="arrowBackOutline"></ion-icon>&nbsp;{{
t('Retour à ma collection')
}}
</ion-button>
<template v-else>
<div>{{ t('Ma collection') }}</div>
<ion-chip outline v-if="total !== undefined">{{ total }}</ion-chip></template
>
</div>
</div></ion-title
>
Expand All @@ -33,6 +40,8 @@
</template>

<script setup lang="ts">
import { arrowBackOutline, arrowBackSharp } from 'ionicons/icons';
import OwnedIssueCopies from './OwnedIssueCopies.vue';
import { app } from '~/stores/app';
Expand All @@ -44,7 +53,7 @@ import PublicationList from '~/views/PublicationList.vue';
const { t } = useI18n();
const { total } = storeToRefs(wtdcollection());
const { filterText, navigationItemGroups } = storeToRefs(app());
const { filterText, navigationItemGroups, isCoaView } = storeToRefs(app());
const hasItems = ref<boolean | undefined>();
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/>
<template v-if="partIdx === 4 && issuenumber !== undefined"
><div>
<Issue :issuenumber="issuenumber" /><template v-if="extraIssuenumbers"
<Issue :issuenumber="issuenumber" /><template v-if="extraIssuenumbers.length"
><ion-chip :outline="true">+&nbsp;{{ extraIssuenumbers.length - 1 }}</ion-chip></template
>
</div></template
Expand Down
16 changes: 10 additions & 6 deletions apps/whattheduck/src/components/NavigationDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,16 @@ const appFooterPages = [
title: t('Signaler un problème'),
url: '/report',
},
{
iosIcon: logOutOutline,
mdIcon: logOutSharp,
title: t('Déconnexion'),
url: '/login',
},
...(token.value
? [
{
iosIcon: logOutOutline,
mdIcon: logOutSharp,
title: t('Déconnexion'),
url: '/login',
},
]
: []),
];
const { user } = storeToRefs(collectionStore);
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/src/components/OwnedIssueCopies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
color="danger"
size="small"
v-if="currentCopyIndex !== undefined && !isOfflineMode"
>{{ t('Supprimer') }}</ion-button
>{{ t('Retirer de la collection') }}</ion-button
>
<owned-issue-copy v-if="currentCopyIndex !== undefined" v-model="copies[currentCopyIndex]" />
</ion-col>
Expand Down
9 changes: 2 additions & 7 deletions apps/whattheduck/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRouter, createWebHistory } from '@ionic/vue-router';
import type { RouteRecordRaw } from 'vue-router';
import type { RouteMeta } from 'vue-router';

import Collection from '~/components/Collection.vue';
import Authors from '~/views/Authors.vue';
Expand All @@ -14,12 +14,7 @@ import Signup from '~/views/Signup.vue';
import Stats from '~/views/Stats.vue';
import Suggestions from '~/views/Suggestions.vue';

export interface RouteMeta {
onOffline?: 'readonly' | 'unavailable';
onNoToken?: 'logout';
}

const routes: RouteRecordRaw[] = [
const routes = [
{
name: 'Collection',
path: '/:type(collection|coa)',
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/src/theme/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ion-label {
}

ion-title {
padding-inline-start: 50px;
padding-inline-start: 5px;
}

ion-content {
Expand Down
7 changes: 5 additions & 2 deletions apps/whattheduck/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
"Progression de la collection": "Collection progression",
"Quelque chose ne fonctionne pas sur l'application ?\nDétaillez votre problème et nous essaierons de le résoudre dans une prochaine version :-)": "Is something not working in the app? Explain your issue and we will try to fix it in the next version :-)",
"Rechercher une histoire": "Find a story",
"Retirer de la collection": "Remove from collection",
"Retour à ma collection": "Back to my collection",
"Résultat": "Result",
"Résultats de la recherche": "Search results",
"Sans titre": "No title",
Expand All @@ -144,7 +146,7 @@
"Sélection invalide": "Invalid selection",
"Sélectionnez au moins un numéro": "Select at least one issue",
"Sélectionnez un numéro en appuyant dessus.\nSélectionnez une liste de numéros consécutive en effectuant un appui long.": "Select an issue by tapping on it.\nSelect a range of issues by long-tapping on the first item of the range.",
"Tapotez sur un magazine récent pour l'ajouter à votre collection": "Tap on a recent issue to add it to your collection",
"Tapotez sur un magazine récent pour l'ajouter à votre collection.": "Tap on a recent issue to add it to your collection.",
"Terminer l'inscription": "Finish signup",
"Tous les pays": "All countries",
"Toute la collection": "Whole collection",
Expand All @@ -155,6 +157,7 @@
"Valeur de la collection": "Value estimation",
"Veuillez entrer des nombres valides dans les champs \"largeur\" et \"hauteur\" !": "Please enter valid numbers in the width and height fields!",
"Vos identifiants sont invalides": "Invalid credentials",
"Votre collection est vide.": "Your collection is empty.",
"Votre collection a été mise à jour": "Your collection has been updated",
"Votre collection s'affiche lorsque vous ouvrez What The Duck. Tapotez sur un pays pour visualiser les magazines que vous possédez, ou tapotez sur + pour ajouter un numéro.": "Your DucksManager collection is displayed when you open What The Duck. Tap on a country to view the publications that you possess, or tap on \"+\" to add an issue to your collection.",
"Vous avez atteint le nombre maximal d'auteurs surveillés. Supprimez des auteurs existants pour en ajouter d'autres.": "You have reached the maximum number of authors to rate. Remove already watched authors if you want to rate a new one.",
Expand All @@ -166,7 +169,7 @@
"Vous possédez déjà ce numéro dans votre collection": "You already have this issue in your collection",
"Vous pouvez maintenant voir votre bibliothèque depuis l'application ! Lorsque vous consultez une liste de numéros, appuyez sur l'icône \"bibliothèque\" pour passer à la vue bibliothèque.": "You can now add multiple copies of the same issue in your collection!",
"Vous pouvez spécifier un maximum de 3 exemplaires par numéro.": "You can specify a maximum of 3 copies for each issue",
"Vous êtes en mode hors-ligne. Vous pouvez naviguer dans votre collection mais pas la modifier. Certaines fonctionnalités ne sont pas disponibles.": "You are using offline mode. You can browse through your collection but not update it. Some features will not be available.",
"Vous êtes en mode hors-ligne. Vous pouvez naviguer dans votre collection mais pas la modifier.\nCertaines fonctionnalités ne sont pas disponibles.": "You are using offline mode. You can browse through your collection but not update it.\nSome features will not be available.",
"Vue Bibliothèque": "Bookcase view",
"What The Duck": "What The Duck",
"What The Duck est l'application mobile de DucksManager. Cliquez ici pour accéder au site Web de DucksManager.": "What The Duck is the mobile app of DucksManager. Click here to access the DucksManager website.",
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"~socket.io-client-services/*": ["../../packages/socket.io-client-services/*"],
"~socket.io-services/*": ["../../packages/socket.io-services/*"],
"~web/*": ["../web/*"]
}
},
},
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/api/services/coa/stories/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default (socket: Socket<Events>) => {

const listIssuesFromStoryCode = async (storycode: string) =>
prismaCoa.$queryRaw<SimpleIssue[]>`
SELECT inducks_issue.publicationcode, inducks_issue.issuenumber, short_issuecode AS shortIssuecode,
SELECT inducks_issue.publicationcode, inducks_issue.issuenumber, inducks_issue.short_issuecode AS shortIssuecode,
FROM inducks_issue
INNER JOIN inducks_entry USING (short_issuecode)
INNER JOIN inducks_storyversion USING (storyversioncode)
Expand Down
2 changes: 1 addition & 1 deletion packages/prisma-clients/schemas/schema_cover_info.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ model cover {
@@unique([shortIssuecode, url], map: "uniquefieldset_covers")
@@map("covers")
}
}

0 comments on commit 03e22c6

Please sign in to comment.