Skip to content

Commit

Permalink
feat: invite users (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrunton authored Aug 24, 2024
1 parent c876a95 commit 643a3ee
Show file tree
Hide file tree
Showing 32 changed files with 837 additions and 198 deletions.
1 change: 1 addition & 0 deletions client/src/data/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const useMessagesSubscription = (roomId?: string, opts: QueryOptions = De
}
if (message.updatedEntities?.includes('users')) {
queryClient.invalidateQueries({ queryKey: ['users'] })
queryClient.invalidateQueries({ queryKey: ['me'] })
}
queryClient.setQueryData(['messages', message.roomId], (messages: Message[] | undefined) => {
if (!messages) return
Expand Down
6 changes: 3 additions & 3 deletions client/src/features/room/organisms/ChatBox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Icon, Textarea, Spinner, VStack, Alert, AlertIcon, Spacer } from '@chakra-ui/react'
import React, { useState, KeyboardEventHandler, useRef, useEffect } from 'react'
import React, { useState, KeyboardEventHandler, useRef, useEffect, ReactElement } from 'react'
import { AiOutlineArrowRight } from 'react-icons/ai'
import { usePostMessage } from '../../../data/messages'
import { useJoinRoom } from '../../../data/rooms'
Expand All @@ -23,7 +23,7 @@ const JoinAlert = ({ roomId, canJoin }: ChatBoxProps) => {
return (
<Alert status='info' variant='top-accent'>
<AlertIcon />
You need to join this room to chat.
Join this room to chat.
<Spacer />
<Button rightIcon={isLoading ? <Spinner /> : undefined} onClick={() => joinRoom()}>
Join
Expand All @@ -40,7 +40,7 @@ const JoinAlert = ({ roomId, canJoin }: ChatBoxProps) => {
)
}

export const ChatBox: React.FC<ChatBoxProps> = ({ roomId, canJoin }: ChatBoxProps) => {
export const ChatBox: React.FC<ChatBoxProps> = ({ roomId, canJoin }: ChatBoxProps): ReactElement => {
const [content, setContent] = useState<string>('')
const { data: user, isLoading } = useUserDetails()
const joined = user?.rooms.some((room) => room.id === roomId)
Expand Down
2 changes: 1 addition & 1 deletion services/api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = {
},
{
from: ['*'],
allow: ['rambda', 'rxjs', 'zod'],
allow: ['rambda', 'remeda', 'rxjs', 'zod'],
},
],
},
Expand Down
Loading

0 comments on commit 643a3ee

Please sign in to comment.