feat: enhance room management and UI with join/leave functionality

- Added GraphQL mutations and subscriptions for joining and leaving rooms
- Implemented room member tracking and display in room list
- Added leave room confirmation and error handling in chat room
- Updated room list and chat room components with new interaction features
- Improved UI with member badges, join/leave buttons, and error messages
- Enhanced room query to include member information
This commit is contained in:
Juan Sebastián Montoya 2025-03-04 01:46:30 -05:00
parent 16731409df
commit c737258aed
6 changed files with 339 additions and 49 deletions

View file

@ -211,23 +211,49 @@ button:disabled {
}
.room-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem;
border-radius: 0.25rem;
cursor: pointer;
margin-bottom: 0.5rem;
transition: background-color 0.2s;
border: 1px solid var(--border-color);
transition: border-color 0.2s;
}
.room-item:hover {
.room-info {
flex: 1;
cursor: pointer;
}
.room-info.selected {
background-color: rgba(79, 70, 229, 0.2);
}
.room-info:hover {
background-color: rgba(79, 70, 229, 0.1);
}
.room-item.selected {
background-color: rgba(79, 70, 229, 0.2);
.join-button {
padding: 0.4rem 0.8rem;
font-size: 0.875rem;
margin-left: 0.5rem;
}
.room-name {
font-weight: 500;
display: flex;
align-items: center;
gap: 0.5rem;
}
.member-badge {
font-size: 0.7rem;
background-color: var(--primary-color);
color: white;
padding: 0.1rem 0.4rem;
border-radius: 1rem;
font-weight: normal;
}
.room-description {
@ -259,6 +285,60 @@ button:disabled {
.chat-header {
padding: 1rem;
border-bottom: 1px solid var(--border-color);
display: flex;
flex-direction: column;
}
.room-actions {
display: flex;
justify-content: flex-end;
margin-top: 0.5rem;
}
.leave-button {
padding: 0.4rem 0.8rem;
font-size: 0.875rem;
background-color: var(--error-color);
}
.leave-button:hover {
background-color: #dc2626;
}
.confirm-leave {
display: flex;
align-items: center;
gap: 0.5rem;
}
.confirm-leave span {
font-size: 0.875rem;
color: var(--error-color);
}
.confirm-leave button {
padding: 0.3rem 0.6rem;
font-size: 0.75rem;
}
.confirm-leave button:first-of-type {
background-color: var(--error-color);
}
.confirm-leave button:last-of-type {
background-color: var(--secondary-color);
}
.error-message {
color: var(--error-color);
font-size: 0.875rem;
margin-bottom: 0.5rem;
}
.chat-main {
flex: 1;
display: flex;
flex-direction: column;
}
.chat-header h2 {