= ({Name, Id}: IProps)
);
};
-export default NewUserChannelAccessList;
+export default CheckBoxListItem;
diff --git a/src/components/dashboard/users/NewUserFolderAccessList.tsx b/src/components/dashboard/users/NewUserFolderAccessList.tsx
deleted file mode 100644
index 378475cb77..0000000000
--- a/src/components/dashboard/users/NewUserFolderAccessList.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import React, { FunctionComponent } from 'react';
-
-const createCheckBoxElement = ({Name, Id}) => ({
- __html: `
`
-});
-
-type IProps = {
- Name?: string;
- Id?: string;
-}
-
-const NewUserFolderAccessList: FunctionComponent
= ({Name, Id}: IProps) => {
- return (
-
- );
-};
-
-export default NewUserFolderAccessList;
-
diff --git a/src/components/pages/NewUserPage.tsx b/src/components/pages/NewUserPage.tsx
index aa56df0bda..fcd94e0b37 100644
--- a/src/components/pages/NewUserPage.tsx
+++ b/src/components/pages/NewUserPage.tsx
@@ -8,8 +8,7 @@ import toast from '../toast/toast';
import SectionTitleLinkElement from '../dashboard/users/SectionTitleLinkElement';
import InputElement from '../dashboard/users/InputElement';
import CheckBoxElement from '../dashboard/users/CheckBoxElement';
-import NewUserFolderAccessList from '../dashboard/users/NewUserFolderAccessList';
-import NewUserChannelAccessList from '../dashboard/users/NewUserChannelAccessList';
+import CheckBoxListItem from '../dashboard/users/CheckBoxListItem';
import ButtonElement from '../dashboard/users/ButtonElement';
type userInput = {
@@ -17,9 +16,14 @@ type userInput = {
Password?: string;
}
+type ItemsArr = {
+ Name?: string;
+ Id?: string;
+}
+
const NewUserPage: FunctionComponent = () => {
- const [ channelsResult, setChannelsResult ] = useState([]);
- const [ mediaFoldersResult, setMediaFoldersResult ] = useState([]);
+ const [ channelsItems, setChannelsItems ] = useState([]);
+ const [ mediaFoldersItems, setMediaFoldersItems ] = useState([]);
const element = useRef(null);
useEffect(() => {
@@ -42,7 +46,16 @@ const NewUserPage: FunctionComponent = () => {
loadUser();
const loadMediaFolders = (mediaFolders) => {
- setMediaFoldersResult(mediaFolders);
+ const itemsArr: ItemsArr[] = [];
+
+ for (const folder of mediaFolders) {
+ itemsArr.push({
+ Id: folder.Id,
+ Name: folder.Name
+ });
+ }
+
+ setMediaFoldersItems(itemsArr);
const folderAccess = element?.current?.querySelector('.folderAccess');
folderAccess.dispatchEvent(new CustomEvent('create'));
@@ -51,7 +64,16 @@ const NewUserPage: FunctionComponent = () => {
};
const loadChannels = (channels) => {
- setChannelsResult(channels);
+ const itemsArr: ItemsArr[] = [];
+
+ for (const folder of channels) {
+ itemsArr.push({
+ Id: folder.Id,
+ Name: folder.Name
+ });
+ }
+
+ setChannelsItems(itemsArr);
const channelAccess = element?.current?.querySelector('.channelAccess');
channelAccess.dispatchEvent(new CustomEvent('create'));
@@ -179,11 +201,12 @@ const NewUserPage: FunctionComponent = () => {
{globalize.translate('HeaderLibraries')}
- {mediaFoldersResult.map(folder => (
- (
+
))}
@@ -206,11 +229,12 @@ const NewUserPage: FunctionComponent = () => {
{globalize.translate('Channels')}
- {channelsResult.map(folder => (
- (
+
))}