Skip to content

Commit

Permalink
dumili: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Nov 5, 2024
1 parent b058823 commit 098042f
Show file tree
Hide file tree
Showing 14 changed files with 664 additions and 609 deletions.
1 change: 1 addition & 0 deletions apps/dumili/api/services/indexation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const setKumikoInferredPageStoryKinds = async (pages: page[]) => {
data: {
aiKumikoInferredStoryKind: inferredStoryKind,
aiKumikoResultPanels: {
deleteMany: {},
createMany: {
data: panelsOfPage,
},
Expand Down
14 changes: 13 additions & 1 deletion apps/dumili/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import vueI18n from "@intlify/eslint-plugin-vue-i18n";

import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
Expand All @@ -16,14 +17,23 @@ const compat = new FlatCompat({

export default [
{
ignores: ["api/**/*", "**/*.d.ts", "**/dist", "**/node_modules"],
ignores: [
"api/**/*",
"**/*.d.ts",
"**/dist",
"**/node_modules",
"**/*.json",
"**/*.yml",
],
},
...vueI18n.configs["flat/recommended"],
...compat.extends(
"plugin:vue/vue3-recommended",
"plugin:prettier-vue/recommended",
"prettier",
"plugin:@typescript-eslint/recommended",
),

{
plugins: {
"@typescript-eslint": typescriptEslint,
Expand Down Expand Up @@ -58,6 +68,8 @@ export default [
ignores: [],
},
],

"@intlify/vue-i18n/no-deprecated-i18n-component": "off",
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion apps/dumili/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@intlify/unplugin-vue-i18n": "^5.2.0",
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
"@types/js-cookie": "^3.0.6",
"@vitejs/plugin-vue": "^5.1.4",
"concurrently": "^9.0.1",
Expand All @@ -69,4 +70,4 @@
"eslintConfig": {
"extends": "@antfu"
}
}
}
5 changes: 4 additions & 1 deletion apps/dumili/src/components/AiSuggestionIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ svg {
min-width: 20px;
cursor: help;
color: grey;
&.button {
background: black;
Expand All @@ -59,6 +58,10 @@ svg {
height: 20px;
}
&.idle {
color: grey;
}
&.success {
color: yellow;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dumili/src/components/AiTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const showRepeat = ref(false);
</script>

<style lang="scss" scoped>
> svg {
span > svg {
width: 20px;
height: 20px;
color: black;
Expand Down
4 changes: 3 additions & 1 deletion apps/dumili/src/components/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>
</b-col>
</b-row>
<b-container v-else>Loading...</b-container>
<b-container v-else>{{ $t("Loading...") }}</b-container>
</b-container>
</template>
<script lang="ts" setup>
Expand All @@ -37,6 +37,8 @@ const emit = defineEmits<{
(e: "selected", url: string): void;
}>();
const { t: $t } = useI18n();
const selectedUrl = ref<string | undefined>(undefined);
watch(selectedUrl, (url) => {
Expand Down
36 changes: 26 additions & 10 deletions apps/dumili/src/components/StorySuggestionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@
<template #unknown-text>{{ $t("Contenu inconnu") }}</template>
<template #customize-text>{{ $t("Rechercher...") }}</template>
<template #customize-form>
<StorySearch @story-selected="createAndAcceptStorySuggestion" />
<StorySearch @story-selected="acceptStory($event.storycode)" />
</template>
</suggestion-list>
</template>

<script lang="ts" setup>
import { dumiliSocketInjectionKey } from "~/composables/useDumiliSocket";
import { SimpleStory } from "~dm-types/SimpleStory";
import { FullIndexation } from "~dumili-services/indexation/types";
import { suggestions } from "../stores/suggestions";
Expand All @@ -51,17 +50,34 @@ const { indexation } = storeToRefs(suggestions());
const showEntrySelect = ref(false);
const { storyDetails, storyversionDetails } = storeToRefs(coa());
const createAndAcceptStorySuggestion = async (searchResult: SimpleStory) => {
const result = await indexationSocket.value!.services.createStorySuggestion({
entryId: entry.value.id,
storycode: searchResult.storycode,
});
if (!("error" in result)) {
const acceptStory = async (storycode: string) => {
let storySuggestionId = entry.value.storySuggestions.find(
(s) => s.storycode === storycode,
)?.id;
if (!storySuggestionId) {
const result = await indexationSocket.value!.services.createStorySuggestion(
{
entryId: entry.value.id,
storycode,
},
);
if ("error" in result) {
console.error(result.error);
return;
}
}
if (entry.value.acceptedStory?.storycode !== storycode) {
await indexationSocket.value!.services.acceptStorySuggestion(
result.createdStorySuggestion!.id || null,
storySuggestionId || null,
);
await loadIndexation(indexation.value!.id);
}
};
watch(
() => entry.value.acceptedStory,
async (story) => {
acceptStory(story?.storycode || "");
},
);
</script>
12 changes: 2 additions & 10 deletions apps/dumili/src/components/TableResults.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<template>
<table>
<thead v-if="data.length">
<th
v-for="header in Object.keys(data[0])"
:key="header"
style="border: 1px solid black"
>
<th v-for="header in Object.keys(data[0])" :key="header" class="border">
{{ header }}
</th>
</thead>
<tbody>
<tr v-for="(row, rowIdx) in data" :key="rowIdx">
<td
v-for="value in Object.values(row)"
:key="value"
style="border: 1px solid black"
>
<td v-for="value in Object.values(row)" :key="value" class="border">
{{ value }}
</td>
</tr>
Expand Down
5 changes: 2 additions & 3 deletions apps/dumili/src/components/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ const textContent = computed(() => {
watch(
acceptedStories,
async (value) => {
if (!issue.value?.issuecode) {
return undefined;
if (issue.value?.issuecode) {
storiesWithDetails.value = await getStoriesWithDetails(value);
}
storiesWithDetails.value = await getStoriesWithDetails(value);
},
{ immediate: true, deep: true },
);
Expand Down
2 changes: 1 addition & 1 deletion apps/dumili/src/pages/indexation/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
v-show="!showUploadWidget"
@click="showUploadWidget = !showUploadWidget"
>
{{ $t("Upload page files") }}
{{ $t("Envoyer des images de pages") }}
</b-button>
</template>
<Book
Expand Down
3 changes: 2 additions & 1 deletion apps/dumili/translations/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
"Entrez les noms de vos auteurs favoris pour voir combien de leurs histoires vous possédez. Noter les auteurs permettra également à DucksManager de vous": "Type in the names of your favorite authors to see how many stories you have from them. Rating the authors will also allow DucksManager to",
"Envie de mémoriser les moindres détails de votre collection ? Avec DucksManager un clic droit suffit !": "Want DucksManager to remember the most precise details of your collection? A right click will be enough!",
"Envoyer": "Send",
"Envoyer des images de pages": "Upload page files",
"Envoyer des photos de tranches": "Send edge photos",
"Envoyer une photo de tranche": "Send a photo of the edge",
"Envoyez des photos de tranches de magazines et gagnez jusqu'à {0} points par tranche !": "Send us photos of magazine edges and earn up to {0} Edge photographer points per edge!",
Expand Down Expand Up @@ -544,4 +545,4 @@
"à sa collection": "to their collection",
"• 1 nouvelle histoire de {{authorName}}": "• 1 new story from {{authorName}}",
"• {{newStoriesNumber}} nouvelles histoires de {{authorName}}": "• {{newStoriesNumber}} new stories from {{authorName}}"
}
}
Loading

0 comments on commit 098042f

Please sign in to comment.