Skip to content

Commit

Permalink
remove room's name chars limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishawdeep-Singh committed Jan 6, 2025
1 parent dc53ca4 commit d51b48b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
30 changes: 6 additions & 24 deletions src/app/organisms/create-room/CreateRoom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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" />
Expand Down
13 changes: 1 addition & 12 deletions src/app/organisms/create-room/CreateRoom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

&__name-wrapper {
display: flex;
flex-direction: column;
align-items: flex-end;

& .input-container {
flex: 1;
Expand All @@ -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 {
Expand Down

0 comments on commit d51b48b

Please sign in to comment.