diff --git a/frontend/src/components/AddTagPopoverContent/AddTagPopoverContent.tsx b/frontend/src/components/AddTagPopoverContent/AddTagPopoverContent.tsx new file mode 100644 index 000000000..a8b965269 --- /dev/null +++ b/frontend/src/components/AddTagPopoverContent/AddTagPopoverContent.tsx @@ -0,0 +1,78 @@ + +import { faPlus } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +import { Checkbox, PopoverContent } from "@app/components/v2"; + +import { WsTag } from "../../hooks/api/tags/types"; + +interface Props { + wsTags: WsTag[] | undefined; + secKey: string; + selectedTagIds: Record; + handleSelectTag: (wsTag: WsTag) => void; + handleTagOnMouseEnter: (wsTag: WsTag) => void; + handleTagOnMouseLeave: () => void; + checkIfTagIsVisible: (wsTag: WsTag) => boolean; + handleOnCreateTagOpen: () => void +} + +const AddTagPopoverContent = ({ + wsTags, + secKey, + selectedTagIds, + handleSelectTag, + handleTagOnMouseEnter, + handleTagOnMouseLeave, + checkIfTagIsVisible, + handleOnCreateTagOpen +}: Props) => { + return ( + +
+ Add tags to {secKey || "this secret"} +
+
+
+ {wsTags?.map((wsTag: WsTag) => ( +
handleSelectTag(wsTag)} + onMouseEnter={() => handleTagOnMouseEnter(wsTag)} + onMouseLeave={() => handleTagOnMouseLeave()} + tabIndex={0} role="button" + onKeyDown={() => { }}> + { + + (checkIfTagIsVisible(wsTag) || selectedTagIds?.[wsTag.slug]) && + } +
+
+ + {wsTag.slug} + +
+
+ ))} +
handleOnCreateTagOpen()} + tabIndex={0} role="button" + onKeyDown={() => { }}> + + Add new tag +
+
+ + ) +} + +export default AddTagPopoverContent \ No newline at end of file diff --git a/frontend/src/components/v2/Checkbox/Checkbox.tsx b/frontend/src/components/v2/Checkbox/Checkbox.tsx index 3c546f067..64ec0a54a 100644 --- a/frontend/src/components/v2/Checkbox/Checkbox.tsx +++ b/frontend/src/components/v2/Checkbox/Checkbox.tsx @@ -8,11 +8,12 @@ export type CheckboxProps = Omit< CheckboxPrimitive.CheckboxProps, "checked" | "disabled" | "required" > & { - children: ReactNode; + children?: ReactNode; id: string; isDisabled?: boolean; isChecked?: boolean; isRequired?: boolean; + checkIndicatorBg?: string | undefined; }; export const Checkbox = ({ @@ -22,6 +23,7 @@ export const Checkbox = ({ isChecked, isDisabled, isRequired, + checkIndicatorBg, ...props }: CheckboxProps): JSX.Element => { return ( @@ -39,7 +41,7 @@ export const Checkbox = ({ {...props} id={id} > - + diff --git a/frontend/src/components/v2/Tag/Tag.tsx b/frontend/src/components/v2/Tag/Tag.tsx index a2de200ef..10c1d6246 100644 --- a/frontend/src/components/v2/Tag/Tag.tsx +++ b/frontend/src/components/v2/Tag/Tag.tsx @@ -1,17 +1,10 @@ import { ReactNode } from "react"; -import { faClose } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { cva, VariantProps } from "cva"; import { twMerge } from "tailwind-merge"; type Props = { children: ReactNode; className?: string; - onClose?: () => void; - color?: string; - styles?: Record - isDisabled?: boolean; - tagColor: string; } & VariantProps; const tagVariants = cva( @@ -34,12 +27,7 @@ export const Tag = ({ children, className, colorSchema = "gray", - color, - isDisabled, - size = "sm", - onClose, - styles = {} -}: Props) => ( + size = "sm" }: Props) => (
diff --git a/frontend/src/const.ts b/frontend/src/const.ts index 7f24f8fc5..267d80ccd 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -55,65 +55,65 @@ export const leaveConfirmDefaultMessage = "Your changes will be lost if you leav export const secretTagsColors = [ { id: 1, - hex: '#bec2c8', + hex: "#bec2c8", rgba: "rgb(128,128,128, 0.8)", - name: 'Grey', + name: "Grey", selected: true }, { id: 2, - hex: '#95a2b3', + hex: "#95a2b3", rgba: "rgb(0,0,255, 0.8)", - name: 'blue', + name: "blue", selected: false }, { id: 3, - hex: '#5e6ad2', + hex: "#5e6ad2", rgba: "rgb(128,0,128, 0.8)", - name: 'Purple', + name: "Purple", selected: false }, { id: 4, - hex: '#26b5ce', + hex: "#26b5ce", rgba: "rgb(0,128,128, 0.8)", - name: 'Teal', + name: "Teal", selected: false }, { id: 5, - hex: '#4cb782', + hex: "#4cb782", rgba: "rgb(0,128,0, 0.8)", - name: 'Green', + name: "Green", selected: false }, { id: 6, - hex: '#f2c94c', + hex: "#f2c94c", rgba: "rgb(255,255,0, 0.8)", - name: 'Yellow', + name: "Yellow", selected: false }, { id: 7, - hex: '#f2994a', + hex: "#f2994a", rgba: "rgb(128,128,0, 0.8)", - name: 'Orange', + name: "Orange", selected: false }, { id: 8, - hex: '#f7c8c1', + hex: "#f7c8c1", rgba: "rgb(128,0,0, 0.8)", - name: 'Pink', + name: "Pink", selected: false }, { id: 9, - hex: '#eb5757', + hex: "#eb5757", rgba: "rgb(255,0,0, 0.8)", - name: 'Red', + name: "Red", selected: false }, ] \ No newline at end of file diff --git a/frontend/src/hooks/api/tags/queries.tsx b/frontend/src/hooks/api/tags/queries.tsx index b0216828c..0b7fb7c17 100644 --- a/frontend/src/hooks/api/tags/queries.tsx +++ b/frontend/src/hooks/api/tags/queries.tsx @@ -7,9 +7,7 @@ import { CreateTagRes, DeleteTagDTO, DeleteWsTagRes, - QueryTag, UserWsTags, - WsTag } from "./types"; const workspaceTags = { @@ -32,33 +30,35 @@ export const useGetWsTags = (workspaceID: string) => { }); } + export const useCreateWsTag = () => { const queryClient = useQueryClient(); return useMutation({ - mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }: QueryTag) => { + mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }) => { const { data } = await apiRequest.post(`/api/v2/workspace/${workspaceID}/tags`, { name: tagName, - tagColor: tagColor, + tagColor, slug: tagSlug }) return data; }, - onSuccess: (tagData: WsTag) => { + onSuccess: (tagData) => { queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace)); } }); }; + export const useDeleteWsTag = () => { const queryClient = useQueryClient(); return useMutation({ - mutationFn: async ({ tagID }: {tagID: string}) => { + mutationFn: async ({ tagID }) => { const { data } = await apiRequest.delete(`/api/v2/workspace/tags/${tagID}`); return data }, - onSuccess: (tagData: WsTag) => { + onSuccess: (tagData) => { queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace)); } }); diff --git a/frontend/src/hooks/api/tags/types.ts b/frontend/src/hooks/api/tags/types.ts index db162415e..de09f5ac4 100644 --- a/frontend/src/hooks/api/tags/types.ts +++ b/frontend/src/hooks/api/tags/types.ts @@ -4,6 +4,7 @@ export type WsTag = { _id: string; name: string; slug: string; + tagColor?: string; workspace: string; createdAt: string; updatedAt: string; @@ -16,6 +17,7 @@ export type CreateTagDTO = { workspaceID: string; tagSlug: string; tagName: string; + tagColor: string; }; export type CreateTagRes = { @@ -23,6 +25,7 @@ export type CreateTagRes = { slug: string; workspace: string; createdAt: string; + tagColor?: string; user: string; _id: string; }; @@ -51,11 +54,4 @@ export type TagColor = { rgba: string name: string selected: boolean -} - -export type QueryTag = { - workspaceID: string; - tagName: string; - tagColor: string; - tagSlug: string } \ No newline at end of file diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx index 4c84aab84..8c9706c24 100644 --- a/frontend/src/views/DashboardPage/DashboardPage.tsx +++ b/frontend/src/views/DashboardPage/DashboardPage.tsx @@ -297,6 +297,8 @@ export const DashboardPage = () => { resolver: yupResolver(schema) }); + console.log("300 => secrets", secrets) + const { register, control, diff --git a/frontend/src/views/DashboardPage/DashboardPage.utils.ts b/frontend/src/views/DashboardPage/DashboardPage.utils.ts index a8e63f89f..bd0131e8e 100644 --- a/frontend/src/views/DashboardPage/DashboardPage.utils.ts +++ b/frontend/src/views/DashboardPage/DashboardPage.utils.ts @@ -58,7 +58,8 @@ const secretSchema = yup.object({ yup.object({ _id: yup.string().required(), name: yup.string().required(), - slug: yup.string().required() + slug: yup.string().required(), + tagColor: yup.string().nullable(), }) ), overrideAction: yup.string().notRequired().oneOf(Object.values(SecretActionType)), diff --git a/frontend/src/views/DashboardPage/components/CreateTagModal/CreateTagModal.tsx b/frontend/src/views/DashboardPage/components/CreateTagModal/CreateTagModal.tsx index c378bf54c..e725249ed 100644 --- a/frontend/src/views/DashboardPage/components/CreateTagModal/CreateTagModal.tsx +++ b/frontend/src/views/DashboardPage/components/CreateTagModal/CreateTagModal.tsx @@ -1,17 +1,17 @@ -import { useState, useEffect } from 'react'; +import { useEffect, useState } from "react"; import { Controller, useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import * as yup from "yup"; -import { secretTagsColors } from "~/const" import { faCheck } from "@fortawesome/free-solid-svg-icons"; - import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { yupResolver } from "@hookform/resolvers/yup"; +import * as yup from "yup"; import { Button, FormControl, Input, ModalClose, Tooltip } from "@app/components/v2"; -import { isValidHexColor } from "~/components/utilities/isValidHexColor"; -import { TagColor } from '~/hooks/api/tags/types'; + +import { isValidHexColor } from "../../../../components/utilities/isValidHexColor"; +import { secretTagsColors } from "../../../../const" +import { TagColor } from "../../../../hooks/api/tags/types"; type Props = { @@ -33,8 +33,8 @@ export const CreateTagModal = ({ onCreateTag }: Props): JSX.Element => { resolver: yupResolver(createTagSchema) }); - const [tagsColors, setTagsColors] = useState(secretTagsColors) - const [selectedTagColor, setSelectedTagColor] = useState({}) + const [tagsColors] = useState(secretTagsColors) + const [selectedTagColor, setSelectedTagColor] = useState(tagsColors[0]) const [showHexInput, setShowHexInput] = useState(false) const [tagColor, setTagColor] = useState("") @@ -46,12 +46,11 @@ export const CreateTagModal = ({ onCreateTag }: Props): JSX.Element => { useEffect(() => { const clonedTagColors = [...tagsColors] - for (const tagColor of clonedTagColors) { - if (tagColor.selected) { - setSelectedTagColor(tagColor) - setTagColor(tagColor.hex) - break - } + const selectedTagBgColor = clonedTagColors.find($tagColor => $tagColor.selected); + + if (selectedTagBgColor) { + setSelectedTagColor(selectedTagBgColor); + setTagColor(selectedTagBgColor.hex); } }, []) @@ -60,124 +59,133 @@ export const CreateTagModal = ({ onCreateTag }: Props): JSX.Element => { const tagsHexWrapper = document.querySelector(".tags-hex-wrapper") if (showHexInput) { - tagsList?.classList.add('hide-tags') - tagsList?.classList.remove('show-tags') - tagsHexWrapper?.classList.add('show-hex-input') - tagsHexWrapper?.classList.remove('hide-hex-input') + tagsList?.classList.add("hide-tags") + tagsList?.classList.remove("show-tags") + tagsHexWrapper?.classList.add("show-hex-input") + tagsHexWrapper?.classList.remove("hide-hex-input") } else { - tagsList?.classList.remove('hide-tags') - tagsList?.classList.add('show-tags') - tagsHexWrapper?.classList.remove('show-hex-input') - tagsHexWrapper?.classList.add('hide-hex-input') + tagsList?.classList.remove("hide-tags") + tagsList?.classList.add("show-tags") + tagsHexWrapper?.classList.remove("show-hex-input") + tagsHexWrapper?.classList.add("hide-hex-input") } }, [showHexInput]) - const handleColorChange = (tagColor: TagColor) => { - const clonedTagColors = [...tagsColors] - const tagColorIndex = clonedTagColors.findIndex(_tagColor => _tagColor.id === tagColor.id) - const _selectedTagColor = clonedTagColors[tagColorIndex] - clonedTagColors.forEach(tagColor => { - tagColor.selected = false - }) - if (selectedTagColor.id !== tagColor.id) { - _selectedTagColor.selected = !_selectedTagColor.selected - setSelectedTagColor(_selectedTagColor) - setTagColor(_selectedTagColor.hex) + + const handleColorChange = (clickedTagColor: TagColor) => { + const updatedTagColors = [...tagsColors]; + const clickedTagColorIndex = updatedTagColors.findIndex(($tagColor) => $tagColor.id === clickedTagColor.id); + const updatedClickedTagColor = updatedTagColors[clickedTagColorIndex]; + + updatedTagColors.forEach((tgColor) => { + // eslint-disable-next-line no-param-reassign + tgColor.selected = false; + }); + + if (selectedTagColor.id !== clickedTagColor.id) { + updatedClickedTagColor.selected = !updatedClickedTagColor.selected; + setSelectedTagColor(updatedClickedTagColor); + setTagColor(updatedClickedTagColor.hex); } - } + }; return ( - <> -
- ( - - - - )} - /> + + ( + + + + )} + /> -
- -
-
-
+
+
Tag color
+
+
+
+
+ +
+
+ { + tagsColors.map(($tagColor: TagColor) => { + return ( +
+ +
handleColorChange($tagColor)} + tabIndex={0} role="button" + onKeyDown={() => { }} + > + { + $tagColor.selected && + } +
+
+
+ ) + }) + }
-
- { - ( -
- { - tagsColors.map((tagColor: TagColor) => { - return ( - -
handleColorChange(tagColor)}> - { - tagColor.selected && - } -
-
- ) - }) - } -
- ) - } +
+
+ { + isValidHexColor(tagColor) && ( +
+ +
+ ) + } -
-
- { - isValidHexColor(tagColor) && ( -
- -
- ) - } - - { - !isValidHexColor(tagColor) && ( -
- ) - } -
-
- ) => setTagColor(e.target.value)} - /> -
+ { + !isValidHexColor(tagColor) && ( +
+ ) + }
+
+ ) => setTagColor(e.target.value)} + /> +
+
-
-
-
setShowHexInput((prev) => !prev)} style={{ border: '1px solid rgba(220, 216, 254, 0.376)' }}> - { - !showHexInput && # - } -
+
+
+
setShowHexInput((prev) => !prev)} style={{ border: "1px solid rgba(220, 216, 254, 0.376)" }} + tabIndex={0} role="button" + onKeyDown={() => { }}> + { + !showHexInput && # + }
+
-
- + + - - - -
- - + +
+ ); }; diff --git a/frontend/src/views/DashboardPage/components/DesignTagModal/DesignTagModal.tsx b/frontend/src/views/DashboardPage/components/DesignTagModal/DesignTagModal.tsx deleted file mode 100644 index 6993471e9..000000000 --- a/frontend/src/views/DashboardPage/components/DesignTagModal/DesignTagModal.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import { Controller, useForm } from "react-hook-form"; -import { yupResolver } from "@hookform/resolvers/yup"; -import * as yup from "yup"; - -import { Button, FormControl, Input, ModalClose, Tooltip, IconButton, Tag } from "@app/components/v2"; -import { useToggle } from "@app/hooks"; -import { TagDesign } from "~/hooks/api/tags/types"; - -import { - faEye, - faEyeSlash -} from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { useState } from 'react'; -import { WsTag } from '../../../../hooks/api/tags/types'; - -type TagData = { - tagBackground: string; - tagLabel: string -} - -type Props = { - onDesignTag: (tagData: TagData) => void; - selectedTag: WsTag -}; - -const designTagSchema = yup.object({ - tagBackground: yup.string().required().trim().label("Tag Background"), - tagLabel: yup.string().required().trim().label("Tag Label"), -}); -type FormData = yup.InferType; - - -export const DesignTagModal = ({ onDesignTag, selectedTag }: Props): JSX.Element => { - const [tagDesignObj, setTagDesignObj] = useState({ - tagColor: { - bg: "", - text: "" - } - }) - - const { - control, - reset, - formState, - handleSubmit, - setValue - } = useForm({ - resolver: yupResolver(designTagSchema) - }); - - const onFormSubmit = ({ tagBackground, tagLabel }: FormData) => { - onDesignTag({ tagBackground, tagLabel }); - reset(); - }; - - const [previewTag, setPreviewTag] = useToggle(false); - - const handleInputChange = (e: React.ChangeEvent, type: string) => { - setTagDesignObj((prev: { tagColor: { bg: string, text: string }; }) => ({ - tagColor: { - ...prev.tagColor, - [type]: e.target.value - } - })) - if (type === 'bg') { - setValue('tagBackground', e.target.value) - } else { - setValue('tagLabel', e.target.value) - } - } - - return ( -
-
- { - return ( - <> - - ) => handleInputChange(e, 'bg')} /> - - - ) - }} - /> - {/* */} -
- setPreviewTag.toggle()} className="absolute top-[2px] left-[127px] cursor-pointer" /> - {previewTag && ( - void (0)} - key={selectedTag._id} - className="absolute top-[-5px] right-[-5px] cursor-pointer" - > - {selectedTag.slug} - - )} - -
- {/*
*/} -
- - { - return ( - <> - - ) => handleInputChange(e, 'text')} value={tagDesignObj.tagColor.text} /> - - - ) - }} - /> -
- - - - -
- - ); -}; diff --git a/frontend/src/views/DashboardPage/components/DesignTagModal/index.tsx b/frontend/src/views/DashboardPage/components/DesignTagModal/index.tsx deleted file mode 100644 index 165e8e3a3..000000000 --- a/frontend/src/views/DashboardPage/components/DesignTagModal/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export {DesignTagModal} from "./DesignTagModal" \ No newline at end of file diff --git a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx index 9b70b936e..cdb95864a 100644 --- a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx +++ b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx @@ -1,5 +1,5 @@ /* eslint-disable react/jsx-no-useless-fragment */ -import { memo, useEffect, useRef, useState } from "react"; +import { memo, useEffect,useRef, useState } from "react"; import { Control, Controller, @@ -15,7 +15,6 @@ import { faCopy, faEllipsis, faInfoCircle, - faPlus, faTags, faXmark } from "@fortawesome/free-solid-svg-icons"; @@ -24,41 +23,21 @@ import { cx } from "cva"; import { twMerge } from "tailwind-merge"; import { - Button, - Checkbox, - FormControl, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, Input, Popover, - PopoverContent, PopoverTrigger, SecretInput, Tag, - TextArea, - Tooltip, - Modal, - ModalContent, -} from "@app/components/v2"; - + Tooltip} from "@app/components/v2"; +import { useToggle } from "@app/hooks"; import { WsTag } from "@app/hooks/api/types"; +import AddTagPopoverContent from "../../../../components/AddTagPopoverContent/AddTagPopoverContent"; import { FormData, SecretActionType } from "../../DashboardPage.utils"; -import { SecretTags } from "~/hooks/api/tags/types"; -import { useToggle } from "@app/hooks"; - -const tagColors = [ - { bg: "bg-[#f1c40f]/40", text: "text-[#fcf0c3]/70" }, - { bg: "bg-[#cb1c8d]/40", text: "text-[#f2c6e3]/70" }, - { bg: "bg-[#badc58]/40", text: "text-[#eef6d5]/70" }, - { bg: "bg-[#ff5400]/40", text: "text-[#ffddcc]/70" }, - { bg: "bg-[#3AB0FF]/40", text: "text-[#f0fffd]/70" }, - { bg: "bg-[#6F1AB6]/40", text: "text-[#FFE5F1]/70" }, - { bg: "bg-[#C40B13]/40", text: "text-[#FFDEDE]/70" }, - { bg: "bg-[#332FD0]/40", text: "text-[#DFF6FF]/70" } -]; type Props = { index: number; @@ -77,7 +56,6 @@ type Props = { // tag props wsTags?: WsTag[]; onCreateTagOpen: () => void; - onDesignTagOpen: (selectedTag: WsTag, selectedFieldIndex: number) => void; // rhf specific functions, dont put this using useFormContext. This is passed as props to avoid re-rendering control: Control; register: UseFormRegister; @@ -97,11 +75,10 @@ export const SecretInputRow = memo( isAddOnly, wsTags, onCreateTagOpen, - onDesignTagOpen, onSecretDelete, searchTerm, control, - register, + // register, setValue, isKeyError, keyError, @@ -116,8 +93,6 @@ export const SecretInputRow = memo( append } = useFieldArray({ control, name: `secrets.${index}.tags` }); - const tagColorByTagId = new Map((wsTags || []).map((wsTag, i) => [wsTag._id, tagColors[i % tagColors.length]])) - // display the tags in alphabetical order secretTags.sort((a, b) => a?.name?.localeCompare(b?.name)) @@ -152,7 +127,19 @@ export const SecretInputRow = memo( const isOverridden = overrideAction === SecretActionType.Created || overrideAction === SecretActionType.Modified; + const [editorRef, setEditorRef] = useState(isOverridden ? secValueOverride : secValue); + const [hoveredTag, setHoveredTag] = useState(null); + + const handleTagOnMouseEnter = (wsTag: WsTag) => { + setHoveredTag(wsTag); + } + + const handleTagOnMouseLeave = () => { + setHoveredTag(null); + } + + const checkIfTagIsVisible = (wsTag: WsTag) => wsTag._id === hoveredTag?._id; const secId = useWatch({ control, name: `secrets.${index}._id`, exact: true }); const tags = useWatch({ control, name: `secrets.${index}.tags`, exact: true, defaultValue: [] }) || []; @@ -164,6 +151,7 @@ export const SecretInputRow = memo( const [isInviteLinkCopied, setInviteLinkCopied] = useToggle(false); + useEffect(() => { let timer: NodeJS.Timeout; if (isInviteLinkCopied) { @@ -172,6 +160,7 @@ export const SecretInputRow = memo( return () => clearTimeout(timer); }, [isInviteLinkCopied]); + useEffect(() => { setEditorRef(isOverridden ? secValueOverride : secValue); }, [isOverridden]); @@ -202,7 +191,8 @@ export const SecretInputRow = memo( const onSelectTag = (selectedTag: WsTag) => { const shouldAppend = !selectedTagIds[selectedTag.slug]; if (shouldAppend) { - append(selectedTag); + const {_id: id, name, slug, tagColor} = selectedTag + append({_id: id, name, slug, tagColor}); } else { const pos = tags.findIndex(({ slug }: { slug: string }) => selectedTag.slug === slug); remove(pos); @@ -229,8 +219,6 @@ export const SecretInputRow = memo( return <>; } - - return ( @@ -335,67 +323,37 @@ export const SecretInputRow = memo(
- {secretTags.map(({ id, _id, slug, tagColor }: SecretTags, i: number) => { + {secretTags.map(({ id, slug, tagColor}) => { return ( - + <> +
remove(i)} + // isDisabled={isReadOnly || isAddOnly || isRollbackMode} + // onClose={() => remove(i)} key={id} className="cursor-pointer" > -
-
+
+
{slug}
-
- -
- Add tags to {secKey || "this secret"} -
-
- {wsTags?.map((wsTag) => ( - - ))} - -
-
+ onSelectTag(wsTag)} + handleTagOnMouseEnter={(wsTag: WsTag) => handleTagOnMouseEnter(wsTag)} + handleTagOnMouseLeave={() => handleTagOnMouseLeave()} + checkIfTagIsVisible={(wsTag: WsTag) => checkIfTagIsVisible(wsTag)} + handleOnCreateTagOpen={() => onCreateTagOpen()} + /> - + ) })}
@@ -428,46 +386,16 @@ export const SecretInputRow = memo(
- -
- Add tags to {secKey || "this secret"} -
-
- {wsTags?.map((wsTag) => ( - - ))} - -
-
+ onSelectTag(wsTag)} + handleTagOnMouseEnter={(wsTag: WsTag) => handleTagOnMouseEnter(wsTag)} + handleTagOnMouseLeave={() => handleTagOnMouseLeave()} + checkIfTagIsVisible={(wsTag: WsTag) => checkIfTagIsVisible(wsTag)} + handleOnCreateTagOpen={() => onCreateTagOpen()} + />
)} @@ -511,20 +439,16 @@ export const SecretInputRow = memo( - - -