diff --git a/backend/src/db.rs b/backend/src/db.rs index 1b43fc4..8d58a36 100644 --- a/backend/src/db.rs +++ b/backend/src/db.rs @@ -38,6 +38,7 @@ pub struct Experience { #[derive(Deserialize, Serialize)] pub struct Project { + pub id: Option, pub date_done: Option, pub title: Option, pub description: Option, diff --git a/backend/src/main.rs b/backend/src/main.rs index 69f28b0..e8501db 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -83,7 +83,7 @@ async fn skills( )> { let project = sqlx::query_as!( Project, - "SELECT 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 FROM public.project WHERE project.info_id = $1 ORDER BY date_done DESC", id ) .fetch_all(&pool) @@ -155,7 +155,8 @@ async fn alltags(Path(info_id): Path, State(pool): State) -> Json - import SvgIcon from "@jamescoyle/svelte-icon"; - import "$lib/css/pill.css"; - import { mdiHelp } from "@mdi/js"; - import { shouldColorBeWhite } from "$lib/js/color.js"; + import SvgIcon from "@jamescoyle/svelte-icon"; + import "$lib/css/pill.css"; + import { mdiHelp } from "@mdi/js"; + import { shouldColorBeWhite } from "$lib/js/color.js"; - export let name = "Unknown"; - export let icon = mdiHelp; - export let color = "#000000"; - export let type_icon = "mdi"; + export let name = "Unknown"; + export let icon = mdiHelp; + export let color = "#000000"; + export let type_icon = "mdi"; + export let shadow_color = null; - const white = shouldColorBeWhite(color.slice(1)); - const style = `background-color: ${color}; + const white = shouldColorBeWhite(color.slice(1)); + let style; + if (shadow_color === null) { + style = `background-color: ${color}; box-shadow: 0px 8px 18px -1px ${color}60;`; + } else { + style = `background-color: ${color}; + box-shadow: 0px 8px 18px -1px ${shadow_color}60;`; + } -
- {#if type_icon === "simpleicons"} - {name} - {:else} - - {/if} -

{name}

+
+ {#if type_icon === "simpleicons"} + {name} + {:else} + + {/if} +

{name}

diff --git a/frontend/src/lib/components/projects-popup.svelte b/frontend/src/lib/components/projects-popup.svelte index 05d4ea5..59926f8 100644 --- a/frontend/src/lib/components/projects-popup.svelte +++ b/frontend/src/lib/components/projects-popup.svelte @@ -3,6 +3,7 @@ import "$lib/css/project-popup.css"; import "$lib/css/slide.css"; + import Pill from "$lib/components/pill.svelte"; import { showPopup, popupDatas } from "$lib/js/popup.js"; import SvgIcon from "@jamescoyle/svelte-icon"; import { @@ -16,7 +17,7 @@ mdiLink, mdiTag, mdiBookMultiple, - mdiDownload + mdiDownload, } from "@mdi/js"; // Variables @@ -25,11 +26,13 @@ let active = false; // Informations + export let tags; let title = "Title"; let date = "Date"; let type_project = "Type of project"; let picture; let description = "Description"; + let id = 0; async function popupShowed(data) { /** @@ -45,6 +48,7 @@ type_project = data.type_project; picture = (await import(`/src/lib/img/${data.picture_name}`)).default; description = data.description; + id = data.id; // Active set to true after the await to avoid conflict when clicking outside while the popup hasn't showed yet. active = true; } @@ -140,6 +144,19 @@

Tags

+
diff --git a/frontend/src/lib/components/projects.svelte b/frontend/src/lib/components/projects.svelte index e94d3d8..ca4e64c 100644 --- a/frontend/src/lib/components/projects.svelte +++ b/frontend/src/lib/components/projects.svelte @@ -17,6 +17,7 @@ const project_type = data.type_project; let picture; const popDataObject = { + id: data.id, title: data.title, date: issued_date, type_project: data.type_project, diff --git a/frontend/src/lib/css/pill.css b/frontend/src/lib/css/pill.css index deea793..bf52a51 100644 --- a/frontend/src/lib/css/pill.css +++ b/frontend/src/lib/css/pill.css @@ -11,6 +11,7 @@ align-items: center; font-family: 'Urbanist', sans-serif; font-weight: 700; + cursor: default; } .pill-white { diff --git a/frontend/src/lib/js/processdata.js b/frontend/src/lib/js/processdata.js index 3d9d307..261c6e9 100644 --- a/frontend/src/lib/js/processdata.js +++ b/frontend/src/lib/js/processdata.js @@ -12,8 +12,9 @@ export function processData(data) { const experiences = arrangeById(data.experience); const education = arrangeById(data.education); const skills = data.skills; + const tags = data.tags; - return {info, experiences, education, skills}; + return {info, experiences, education, skills, tags}; } else { return null; // Indicates an error } diff --git a/frontend/src/routes/+page.js b/frontend/src/routes/+page.js index 8d1d650..863137c 100644 --- a/frontend/src/routes/+page.js +++ b/frontend/src/routes/+page.js @@ -18,7 +18,7 @@ export async function load(context) { } const infos = []; - const dataToGather = ['info', 'education', 'experience', 'skills/1']; + const dataToGather = ['info', 'education', 'experience', 'skills/1', 'tags/1']; for (const url of dataToGather) { const res = await fetchData(url); if (res.status == 0) { @@ -41,5 +41,6 @@ export async function load(context) { softwares: infos[3][2], languages: infos[3][3], }, + tags: infos[4], }; } diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 0625974..6f73222 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -76,7 +76,7 @@ {#if data.status == 0} - +