mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
improvement: show queue color picker on focus
This commit is contained in:
@@ -8,6 +8,7 @@ const ColorPicker = ({ onChange, currentColor, handleClose, open }) => {
|
|||||||
|
|
||||||
const handleChange = color => {
|
const handleChange = color => {
|
||||||
setColor(color.hex);
|
setColor(color.hex);
|
||||||
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect, useRef } from "react";
|
||||||
|
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { Formik, Form, Field } from "formik";
|
import { Formik, Form, Field } from "formik";
|
||||||
@@ -74,6 +74,7 @@ const QueueModal = ({ open, onClose, queueId }) => {
|
|||||||
|
|
||||||
const [colorPickerModalOpen, setColorPickerModalOpen] = useState(false);
|
const [colorPickerModalOpen, setColorPickerModalOpen] = useState(false);
|
||||||
const [queue, setQueue] = useState(initialState);
|
const [queue, setQueue] = useState(initialState);
|
||||||
|
const greetingRef = useRef();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -154,7 +155,12 @@ const QueueModal = ({ open, onClose, queueId }) => {
|
|||||||
label={i18n.t("queueModal.form.color")}
|
label={i18n.t("queueModal.form.color")}
|
||||||
name="color"
|
name="color"
|
||||||
id="color"
|
id="color"
|
||||||
// disabled
|
onFocus={() => {
|
||||||
|
setColorPickerModalOpen(true);
|
||||||
|
greetingRef.current.focus();
|
||||||
|
}}
|
||||||
|
error={touched.color && Boolean(errors.color)}
|
||||||
|
helperText={touched.color && errors.color}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
startAdornment: (
|
startAdornment: (
|
||||||
<InputAdornment position="start">
|
<InputAdornment position="start">
|
||||||
@@ -193,6 +199,7 @@ const QueueModal = ({ open, onClose, queueId }) => {
|
|||||||
label={i18n.t("queueModal.form.greetingMessage")}
|
label={i18n.t("queueModal.form.greetingMessage")}
|
||||||
type="greetingMessage"
|
type="greetingMessage"
|
||||||
multiline
|
multiline
|
||||||
|
inputRef={greetingRef}
|
||||||
rows={5}
|
rows={5}
|
||||||
fullWidth
|
fullWidth
|
||||||
name="greetingMessage"
|
name="greetingMessage"
|
||||||
|
|||||||
Reference in New Issue
Block a user