Fix layout

This commit is contained in:
Bill 2021-08-18 22:29:00 -04:00
parent f09a0d734c
commit 1bdcfd5cdf
4 changed files with 120 additions and 36 deletions

View File

@ -5,6 +5,16 @@
height: 350px; height: 350px;
} }
.user-rights-container {
.row {
.col:nth-child(even) {
//background: $light !important;
}
}
}
.list-container { .list-container {
max-height: 100px; max-height: 100px;
min-height: 100px; min-height: 100px;

View File

@ -2,6 +2,7 @@ import { RemoveAllRightsMessageComposer, RoomGiveRightsComposer, RoomTakeRightsC
import { FC, useCallback, useMemo } from 'react'; import { FC, useCallback, useMemo } from 'react';
import { LocalizeText } from '../../../../../../api'; import { LocalizeText } from '../../../../../../api';
import { SendMessageHook } from '../../../../../../hooks'; import { SendMessageHook } from '../../../../../../hooks';
import { UserProfileIconView } from '../../../../../shared/user-profile-icon/UserProfileIconView';
import { NavigatorRoomSettingsTabViewProps } from '../../NavigatorRoomSettingsView.types'; import { NavigatorRoomSettingsTabViewProps } from '../../NavigatorRoomSettingsView.types';
export const NavigatorRoomSettingsRightsTabView: FC<NavigatorRoomSettingsTabViewProps> = props => export const NavigatorRoomSettingsRightsTabView: FC<NavigatorRoomSettingsTabViewProps> = props =>
@ -52,48 +53,100 @@ export const NavigatorRoomSettingsRightsTabView: FC<NavigatorRoomSettingsTabView
}, [roomSettingsData]); }, [roomSettingsData]);
return ( return (
<> <div className="d-flex flex-column h-100 overflow-hidden user-rights">
<div className="row"> <div className="row">
<div className="col-6"> <div className="col">
<div className="fw-bold mb-2">{LocalizeText('navigator.flatctrls.userswithrights', ['displayed', 'total'], [roomSettingsData.usersWithRights.size.toString(), roomSettingsData.usersWithRights.size.toString()])}</div> filter
</div>
<div className="col-6">
<div className="fw-bold mb-2">{LocalizeText('navigator.flatctrls.friends', ['displayed', 'total'], [friendsWithoutRights.size.toString(), friendsWithoutRights.size.toString()])}</div>
</div> </div>
</div> </div>
<div className="row h-100"> <div className="row h-100">
<div className="col-6"> <div className="col-6 d-flex flex-column h-100">
<div className="list-container rights justify-content-center align-items-center"> <div className="fw-bold mb-1">{ LocalizeText('navigator.flatctrls.userswithrights', [ 'displayed', 'total' ], [ roomSettingsData.usersWithRights.size.toString(), roomSettingsData.usersWithRights.size.toString() ]) }</div>
{ <div className="d-flex flex-column justify-content-between rounded bg-white h-100 overflow-hidden px-2 py-1 user-rights-container">
Array.from(roomSettingsData.usersWithRights.entries()).map(([id, name], index) => <div className="row row-cols-1 overflow-auto">
{ { Array.from(roomSettingsData.usersWithRights.entries()).map(([id, name], index) =>
return <div key={index} className={'list-item flex-row'} > {
<span className="w-100" >{name}</span> return (
<button className="btn btn-danger btn-sm rights-button" onClick={ () => removeUserRights(id) }> <div key={index} className="d-flex align-items-center col w-100" onClick={ () => removeUserRights(id) }>
<i className="fas fa-times" /> <div className="d-flex align-items-center me-2">
</button> <UserProfileIconView userName={ name } />
</div> <span>{ name }</span>
}) </div>
} <i className="fas fa-caret-right fw-bold text-black me-2" />
</div>
);
})
}
</div>
<button className="btn btn-danger btn-sm w-100" disabled={ !roomSettingsData.usersWithRights.size } onClick={ removeAllRights } >{ LocalizeText('navigator.flatctrls.clear') }</button>
</div> </div>
<button className={'btn btn-danger btn-sm w-100' + ((roomSettingsData.usersWithRights.size < 1) ? ' disabled' : '')} onClick={ removeAllRights } >{ LocalizeText('navigator.flatctrls.clear') }</button>
</div> </div>
<div className="col-6"> <div className="col-6 d-flex flex-column h-100">
<div className="list-container h-100 friends-rights"> <div className="fw-bold mb-1">{ LocalizeText('navigator.flatctrls.friends', [ 'displayed', 'total' ], [ friendsWithoutRights.size.toString(), friendsWithoutRights.size.toString() ]) }</div>
{ <div className="d-flex flex-column rounded bg-white h-100 overflow-hidden px-2 py-1 user-rights-container">
Array.from(friendsWithoutRights.entries()).map(([id, name], index) => <div className="row row-cols-1 overflow-auto">
{ { Array.from(friendsWithoutRights.entries()).map(([id, name], index) =>
return <div key={index} className={'list-item flex-row'} > {
<span className="w-100">{name}</span> return (
<button className="btn btn-success btn-sm rights-button" onClick={ () => giveUserRights(id, name) }> <div key={index} className="d-flex align-items-center col w-100" onClick={ () => giveUserRights(id, name) }>
<i className="fas fa-chevron-left" /> <i className="fas fa-caret-left fw-bold text-black me-2" />
</button> <div className="d-flex align-items-center">
</div> <UserProfileIconView userName={ name } />
}) <span>{ name }</span>
} </div>
</div>
);
})
}
</div>
</div> </div>
</div > </div>
</div > </div>
</> </div>
// <div className="row h-100">
// <div className="col-6">
// <div className="fw-bold mb-2">{LocalizeText('navigator.flatctrls.userswithrights', ['displayed', 'total'], [roomSettingsData.usersWithRights.size.toString(), roomSettingsData.usersWithRights.size.toString()])}</div>
// </div>
// <div className="col-6">
// <div className="fw-bold mb-2">{LocalizeText('navigator.flatctrls.friends', ['displayed', 'total'], [friendsWithoutRights.size.toString(), friendsWithoutRights.size.toString()])}</div>
// </div>
// </div>
// <div className="row h-100">
// <div className="col-6 d-flex flex-column h-100">
// <div className="row row-cols-1 g-0 overflow-auto">
// {
// Array.from(roomSettingsData.usersWithRights.entries()).map(([id, name], index) =>
// {
// return (
// <div key={ index } className="col">
// <span className="w-100" >{name}</span>
// <button className="btn btn-danger btn-sm rights-button" onClick={ () => removeUserRights(id) }>
// <i className="fas fa-times" />
// </button>
// </div>
// );
// })
// }
// </div>
// <button className={'btn btn-danger btn-sm w-100' + ((roomSettingsData.usersWithRights.size < 1) ? ' disabled' : '')} onClick={ removeAllRights } >{ LocalizeText('navigator.flatctrls.clear') }</button>
// </div>
// <div className="col-6 d-flex flex-column h-100">
// <div className="row row-cols-1 g-0 overflow-auto bg-white h-100">
// {
// Array.from(friendsWithoutRights.entries()).map(([id, name], index) =>
// {
// return (
// <div key={index} className="col">
// <span className="w-100">{name}</span>
// <button className="btn btn-success btn-sm rights-button" onClick={ () => giveUserRights(id, name) }>
// <i className="fas fa-chevron-left" />
// </button>
// </div>
// );
// })
// }
// </div>
// </div >
// </div >
); );
} }

View File

@ -0,0 +1,16 @@
import { FC, useCallback } from 'react';
import { UserProfileIconViewProps } from './UserProfileIconView.types';
export const UserProfileIconView: FC<UserProfileIconViewProps> = props =>
{
const { userId = -1, userName = null } = props;
const visitProfile = useCallback(() =>
{
}, [ userId, userName ]);
return (
<i className="icon icon-user-profile me-1 cursor-pointer" onClick={ visitProfile } />
);
}

View File

@ -0,0 +1,5 @@
export interface UserProfileIconViewProps
{
userId?: number;
userName?: string;
}