Skip to content

Commit

Permalink
feat: 🔥 finished rules select section
Browse files Browse the repository at this point in the history
finished rules select section
  • Loading branch information
amir-ben-shimol committed Jun 8, 2022
1 parent 0503127 commit 39687a8
Show file tree
Hide file tree
Showing 91 changed files with 3,824 additions and 380 deletions.
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"react": "18.1.0",
"react-dom": "18.1.0",
"react-i18next": "11.16.9",
"react-lineto": "3.3.0",
"react-redux": "8.0.2",
"react-router-dom": "5",
"react-scripts": "5.0.1",
Expand Down
115 changes: 94 additions & 21 deletions apps/frontend/src/assets/icons.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.groupCenterContainer {
display: flex;
height: 100%;
overflow: hidden;

// overflow: hidden;

.innerGroupDetalis {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const GroupCenter: React.FC<IProps> = () => {

const [policyLabelInputState, setPolicyLabelInputState] = useState<string | null>(null);

const [groupsList, setGroupsList] = useState<IGroup[]>([]);

const onPolicyLabelInputChanged = (input: string) => setPolicyLabelInputState(() => input);

const onSelectedLibrary = (library: ILibrary) => {
Expand All @@ -28,15 +30,21 @@ const GroupCenter: React.FC<IProps> = () => {
setSelectLibraryState(() => null);
};

const onCreateNewGroup = () => {
setGroupsList([...groupsList, { title: 'Group Label', id: Math.random(), policies: [1, 2, 3, 4] }]);
};

return (
<GroupCenterView
selectedGroup={selectedGroupState}
selectedLibrary={selectedLibraryState}
policyLabelInput={policyLabelInputState}
groupsList={groupsList}
onPolicyLabelInputChanged={onPolicyLabelInputChanged}
onSelectedLibrary={onSelectedLibrary}
onCancelSelectedLibrary={onCancelSelectedLibrary}
onSelectedGroup={onSelectedGroup}
onCreateNewGroup={onCreateNewGroup}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ interface IProps {
readonly selectedGroup: IGroup | null;
readonly selectedLibrary: ILibrary | null;
readonly policyLabelInput: string | null;
readonly groupsList: IGroup[] | [];
readonly onPolicyLabelInputChanged: (input: string) => void;
readonly onSelectedLibrary: (library: ILibrary) => void;
readonly onCancelSelectedLibrary: () => void;
readonly onSelectedGroup: (group: IGroup) => void;
readonly onCreateNewGroup: () => void;
}

const GroupCenterView: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => {
Expand All @@ -29,14 +31,21 @@ const GroupCenterView: React.FC<IProps> = (props: React.PropsWithChildren<IProps

if (route.pathname.includes('/Policy')) {
currentPage = 'configurations';
} else if (route.pathname.includes('/manuel')) {
currentPage = 'manual';
}

return (
<section className={classes['groupCenterContainer']}>
<section
className={classes['groupCenterContainer']}
style={{ overflow: currentPage !== 'manual' ? 'auto' : 'hidden' }}
>
{currentPage !== 'configurations' && (
<div className={classes['innerGroupDetalis']}>
<GroupsSidebar
selectedGroup={props.selectedGroup}
groupsList={props.groupsList}
onCreateNewGroup={props.onCreateNewGroup}
onSelectedGroup={props.onSelectedGroup}
/>
<GroupDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Route } from 'react-router-dom';

import { IGroup } from '@/interfaces/group';
import { ILibrary } from '@/interfaces/library';
// import { Trans, useTranslation } from 'react-i18next';

import GroupInfo from './GroupInfo';

Expand All @@ -19,8 +18,6 @@ interface IProps {
}

const GroupDetailsView: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => {
// const { t } = useTranslation();

return (
<section className={classes['groupDetails']}>
<Route path="/groupCenter/group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ interface IProps {

const LibrariesListView: React.FC<IProps> = (props: React.PropsWithChildren<IProps>) => {
// const { t } = useTranslation();
const libraries = Object.keys(librariesList) as (keyof typeof librariesList)[];

return (
<div className={classes['librariesList']}>
{librariesList.map((library, index) => (
{libraries.map((library, index) => (
<Library
key={index}
logo={library.logo}
title={library.title}
madeBy={library.madeBy}
description={library.description}
type={library.type}
category={library.category}
logo={librariesList[library].logo}
title={librariesList[library].title}
madeBy={librariesList[library].madeBy}
description={librariesList[library].description}
type={librariesList[library].type}
category={librariesList[library].category}
index={index}
selectedLibrary={props.selectedLibrary}
onSelectedLibrary={props.onSelectedLibrary}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const NewPolicyView: React.FC<IProps> = (props: React.PropsWithChildren<IProps>)
</div>
<div className={classes['sortByContainer']}>
<SelectFromOptions
componentWidth="150px"
componentWidth="200px"
defaultValue="Sort by"
border="2px solid #E7E7E7"
selectedOptionIndex={props.selectedSortByOptionIndex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const NewPolicyConfigurationView: React.FC<IProps> = (props: React.PropsWithChil

return (
<section className={classes['newPolicyConfiguration']}>
<NavigateBackButton />
<NavigateBackButton position={{ bottom: '50px', right: ' 100px' }} />

<div className={classes['innerNewPolicyConfiguration']}>
<div className={classes['headerContainer']}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.policyConfiguration {
display: flex;
width: 100%;
height: 100%;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Route, useLocation } from 'react-router-dom';
import React, { Suspense } from 'react';
import { Redirect, Route, Switch, useLocation } from 'react-router-dom';
import { ILibrary } from '@/interfaces/library';

import PolicySidebar from './PolicySidebar';
Expand All @@ -18,26 +18,33 @@ const PolicyConfiguration: React.FC<IProps> = (props: React.PropsWithChildren<IP

let currentPage;

if (route.pathname.includes('/Configurations')) {
currentPage = 'configurations';
} else if (route.pathname.includes('/ruleOnboarding')) {
currentPage = 'ruleCreation';
if (route.pathname.includes('/manual')) {
currentPage = 'manual';
}

return (
<section className={classes['policyConfiguration']}>
<section
className={classes['policyConfiguration']}
style={{ height: currentPage !== 'manual' ? '100%' : 'fit-content' }}
>
<PolicySidebar
selectedLibrary={props.selectedLibrary}
policyLabelInput={props.policyLabelInput}
/>
<Route path="/groupCenter/group/Policy/Configurations-Onboarding">
{currentPage === 'configurations' && (
<NewPolicyConfiguration policyLabelInput={props.policyLabelInput} />
)}
</Route>
<Route path="/groupCenter/group/Policy/ruleOnboarding">
{currentPage === 'ruleCreation' && <RuleCreation policyLabelInput={props.policyLabelInput} />}
</Route>
<Suspense fallback={null}>
<Switch>
<Route path="/groupCenter/group/Policy/Configurations-Onboarding">
<NewPolicyConfiguration policyLabelInput={props.policyLabelInput} />
</Route>
<Route path="/groupCenter/group/Policy/ruleOnboarding">
<RuleCreation
policyLabelInput={props.policyLabelInput}
selectedLibrary={props.selectedLibrary}
/>
</Route>
<Redirect path="*" to="/groupCenter/group/Policy/ruleOnboarding" />
</Switch>
</Suspense>
</section>
);
};
Expand Down
Loading

0 comments on commit 39687a8

Please sign in to comment.