diff --git a/frontend/src/App.vue b/frontend/src/App.vue index cea4a3a3..a1ecc46f 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,18 +1,14 @@ diff --git a/frontend/src/components/ModalComponent.vue b/frontend/src/components/ModalComponent.vue index 74a5e0b7..4fe9d6f9 100644 --- a/frontend/src/components/ModalComponent.vue +++ b/frontend/src/components/ModalComponent.vue @@ -1,35 +1,40 @@ diff --git a/frontend/src/components/ProjectColumnComponent.vue b/frontend/src/components/ProjectColumnComponent.vue new file mode 100644 index 00000000..73842554 --- /dev/null +++ b/frontend/src/components/ProjectColumnComponent.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/frontend/src/components/SideBarComponent.vue b/frontend/src/components/SideBarComponent.vue new file mode 100644 index 00000000..5921b056 --- /dev/null +++ b/frontend/src/components/SideBarComponent.vue @@ -0,0 +1,50 @@ + + + diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 51d33ebf..3afd3ff7 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -15,11 +15,12 @@ import { faFilePen, faAngleDown, faCheck, - faSort + faSort, + faFile } from '@fortawesome/free-solid-svg-icons' /* add icons to the library */ -library.add(faPlus, faMinus, faXmark, faTrash, faFilePen, faAngleDown, faCheck, faSort) +library.add(faPlus, faMinus, faXmark, faTrash, faFilePen, faAngleDown, faCheck, faSort, faFile) import App from './App.vue' import router from './router' diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index f3327893..01a6f55b 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,14 +1,17 @@ import PrivacyAndCookieStatement from '@/views/PrivacyAndCookieStatement.vue' import StartView from '@/views/StartView.vue' import TermsOfService from '@/views/TermsOfService.vue' +import CollectionsView from '@/views/CollectionsView.vue' import { createRouter, createWebHistory } from 'vue-router' +import FrequentlyAskedQuestions from '@/components/FrequentlyAskedQuestions.vue' +import ContactPage from '@/components/ContactPage.vue' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ { - path: '/', - name: 'start', - component: StartView + path: '/collections', + name: 'collections', + component: CollectionsView }, { path: '/privacy-and-cookie-statement', @@ -19,6 +22,21 @@ const router = createRouter({ path: '/terms-of-service', name: 'TermsOfService', component: TermsOfService + }, + { + path: '/faq', + name: 'faq', + component: FrequentlyAskedQuestions + }, + { + path: '/contact', + name: 'contact', + component: ContactPage + }, + { + path: '/', + name: 'start', + component: StartView } ] }) diff --git a/frontend/src/stores/stores.ts b/frontend/src/stores/stores.ts index ec5808d9..1a0f1d52 100644 --- a/frontend/src/stores/stores.ts +++ b/frontend/src/stores/stores.ts @@ -1,23 +1,35 @@ import { ref, type Ref } from 'vue' import { defineStore } from 'pinia' -import { Constants, EmptyConstants, type AlertMessage, type Environ, AlertType } from '@/constants' +import { + Constants, + EmptyConstants, + type AlertMessage, + type Environ, + AlertType, + type Project +} from '@/constants' import { v4 as uuid } from 'uuid' import axios from 'axios' -export const useProjectIdStore = defineStore( +export const useProjectStore = defineStore( 'projectId', () => { - const projectId: Ref = ref(null) + const lastProjectId: Ref = ref(null) + const projects: Ref = ref([]) - function setProjectId(newId: string) { - projectId.value = newId + function setProjects(newIds: Project[]) { + projects.value = newIds } - function clearProjectId() { - projectId.value = null + function setLastProjectId(newId: string) { + lastProjectId.value = newId } - return { projectId, setProjectId, clearProjectId } + function clearLastProjectId() { + lastProjectId.value = null + } + + return { projects, lastProjectId, setLastProjectId, clearLastProjectId, setProjects } }, { persist: true @@ -84,3 +96,45 @@ export const useInitialFilesStore = defineStore('initialFiles', () => { } return { initialFiles, setInitialFiles } }) + +export const useModalStore = defineStore('modal', () => { + const isShown = ref(false) + const title = ref('') + const primaryButtonTitle = ref('') + const secondaryButtonTitle = ref('') + const clickPrimaryButton = ref(async () => {}) + const clickSecondaryButton = ref(async () => {}) + const content: Ref = ref([]) + + function showModal( + newTitle: string, + newPrimaryButtonTitle: string, + newSecondaryButtonTitle: string, + newClickPrimaryButton: () => Promise, + newClickSecondaryButton: () => Promise, + newContent: string[] + ) { + title.value = newTitle + primaryButtonTitle.value = newPrimaryButtonTitle + secondaryButtonTitle.value = newSecondaryButtonTitle + clickPrimaryButton.value = newClickPrimaryButton + clickSecondaryButton.value = newClickSecondaryButton + content.value = newContent + isShown.value = true + } + + function dismissModal() { + isShown.value = false + } + return { + title, + primaryButtonTitle, + secondaryButtonTitle, + clickPrimaryButton, + clickSecondaryButton, + content, + isShown, + showModal, + dismissModal + } +}) diff --git a/frontend/src/utils.ts b/frontend/src/utils.ts index 9a42b041..d2a14c34 100644 --- a/frontend/src/utils.ts +++ b/frontend/src/utils.ts @@ -1,4 +1,4 @@ -import { useAppStore } from './stores/stores' +import { useAppStore, useProjectStore } from './stores/stores' import type { Project } from '@/constants' /** Checks if a given project ID is valid */ @@ -29,3 +29,33 @@ export async function validateUser() { } return result } + +export async function createNewProject(name: string): Promise { + const storeApp = useAppStore() + const projectRequestData = { + name: name + } + try { + const createProjectResponse = await storeApp.axiosInstance.post( + '/projects', + projectRequestData + ) + return createProjectResponse.data + } catch (error: unknown) { + console.log('Unable to create a new project.', error) + storeApp.alertsError('Unable to create a new project.') + return null + } +} + +export async function updateProjects() { + const storeProject = useProjectStore() + const storeApp = useAppStore() + try { + const response = await storeApp.axiosInstance.get('/projects') + storeProject.setProjects(response.data) + } catch (error: unknown) { + console.log('Unable to retrieve projects info', error) + storeApp.alertsError('Unable to retrieve projects info') + } +} diff --git a/frontend/src/views/CollectionsView.vue b/frontend/src/views/CollectionsView.vue new file mode 100644 index 00000000..5214cadc --- /dev/null +++ b/frontend/src/views/CollectionsView.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 5b8277c8..4e9e71e8 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -1,21 +1,27 @@