Minimal Viable Product + Refactor to pinia store + Fix PDF export
This commit is contained in:
@@ -2,20 +2,25 @@
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import { type BreadcrumbItem } from '@/types';
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
import { Resume, ResumeComponentPlacement } from '@/types/resume';
|
||||
import { Resume } from '@/types/resume';
|
||||
import { useResumesStore } from '@/stores/resume';
|
||||
import ResumeEditPanel from '@/components/resume/ResumeEditPanel.vue';
|
||||
import ResumePreviewPanel from '@/components/resume/ResumePreviewPanel.vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useShowComponentSelectionStore } from '@/stores/ui';
|
||||
|
||||
const props = defineProps<{
|
||||
resume: Resume
|
||||
}>();
|
||||
|
||||
const localResume = ref({ ...props.resume });
|
||||
const resumeStore = useResumesStore();
|
||||
resumeStore.setAndUpdateCurrentResumeWhenFetched(props.resume);
|
||||
|
||||
const resumeTitle = computed<string>(() => (localResume.value.name == '' ? 'Sans titre' : localResume.value.name) ?? 'Sans titre');
|
||||
const showComponentSelectionStore = useShowComponentSelectionStore();
|
||||
showComponentSelectionStore.setShowComponentSelection(false);
|
||||
|
||||
const selectedComponent = ref<ResumeComponentPlacement | null>(null);
|
||||
const resumeTitle = resumeStore.currentResumeName;
|
||||
|
||||
resumeStore.setSelectedResumePlacement(-1);
|
||||
|
||||
const breadcrumbs: BreadcrumbItem[] = [
|
||||
{
|
||||
@@ -24,21 +29,6 @@ const breadcrumbs: BreadcrumbItem[] = [
|
||||
},
|
||||
];
|
||||
|
||||
function changeSelectedComponent(newComponent: ResumeComponentPlacement) {
|
||||
selectedComponent.value = newComponent;
|
||||
// Update the resume
|
||||
localResume.value.components_placements! = localResume.value.components_placements!.map(component =>
|
||||
component.id === newComponent.id ? newComponent : component
|
||||
);
|
||||
}
|
||||
|
||||
function changeResumeTitle(newTitle: string) {
|
||||
console.log('Changing resume title to ', newTitle);
|
||||
localResume.value.name = newTitle;
|
||||
}
|
||||
|
||||
console.debug('Resume : ', localResume.value);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -46,8 +36,8 @@ console.debug('Resume : ', localResume.value);
|
||||
|
||||
<AppLayout :breadcrumbs="breadcrumbs">
|
||||
<div class="flex h-full flex-1 gap-4 rounded-xl p-4 overflow-x-auto">
|
||||
<ResumeEditPanel :resume="localResume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" />
|
||||
<ResumePreviewPanel :resume="localResume" :selected-component="selectedComponent" @selected-component-change="changeSelectedComponent" @update:resume-title="changeResumeTitle" />
|
||||
<ResumeEditPanel />
|
||||
<ResumePreviewPanel />
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user