Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 777ef24

Browse files
committed
Improves create room dialog
1 parent f3e9d8c commit 777ef24

3 files changed

Lines changed: 78 additions & 55 deletions

File tree

client/src/components/CreateChannel/index.css

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,24 @@
44
}
55

66
.create-dialog-description {
7+
margin-top: 0px;
78
color: #8e9299;
89
}
910

10-
.repository-autocomplete {
11-
width: 80%;
11+
.create-button {
12+
margin-bottom: 10px !important;
1213
}
1314

14-
.create-button {
15-
margin-bottom: 10px;
15+
.form-switch {
16+
display: flex;
17+
flex-direction: row;
18+
justify-content: space-between;
1619
}
20+
21+
.form-control-label {
22+
margin-right: 0px !important;
23+
}
24+
25+
.repository-select-label {
26+
margin-top: 0px;
27+
}

client/src/components/CreateChannel/index.js

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ export default class CreateChannel extends Component {
156156
});
157157
if (rcCreateChannelResponse.data.data.success) {
158158
let room = rcCreateChannelResponse.data.data.channel;
159-
//Add embeddable code for community to description
159+
//Add embeddable code for room to description
160160
description = description.concat(`
161161
162162
-----
163-
Embed this community
163+
Embed this room
164164
<pre><code>&lt;a&nbsp;href=&quot;${rc4gitDomain}/channel/${room.name}&quot;&gt;
165165
&lt;img&nbsp;src=&quot;${rcApiDomain}/images/join-chat.svg&quot;/&gt;
166166
&lt;/a&gt;</code></pre>
@@ -180,7 +180,7 @@ Embed this community
180180
});
181181

182182
addRoom(room);
183-
setSnackbar(true, "success", "Community created successfully!");
183+
setSnackbar(true, "success", "Room created successfully!");
184184
this.setState({
185185
loading: false,
186186
room: room,
@@ -189,12 +189,12 @@ Embed this community
189189
});
190190
} else {
191191
this.setState({ loading: false });
192-
setSnackbar(true, "error", "Error Creating Community!");
192+
setSnackbar(true, "error", "Error Creating Room!");
193193
}
194194
} catch (error) {
195195
console.log(error);
196196
this.setState({ loading: false });
197-
setSnackbar(true, "error", "Error Creating Community!");
197+
setSnackbar(true, "error", "Error Creating Room!");
198198
}
199199
};
200200

@@ -223,52 +223,20 @@ Embed this community
223223
maxWidth="sm"
224224
fullWidth={true}
225225
>
226-
<DialogTitle>Create a New Community</DialogTitle>
226+
<DialogTitle >Create Room</DialogTitle>
227227
<DialogContent>
228228
<p className="create-dialog-description">
229-
Communities are where your teams communicate.
229+
Rooms are where your teams communicate.
230230
</p>
231231
<div>
232232
<br />
233-
<FormControlLabel
234-
control={
235-
<RCSwitch
236-
checked={publicChannel}
237-
onChange={() =>
238-
this.setState({ publicChannel: !publicChannel })
239-
}
240-
name="publicChannel"
241-
/>
242-
}
243-
label="Public Community"
244-
/>
245-
<p className="create-dialog-description">
246-
{publicChannel
247-
? "Everyone can access this community."
248-
: "Just invited people can access this community."}
249-
</p>
250-
<br />
251-
<FormControlLabel
252-
control={
253-
<RCSwitch
254-
checked={this.state.includePrivateRepositories}
255-
onChange={this.handleAllRepositories}
256-
name="includePrivateRepositories"
257-
/>
258-
}
259-
label="Show All Repositories"
260-
/>
261-
<p className="create-dialog-description">
262-
Show public {includePrivateRepositories ? "and private " : ""}
263-
repositories.
264-
</p>
265-
<br />
266-
<p>Select a repository</p>
233+
<p className="repository-select-label">Select Repository</p>
267234
<Autocomplete
268235
id="combo-box-repo"
269-
className="repository-autocomplete"
236+
fullWidth
270237
options={repositories.sort()}
271-
getOptionLabel={(option) => option.split("/")[1]}
238+
renderOption={(option) => option.split("/")[1]}
239+
getOptionLabel={(option) => option}
272240
groupBy={(option) => option.split("/")[0]}
273241
onChange={(event, value) => {
274242
this.setState({ channel: value });
@@ -285,12 +253,56 @@ Embed this community
285253
{channel && (
286254
<>
287255
<p className="create-dialog-description">
288-
Your community would be created as{" "}
256+
Your room would be created as{" "}
289257
<strong>{channel.replace("/", "_")}</strong>
290258
</p>
291259
</>
292260
)}
293261
<br />
262+
<div className="form-switch">
263+
<p>Show All Repositories</p>
264+
<FormControlLabel
265+
className="form-control-label"
266+
control={
267+
<RCSwitch
268+
checked={this.state.includePrivateRepositories}
269+
onChange={this.handleAllRepositories}
270+
name="includePrivateRepositories"
271+
/>
272+
}
273+
/>
274+
</div>
275+
276+
<p className="create-dialog-description">
277+
{includePrivateRepositories ? "Both public and private " : "Only public "}
278+
repositories are visible.
279+
</p>
280+
<br />
281+
<div className="form-switch">
282+
283+
<p>
284+
Public Room
285+
</p>
286+
<FormControlLabel
287+
className="form-control-label"
288+
control={
289+
<RCSwitch
290+
checked={publicChannel}
291+
onChange={() =>
292+
this.setState({ publicChannel: !publicChannel })
293+
}
294+
name="publicChannel"
295+
296+
/>
297+
}
298+
/>
299+
</div>
300+
<p className="create-dialog-description">
301+
{publicChannel
302+
? "Everyone can access this room."
303+
: "Just invited people can access this room."}
304+
</p>
305+
<br />
294306
<Button
295307
className="create-button"
296308
disabled={!channel || loading}

client/src/components/RCSwitch.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import Switch from '@material-ui/core/Switch';
44
const RCSwitch = withStyles((theme) => ({
55
root: {
66
width: 42,
7-
height: 26,
7+
height: 20,
88
padding: 0,
99
margin: 10,
1010
},
1111
switchBase: {
12-
padding: 1,
12+
padding: 0,
1313
'&$checked': {
14-
transform: 'translateX(16px)',
14+
transform: 'translateX(20px)',
1515
color: theme.palette.common.white,
1616
'& + $track': {
1717
backgroundColor: '#52d869',
@@ -21,15 +21,15 @@ const RCSwitch = withStyles((theme) => ({
2121
},
2222
'&$focusVisible $thumb': {
2323
color: '#52d869',
24-
border: '6px solid #fff',
2524
},
2625
},
2726
thumb: {
28-
width: 24,
29-
height: 24,
27+
width: 20,
28+
height: 20,
3029
},
3130
track: {
32-
borderRadius: 26 / 2,
31+
display: "inline-table",
32+
borderRadius: 20 / 2,
3333
border: `1px solid ${theme.palette.grey[400]}`,
3434
backgroundColor: theme.palette.grey[50],
3535
opacity: 1,

0 commit comments

Comments
 (0)