Frontend: fixed issue with description crashing popup component. Popup does not show description if null, updated time locale depending on language. Popup is now multi-language.
This commit is contained in:
parent
bcc2ee7e7f
commit
d1059eade6
7 changed files with 106 additions and 53 deletions
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
// Informations
|
// Informations
|
||||||
export let tags;
|
export let tags;
|
||||||
|
// Lang text
|
||||||
|
export let text;
|
||||||
|
|
||||||
// Not exported but still Informations
|
// Not exported but still Informations
|
||||||
let filteredTags = [];
|
let filteredTags = [];
|
||||||
|
@ -38,7 +40,7 @@
|
||||||
let date = "Date";
|
let date = "Date";
|
||||||
let type_project = "Type of project";
|
let type_project = "Type of project";
|
||||||
let picture;
|
let picture;
|
||||||
let description = "Description";
|
$: description = null;
|
||||||
let report_link;
|
let report_link;
|
||||||
let github_link;
|
let github_link;
|
||||||
let archive_link;
|
let archive_link;
|
||||||
|
@ -102,7 +104,11 @@
|
||||||
|
|
||||||
<svelte:window on:click={hidePopup} />
|
<svelte:window on:click={hidePopup} />
|
||||||
|
|
||||||
<div id="project-popup-main" bind:this={popupMain}>
|
<div
|
||||||
|
id="project-popup-main"
|
||||||
|
class={description != null ? "" : "project-popup-main-min"}
|
||||||
|
bind:this={popupMain}
|
||||||
|
>
|
||||||
<!--Closing button-->
|
<!--Closing button-->
|
||||||
<button
|
<button
|
||||||
class="project-popup-close"
|
class="project-popup-close"
|
||||||
|
@ -116,7 +122,7 @@
|
||||||
|
|
||||||
<div class="project-popup-container">
|
<div class="project-popup-container">
|
||||||
<!-- Information -->
|
<!-- Information -->
|
||||||
<div>
|
<div class={description != null ? "" : "project-popup-nodescription"}>
|
||||||
<h1 class="slide-title">{title}</h1>
|
<h1 class="slide-title">{title}</h1>
|
||||||
<div class="project-popup-img-container">
|
<div class="project-popup-img-container">
|
||||||
<img class="project-popup-img" src={picture} alt="Project Popup" />
|
<img class="project-popup-img" src={picture} alt="Project Popup" />
|
||||||
|
@ -133,13 +139,14 @@
|
||||||
path={type_project == "School" ? mdiSchool : mdiAccount}
|
path={type_project == "School" ? mdiSchool : mdiAccount}
|
||||||
type="mdi"
|
type="mdi"
|
||||||
/>
|
/>
|
||||||
<p class="project-popup-subtitle slide-aftericon">{type_project}</p>
|
<p class="project-popup-subtitle slide-aftericon">{type_project == "School" ? text.popup_school : text.popup_personal}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{#if description != null}
|
||||||
<div class="popup-mobile">
|
<div class="popup-mobile">
|
||||||
<div class="popup-subtitle-container">
|
<div class="popup-subtitle-container">
|
||||||
<SvgIcon size="35" path={mdiTextBox} type="mdi" />
|
<SvgIcon size="35" path={mdiTextBox} type="mdi" />
|
||||||
<p class="slide-subtitle slide-aftericon">Description</p>
|
<p class="slide-subtitle slide-aftericon">{text.popup_description}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown">
|
<div class="markdown">
|
||||||
<SvelteMarkdown
|
<SvelteMarkdown
|
||||||
|
@ -148,11 +155,12 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
<!-- Links -->
|
<!-- Links -->
|
||||||
{#if report_link != null || github_link != null || archive_link != null || application_link != null}
|
{#if report_link != null || github_link != null || archive_link != null || application_link != null}
|
||||||
<div class="popup-subtitle-container">
|
<div class="popup-subtitle-container">
|
||||||
<SvgIcon size="35" path={mdiLink} type="mdi" />
|
<SvgIcon size="35" path={mdiLink} type="mdi" />
|
||||||
<p class="slide-subtitle slide-aftericon">Links</p>
|
<p class="slide-subtitle slide-aftericon">{text.popup_links}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="project-popup-link-container">
|
<div class="project-popup-link-container">
|
||||||
{#if report_link != null}
|
{#if report_link != null}
|
||||||
|
@ -162,7 +170,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<SvgIcon size="20" path={mdiFileDocumentOutline} type="mdi" />
|
<SvgIcon size="20" path={mdiFileDocumentOutline} type="mdi" />
|
||||||
<p>See Report</p>
|
<p>{text.popup_dl_rep}</p>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{#if github_link != null}
|
{#if github_link != null}
|
||||||
|
@ -172,7 +180,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<SvgIcon size="20" path={mdiGithub} type="mdi" />
|
<SvgIcon size="20" path={mdiGithub} type="mdi" />
|
||||||
<p>Github Repository</p>
|
<p>{text.github}</p>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{#if archive_link != null}
|
{#if archive_link != null}
|
||||||
|
@ -182,7 +190,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<SvgIcon size="20" path={mdiBookMultiple} type="mdi" />
|
<SvgIcon size="20" path={mdiBookMultiple} type="mdi" />
|
||||||
<p>Download Archive</p>
|
<p>{text.popup_dl_arc}</p>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{#if application_link != null}
|
{#if application_link != null}
|
||||||
|
@ -192,7 +200,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
<SvgIcon size="20" path={mdiDownload} type="mdi" />
|
<SvgIcon size="20" path={mdiDownload} type="mdi" />
|
||||||
<p>Download Application</p>
|
<p>{text.popup_dl_app}</p>
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -201,7 +209,7 @@
|
||||||
{#if filteredTags.length != 0}
|
{#if filteredTags.length != 0}
|
||||||
<div class="popup-subtitle-container">
|
<div class="popup-subtitle-container">
|
||||||
<SvgIcon size="35" path={mdiTag} type="mdi" />
|
<SvgIcon size="35" path={mdiTag} type="mdi" />
|
||||||
<p class="slide-subtitle slide-aftericon">Tags</p>
|
<p class="slide-subtitle slide-aftericon">{text.popup_tags}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="project-popup-link-container project-popup-tag-container">
|
<div class="project-popup-link-container project-popup-tag-container">
|
||||||
{#each filteredTags as tag}
|
{#each filteredTags as tag}
|
||||||
|
@ -217,10 +225,11 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<!-- Text -->
|
<!-- Text -->
|
||||||
|
{#if description != null}
|
||||||
<div class="popup-desktop">
|
<div class="popup-desktop">
|
||||||
<div class="popup-subtitle-container">
|
<div class="popup-subtitle-container">
|
||||||
<SvgIcon size="35" path={mdiTextBox} type="mdi" />
|
<SvgIcon size="35" path={mdiTextBox} type="mdi" />
|
||||||
<p class="slide-subtitle slide-aftericon">Description</p>
|
<p class="slide-subtitle slide-aftericon">{text.popup_description}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="markdown">
|
<div class="markdown">
|
||||||
<SvelteMarkdown
|
<SvelteMarkdown
|
||||||
|
@ -229,6 +238,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="project-popup-background"></div>
|
<div id="project-popup-background"></div>
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.project-popup-main-min {
|
||||||
|
width: 40dvw !important;
|
||||||
|
/* 100-width/2 */
|
||||||
|
left: calc(30vw - 1.5rem) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.project-popup-container {
|
.project-popup-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -31,6 +37,10 @@
|
||||||
height: 80dvh;
|
height: 80dvh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.project-popup-nodescription {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
.project-popup-img {
|
.project-popup-img {
|
||||||
max-height: 16rem;
|
max-height: 16rem;
|
||||||
max-width: 40dvh;
|
max-width: 40dvh;
|
||||||
|
|
|
@ -1,27 +1,41 @@
|
||||||
export function formatDate(date) {
|
import { writable } from "svelte/store";
|
||||||
const options = { day: 'numeric', month: 'long', year: 'numeric' };
|
|
||||||
|
export let locale_lang = writable("en");
|
||||||
|
|
||||||
|
function getLocale(date)
|
||||||
|
{
|
||||||
|
let locale;
|
||||||
|
const unsubscribe = locale_lang.subscribe(value => {
|
||||||
|
locale = value
|
||||||
|
});
|
||||||
|
unsubscribe();
|
||||||
const cool_date = new Date(date);
|
const cool_date = new Date(date);
|
||||||
const formattedDate = cool_date.toLocaleDateString('fr-FR', options);
|
return {
|
||||||
return formattedDate;
|
locale: locale,
|
||||||
|
date: cool_date
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function formatDate(date) {
|
||||||
|
let data = getLocale(date);
|
||||||
|
const options = { day: 'numeric', month: 'long', year: 'numeric' };
|
||||||
|
return data.date.toLocaleDateString(data.locale, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateMobile(date) {
|
export function formatDateMobile(date) {
|
||||||
|
let data = getLocale(date);
|
||||||
const options = { month: 'numeric', year: 'numeric' };
|
const options = { month: 'numeric', year: 'numeric' };
|
||||||
const cool_date = new Date(date);
|
return data.date.toLocaleDateString(data.locale, options);
|
||||||
const formattedDate = cool_date.toLocaleString('fr-FR', options);
|
|
||||||
return formattedDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatMonth(date) {
|
export function formatMonth(date) {
|
||||||
|
let data = getLocale(date);
|
||||||
const options = { month: 'long', year: 'numeric' };
|
const options = { month: 'long', year: 'numeric' };
|
||||||
const cool_date = new Date(date);
|
return data.date.toLocaleDateString(data.locale, options);
|
||||||
const formattedDate = cool_date.toLocaleDateString('fr-FR', options);
|
|
||||||
return formattedDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatYear(date) {
|
export function formatYear(date) {
|
||||||
|
let data = getLocale(date);
|
||||||
const options = { year: 'numeric' };
|
const options = { year: 'numeric' };
|
||||||
const cool_date = new Date(date);
|
return data.date.toLocaleDateString(data.locale, options);
|
||||||
const formattedDate = cool_date.toLocaleDateString('fr-FR', options);
|
|
||||||
return formattedDate;
|
|
||||||
}
|
}
|
|
@ -14,5 +14,14 @@
|
||||||
"madewith": "Made with",
|
"madewith": "Made with",
|
||||||
"usingsvelte": "using Svelte",
|
"usingsvelte": "using Svelte",
|
||||||
"copyright": "All rights reserved, Yohan Boujon",
|
"copyright": "All rights reserved, Yohan Boujon",
|
||||||
"github": "Github Repo"
|
"github": "Github Repo",
|
||||||
|
|
||||||
|
"popup_school": "School",
|
||||||
|
"popup_personal": "Personal",
|
||||||
|
"popup_links": "Links",
|
||||||
|
"popup_tags": "Tags",
|
||||||
|
"popup_description": "Description",
|
||||||
|
"popup_dl_app": "Download App",
|
||||||
|
"popup_dl_arc": "Download Archive",
|
||||||
|
"popup_dl_rep": "See Report"
|
||||||
}
|
}
|
|
@ -14,5 +14,14 @@
|
||||||
"madewith": "Fait avec",
|
"madewith": "Fait avec",
|
||||||
"usingsvelte": "à l'aide de Svelte",
|
"usingsvelte": "à l'aide de Svelte",
|
||||||
"copyright": "Tous droits réservés, Yohan Boujon",
|
"copyright": "Tous droits réservés, Yohan Boujon",
|
||||||
"github": "Lien Github"
|
"github": "Lien Github",
|
||||||
|
|
||||||
|
"popup_school": "École",
|
||||||
|
"popup_personal": "Personnel",
|
||||||
|
"popup_links": "Liens",
|
||||||
|
"popup_tags": "Compétences",
|
||||||
|
"popup_description": "Description",
|
||||||
|
"popup_dl_app": "Application",
|
||||||
|
"popup_dl_arc": "Archive ZIP",
|
||||||
|
"popup_dl_rep": "Voir le Rapport"
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import { json } from '@sveltejs/kit';
|
import { locale_lang } from "$lib/js/date.js"
|
||||||
|
|
||||||
export async function load(context) {
|
export async function load(context) {
|
||||||
async function fetchData(data) {
|
async function fetchData(data) {
|
||||||
|
@ -35,8 +35,10 @@ export async function load(context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gathering the language
|
// Updating locale
|
||||||
const lang = context.params.lang;
|
const lang = context.params.lang;
|
||||||
|
locale_lang.set(lang);
|
||||||
|
// Gathering language id
|
||||||
let lang_id;
|
let lang_id;
|
||||||
const res = (await fetchData(`get_lang_id/${lang}`));
|
const res = (await fetchData(`get_lang_id/${lang}`));
|
||||||
if (res.status == 500) return {
|
if (res.status == 500) return {
|
||||||
|
@ -45,8 +47,7 @@ export async function load(context) {
|
||||||
else {
|
else {
|
||||||
lang_id = res.data.id;
|
lang_id = res.data.id;
|
||||||
}
|
}
|
||||||
|
// Updating json for locale text
|
||||||
// Gathering texts for languages
|
|
||||||
let text;
|
let text;
|
||||||
const jsonData = await fetchJSON(lang);
|
const jsonData = await fetchJSON(lang);
|
||||||
if (jsonData.status == 0) text = jsonData.data;
|
if (jsonData.status == 0) text = jsonData.data;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
// Sidebar
|
// Sidebar
|
||||||
let containerCv;
|
let containerCv;
|
||||||
let footer;
|
let footer;
|
||||||
let sidebarLoaded = false;
|
$: sidebarLoaded = false;
|
||||||
let Sidebar;
|
let Sidebar;
|
||||||
|
|
||||||
// Mobile top bar
|
// Mobile top bar
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if data.status == 0}
|
{#if data.status == 0}
|
||||||
<ProjectsPopup tags={cv.tags} />
|
<ProjectsPopup tags={cv.tags} {text} />
|
||||||
<!-- TOPBAR DIV (POPUP: mobile) -->
|
<!-- TOPBAR DIV (POPUP: mobile) -->
|
||||||
{#if innerWidth < 1200 && sidebarLoaded}
|
{#if innerWidth < 1200 && sidebarLoaded}
|
||||||
<Sidebar info={cv.info} bind:sidebarContainer {text} />
|
<Sidebar info={cv.info} bind:sidebarContainer {text} />
|
||||||
|
|
Loading…
Add table
Reference in a new issue