Skip to content

Commit

Permalink
Merge pull request stakwork#2307 from MahtabBukhari/update_color_pick…
Browse files Browse the repository at this point in the history
…er_request_for_color

update color picker request
  • Loading branch information
Rassl authored Oct 8, 2024
2 parents e6e61c0 + fe43315 commit 47f61c0
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 @@ -367,7 +369,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 @@ -381,7 +383,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 47f61c0

Please sign in to comment.