feat: Listes stats

pull/2573/head
Jérémy Rialland 2023-04-06 20:22:40 +02:00 committed by Jérémy Rialland
parent 30b2f3c3fa
commit 14a75ae055
2 changed files with 16 additions and 9 deletions

View File

@ -1,11 +1,10 @@
import { DottedName } from 'modele-social'
import { Trans, useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'
import { Hit as AlgoliaHit } from 'react-instantsearch-core'
import { connectInfiniteHits, connectStats } from 'react-instantsearch-dom'
import { connectInfiniteHits } from 'react-instantsearch-dom'
import styled from 'styled-components'
import { Button } from '@/design-system/buttons'
import { H3 } from '@/design-system/typography/heading'
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
import RuleLink from '../../RuleLink'
@ -18,6 +17,7 @@ const StyledRuleLink = styled(RuleLink)`
margin: 0;
color: inherit;
background-color: inherit;
display: block;
}
${Body} {
@ -46,11 +46,11 @@ const Hit = (hit: THit) => {
<HitContainer>
<StyledRuleLink dottedName={hit.objectID}>
{hit.namespace && (
<SmallBody className="hit-namespace">
<SmallBody as="span" className="hit-namespace">
<Highlight hit={hit} attribute="namespace" separator=" > " />
</SmallBody>
)}
<Body className="hit-ruleName">
<Body as="span" className="hit-ruleName">
<Highlight hit={hit} attribute="ruleName" />
</Body>
</StyledRuleLink>

View File

@ -13,7 +13,7 @@ const lastCompare = (startDate: Date, dateStr: string) =>
startDate < new Date(dateStr)
export const BigIndicator = ({ main, subTitle, footnote }: IndicatorProps) => (
<Grid item xs={6} md={4} lg={3}>
<Grid item xs={6} md={4} lg={3} as="li" style={{ listStyle: 'none' }}>
<Indicator main={main} subTitle={subTitle} footnote={footnote} />
</Grid>
)
@ -151,7 +151,7 @@ export default function GlobalStats({ stats }: { stats: StatsStruct }) {
return (
<>
<Grid container spacing={2}>
<Grid as="ul" container spacing={2} style={{ padding: 0 }}>
<BigIndicator
main={`${last30dConv} %`}
subTitle="Taux de conversion"
@ -181,7 +181,14 @@ export default function GlobalStats({ stats }: { stats: StatsStruct }) {
/>
{currentMonthSatisfaction.total > 0 && (
<Grid item xs={12} md={8} lg={12}>
<Grid
item
xs={12}
md={8}
lg={12}
as="li"
style={{ listStyle: 'none' }}
>
<Indicator
subTitle="Satisfaction utilisateurs"
main={
@ -199,7 +206,7 @@ export default function GlobalStats({ stats }: { stats: StatsStruct }) {
<Spacing md />
<Grid container spacing={2}>
<Grid container spacing={2} as="ul" style={{ padding: 0 }}>
<BigIndicator
main={totalVisits}
subTitle="Visites"