-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1055 from The-Commit-Company/develop
Release v1.7.0
- Loading branch information
Showing
52 changed files
with
1,092 additions
and
168 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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
...rc/components/feature/chat/ChatMessage/MessageActions/QuickActions/CreateThreadButton.tsx
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,49 @@ | ||
import { useFrappePostCall } from 'frappe-react-sdk' | ||
import { toast } from 'sonner' | ||
import { QuickActionButton } from './QuickActionButton' | ||
import { BiMessageDetail } from 'react-icons/bi' | ||
import { useNavigate } from 'react-router-dom' | ||
import { ContextMenu, Flex } from '@radix-ui/themes' | ||
|
||
const useCreateThread = (messageID: string) => { | ||
const navigate = useNavigate() | ||
|
||
const { call } = useFrappePostCall('raven.api.threads.create_thread') | ||
const handleCreateThread = () => { | ||
call({ 'message_id': messageID }).then((res) => { | ||
toast.success('Thread created successfully!') | ||
navigate(`/channel/${res.message.channel_id}/thread/${res.message.thread_id}`) | ||
}).catch(() => { | ||
toast.error('Failed to create thread') | ||
}) | ||
} | ||
|
||
return handleCreateThread | ||
} | ||
|
||
export const CreateThreadActionButton = ({ messageID }: { messageID: string }) => { | ||
|
||
const handleCreateThread = useCreateThread(messageID) | ||
|
||
return ( | ||
<QuickActionButton | ||
tooltip='Create a thread' | ||
aria-label='Create a thread' | ||
onClick={handleCreateThread}> | ||
<BiMessageDetail size='16' /> | ||
</QuickActionButton> | ||
) | ||
} | ||
|
||
export const CreateThreadContextItem = ({ messageID }: { messageID: string }) => { | ||
|
||
const handleCreateThread = useCreateThread(messageID) | ||
|
||
return <ContextMenu.Item onClick={handleCreateThread}> | ||
<Flex gap='2' align='center'> | ||
<BiMessageDetail size='18' /> | ||
Create Thread | ||
|
||
</Flex> | ||
</ContextMenu.Item> | ||
} |
Oops, something went wrong.