Skip to content
Snippets Groups Projects
Commit 6f95b603 authored by sandcha's avatar sandcha
Browse files

Upgrade to new syntax

parent 4770e815
Branches
Tags
1 merge request!6Met à jour les dépendances de l'application
......@@ -24,16 +24,8 @@
export let titreSimulateurMobile = "Cotis. & presta. sociales"
$: authenticationEnabled = $session.authenticationEnabled
$: pageUrlPath = $page.path.replace(/\/+$/, "") || "/"
$: title = $session.title
$: pathname = $page.url.pathname
$: user = $session.user
// function activeMenuItem(href: string) {
// return pageUrlPath === href || pageUrlPath.startsWith(href + "/")
// }
</script>
<div class="fixed top-0 w-full z-50">
......@@ -171,7 +163,7 @@
<div class="flex">
<a
title={titleLinkConnectionButton}
href="/authentication/signin/leximpact?redirect={$page.path}"
href="/authentication/signin/leximpact?redirect={pathname}"
class="bg-le-jaune-dark text-white uppercase text-sm rounded-sm focus:outline-none hover:bg-black hover:bg-opacity-20 hover:text-white shadow-md"
type="button"
>
......@@ -387,7 +379,7 @@
{#if user === undefined}
<a
title={titleLinkConnectionButton}
href="/authentication/signin/leximpact?redirect={$page.path}"
href="/authentication/signin/leximpact?redirect={pathname}"
class="border-b block px-4 py-3 text-sm bg-le-jaune-dark text-white hover:text-black"
role="menuitem"
>
......
......@@ -20,7 +20,7 @@
<div class="flex m-4">
<a
title={titleLinkConnectionButton}
href="/authentication/signin/leximpact?redirect={$page.path}"
href="/authentication/signin/leximpact?redirect={$page.url.pathname}"
class="flex bg-le-bleu text-center text-white uppercase text-sm rounded focus:outline-none hover:bg-le-gris-dispositif-dark hover:text-white shadow-lg w-full mx-10 py-3 justify-center items-center"
>
<span class="text-center text-base">S'authentifier</span>
......
......@@ -53,15 +53,11 @@
localStorage.setItem("reform", JSON.stringify($reform))
}
$: url = $page.url
$: if (browser && matomoConfig !== undefined && $page) {
let url = $page.path
const queryString = $page.query.toString()
if (queryString !== "") {
url += "?" + queryString
}
// @ts-expect-error: global variable needed by Matomo.
const _paq = window._paq
_paq.push(["setCustomUrl", url])
_paq.push(["setCustomUrl", url.pathname + url.search])
_paq.push([
"setDocumentTitle",
matomoConfig.prependDomain
......
......@@ -8,7 +8,8 @@
let initialTerm: string | undefined = undefined
$: term = $page.query.get("q") ?? ""
$: term = $page.url.searchParams.get("q") ?? ""
$: pathname = $page.url.pathname
function searchTermChanged({ detail }: { detail: string }) {
if (initialTerm === undefined) {
......@@ -18,7 +19,7 @@
history.replaceState(
null,
"",
`${$page.path}${term ? `?q=${encodeURIComponent(term)}` : ""}`,
`${pathname}${term ? `?q=${encodeURIComponent(term)}` : ""}`,
)
}
......@@ -30,13 +31,13 @@
if (initialTerm !== undefined) {
// Restore the initial term in browser history.
await goto(
`${$page.path}${
`${pathname}${
initialTerm ? `?q=${encodeURIComponent(initialTerm)}` : ""
}`,
{ replaceState: true },
)
// Push the current term.
await goto(`${$page.path}${term ? `?q=${encodeURIComponent(term)}` : ""}`)
await goto(`${pathname}${term ? `?q=${encodeURIComponent(term)}` : ""}`)
}
// Go to parameter page.
await goto(`/parameters/${parameter.name}`)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment