Skip to content

Commit

Permalink
🎨 ne plus utiliser de type anonyme dans l'app next
Browse files Browse the repository at this point in the history
  • Loading branch information
HubM committed Jan 12, 2024
1 parent 6c76b27 commit ecab03a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
6 changes: 5 additions & 1 deletion packages/applications/ssr/src/app/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { SessionProvider } from 'next-auth/react';
import { DsfrProvider } from '@codegouvfr/react-dsfr/next-appdir/DsfrProvider';
import { createMuiDsfrThemeProvider } from '@codegouvfr/react-dsfr/mui';

const Providers = ({ children }: { children: React.ReactNode }) => {
type ProvidersProps = {
children: React.ReactNode;
};

const Providers = ({ children }: ProvidersProps) => {
const { MuiDsfrThemeProvider } = createMuiDsfrThemeProvider({});
return (
<DsfrProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { mediator } from 'mediateur';
import { ConsulterDocumentProjetQuery } from '@potentiel-domain/document';

export const GET = async (
request: Request,
{ params: { documentKey } }: { params: { documentKey: string } },
) => {
type DocumentKeyParameter = {
params: {
documentKey: string;
};
};

export const GET = async (request: Request, { params: { documentKey } }: DocumentKeyParameter) => {
const result = await mediator.send<ConsulterDocumentProjetQuery>({
type: 'CONSULTER_DOCUMENT_PROJET',
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ export default async function Page({ params: { identifiant } }: PageProps) {

// TODO: this should be a query with the identifiantUtilisateur and identifiantProjet
type AvailableActions = DetailAbandonPageProps['actions'];

type MapToActionsProps = {
utilisateur: Utilisateur.ValueType;
recandidature: boolean;
statut: Abandon.StatutAbandon.ValueType;
};

const mapToActions = ({
utilisateur,
recandidature,
statut,
}: {
utilisateur: Utilisateur.ValueType;
recandidature: boolean;
statut: Abandon.StatutAbandon.ValueType;
}): AvailableActions => {
}: MapToActionsProps): AvailableActions => {
const actions: AvailableActions = [];
const demandeConfirmationPossible = statut.estDemandé() && !recandidature;

Expand Down
6 changes: 5 additions & 1 deletion packages/applications/ssr/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export const metadata: Metadata = {

export const dynamic = 'force-dynamic';

export default function RootLayout({ children }: { children: JSX.Element }) {
type RootLayoutProps = {
children: JSX.Element;
};

export default function RootLayout({ children }: RootLayoutProps) {
//NOTE: The lang parameter is optional and defaults to "fr"
return (
<html {...getHtmlAttributes({ defaultColorScheme })} lang="fr">
Expand Down
10 changes: 6 additions & 4 deletions packages/applications/ssr/src/components/organisms/Tile.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { FC } from 'react';

export const Tile: FC<{ className?: string; children: React.ReactNode }> = ({
children,
className = '',
}) => (
type TileProps = {
className?: string;
children: React.ReactNode;
};

export const Tile: FC<TileProps> = ({ children, className = '' }) => (
<div
className={`p-5 border border-solid border-grey-925-base border-b-[3px] border-b-blue-france-sun-base ${className}`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ export const DetailAbandonPage: FC<DetailAbandonPageProps> = ({
);
};

const mapToActionComponents = ({
actions,
identifiantProjet,
}: {
type MapToActionsComponentsProps = {
actions: AvailableActions;
identifiantProjet: string;
}) => {
};

const mapToActionComponents = ({ actions, identifiantProjet }: MapToActionsComponentsProps) => {
return actions.length ? (
<>
{actions.includes('demander-confirmation') && (
Expand Down

0 comments on commit ecab03a

Please sign in to comment.