Skip to content

Commit

Permalink
refactor(console,phrases): move permissions and roles to step 2 in or…
Browse files Browse the repository at this point in the history
…g guide (#4858)
  • Loading branch information
charIeszhao authored Nov 13, 2023
1 parent 73f348a commit a8b164c
Show file tree
Hide file tree
Showing 26 changed files with 455 additions and 472 deletions.
2 changes: 1 addition & 1 deletion packages/console/src/pages/OrganizationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import TabNav, { TabNavItem } from '@/ds-components/TabNav';
import useApi, { type RequestError } from '@/hooks/use-api';
import useTenantPathname from '@/hooks/use-tenant-pathname';

import IntroductionAndPermissions from '../Organizations/Guide/IntroductionAndPermissions';
import IntroductionAndPermissions from '../Organizations/Guide/Introduction';

import Members from './Members';
import Settings from './Settings';
Expand Down
165 changes: 0 additions & 165 deletions packages/console/src/pages/Organizations/Guide/CreateRoles/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import * as styles from './index.module.scss';

function Diagram() {
return (
<svg
width="100%"
height="auto"
viewBox="0 0 762 630"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<svg width="100%" viewBox="0 0 762 630" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="762" height="629.523" fill="none" />
<path d="M93.234 89.1221L279.704 89.589" stroke="#8E9192" strokeWidth="0.71719" />
<path d="M283.131 89.561L278.11 93.0809L278.11 86.041L283.131 89.561Z" fill="#8E9192" />
Expand Down
130 changes: 130 additions & 0 deletions packages/console/src/pages/Organizations/Guide/Introduction/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import { Theme } from '@logto/schemas';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';

import OrganizationFeatureDark from '@/assets/icons/organization-feature-dark.svg';
import OrganizationFeature from '@/assets/icons/organization-feature.svg';
import ActionBar from '@/components/ActionBar';
import Button from '@/ds-components/Button';
import Card from '@/ds-components/Card';
import OverlayScrollbar from '@/ds-components/OverlayScrollbar';
import useTenantPathname from '@/hooks/use-tenant-pathname';
import useTheme from '@/hooks/use-theme';

import { steps } from '../const';
import * as parentStyles from '../index.module.scss';

import Diagram from './Diagram';
import * as styles from './index.module.scss';

const icons = {
[Theme.Light]: { OrganizationIcon: OrganizationFeature },
[Theme.Dark]: { OrganizationIcon: OrganizationFeatureDark },
};

type Props = {
/* True if the guide is in the "Check guide" drawer of organization details page */
isReadonly?: boolean;
};

function Introduction({ isReadonly }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.organizations.guide' });
const { navigate } = useTenantPathname();
const theme = useTheme();
const { OrganizationIcon } = icons[theme];

return (
<>
<OverlayScrollbar className={parentStyles.stepContainer}>
<div className={classNames(parentStyles.content)}>
<Card className={parentStyles.card}>
<OrganizationIcon className={parentStyles.icon} />
<div className={styles.container}>
<div className={styles.section}>
<div className={styles.title}>{t('introduction.section_1.title')}</div>
<div className={styles.description}>{t('introduction.section_1.description')}</div>
</div>
<div className={styles.title}>{t('introduction.section_2.title')}</div>
<div className={styles.section}>
<div className={styles.subtitle}>{t('organization_permissions')}</div>
<div className={styles.description}>
{t('introduction.section_2.organization_permission_description')}
</div>
<div className={styles.panel}>
<div className={styles.header}>{t('organization_permissions')}</div>
<div className={styles.body}>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('read_resource')}</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('edit_resource')}</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('delete_resource')}</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('ellipsis')}</div>
</div>
</div>
</div>
</div>
<div className={styles.section}>
<div className={styles.subtitle}>{t('organization_roles')}</div>
<div className={styles.description}>
{t('introduction.section_2.organization_role_description')}
</div>
<div className={styles.panel}>
<div className={styles.header}>{t('organization_roles')}</div>
<div className={styles.body}>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('admin')}</div>
<div className={styles.items}>
<div>{t('read_resource')}</div>
<div>{t('edit_resource')}</div>
<div>{t('delete_resource')}</div>
</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('member')}</div>
<div className={styles.items}>
<div>{t('read_resource')}</div>
<div>{t('edit_resource')}</div>
</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('guest')}</div>
<div className={styles.items}>
<div>{t('read_resource')}</div>
</div>
</div>
<div className={styles.cell}>
<div className={styles.cellTitle}>{t('ellipsis')}</div>
</div>
</div>
</div>
</div>
<div className={styles.section}>
<div className={styles.title}>{t('introduction.section_3.title')}</div>
<div className={styles.description}>{t('introduction.section_3.description')}</div>
<Diagram />
</div>
</div>
</Card>
</div>
</OverlayScrollbar>
{!isReadonly && (
<ActionBar step={1} totalSteps={3}>
<Button
title="general.next"
type="primary"
onClick={() => {
navigate(`../${steps.permissionsAndRoles}`);
}}
/>
</ActionBar>
)}
</>
);
}

export default Introduction;
Loading

0 comments on commit a8b164c

Please sign in to comment.