Skip to content

Commit

Permalink
fix(icon-picker-modal): update color picker request
Browse files Browse the repository at this point in the history
  • Loading branch information
MahtabBukhari committed Oct 7, 2024
1 parent 8a53946 commit fe43315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const handleSubmitForm = async (
data: FieldValues,
isUpdate = false,
deletedAttributes: string[],
selectedColor: string,
selectedPrimaryColor: string,
selectedIcon: string,
mediaOptions: { videoAudio: boolean; image: boolean; sourceLink: boolean },
initialMediaOptions: { videoAudio: boolean; image: boolean; sourceLink: boolean },
Expand All @@ -89,7 +89,7 @@ const handleSubmitForm = async (
attributes: { [key: string]: string }
index?: string
media_url?: string
color?: string
primary_color?: string
icon?: string
image_url?: string
source_link?: string
Expand All @@ -99,8 +99,8 @@ const handleSubmitForm = async (
index: selectedIndex,
}

if (selectedColor) {
requestData.color = selectedColor
if (selectedPrimaryColor) {
requestData.primary_color = selectedPrimaryColor
}

if (selectedIcon) {
Expand Down Expand Up @@ -227,6 +227,8 @@ export const Editor = ({
const { selectedColor, selectedIcon } = useAppStore((s) => s)
const [isPopoverOpen, setPopoverOpen] = useState(!!selectedSchema)

const selectedPrimaryColor = selectedColor.replace('#', '')

const handleColorPickerPopover = () => setPopoverOpen(!isPopoverOpen)

useEffect(
Expand Down Expand Up @@ -368,7 +370,7 @@ export const Editor = ({
await editNodeSchemaUpdate(selectedSchema?.ref_id as string, {
type: data.type,
parent: newParent as string,
color: selectedColor,
primary_color: selectedPrimaryColor,
icon: selectedIcon,
attributes: {
index: selectedIndex as string,
Expand All @@ -382,7 +384,7 @@ export const Editor = ({
{ ...data, ...(selectedSchema ? { ref_id: selectedSchema?.ref_id } : {}) },
!!selectedSchema,
deletedAttributes,
selectedColor,
selectedPrimaryColor,
selectedIcon,
mediaOptions,
{
Expand Down
2 changes: 1 addition & 1 deletion src/network/fetchSourcesData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ interface UpdateEdgeData {
export interface UpdateSchemaParams {
type: string
parent: string
color?: string
primary_color?: string
icon?: string
attributes: {
index: string
Expand Down

0 comments on commit fe43315

Please sign in to comment.