-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(mothership): request ids #3645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Include rid
- Loading branch information
commit c2ac24f945f919479535c96c515de663cccc23c4
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
apps/sim/app/workspace/[workspaceId]/home/components/message-actions/index.ts
This file contains hidden or 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 @@ | ||
| export { MessageActions } from './message-actions' |
75 changes: 75 additions & 0 deletions
75
apps/sim/app/workspace/[workspaceId]/home/components/message-actions/message-actions.tsx
This file contains hidden or 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,75 @@ | ||
| 'use client' | ||
|
|
||
| import { useCallback, useState } from 'react' | ||
| import { Check, Copy, Ellipsis, Hash } from 'lucide-react' | ||
| import { | ||
| Popover, | ||
| PopoverContent, | ||
| PopoverItem, | ||
| PopoverScrollArea, | ||
| PopoverTrigger, | ||
| } from '@/components/emcn' | ||
|
|
||
| interface MessageActionsProps { | ||
| content: string | ||
| requestId?: string | ||
| } | ||
|
|
||
| export function MessageActions({ content, requestId }: MessageActionsProps) { | ||
| const [open, setOpen] = useState(false) | ||
| const [copied, setCopied] = useState<'message' | 'request' | null>(null) | ||
|
|
||
| const copyToClipboard = useCallback(async (text: string, type: 'message' | 'request') => { | ||
| try { | ||
| await navigator.clipboard.writeText(text) | ||
| setCopied(type) | ||
| setTimeout(() => setCopied(null), 1500) | ||
| } catch { | ||
| // Silently fail | ||
| } | ||
| setOpen(false) | ||
| }, []) | ||
|
|
||
| return ( | ||
| <Popover variant='default' size='sm' open={open} onOpenChange={setOpen}> | ||
| <PopoverTrigger asChild> | ||
| <button | ||
| type='button' | ||
| className='rounded-md p-1 text-[var(--text-icon)] opacity-0 transition-opacity hover:bg-[var(--surface-3)] group-hover/msg:opacity-100 data-[state=open]:opacity-100' | ||
| onClick={(e) => e.stopPropagation()} | ||
| > | ||
| <Ellipsis className='h-[14px] w-[14px]' strokeWidth={2} /> | ||
| </button> | ||
| </PopoverTrigger> | ||
| <PopoverContent | ||
| side='bottom' | ||
| align='end' | ||
| sideOffset={4} | ||
| maxHeight={120} | ||
| style={{ width: '160px', minWidth: '160px' }} | ||
| > | ||
| <PopoverScrollArea> | ||
| <PopoverItem onClick={() => copyToClipboard(content, 'message')} disabled={!content}> | ||
| {copied === 'message' ? ( | ||
| <Check className='h-[13px] w-[13px]' /> | ||
| ) : ( | ||
| <Copy className='h-[13px] w-[13px]' /> | ||
| )} | ||
| <span>Copy Message</span> | ||
| </PopoverItem> | ||
| <PopoverItem | ||
| onClick={() => requestId && copyToClipboard(requestId, 'request')} | ||
| disabled={!requestId} | ||
| > | ||
| {copied === 'request' ? ( | ||
| <Check className='h-[13px] w-[13px]' /> | ||
| ) : ( | ||
| <Hash className='h-[13px] w-[13px]' /> | ||
| )} | ||
| <span>Copy Request ID</span> | ||
| </PopoverItem> | ||
| </PopoverScrollArea> | ||
| </PopoverContent> | ||
| </Popover> | ||
| ) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.