Update navigator

This commit is contained in:
Bill 2021-04-22 02:45:33 -04:00
parent a39db6cf91
commit 3effb407ce
6 changed files with 37 additions and 27 deletions

View File

@ -140,7 +140,7 @@ export function NavigatorView(props: NavigatorViewProps): JSX.Element
</button>
</div>
<NavigatorTabsView topLevelContext={ topLevelContext } topLevelContexts={ topLevelContexts } setTopLevelContext={ setTopLevelContext } />
<TransitionAnimation className="d-flex px-3 pb-3" type={ TransitionAnimationTypes.FADE_IN } inProp={ (!isSearching && !!searchResults) } timeout={ 200 }>
<TransitionAnimation className="d-flex px-3 pb-3" type={ TransitionAnimationTypes.FADE_IN } inProp={ (!isSearching && !!searchResults) } timeout={ 150 }>
<NavigatorResultListsView resultLists={ searchResults } />
</TransitionAnimation>
</div>

View File

@ -7,9 +7,9 @@ export function NavigatorResultListsView(props: NavigatorResultListsViewProps):
return (
<div className="nitro-navigator-result-lists w-100">
{ resultLists && resultLists.length && resultLists.map((resultList, index) =>
{ resultLists && resultLists.length && resultLists.map((resultList, index) =>
{
return <NavigatorResultListView key={ index } resultList={ resultList } isLast={ index + 1 === resultLists.length } />
return <NavigatorResultListView key={ index } resultList={ resultList } />
})
}
</div>

View File

@ -6,7 +6,7 @@ import { NavigatorResultView } from './result/NavigatorResultView';
export function NavigatorResultListView(props: NavigatorResultListViewProps): JSX.Element
{
const { resultList = null, isLast = false } = props;
const { resultList = null } = props;
const [ isExtended, setIsExtended ] = useState(true);
const [ displayMode, setDisplayMode ] = useState<number>(0);
@ -55,12 +55,10 @@ export function NavigatorResultListView(props: NavigatorResultListViewProps): JS
<div className="align-self-center w-100 ml-2">{ LocalizeText(getListCode()) }</div>
<i className={ "fas " + classNames({ 'fa-bars': displayMode === NavigatorResultListViewDisplayMode.LIST, 'fa-th': displayMode >= NavigatorResultListViewDisplayMode.THUMBNAILS })} onClick={ toggleDisplayMode }></i>
</div>
<div className={ 'row row-grid row-cols-' + classNames({ '1': displayMode === NavigatorResultListViewDisplayMode.LIST, '2': displayMode >= NavigatorResultListViewDisplayMode.THUMBNAILS }) }>
<div className={ 'row mx-n2 row-cols-' + classNames({ '1': displayMode === NavigatorResultListViewDisplayMode.LIST, '2': displayMode >= NavigatorResultListViewDisplayMode.THUMBNAILS }) }>
{ isExtended && resultList && resultList.rooms.map((room, index) =>
{
return <div className="col">
<NavigatorResultView key={ index } result={ room } />
</div>
return <NavigatorResultView key={ index } result={ room } />
})
}
</div>

View File

@ -3,7 +3,6 @@ import { NavigatorSearchResultList } from 'nitro-renderer';
export interface NavigatorResultListViewProps
{
resultList: NavigatorSearchResultList;
isLast: boolean;
}
export class NavigatorResultListViewDisplayMode

View File

@ -6,21 +6,32 @@
}
.nitro-navigator-result-list {
.nitro-navigator-result {
border-radius: $border-radius;
background: $secondary;
}
.row {
&.row-cols-1 {
.col:nth-child(odd) {
.col:nth-child(even) {
.nitro-navigator-result {
border-radius: $border-radius;
background: $secondary !important;
background: $primary !important;
}
}
}
&.row-cols-2 {
.col {
.col:nth-child(4n+3),
.col:nth-child(4n+4) {
.nitro-navigator-result {
border-radius: $border-radius;
background: $secondary !important;
background: $primary !important;
}
}
}

View File

@ -39,23 +39,25 @@ export function NavigatorResultView(props: NavigatorResultViewProps): JSX.Elemen
}
return (
<div className="d-flex flex-column justify-content-center align-items-center nitro-navigator-result small" onClick={ () => navigatorContext.onTryVisitRoom(result) }>
<div className="d-flex justify-content-between w-100 px-2 py-1">
<div className="d-flex justify-content-center flex-grow-1 overflow-hidden">
<div className={ "d-flex justify-content-center align-items-center badge text-center " + getUserCounterColor() }>
<i className="fas fa-user mr-1"></i> { result.userCount }
<div className="col px-2">
<div className="d-flex flex-column justify-content-center align-items-center nitro-navigator-result small" onClick={ () => navigatorContext.onTryVisitRoom(result) }>
<div className="d-flex justify-content-between w-100 px-2 py-1">
<div className="d-flex justify-content-center flex-grow-1 overflow-hidden">
<div className={ "d-flex justify-content-center align-items-center badge text-center " + getUserCounterColor() }>
<i className="fas fa-user mr-1"></i> { result.userCount }
</div>
<div className="d-flex flex-column justify-content-center align-items-start flex-grow-1 px-2 overflow-hidden">
<span className="d-block text-truncate" style={ { maxWidth: '95%' } }>{ result.roomName }</span>
</div>
</div>
<div className="d-flex flex-column justify-content-center align-items-start flex-grow-1 px-2 overflow-hidden">
<span className="d-block text-truncate" style={ { maxWidth: '95%' } }>{ result.roomName }</span>
<div className="d-flex flex-row-reverse align-items-center">
<i className="fas fa-info-circle" onClick={ openInfo }></i>
{ result.habboGroupId > 0 && <i className="fas fa-users mr-2"></i> }
{ result.doorMode !== RoomDataParser.OPEN_STATE &&
<i className={ 'mr-2 fas ' + classNames( {'fa-lock': result.doorMode === RoomDataParser.DOORBELL_STATE, 'fa-key': result.doorMode === RoomDataParser.PASSWORD_STATE })}></i>
}
</div>
</div>
<div className="d-flex flex-row-reverse align-items-center">
<i className="fas fa-info-circle" onClick={ openInfo }></i>
{ result.habboGroupId > 0 && <i className="fas fa-users mr-2"></i> }
{ result.doorMode !== RoomDataParser.OPEN_STATE &&
<i className={ 'mr-2 fas ' + classNames( {'fa-lock': result.doorMode === RoomDataParser.DOORBELL_STATE, 'fa-key': result.doorMode === RoomDataParser.PASSWORD_STATE })}></i>
}
</div>
</div>
</div>
);