diff --git a/src/components/chat/RoomList.js b/src/components/chat/RoomList.js index 31e9568..0968e73 100644 --- a/src/components/chat/RoomList.js +++ b/src/components/chat/RoomList.js @@ -8,7 +8,7 @@ const RoomList = ({ const displayRoomName = (passphrase) => { // 'OneTwoThreeFourFive' => 'One Two Three' return passphrase.replace(/([A-Z])/g, '_$1').slice(1).split('_').slice(0, 3).join(' '); - } + }; // Append the current room to our room list if it isn't there already let roomList = JSON.parse( localStorage.getItem('roomList') || '[]' ); @@ -18,34 +18,25 @@ const RoomList = ({ localStorage.setItem('roomList', JSON.stringify(roomList)); } - const styleRoomList = () => { - return { - display: 'flex', - flexDirection: 'column', - width: '100%', - marginTop: '48px' - }; + const setPassphrase = (passphrase) => { + console.log('setPassphrase() -- TODO: Disconnect the WebSocket, change the current URL hash, auth again, connect via WebSocket'); }; - const styleRoomName = (passphrase) => { - const lightPurple = '#aa6fe3'; - return { - color: passphrase === passphraseFromUrlHash ? lightPurple : 'white', - width: '100%' - } - } + const changeRoom = (passphrase) => { + // just update fragment and reload page for now + window.location.assign(window.location.origin + `/#${passphrase}`); + window.location.reload(true); + }; - const setPassphrase = (passphrase) => { - console.log('setPassphrase() -- TODO: Disconnect the WebSocket, change the current URL hash, auth again, connect via WebSocket'); - } + roomList.sort((a, b) => {a > b;}); return ( -
+

Chat Rooms