Skip to content

Commit

Permalink
Add visual indicator when in collaborative session
Browse files Browse the repository at this point in the history
  • Loading branch information
Process-ing committed Dec 30, 2024
1 parent 0b0337f commit 825e6e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const CollabModal = ({ isOpen, closeModal }: Props) => {
const handleExitSession = () => {
sessionsSocket.disconnect();
toast({ title: 'Sessão abandonada', description: 'Podes voltar a ela mais tarde, ou iniciar/entrar noutra sessão.'});
setCurrentSessionId(null);
setCurrentView(PICK_SESSION);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const CollaborativeSession = () => {
return (
<CollabSessionContext.Provider value={{ sessions, setSessions, currentSessionId, setCurrentSessionId }}>
<div>
<Button variant="icon" className="bg-primary" onClick={openModal}>
<Button variant="icon" className={!currentSessionId ? "bg-primary" : "bg-green-600"} onClick={openModal}>
<UsersIcon className="h-5 w-5" />
</Button>

Expand Down
24 changes: 24 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import './api/socket'
import { sessionsSocket } from './api/socket'

const strictMode = false
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)

// sessionsSocket.connect();

// sessionsSocket.on('connected', data => {
// console.log('Connected to sessions socket');
// console.log(data);
// });

// sessionsSocket.onAny((event, data) => {
// console.log('Received event from sessions socket');
// console.log(event);
// console.log(data);
// })

// sessionsSocket.on('disconnect', data => {
// console.log('Disconnected from sessions socket');
// console.log(data);
// });

// setTimeout(() => {
// sessionsSocket.emit('test', 'Hello, world!');
// });

root.render(strictMode
?
<React.StrictMode>
Expand Down

0 comments on commit 825e6e4

Please sign in to comment.