diff --git a/src/components/dashboard/users/AccessContainer.tsx b/src/components/dashboard/users/AccessContainer.tsx new file mode 100644 index 0000000000..5c0d6341b7 --- /dev/null +++ b/src/components/dashboard/users/AccessContainer.tsx @@ -0,0 +1,41 @@ +import React, { FunctionComponent } from 'react'; +import globalize from '../../../scripts/globalize'; +import CheckBoxElement from './CheckBoxElement'; + +type IProps = { + containerClassName?: string; + headerTitle?: string; + checkBoxClassName?: string; + checkBoxTitle?: string; + listContainerClassName?: string; + accessClassName?: string; + listTitle?: string; + description?: string; + children?: React.ReactNode +} + +const AccessContainer: FunctionComponent = ({containerClassName, headerTitle, checkBoxClassName, checkBoxTitle, listContainerClassName, accessClassName, listTitle, description, children }: IProps) => { + return ( +
+

{globalize.translate(headerTitle)}

+ +
+
+

+ {globalize.translate(listTitle)} +

+
+ {children} +
+
+
+ {globalize.translate(description)} +
+
+
+ ); +}; + +export default AccessContainer; diff --git a/src/components/dashboard/users/SectionTitleContainer.tsx b/src/components/dashboard/users/SectionTitleContainer.tsx new file mode 100644 index 0000000000..e5e4b8952a --- /dev/null +++ b/src/components/dashboard/users/SectionTitleContainer.tsx @@ -0,0 +1,35 @@ +import React, { FunctionComponent } from 'react'; +import SectionTitleButtonElement from './SectionTitleButtonElement'; +import SectionTitleLinkElement from './SectionTitleLinkElement'; + +type IProps = { + title: string; + isBtnVisible?: boolean; + titleLink?: string; +} + +const SectionTitleContainer: FunctionComponent = ({title, isBtnVisible = false, titleLink}: IProps) => { + return ( +
+
+

+ {title} +

+ + {isBtnVisible && } + + +
+
+ ); +}; + +export default SectionTitleContainer; diff --git a/src/components/pages/NewUserPage.tsx b/src/components/pages/NewUserPage.tsx index 9c8110310c..3f94055dae 100644 --- a/src/components/pages/NewUserPage.tsx +++ b/src/components/pages/NewUserPage.tsx @@ -4,12 +4,11 @@ import Dashboard from '../../utils/dashboard'; import globalize from '../../scripts/globalize'; import loading from '../loading/loading'; import toast from '../toast/toast'; - -import SectionTitleLinkElement from '../dashboard/users/SectionTitleLinkElement'; +import SectionTitleContainer from '../dashboard/users/SectionTitleContainer'; import InputElement from '../dashboard/users/InputElement'; -import CheckBoxElement from '../dashboard/users/CheckBoxElement'; import CheckBoxListItem from '../dashboard/users/CheckBoxListItem'; import ButtonElement from '../dashboard/users/ButtonElement'; +import AccessContainer from '../dashboard/users/AccessContainer'; type userInput = { Name?: string; @@ -178,18 +177,10 @@ const NewUserPage: FunctionComponent = () => { return (
-
-
-

- {globalize.translate('ButtonAddUser')} -

- -
-
+
{ label='LabelPassword' />
+ + {mediaFoldersItems.map(Item => ( + + ))} + -
-

{globalize.translate('HeaderLibraryAccess')}

- -
-
-

- {globalize.translate('HeaderLibraries')} -

-
- {mediaFoldersItems.map(Item => ( - - ))} -
-
-
- {globalize.translate('LibraryAccessHelp')} -
-
-
-
-

{globalize.translate('HeaderChannelAccess')}

- -
-
-

- {globalize.translate('Channels')} -

-
- {channelsItems.map(Item => ( - - ))} -
-
-
- {globalize.translate('ChannelAccessHelp')} -
-
-
+ + {channelsItems.map(Item => ( + + ))} +
{ return (
-
-
-

- {userName} -

- -
-
+
{ itemsArr.push({ Id: device.Id, Name: device.Name, - AppName : device.AppName, + AppName: device.AppName, checkedAttribute: checkedAttribute }); } @@ -228,115 +228,75 @@ const UserLibraryAccessPage: FunctionComponent = () => { return (
-
-
-

- {userName} -

- -
-
+ -
-

{globalize.translate('HeaderLibraryAccess')}

- -
-
-

- {globalize.translate('HeaderLibraries')} -

-
- {mediaFoldersItems.map(Item => { - return ( - - ); - })} -
-
-
- {globalize.translate('LibraryAccessHelp')} -
-
-
-
-

{globalize.translate('HeaderChannelAccess')}

- -
-
-

- {globalize.translate('Channels')} -

-
- {channelsItems.map(Item => ( - - ))} -
-
-
- {globalize.translate('ChannelAccessHelp')} -
-
-
-
-
-

{globalize.translate('HeaderDeviceAccess')}

- -
-
-

- {globalize.translate('HeaderDevices')} -

-
- {devicesItems.map(Item => ( - - ))} -
-
-
- {globalize.translate('DeviceAccessHelp')} -
-
-
-
+ + {mediaFoldersItems.map(Item => ( + + ))} + + + + {channelsItems.map(Item => ( + + ))} + + + + {devicesItems.map(Item => ( + + ))} +
{ return (
-
-
-

- {userName} -

- -
-
+
diff --git a/src/components/pages/UserPasswordPage.tsx b/src/components/pages/UserPasswordPage.tsx index 2eba530ae2..305e8a4422 100644 --- a/src/components/pages/UserPasswordPage.tsx +++ b/src/components/pages/UserPasswordPage.tsx @@ -1,8 +1,8 @@ import React, { FunctionComponent, useCallback, useEffect, useState } from 'react'; -import SectionTitleLinkElement from '../dashboard/users/SectionTitleLinkElement'; import SectionTabs from '../dashboard/users/SectionTabs'; import UserPasswordForm from '../dashboard/users/UserPasswordForm'; import { getParameterByName } from '../../utils/url'; +import SectionTitleContainer from '../dashboard/users/SectionTitleContainer'; const UserPasswordPage: FunctionComponent = () => { const userId = getParameterByName('userId'); @@ -23,18 +23,10 @@ const UserPasswordPage: FunctionComponent = () => { return (
-
-
-

- {userName} -

- -
-
+
{ return (
-
-
-

- {globalize.translate('HeaderUsers')} -

- - -
-
- {users.map(user => { - return ; - })} -
+ + +
+ {users.map(user => { + return ; + })}