Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

feat/fix posthog log #156

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b9d0eb5
:rocket: trigger release
mehdilouraoui Jun 3, 2022
e52e4cb
:ambulance: fix download links
mehdilouraoui Jun 7, 2022
783e53d
fix(stats): statistic page (#117) (#118)
mehdilouraoui Dec 1, 2022
70ef2b2
:bookmark: release v1.12.0
SocialGroovyBot Dec 1, 2022
0c923ea
Merge branch 'dev'
mehdilouraoui Mar 27, 2023
7ea08d4
Merge branch 'dev' of https://github.com/SocialGouv/archifiltre-site-v2
mehdilouraoui Mar 27, 2023
3bb9e7b
trigger deploy
mehdilouraoui Jun 3, 2022
4a43b84
update
mehdilouraoui Mar 27, 2023
217ea4d
update
mehdilouraoui Mar 27, 2023
0aff9c4
:bookmark: release v1.13.0
SocialGroovyBot Mar 27, 2023
871faab
feat/update-site-v2
mehdilouraoui Mar 27, 2023
ec7991c
Merge branch 'main' of https://github.com/SocialGouv/archifiltre-site-v2
mehdilouraoui Mar 27, 2023
e304936
:bookmark: release v1.14.0
SocialGroovyBot Mar 27, 2023
3c41ab9
feat/update (#145) (#146)
mehdilouraoui Mar 27, 2023
6ad7814
feat(version): add 4.0
mehdilouraoui Jul 7, 2023
5bc3f2a
:bookmark: release v1.15.0
SocialGroovyBot Jul 7, 2023
9f8e733
fix(version): fix lock
mehdilouraoui Jul 7, 2023
3e70fd2
fix: resolve lockfile
lsagetlethias Jul 7, 2023
ebfcda2
:bookmark: release v1.16.0
SocialGroovyBot Jul 7, 2023
f510bb1
:rotating_light: Lint
lsagetlethias Jul 7, 2023
be8b67d
:bookmark: release v1.17.0
SocialGroovyBot Jul 7, 2023
4024980
feat: update stats (#149)
mehdilouraoui Sep 4, 2023
de5f6ad
:bookmark: release v1.18.0
SocialGroovyBot Sep 4, 2023
a0d9a5d
Merge branch 'main' of https://github.com/SocialGouv/archifiltre-site-v2
mehdilouraoui Sep 5, 2023
215684c
feat/update (#145)
mehdilouraoui Mar 27, 2023
0251ccd
feat: update download page (#153)
mehdilouraoui Sep 5, 2023
6986d0b
:bookmark: release v1.19.0
SocialGroovyBot Sep 5, 2023
27032e7
feat/update download page (#154)
mehdilouraoui Sep 19, 2023
6567d41
:bookmark: release v1.20.0
SocialGroovyBot Sep 19, 2023
cf79b16
feat: fix posthog (#155)
mehdilouraoui Sep 19, 2023
d945bec
:bookmark: release v1.21.0
SocialGroovyBot Sep 19, 2023
ed02b5a
feat: fix posthog logs
mehdilouraoui Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
}
]
}
}
}
2 changes: 1 addition & 1 deletion components/download/Download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const Download = ({ content, productVersions }: DownloadProps) => {
productVersions[slice.primary.key];

if (typeof productOrError === 'string') {
return <span>{productOrError}</span>;
return <span key={index}>{productOrError}</span>;
}

return (
Expand Down
6 changes: 4 additions & 2 deletions components/download/DownloadProdutItemProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ export const DownloadProductItem = ({
slice,
product,
}: DownloadProdutItemProps) => {
const dlHref = getDownloadLink(product);
const dlHref = getDownloadLink(product); // TODO: Change to proper url selection
const productName = product?.name?.substring(0, product?.name.indexOf('-')); // TODO: Change to proper title selection

return (
<div className="download__products__item">
<h3>
{slice.primary.title}
<span>
{product
? product.name
? productName
: 'Pas de version stable disponible 😢'}
</span>
</h3>
Expand Down
36 changes: 21 additions & 15 deletions components/statistic/Statistic.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/* eslint-disable @next/next/no-img-element */
import { FC } from 'react';
import { Page } from '../common/Page';

const statsDocs = [
{ label: 'Nombre de téléchargements', size: 100 },
{ label: 'Carte des téléchargements', size: 100 },
{ label: 'Volume total analysé', size: 100 },
{ label: 'Volume total tagué à éliminer', size: 100 },
{ label: 'Nombre de téléchargements', size: 20877, date: '' },
{ label: 'Volume total analysé', size: '1293.1 To', date: '' },
{ label: 'Volume total tagué à éliminer', size: '9.1 To', date: '' },
{ label: 'Parcourus en avion', size: '8489 Kms', date: '' },
];

const statsMails = [
{ label: 'Nombre de téléchargements', size: 100 },
{ label: 'Nombre de pst déposés', size: 100 },
{ label: 'Volume total analysé', size: 100 },
{ label: 'Volume total tagué à éliminer', size: 100 },
{ label: 'Nombre de téléchargements', size: 5614, date: '' },
{ label: 'Nombre de pst déposés', size: 513, date: '' },
{ label: 'Volume total analysé (en mails)', size: 1373449, date: '' },
{ label: 'Volume total tagué à éliminer (en Mo)', size: 12.5, date: '' },
];

type TStat = {
label: string;
size: number;
size: number | string;
};

const Stat: FC<TStat> = ({ size, label }) => {
Expand All @@ -33,20 +34,25 @@ export const Statistic = () => {
return (
<Page className="statistics">
<h1>Statistiques</h1>
<div className="wrapper">
<div className="statistics-wrapper">
<h2>Docs</h2>
<div className="item-wrapper">
{/* {statsDocs.map((stat, index) => (
{statsDocs.map((stat, index) => (
<Stat label={stat.label} size={stat.size} key={index} />
))} */}
))}
</div>
<h3>Utilisations de Docs dans le monde</h3>
<img
src="/assets/map.png"
alt="carte de l'utilisation d'Archifiltre Docs dans le monde"
/>
</div>
<div className="wrapper">
<div className="statistics-wrapper">
<h2>Mails</h2>
<div className="item-wrapper">
{/* {statsMails.map((stat, index) => (
{statsMails.map((stat, index) => (
<Stat label={stat.label} size={stat.size} key={index} />
))} */}
))}
</div>
</div>
</Page>
Expand Down
32 changes: 32 additions & 0 deletions hooks/usePostHog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useRouter } from 'next/router';
import posthog from 'posthog-js';
import { useEffect } from 'react';

if (typeof window !== 'undefined') {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY ?? '', {
api_host:
process.env.NEXT_PUBLIC_POSTHOG_HOST ||
'https://docs.posthog.archifiltre.fr',
capture_pageview: false,
});
}

export const usePostHog = () => {
const router = useRouter();

useEffect(() => {
const handleRouteChange = () => {
posthog?.capture('$pageview');
};
router.events.on('routeChangeComplete', handleRouteChange);

return () => {
router.events.off('routeChangeComplete', handleRouteChange);
};
}, []);
};

export const PostHogTracker = () => {
usePostHog();
return <></>;
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "archifiltre-site-v2",
"version": "1.11.0",
"version": "1.21.0",
"private": true,
"author": "Archifiltre",
"license": "Apache-2.0",
Expand Down Expand Up @@ -47,6 +47,7 @@
"include-media": "^1.4.10",
"next": "12.1.6",
"next-seo": "^5.4.0",
"posthog-js": "^1.79.0",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-markdown": "^8.0.3",
Expand Down
193 changes: 99 additions & 94 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,113 +1,118 @@
import { PrismicPreview } from '@prismicio/next';
import { PrismicProvider } from '@prismicio/react';
import { DefaultSeo } from 'next-seo';
import type { AppProps } from 'next/app';
import Link from 'next/link';
import { DefaultSeo } from 'next-seo';
import { PostHogProvider } from 'posthog-js/react';
import { Footer } from '../components/common/Footer';
import { Header } from '../components/common/Header';
import { Layout } from '../components/common/Layout';
import { Main } from '../components/common/Main';
import { PostHogTracker } from '../hooks/usePostHog';
import { repositoryName } from '../prismicConfiguration';
import '../styles/index.scss';
import { linkResolver } from '../utils/prismic/helpers';

const App = ({ Component, pageProps }: AppProps) => {
return (
<PrismicProvider
linkResolver={linkResolver}
internalLinkComponent={({ href, children, ...props }) => (
<Link href={href}>
<a {...props}>{children}</a>
</Link>
)}
>
<PrismicPreview repositoryName={repositoryName}>
<Layout>
<DefaultSeo
canonical="https://archifiltre.fr"
titleTemplate="%s | Suite Archifiltre"
defaultTitle="Suite Archifiltre"
additionalLinkTags={[
{
rel: 'icon',
href: 'https://archifiltre.fr/favicon.ico',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Bold.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Light.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Medium.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Bold.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Light.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Medium.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
]}
openGraph={{
title: 'Suite Archifitre',
type: 'website',
locale: 'fr_FR',
url: 'https://archifiltre.fr',
site_name: 'Archifiltre',
description:
'Aider les archivistes et les agents des administrations à appréhender et trier des arborescences de fichiers et des messageries complètes.',
images: [
<PostHogProvider>
<PostHogTracker />
<PrismicProvider
linkResolver={linkResolver}
internalLinkComponent={({ href, children, ...props }) => (
<Link href={href}>
<a {...props}>{children}</a>
</Link>
)}
>
<PrismicPreview repositoryName={repositoryName}>
<Layout>
<DefaultSeo
canonical="https://archifiltre.fr"
titleTemplate="%s | Suite Archifiltre"
defaultTitle="Suite Archifiltre"
additionalLinkTags={[
{
rel: 'icon',
href: 'https://archifiltre.fr/favicon.ico',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Bold.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Light.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Quicksand-Medium.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Bold.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Light.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
{
url: 'https://archifiltre.fr/assets/team_logo.png',
secureUrl:
'https://archifiltre.fr/assets/team_logo.png',
alt: 'Team Logo',
height: 1024,
width: 1024,
rel: 'preload',
href: 'https://archifiltre.fr/assets/fonts/Inter-Medium.ttf',
as: 'font',
type: 'font/ttf',
crossOrigin: 'anonymous',
},
],
}}
twitter={{
handle: '@archifiltre',
site: '@archifiltre',
cardType: 'summary_large_image',
}}
/>
<Header />
<Main>
<Component {...pageProps} />
</Main>
<Footer />
</Layout>
</PrismicPreview>
</PrismicProvider>
]}
openGraph={{
title: 'Suite Archifitre',
type: 'website',
locale: 'fr_FR',
url: 'https://archifiltre.fr',
site_name: 'Archifiltre',
description:
'Aider les archivistes et les agents des administrations à appréhender et trier des arborescences de fichiers et des messageries complètes.',
images: [
{
url: 'https://archifiltre.fr/assets/team_logo.png',
secureUrl:
'https://archifiltre.fr/assets/team_logo.png',
alt: 'Team Logo',
height: 1024,
width: 1024,
},
],
}}
twitter={{
handle: '@archifiltre',
site: '@archifiltre',
cardType: 'summary_large_image',
}}
/>
<Header />
<Main>
<Component {...pageProps} />
</Main>
<Footer />
</Layout>
</PrismicPreview>
</PrismicProvider>
</PostHogProvider>
);
};

Expand Down
13 changes: 13 additions & 0 deletions pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next';

type Data = {
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>,
) {
res.status(200).json({ name: 'John Doe' });
}
Binary file added public/assets/map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading