remove room's name chars limit

This commit is contained in:
Vishawdeep Singh 2025-01-06 11:40:17 +05:30
parent dc53ca4d83
commit d51b48be13
2 changed files with 7 additions and 36 deletions

View file

@ -43,7 +43,7 @@ function CreateRoomContent({ isSpace, parentId, onRequestClose }) {
const [isValidAddress, setIsValidAddress] = useState(null);
const [addressValue, setAddressValue] = useState(undefined);
const [roleIndex, setRoleIndex] = useState(0);
const [nameError, setNameError] = useState(null);
const addressRef = useRef(null);
const mx = useMatrixClient();
@ -121,15 +121,6 @@ function CreateRoomContent({ isSpace, parentId, onRequestClose }) {
}, 1000);
};
const validateRoomName =(value) =>{
if(value.length > 50){
setNameError('Room name should be less than 50 characters');
return false;
}
setNameError(null);
return true;
}
const joinRules = ['invite', 'restricted', 'public'];
const joinRuleShortText = ['Private', 'Restricted', 'Public'];
const joinRuleText = [
@ -228,26 +219,17 @@ function CreateRoomContent({ isSpace, parentId, onRequestClose }) {
}
/>
<Input name="topic" minHeight={174} resizable label="Topic (optional)" />
<div className='create-room__name-wrapper'>
<div className="create-room__name-error-wrapper">
<Input name="name" label={`${isSpace ? 'Space' : 'Room'} name`} required error={nameError} state={nameError !== null ? 'error' : 'normal'} onChange={(e) => validateRoomName(e.target.value)} maxLength={50} />
<Button
disabled={isValidAddress === false || isCreatingRoom || nameError!==null}
<div className="create-room__name-wrapper">
<Input name="name" label={`${isSpace ? 'Space' : 'Room'} name`} required />
<Button
disabled={isValidAddress === false || isCreatingRoom}
iconSrc={isSpace ? SpacePlusIC : HashPlusIC}
type="submit"
variant="primary"
>
Create
</Button>
</div>
{nameError !== null && (
<Text className="create-room__name-wrapper__tip" variant="b3">
<span
style={{ color: 'var(--bg-danger)' }}
>{nameError}</span>
</Text>
)}
</div>
</div>
{isCreatingRoom && (
<div className="create-room__loading">
<Spinner size="small" />

View file

@ -64,7 +64,7 @@
&__name-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;
& .input-container {
flex: 1;
@ -73,19 +73,8 @@
}
& .btn-primary {
padding-top: 11px;
align-self: last baseline;
padding-bottom: 11px;
}
&__tip {
margin-top: var(--sp-ultra-tight);
@include dir.side(margin, 26px, 0);
}
}
&__name-error-wrapper {
display: flex;
align-items: center;
width: 100%;
}
&__loading {