improve project dialog system

- project model : refactor getSteps() method
- create dialog store
- create DialogWrapper component that open the dialog corresponding to the URL query param
This commit is contained in:
isUnknown 2024-11-16 11:30:51 +01:00
parent 4e8c876dac
commit 26369ad71b
228 changed files with 451 additions and 525 deletions

View file

@ -109,6 +109,7 @@ import { watch, ref } from "vue";
import { useUserStore } from "../../stores/user";
import { usePageStore } from "../../stores/page";
import { useApiStore } from "../../stores/api";
import { useDialogStore } from "../../stores/dialog";
import Comment from "./Comment.vue";
dayjs.locale("fr");
@ -121,6 +122,7 @@ const { currentPageIndex, file, comments } = defineProps({
const { user } = useUserStore();
const { page } = usePageStore();
const dialog = useDialogStore();
const api = useApiStore();
const openedComment = ref(null);
@ -193,7 +195,6 @@ function handleSubmit(event = null) {
if (openedComment.value) {
replyComment(newComment);
} else {
console.log(newComment);
addComment(newComment);
}
}
@ -213,11 +214,10 @@ async function addComment(newComment) {
const newFile = await api.addComment(newComment);
newCommentText.value = "";
isAddOpen.value = false;
emits("update:file", newFile);
}
function changeFile(newFile) {
emits("update:file", newFile);
dialog.content.files = dialog.content.files.map((file) =>
file.id === newFile.id ? newFile : file
);
}
function closeComment() {