Skip to content

Commit

Permalink
Merge pull request #2467 from betagouv/feat/plugin-strapi-betagouv
Browse files Browse the repository at this point in the history
Feat/plugin strapi betagouv
  • Loading branch information
Datayama38 authored Apr 18, 2024
2 parents 9290262 + 1e54062 commit 383bdaf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
6 changes: 6 additions & 0 deletions cms/src/admin/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
config: {
locales: ["fr", "en"],
},
bootstrap() {},
};
5 changes: 2 additions & 3 deletions cms/src/plugins/betagouv/admin/src/components/FlowCard.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -11,8 +10,8 @@ const FlowCard = (props: {id: string}) => {

return (
<Box padding={4} hasRadius background="neutral0" shadow="tableShadow">
<Typography>{formatMessage({ id: getTrad(`flow-${props.id}`)})}</Typography>
<Button onClick={run} disabled={isLoading}>{formatMessage({ id: getTrad('action')})}</Button>
<Typography>{formatMessage({ id: getTrad(`flow-${props.id}`)})}</Typography>
<Button onClick={run} disabled={isLoading}>{formatMessage({ id: getTrad('action')})}</Button>
</Box>
);
};
Expand Down
1 change: 0 additions & 1 deletion cms/src/plugins/betagouv/admin/src/pages/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
*/

import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { AnErrorOccurred } from '@strapi/helper-plugin';

Expand Down
35 changes: 12 additions & 23 deletions cms/src/plugins/betagouv/admin/src/pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,27 +9,17 @@ const HomePage = () => {
const [flows, isLoading] = useFlowList();

return (
<Box
as="aside"
aria-labelledby="betagouv"
background="neutral0"
borderColor="neutral150"
hasRadius
paddingBottom={4}
paddingLeft={4}
paddingRight={4}
paddingTop={6}
shadow="tableShadow"
>
<Flex direction='column' wrap='nowrap'>
<Typography variant="sigma" textColor="neutral600" id="betagouv">
{formatMessage({ id: getTrad('name') })}
</Typography>
<GridLayout style={{width: '100%'}}>
{ !isLoading && flows.map(f => <FlowCard id={f} key={f}></FlowCard>)}
</GridLayout>
</Flex>
</Box>
<>
<Box background="neutral100">
<BaseHeaderLayout
title={formatMessage({ id: getTrad(`name`)})}
as="h2"
/>
</Box>
<GridLayout>
{ !isLoading && flows.map((f) => <FlowCard id={f} key={f} />)}
</GridLayout>
</>
);
};

Expand Down
2 changes: 1 addition & 1 deletion cms/src/plugins/betagouv/server/policies/has-permission.ts
Original file line number Diff line number Diff line change
@@ -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;
}

Expand Down

0 comments on commit 383bdaf

Please sign in to comment.