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

Commit

Permalink
revert stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBitard committed Sep 12, 2024
1 parent f28f5a4 commit 7deb13c
Show file tree
Hide file tree
Showing 131 changed files with 494 additions and 484 deletions.
14 changes: 5 additions & 9 deletions packages/ui/src/api/_upload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Uppy from '@uppy/core'
import Tus from '@uppy/tus'
import Tus, { TusOptions } from '@uppy/tus'
import { Upload } from 'tus-js-client'
import { TempDocumentName, tempDocumentNameValidator } from 'camino-common/src/document'
import { isNotNullNorUndefinedNorEmpty, isNullOrUndefinedOrEmpty } from 'camino-common/src/typescript-tools'

const CHUNK_SIZE = 1048576 // 1 Mo
const apiUrl = '/apiUrl'
Expand All @@ -11,7 +11,7 @@ export const uploadCall = async (file: File, progressCb: (progress: number) => v
autoProceed: true,
})

uppy.use(Tus, {
uppy.use<TusOptions & { onChunkComplete: Upload['options']['onChunkComplete'] }, Tus>(Tus, {
chunkSize: CHUNK_SIZE,
endpoint: `${apiUrl}/televersement`,
onShouldRetry: () => {
Expand All @@ -33,15 +33,11 @@ export const uploadCall = async (file: File, progressCb: (progress: number) => v
uppy.on('complete', result => {
const { successful, failed } = result

if (isNotNullNorUndefinedNorEmpty(failed) || isNullOrUndefinedOrEmpty(successful)) {
if (failed.length || !successful.length) {
reject(new Error('Échec du téléversement'))
} else {
const [{ uploadURL }] = successful
if (isNullOrUndefinedOrEmpty(uploadURL)) {
reject(new Error("Pas d'URL d'upload"))
} else {
resolve(tempDocumentNameValidator.parse(uploadURL.substring(uploadURL.lastIndexOf('/') + 1)))
}
resolve(tempDocumentNameValidator.parse(uploadURL.substring(uploadURL.lastIndexOf('/') + 1)))
}
})
})
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/_common/downloads.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const meta: Meta = {
}
export default meta

export const Default: StoryFn = () => <PureDownloads formats={['geojson', 'xlsx']} downloadRoute="/demarches" params={{}} route={{ query: {} }} id="id" />
export const Default: StoryFn = () => <PureDownloads formats={['geojson', 'xlsx']} downloadRoute={'/demarches'} params={{}} route={{ query: {} }} id="id" />

export const OnlyOneFormat: StoryFn = () => <PureDownloads formats={['pdf']} downloadRoute="/demarches" params={{}} route={{ query: {} }} id="id" />
export const OnlyOneFormat: StoryFn = () => <PureDownloads formats={['pdf']} downloadRoute={'/demarches'} params={{}} route={{ query: {} }} id="id" />

export const WithOverridenTitle: StoryFn = () => (
<PureDownloads formats={['pdf']} downloadRoute="/demarches" params={{}} route={{ query: {} }} id="id" downloadTitle="Surchage du titre du bouton de téléchargement" />
<PureDownloads formats={['pdf']} downloadRoute={'/demarches'} params={{}} route={{ query: {} }} id="id" downloadTitle="Surchage du titre du bouton de téléchargement" />
)
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const TableForages: FunctionalComponent<NotNullableKeys<Pick<Props, 'geo_systeme
export const TabCaminoTable = defineComponent<Props>(props => {
return () => (
<div style={{ display: 'flex', flexDirection: 'column' }}>
<GeoSystemeTypeahead disabled geoSystemeId={props.geo_systeme_id} />
<GeoSystemeTypeahead disabled={true} geoSystemeId={props.geo_systeme_id} />

<TablePoints caption={isNotNullNorUndefined(props.geojson_origine_forages) ? 'Points' : ''} {...props} />

Expand Down
18 changes: 9 additions & 9 deletions packages/ui/src/components/_common/dsfr-perimetre.stories.tsx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ui/src/components/_common/dsfr-perimetre.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const DsfrPerimetre = defineComponent<Props>((props: Props) => {
},
] as const satisfies readonly Tab<TabId>[]

return () => <Tabs initTab={props.initTab ?? 'carte'} tabs={vues} tabsTitle="Affichage des titres en vue carte ou tableau" tabClicked={_newTabId => {}} />
return () => <Tabs initTab={props.initTab ?? 'carte'} tabs={vues} tabsTitle={'Affichage des titres en vue carte ou tableau'} tabClicked={_newTabId => {}} />
})

type TabCaminoMapProps = OmitDistributive<Props, 'perimetre'> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default meta

const geoSystemeSelected = action('geoSystemeSelected')

export const Default: StoryFn = () => <GeoSystemeTypeahead geoSystemeSelected={geoSystemeSelected} disabled={false} alwaysOpen />
export const WithGeoSystemeAlreadySelected: StoryFn = () => <GeoSystemeTypeahead geoSystemeId="2154" disabled />
export const Default: StoryFn = () => <GeoSystemeTypeahead geoSystemeSelected={geoSystemeSelected} disabled={false} alwaysOpen={true} />
export const WithGeoSystemeAlreadySelected: StoryFn = () => <GeoSystemeTypeahead geoSystemeId="2154" disabled={true} />
2 changes: 1 addition & 1 deletion packages/ui/src/components/_common/new-section-element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SectionElement: FunctionalComponent<Props> = (props: Props): JSX.El
) : (
<span>
{props.element.id === 'jorf' && props.element.value !== null && props.element.value !== '' ? (
<a target="_blank" rel="noopener noreferrer" href={`https://www.legifrance.gouv.fr/jorf/id/${valeurFind(props.element)}`} title="Légifrance - Lien externe">
<a target="_blank" rel="noopener noreferrer" href={`https://www.legifrance.gouv.fr/jorf/id/${valeurFind(props.element)}`} title={`Légifrance - Lien externe`}>
{valeurFind(props.element)}
</a>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default meta

const substanceLegaleSelected = action('substanceLegaleSelected')

export const Default: StoryFn = () => <SubstanceLegaleTypeahead substanceLegaleIds={['auru', 'aloh']} substanceLegaleSelected={substanceLegaleSelected} alwaysOpen />
export const Default: StoryFn = () => <SubstanceLegaleTypeahead substanceLegaleIds={['auru', 'aloh']} substanceLegaleSelected={substanceLegaleSelected} alwaysOpen={true} />
export const WithSubstanceTypeAlreadySelected: StoryFn = () => <SubstanceLegaleTypeahead substanceLegaleIds={['auru', 'aloh']} initialValue="auru" substanceLegaleSelected={substanceLegaleSelected} />
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const TitreReferenceSelect = defineComponent<Props>(props => {
))}

{isNullOrUndefined(references.value.find(r => !r.referenceTypeId || !r.nom)) ? (
<DsfrButton buttonType="tertiary" onClick={referenceAdd} title="Ajouter une référence" icon="fr-icon-add-line" />
<DsfrButton buttonType="tertiary" onClick={referenceAdd} title="Ajouter une référence" icon={'fr-icon-add-line'} />
) : null}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export const Default: StoryFn = () => <TitreTypeSelect user={{ role: 'super', ..

export const Entreprise: StoryFn = () => <TitreTypeSelect user={{ role: 'entreprise', entrepriseIds: [], ...testBlankUser }} onUpdateTitreTypeId={onUpdateTitreTypeIdAction} titreTypeId={null} />

export const AlreadySelected: StoryFn = () => <TitreTypeSelect user={{ role: 'entreprise', entrepriseIds: [], ...testBlankUser }} onUpdateTitreTypeId={onUpdateTitreTypeIdAction} titreTypeId="arm" />
export const AlreadySelected: StoryFn = () => <TitreTypeSelect user={{ role: 'entreprise', entrepriseIds: [], ...testBlankUser }} onUpdateTitreTypeId={onUpdateTitreTypeIdAction} titreTypeId={'arm'} />
4 changes: 2 additions & 2 deletions packages/ui/src/components/_common/titre-type-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export const TitreTypeSelect = defineComponent<Props>(props => {
return () => (
<>
{isNotNullNorUndefined(domainesFiltered.value) ? (
<DsfrSelect required initialValue={domaineRef.value} items={domainesFiltered.value} valueChanged={domaineUpdate} legend={{ main: 'Domaine' }} />
<DsfrSelect required={true} initialValue={domaineRef.value} items={domainesFiltered.value} valueChanged={domaineUpdate} legend={{ main: 'Domaine' }} />
) : null}

{isNotNullNorUndefined(titresTypeTypes.value) ? (
<DsfrSelect required initialValue={titreTypeType.value} items={titresTypeTypes.value} legend={{ main: 'Type' }} valueChanged={titreTypeTypeUpdate} />
<DsfrSelect required={true} initialValue={titreTypeType.value} items={titresTypeTypes.value} legend={{ main: 'Type' }} valueChanged={titreTypeTypeUpdate} />
) : null}
</>
)
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/_map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const CaminoMap = defineComponent<Props>((props, { expose }) => {
const gauge = L.DomUtil.create('div')
gauge.style.background = 'rgba(255,255,255)'
gauge.style.textAlign = 'right'
gauge.innerHTML = 'Chargement...'
gauge.innerHTML = `Chargement...`

return gauge
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/_map/pattern.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const MapPattern: FunctionalComponent = () => {
// leaflet/mapUtil uses this
return (
<>
<div style={{ display: 'none' }} aria-hidden>
<div style={{ display: 'none' }} aria-hidden={true}>
{domainesIds.map(id => (
<div key={id} id={`domaine_${id}`}>
<Domaine domaineId={id} />
Expand Down Expand Up @@ -52,7 +52,7 @@ export const MapPattern: FunctionalComponent = () => {
height="8"
patternTransform={`rotate(${defs[ttt.id].rotation})`}
>
<path d={defs[ttt.id].d} class={domaineId ? `svg-stroke-domaine-${domaineId}` : 'svg-stroke'} stroke-width={defs[ttt.id].width} stroke-linecap="round" fill="none" />
<path d={defs[ttt.id].d} class={domaineId ? `svg-stroke-domaine-${domaineId}` : `svg-stroke`} stroke-width={defs[ttt.id].width} stroke-linecap="round" fill="none" />
</pattern>
)
})}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/_ui/alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const Warning: StoryFn = () => <Alert type="warning" title="Attention" de
export const Erreur: StoryFn = () => <Alert type="error" title="Erreur" description={<span class="fr-text--bold">Description en gras</span>} />
export const Info: StoryFn = () => <Alert type="info" title="Informations" description={<span class="fr-text--bold">Description en gras</span>} />
export const InfoSansDescription: StoryFn = () => <Alert type="info" title="Informations" />
export const InfoSmall: StoryFn = () => <Alert type="info" title="Informations" small />
export const InfoSmallLink: StoryFn = () => <Alert type="info" title={<DsfrLink icon={null} disabled={false} to={{ name: 'dashboard', params: {} }} title="le titre du lien" />} small />
export const InfoSmall: StoryFn = () => <Alert type="info" title="Informations" small={true} />
export const InfoSmallLink: StoryFn = () => <Alert type="info" title={<DsfrLink icon={null} disabled={false} to={{ name: 'dashboard', params: {} }} title="le titre du lien" />} small={true} />

export const ApiErrorSimple: StoryFn = () => <CaminoApiAlert caminoApiError={{ message: "Ceci est une alerte de l'api" }} />
export const ApiErrorWithCompleteMessage: StoryFn = () => (
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/_ui/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const CaminoApiAlert: FunctionalComponent<{ caminoApiError: CaminoError<s
}

export const PageIntrouvableAlert: FunctionalComponent = () => {
return <Alert type="error" title="Page Introuvable" small />
return <Alert type="error" title="Page Introuvable" small={true} />
}
// Demandé par le router car utilisé dans un import asynchrone /shrug
PageIntrouvableAlert.displayName = 'Page introuvable'
2 changes: 1 addition & 1 deletion packages/ui/src/components/_ui/badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const Systeme: StoryFn = () => (
<Badge ariaLabel="Badge" systemLevel={systeme} />
</td>
<td>
<Badge ariaLabel="Badge" systemLevel={systeme} systemIcon />
<Badge ariaLabel="Badge" systemLevel={systeme} systemIcon={true} />
</td>
</tr>
))}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/_ui/dsfr-button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default meta

const onClick = action('onClick')
export const Default: StoryFn = () => <DsfrButton title="Mon title" onClick={onClick} />
export const Disabled: StoryFn = () => <DsfrButton title="Mon title" disabled onClick={onClick} />
export const Disabled: StoryFn = () => <DsfrButton title="Mon title" disabled={true} onClick={onClick} />
export const All: StoryFn = () => (
<div style={{ display: 'flex', flexDirection: 'column' }}>
{buttonTypes.map(buttonType => (
Expand Down Expand Up @@ -44,6 +44,6 @@ export const Link: StoryFn = () => (
<DsfrLink buttonType="primary" icon={null} disabled={false} title="Titre" to={{ name: 'dashboard', params: {} }} />
<DsfrLink buttonType="primary" disabled={false} icon="fr-icon-alert-fill" title="Titre" to={{ name: 'dashboard', params: {} }} />
<DsfrLink buttonType="primary" disabled={false} icon="fr-icon-alert-fill" title="Titre" to={{ name: 'dashboard', params: {} }} label={null} />
<DsfrLink breadcrumb disabled={false} icon={null} title="Titre" to={{ name: 'dashboard', params: {} }} label={null} />
<DsfrLink breadcrumb={true} disabled={false} icon={null} title="Titre" to={{ name: 'dashboard', params: {} }} label={null} />
</div>
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default meta

const valueChangedAction = action('valueChanged')

export const Checked: StoryFn = () => <DsfrInputCheckbox initialValue legend={{ main: 'Label', description: 'Description' }} valueChanged={valueChangedAction} />
export const Checked: StoryFn = () => <DsfrInputCheckbox initialValue={true} legend={{ main: 'Label', description: 'Description' }} valueChanged={valueChangedAction} />
export const NotChecked: StoryFn = () => <DsfrInputCheckbox initialValue={false} legend={{ main: 'Label' }} valueChanged={valueChangedAction} />
export const Disabled: StoryFn = () => <DsfrInputCheckbox legend={{ main: 'C’est désactivé' }} disabled valueChanged={valueChangedAction} />
export const Disabled: StoryFn = () => <DsfrInputCheckbox legend={{ main: 'C’est désactivé' }} disabled={true} valueChanged={valueChangedAction} />
export const Small: StoryFn = () => <DsfrInputCheckbox legend={{ main: 'Label' }} size="sm" valueChanged={valueChangedAction} />
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const Small: StoryFn = () => (
export const Disabled: StoryFn = () => (
<DsfrInputCheckboxes
legend={{ main: 'C’est désactivé' }}
disabled
disabled={true}
valueChanged={valueChangedAction}
elements={
[
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/components/_ui/dsfr-input-radio.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const WithValue: StoryFn = () => (
export const Disabled: StoryFn = () => (
<DsfrInputRadio
id="input5"
disabled
disabled={true}
legend={{ main: 'Légende' }}
valueChanged={valueChangedAction}
elements={[
Expand All @@ -64,7 +64,7 @@ export const Disabled: StoryFn = () => (
export const Required: StoryFn = () => (
<DsfrInputRadio
id="input6"
required
required={true}
legend={{ main: 'Légende' }}
valueChanged={valueChangedAction}
elements={[
Expand All @@ -79,7 +79,7 @@ export const Small: StoryFn = () => (
<DsfrInputRadio
id="input6"
size="sm"
required
required={true}
legend={{ main: '' }}
valueChanged={valueChangedAction}
elements={[
Expand All @@ -92,7 +92,7 @@ export const Small: StoryFn = () => (
export const Horizontal: StoryFn = () => (
<DsfrInputRadio
id="input6"
required
required={true}
orientation="horizontal"
legend={{ main: 'Légende' }}
valueChanged={valueChangedAction}
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/_ui/dsfr-input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const WithDescription: StoryFn = () => <DsfrInput type={{ type: 'text' }}
export const WithDescriptionAndPlaceholder: StoryFn = () => (
<DsfrInput type={{ type: 'text' }} id="input3" legend={{ main: 'Légende', description: 'une URL', placeholder: 'https://' }} valueChanged={valueChangedAction} />
)
export const WithValue: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input4" legend={{ main: 'Légende' }} initialValue="valeur initiale" valueChanged={valueChangedAction} />
export const Disabled: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input5" disabled legend={{ main: 'Légende' }} initialValue="valeur initiale" valueChanged={valueChangedAction} />
export const Required: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input6" required legend={{ main: 'Légende' }} initialValue="valeur initiale" valueChanged={valueChangedAction} />
export const WithValue: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input4" legend={{ main: 'Légende' }} initialValue={'valeur initiale'} valueChanged={valueChangedAction} />
export const Disabled: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input5" disabled={true} legend={{ main: 'Légende' }} initialValue={'valeur initiale'} valueChanged={valueChangedAction} />
export const Required: StoryFn = () => <DsfrInput type={{ type: 'text' }} id="input6" required={true} legend={{ main: 'Légende' }} initialValue={'valeur initiale'} valueChanged={valueChangedAction} />
export const Number: StoryFn = () => <DsfrInput id="input1" type={{ type: 'number', min: 1, max: 10 }} legend={{ main: 'Légende' }} valueChanged={valueChangedAction} />
export const Date: StoryFn = () => (
<DsfrInput id="input1" type={{ type: 'date' }} legend={{ main: 'Légende' }} valueChanged={valueChangedAction} initialValue={caminoDateValidator.parse('2023-02-26')} />
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/_ui/dsfr-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const DsfrInput = defineComponent<Props>(props => {
{(props.legend.visible ?? true) ? (
<label class="fr-label" for={id}>
{props.legend.main} {isNotNullNorUndefined(props.required) && props.required ? ' *' : null}
{isNotNullNorUndefined(props.legend.description) ? <span class="fr-hint-text" v-html={props.legend.description} /> : null}
{isNotNullNorUndefined(props.legend.description) ? <span class="fr-hint-text" v-html={props.legend.description}></span> : null}
</label>
) : null}
<input
Expand Down
10 changes: 5 additions & 5 deletions packages/ui/src/components/_ui/dsfr-select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ export const Default: StoryFn = () => <DsfrSelect id="select" legend={{ main: 'l
export const WithDescriptionAndPlaceholder: StoryFn = () => (
<DsfrSelect id="select" legend={{ main: 'label de cadix', description: 'Description', placeholder: 'Placeholder custom' }} items={items} initialValue={null} valueChanged={onvalueChangedAction} />
)
export const AlreadySelectedItem: StoryFn = () => <DsfrSelect id="select" legend={{ main: 'label de cadix' }} items={items} initialValue="id1" valueChanged={onvalueChangedAction} />
export const AlreadySelectedItem: StoryFn = () => <DsfrSelect id="select" legend={{ main: 'label de cadix' }} items={items} initialValue={'id1'} valueChanged={onvalueChangedAction} />

export const Disabled: StoryFn = () => <DsfrSelect id="select" disabled legend={{ main: 'label de cadix' }} items={items} initialValue="id1" valueChanged={onvalueChangedAction} />
export const Required: StoryFn = () => <DsfrSelect id="select" required legend={{ main: 'label de cadix' }} items={items} initialValue="id1" valueChanged={onvalueChangedAction} />
export const Disabled: StoryFn = () => <DsfrSelect id="select" disabled={true} legend={{ main: 'label de cadix' }} items={items} initialValue={'id1'} valueChanged={onvalueChangedAction} />
export const Required: StoryFn = () => <DsfrSelect id="select" required={true} legend={{ main: 'label de cadix' }} items={items} initialValue={'id1'} valueChanged={onvalueChangedAction} />

export const ElementDisabled: StoryFn = () => (
<DsfrSelect
id="select"
required
required={true}
legend={{ main: 'label de cadix' }}
items={[
{ id: 'id1', label: 'premier label' },
{ id: 'id2', label: 'second label' },
{ id: 'id3', label: 'troisième label désactivé', disabled: true },
]}
initialValue="id1"
initialValue={'id1'}
valueChanged={onvalueChangedAction}
/>
)
2 changes: 1 addition & 1 deletion packages/ui/src/components/_ui/dsfr-separator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ type Props = {
size?: 'sm' | 'md'
}
export const DsfrSeparator: FunctionalComponent<Props> = props => (
<div class={[props.size === 'sm' ? 'fr-mb-1w fr-mt-1w' : 'fr-mb-3w fr-mt-3w']} style={{ height: '1px', width: '100%', backgroundColor: 'var(--grey-900-175)' }} />
<div class={[props.size === 'sm' ? 'fr-mb-1w fr-mt-1w' : 'fr-mb-3w fr-mt-3w']} style={{ height: '1px', width: '100%', backgroundColor: 'var(--grey-900-175)' }}></div>
)
Loading

0 comments on commit 7deb13c

Please sign in to comment.