From efafd89c82cf4db27e5828580aa1efbd87b8ca89 Mon Sep 17 00:00:00 2001 From: Ludovic Delhomme Date: Wed, 10 Apr 2024 19:28:46 +0200 Subject: [PATCH 1/3] wip plugin admin --- .../admin/src/components/FlowCard.tsx | 1 - .../admin/src/pages/HomePage/index.tsx | 37 +++++++------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx b/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx index 9c1a00556b..1edbbacfd6 100644 --- a/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx +++ b/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Box, Typography, Button } from '@strapi/design-system'; import getTrad from '../utils/getTrad'; import { useIntl } from "react-intl" diff --git a/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx b/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx index 404dfba736..d4400077f6 100644 --- a/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx +++ b/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx @@ -1,5 +1,4 @@ -import React from 'react'; -import { Box, Flex, GridLayout, Typography, Button } from '@strapi/design-system'; +import { Box, BaseHeaderLayout, GridLayout, Typography, Button } from '@strapi/design-system'; import getTrad from '../../utils/getTrad'; import { useIntl } from "react-intl" import { useFlowList } from '../../hooks/useFlowList'; @@ -10,27 +9,19 @@ const HomePage = () => { const [flows, isLoading] = useFlowList(); return ( - - - - {formatMessage({ id: getTrad('name') })} - - - { !isLoading && flows.map(f => )} - - - + <> + + + + + + + { !isLoading && flows.map((f,i) => )} + + ); }; From 34fb9d98e35dd6652a621a5c3959c015acded3d0 Mon Sep 17 00:00:00 2001 From: Ludovic Delhomme Date: Fri, 12 Apr 2024 10:46:49 +0200 Subject: [PATCH 2/3] fix policy has-permission.ts --- cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx | 4 ++-- cms/src/plugins/betagouv/admin/src/pages/App/index.tsx | 1 - cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx | 4 +--- cms/src/plugins/betagouv/server/policies/has-permission.ts | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx b/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx index 1edbbacfd6..675b41193e 100644 --- a/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx +++ b/cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx @@ -10,8 +10,8 @@ const FlowCard = (props: {id: string}) => { return ( - {formatMessage({ id: getTrad(`flow-${props.id}`)})} - + {formatMessage({ id: getTrad(`flow-${props.id}`)})} + ); }; diff --git a/cms/src/plugins/betagouv/admin/src/pages/App/index.tsx b/cms/src/plugins/betagouv/admin/src/pages/App/index.tsx index 862493fe02..1380b49eb3 100644 --- a/cms/src/plugins/betagouv/admin/src/pages/App/index.tsx +++ b/cms/src/plugins/betagouv/admin/src/pages/App/index.tsx @@ -5,7 +5,6 @@ * */ -import React from 'react'; import { Switch, Route } from 'react-router-dom'; import { AnErrorOccurred } from '@strapi/helper-plugin'; diff --git a/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx b/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx index d4400077f6..d71bc3d9cf 100644 --- a/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx +++ b/cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx @@ -17,9 +17,7 @@ const HomePage = () => { /> - - - { !isLoading && flows.map((f,i) => )} + { !isLoading && flows.map((f) => )} ); diff --git a/cms/src/plugins/betagouv/server/policies/has-permission.ts b/cms/src/plugins/betagouv/server/policies/has-permission.ts index d9a759481c..906ec0c15a 100644 --- a/cms/src/plugins/betagouv/server/policies/has-permission.ts +++ b/cms/src/plugins/betagouv/server/policies/has-permission.ts @@ -1,5 +1,5 @@ export default (policyContext, config, { strapi }) => { - if (policyContext.state.user && policyContext.state.user.roles.includes('Authenticated')) { + if (policyContext.state.user && policyContext.state.user.isActive) { return true; } From 1e540622bba695c60dfc1e9c84dca863a419d7f7 Mon Sep 17 00:00:00 2001 From: Ludovic Delhomme Date: Fri, 12 Apr 2024 11:03:03 +0200 Subject: [PATCH 3/3] =?UTF-8?q?ajouter=20le=20fran=C3=A7ais=20comme=20loca?= =?UTF-8?q?le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/src/admin/app.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cms/src/admin/app.ts diff --git a/cms/src/admin/app.ts b/cms/src/admin/app.ts new file mode 100644 index 0000000000..79bc835597 --- /dev/null +++ b/cms/src/admin/app.ts @@ -0,0 +1,6 @@ +export default { + config: { + locales: ["fr", "en"], + }, + bootstrap() {}, +}; \ No newline at end of file