#128 - add position check
This commit is contained in:
parent
092f3f0f7c
commit
37a978763c
3 changed files with 43 additions and 16 deletions
|
|
@ -20,7 +20,13 @@ return [
|
||||||
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
|
$comments = $file->comments()->isEmpty() == true ? [] : Yaml::decode($file->comments()->value());
|
||||||
|
|
||||||
foreach ($comments as $existingComment) {
|
foreach ($comments as $existingComment) {
|
||||||
if ($existingComment['author']['email'] === $user->email() && $existingComment['text'] === $data->text) {
|
if
|
||||||
|
(
|
||||||
|
$existingComment['author']['email'] == $user->email() &&
|
||||||
|
$existingComment['text'] == $data->text &&
|
||||||
|
$existingComment['position']['x'] == $data->position->x &&
|
||||||
|
$existingComment['position']['y'] == $data->position->y
|
||||||
|
) {
|
||||||
return json_encode(null);
|
return json_encode(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ $project = [
|
||||||
'steps' => $page->getSteps(),
|
'steps' => $page->getSteps(),
|
||||||
'designToLight' => $page->isDTLEnabled()->isTrue() ? processDTLProposals($page) : null,
|
'designToLight' => $page->isDTLEnabled()->isTrue() ? processDTLProposals($page) : null,
|
||||||
'hasOptimizationRequest' => $page->hasOptimizationRequest()->isTrue(),
|
'hasOptimizationRequest' => $page->hasOptimizationRequest()->isTrue(),
|
||||||
|
'notifications' => $page->notifications()->yaml(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$pageData = array_merge($genericData, $project);
|
$pageData = array_merge($genericData, $project);
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,28 @@
|
||||||
<h2 :id="step.id">
|
<h2 :id="step.id">
|
||||||
<span :data-icon="step.id">{{ step.label }}</span>
|
<span :data-icon="step.id">{{ step.label }}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<div ref="cards-node" class="cards | flow">
|
<div
|
||||||
|
ref="cards-node"
|
||||||
|
class="cards | flow"
|
||||||
|
:class="{ new: hasUnreadNotifications }"
|
||||||
|
>
|
||||||
<component :is="cardsMap[step.id]" :step="step" />
|
<component :is="cardsMap[step.id]" :step="step" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs';
|
||||||
import "dayjs/locale/fr";
|
import 'dayjs/locale/fr';
|
||||||
import { usePageStore } from "../../stores/page";
|
import { usePageStore } from '../../stores/page';
|
||||||
import { onMounted, useTemplateRef } from "vue";
|
import { computed, onMounted, useTemplateRef } from 'vue';
|
||||||
import { useProjectStore } from "../../stores/project";
|
import { useProjectStore } from '../../stores/project';
|
||||||
import ClientBrief from "./cards/ClientBrief.vue";
|
import ClientBrief from './cards/ClientBrief.vue';
|
||||||
import MultipleDocuments from "./cards/MultipleDocuments.vue";
|
import MultipleDocuments from './cards/MultipleDocuments.vue';
|
||||||
import SimpleDocument from "./cards/SimpleDocument.vue";
|
import SimpleDocument from './cards/SimpleDocument.vue';
|
||||||
import VirtualSample from "./cards/VirtualSample.vue";
|
import VirtualSample from './cards/VirtualSample.vue';
|
||||||
import PhysicalSample from "./cards/PhysicalSample.vue";
|
import PhysicalSample from './cards/PhysicalSample.vue';
|
||||||
|
import { useUserStore } from '../../stores/user';
|
||||||
|
|
||||||
const { step } = defineProps({
|
const { step } = defineProps({
|
||||||
step: Object,
|
step: Object,
|
||||||
|
|
@ -38,21 +43,36 @@ const cardsMap = {
|
||||||
physicalSample: PhysicalSample,
|
physicalSample: PhysicalSample,
|
||||||
};
|
};
|
||||||
|
|
||||||
dayjs.locale("fr");
|
dayjs.locale('fr');
|
||||||
|
|
||||||
const { page } = usePageStore();
|
const { page } = usePageStore();
|
||||||
const { setStatus } = useProjectStore();
|
const { setStatus } = useProjectStore();
|
||||||
const cardsNode = useTemplateRef("cards-node");
|
const cardsNode = useTemplateRef('cards-node');
|
||||||
|
const { user } = useUserStore();
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (step.id === page.content.currentstep) {
|
if (step.id === page.content.currentstep) {
|
||||||
cardsNode.value.scrollIntoView({
|
cardsNode.value.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: 'smooth',
|
||||||
inline: "center",
|
inline: 'center',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const correspondingNotifications = computed(() => {
|
||||||
|
return page.notifications.filter((notification) =>
|
||||||
|
notification.location.page.uri.includes(step.slug)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasUnreadNotifications = computed(() => {
|
||||||
|
return correspondingNotifications.value.some(
|
||||||
|
(notification) =>
|
||||||
|
!notification.readby.includes(user.uuid) &&
|
||||||
|
notification.author.uuid !== user.uuid
|
||||||
|
);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue