diff --git a/backend/src/db.rs b/backend/src/db.rs index e862252..3be178b 100644 --- a/backend/src/db.rs +++ b/backend/src/db.rs @@ -44,7 +44,10 @@ pub struct Project { pub description: Option, pub github_link: Option, pub picture_name: Option, - pub type_project: Option + pub type_project: Option, + pub report_link: Option, + pub archive_link: Option, + pub app_link: Option } #[derive(Deserialize, Serialize)] diff --git a/backend/src/main.rs b/backend/src/main.rs index 25c2b1a..cffec8e 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -94,7 +94,7 @@ async fn skills( )> { let project = sqlx::query_as!( Project, - "SELECT id, date_done, title, description, github_link, picture_name, type_project FROM public.project WHERE project.info_id = $1 ORDER BY date_done DESC", + "SELECT id, date_done, title, description, github_link, picture_name, type_project, report_link, archive_link, app_link FROM public.project WHERE project.info_id = $1 ORDER BY date_done DESC", id ) .fetch_all(&pool) diff --git a/frontend/src/lib/components/projects-popup.svelte b/frontend/src/lib/components/projects-popup.svelte index c17f304..74e4745 100644 --- a/frontend/src/lib/components/projects-popup.svelte +++ b/frontend/src/lib/components/projects-popup.svelte @@ -4,7 +4,7 @@ import "$lib/css/project-popup.css"; import "$lib/css/slide.css"; import Pill from "$lib/components/pill.svelte"; - import { showPopup, actualData } from "$lib/js/popup.js"; + import { showPopup, actualData, filterTag } from "$lib/js/popup.js"; import SvgIcon from "@jamescoyle/svelte-icon"; import { mdiClose, @@ -19,6 +19,7 @@ mdiBookMultiple, mdiDownload, } from "@mdi/js"; + import { formatMonth } from "$lib/js/date.js"; // Variables const unsubscribe = actualData.subscribe(popupShowed); @@ -27,11 +28,18 @@ // Informations export let tags; + + // Not exported but still Informations + let filteredTags = []; let title = "Title"; let date = "Date"; let type_project = "Type of project"; let picture; let description = "Description"; + let report_link; + let github_link; + let archive_link; + let application_link; let id = 0; async function popupShowed(data) { @@ -42,13 +50,19 @@ * is not yet loaded. */ if (data != 0) { - const superData = data; - title = superData.title; - date = data.date; + title = data.title; + date = + formatMonth(data.date_done).charAt(0).toUpperCase() + + formatMonth(data.date_done).slice(1); type_project = data.type_project; picture = (await import(`/src/lib/img/${data.picture_name}`)).default; description = data.description; id = data.id; + report_link = data.report_link; + github_link = data.github_link; + archive_link = data.archive_link; + application_link = data.application_link; + filteredTags = filterTag(tags, id); // Active set to true after the await to avoid conflict when clicking outside while the popup hasn't showed yet. active = true; } @@ -117,36 +131,62 @@ -
- -

Links

-
- + {#if report_link != null || github_link != null || archive_link != null || application_link != null} +
+ +

Links

+
+ + {/if} -
- -

Tags

-
- + {/if}
diff --git a/frontend/src/lib/components/projects.svelte b/frontend/src/lib/components/projects.svelte index 3954464..3dfb492 100644 --- a/frontend/src/lib/components/projects.svelte +++ b/frontend/src/lib/components/projects.svelte @@ -21,16 +21,7 @@ picture = (await import(`/src/lib/img/${data.picture_name}`)).default; popupDatas.update((value) => { - const newData = { - id: data.id, - title: data.title, - date: issued_date, - type_project: data.type_project, - description: data.description, - picture_name: data.picture_name, - }; - - value.push(newData); + value.push(data); return value; }); }); diff --git a/frontend/src/lib/css/project-popup.css b/frontend/src/lib/css/project-popup.css index 1e3a9b3..1b5cbff 100644 --- a/frontend/src/lib/css/project-popup.css +++ b/frontend/src/lib/css/project-popup.css @@ -136,6 +136,9 @@ transition: none; color: var(--color-background); cursor: grab; + text-decoration: none; + text-align: center; + font-size: 0.85rem; } .project-popup-download:hover { @@ -148,9 +151,9 @@ } .project-popup-download>p { - margin: 0; - margin-left: 0.5rem; - margin-right: 0.5rem; + margin: 0 !important; + margin-left: 0.5rem !important; + margin-right: 0.5rem !important; } .project-popup-download>svg { diff --git a/frontend/src/lib/js/popup.js b/frontend/src/lib/js/popup.js index 7e76c48..06ada74 100644 --- a/frontend/src/lib/js/popup.js +++ b/frontend/src/lib/js/popup.js @@ -31,5 +31,18 @@ export function showPopup(show, projectId) { } } +export function filterTag(tags, id) +{ + let returnTags = []; + for(const tag of tags) + { + if(tag.project_id == id) + { + returnTags.push(tag); + } + } + return returnTags; +} + export let popupDatas = writable([]); export let actualData = writable(0); \ No newline at end of file