Skip to content

Commit

Permalink
🧑‍💻 (editor) Add group info in focus toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Sep 6, 2023
1 parent 605132e commit ac899b3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import { CopyIcon, PlayIcon, TrashIcon } from '@/components/icons'
import { HStack, IconButton, useColorModeValue } from '@chakra-ui/react'
import { CopyIcon, InfoIcon, PlayIcon, TrashIcon } from '@/components/icons'
import {
HStack,
IconButton,
Tooltip,
useClipboard,
useColorModeValue,
} from '@chakra-ui/react'

type Props = {
groupId: string
onPlayClick: () => void
onDuplicateClick: () => void
onDeleteClick: () => void
}

export const GroupFocusToolbar = ({
groupId,
onPlayClick,
onDuplicateClick,
onDeleteClick,
}: Props) => {
const { hasCopied, onCopy } = useClipboard(groupId)

return (
<HStack
rounded="md"
Expand Down Expand Up @@ -42,6 +52,22 @@ export const GroupFocusToolbar = ({
}}
size="sm"
/>
<Tooltip
label={hasCopied ? 'Copied!' : groupId}
closeOnClick={false}
placement="top"
>
<IconButton
icon={<InfoIcon />}
borderRightWidth="1px"
borderRightRadius="none"
borderLeftRadius="none"
aria-label={'Show group info'}
variant="ghost"
size="sm"
onClick={onCopy}
/>
</Tooltip>
<IconButton
aria-label="Delete"
borderLeftRadius="none"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ const NonMemoizedDraggableGroupNode = ({
unmountOnExit
>
<GroupFocusToolbar
groupId={group.id}
onPlayClick={startPreviewAtThisGroup}
onDuplicateClick={() => {
setIsFocused(false)
Expand Down

0 comments on commit ac899b3

Please sign in to comment.