Add tags to room-settings

This commit is contained in:
MyNameIsBatman 2022-02-13 19:55:21 -03:00
parent a4c0492034
commit 740a517409
2 changed files with 34 additions and 3 deletions

View File

@ -143,7 +143,7 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
return <NitroCardTabsItemView key={ tab } isActive={ currentTab === tab } onClick={ event => setCurrentTab(tab) }>{ LocalizeText(tab) }</NitroCardTabsItemView>
}) }
</NitroCardTabsView>
<NitroCardContentView className="text-black px-4">
<NitroCardContentView className="text-black px-4 h-100">
{ currentTab === TABS[0] && <NavigatorRoomSettingsBasicTabView roomSettingsData={ roomSettingsData } setRoomSettingsData={ updateSettings } onSave={ save } /> }
{ currentTab === TABS[1] && <NavigatorRoomSettingsAccessTabView roomSettingsData={ roomSettingsData } setRoomSettingsData={ updateSettings } onSave={ save } /> }
{ currentTab === TABS[2] && <NavigatorRoomSettingsRightsTabView roomSettingsData= {roomSettingsData } setRoomSettingsData={ updateSettings } onSave={ save } friends={friends} /> }

View File

@ -36,6 +36,30 @@ export const NavigatorRoomSettingsBasicTabView: FC<NavigatorRoomSettingsTabViewP
case 'trade_state':
roomSettings.tradeState = Number(value);
break;
case 'tag_1':
if(roomSettings.tags.length === 0)
{
roomSettings.tags.push(String(value));
}
else
{
roomSettings.tags[0] = String(value);
}
break;
case 'tag_2':
if(roomSettings.tags.length === 0)
{
roomSettings.tags.push('', String(value));
}
else if(roomSettings.tags.length === 1)
{
roomSettings.tags.push(String(value));
}
else
{
roomSettings.tags[1] = String(value);
}
break;
case 'allow_walkthrough':
roomSettings.allowWalkthrough = Boolean(value);
break;
@ -82,11 +106,18 @@ export const NavigatorRoomSettingsBasicTabView: FC<NavigatorRoomSettingsTabViewP
<option value="2">{ LocalizeText('navigator.roomsettings.trade_allowed') }</option>
</select>
</div>
<div className="form-check">
<div className="form-group mb-2">
<label>{ LocalizeText('navigator.tags') }</label>
<div className="d-flex gap-2">
<input className="form-control form-control-sm" value={ roomSettingsData.tags.length > 0 ? roomSettingsData.tags[0] : '' } onChange={ event => handleChange('tag_1', event.target.value) } onBlur={ () => onSave(roomSettingsData) } />
<input className="form-control form-control-sm" value={ roomSettingsData.tags.length > 1 ? roomSettingsData.tags[1] : '' } onChange={ event => handleChange('tag_2', event.target.value) } onBlur={ () => onSave(roomSettingsData) } />
</div>
</div>
<div className="form-check mb-1">
<input className="form-check-input" type="checkbox" checked={ roomSettingsData.allowWalkthrough } onChange={ event => handleChange('allow_walkthrough', event.target.checked) } />
<label className="form-check-label">{ LocalizeText('navigator.roomsettings.allow_walk_through') }</label>
</div>
<div className="form-group d-flex justify-content-center mt-1">
<div className="form-group d-flex justify-content-center">
<button type="button" className="btn btn-link btn-sm text-danger fw-bold">
<i className="fas fa-times me-1" />
{ LocalizeText('navigator.roomsettings.delete') }</button>