-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(vim): disable eslint.experimental.useFlatConfig neoclide/coc-eslint#41 (comment) * feat(ui): implement community rooms * feat(ui): remove old community room link * feat(ui): improve room label
- Loading branch information
1 parent
bd7e8df
commit 7b676b4
Showing
5 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eslint.experimental.useFlatConfig": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const communityRoomNames = [ | ||
'buy-and-sell', | ||
'crypto', | ||
'hacking', | ||
'leaks', | ||
'news', | ||
'organize', | ||
'politics', | ||
'resist', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { useState, SyntheticEvent } from 'react' | ||
import { useNavigate } from 'react-router-dom' | ||
import Button from '@mui/material/Button' | ||
import Box from '@mui/material/Box' | ||
import Typography from '@mui/material/Typography' | ||
import TextField from '@mui/material/TextField' | ||
import Autocomplete from '@mui/material/Autocomplete' | ||
import Accordion from '@mui/material/Accordion' | ||
import AccordionSummary from '@mui/material/AccordionSummary' | ||
import AccordionDetails from '@mui/material/AccordionDetails' | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore' | ||
|
||
import { communityRoomNames } from 'config/communityRooms' | ||
|
||
export const CommunityRoomSelector = () => { | ||
const navigate = useNavigate() | ||
const [selectedRoom, setSelectedRoom] = useState<string | null>(null) | ||
|
||
const handleRoomNameChange = ( | ||
_event: SyntheticEvent<Element, Event>, | ||
roomName: string | null | ||
) => { | ||
setSelectedRoom(roomName) | ||
} | ||
|
||
const handleJoinClick = () => { | ||
navigate(`/public/${selectedRoom}`) | ||
} | ||
|
||
return ( | ||
<Accordion> | ||
<AccordionSummary | ||
expandIcon={<ExpandMoreIcon />} | ||
aria-controls="panel1-content" | ||
id="panel1-header" | ||
sx={{ | ||
fontWeight: 'bold', | ||
}} | ||
> | ||
Community rooms | ||
</AccordionSummary> | ||
<AccordionDetails> | ||
<Typography variant="body1"> | ||
You can also chat in a public community room. You'll be anonymous, but | ||
be careful what information you choose to share. | ||
</Typography> | ||
<Box display="flex" mt={2} gap={1}> | ||
<Autocomplete | ||
disablePortal | ||
options={communityRoomNames} | ||
value={selectedRoom} | ||
renderInput={params => <TextField {...params} label="Room" />} | ||
onChange={handleRoomNameChange} | ||
sx={{ flexGrow: 1 }} | ||
/> | ||
<Button | ||
variant="contained" | ||
disabled={selectedRoom === null} | ||
onClick={handleJoinClick} | ||
> | ||
Join | ||
</Button> | ||
</Box> | ||
</AccordionDetails> | ||
</Accordion> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters