Skip to content

Commit

Permalink
fix(tags): fix tag modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Oct 9, 2024
1 parent 5464f0c commit 1ab2b65
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions client/src/components/edit-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const EditModal: React.FC<EditModalProps> = ({
}) => {
const [showProfileModal, setShowProfileModal] = useState(false);
const [selectedProfile] = useState(localStorage.getItem("selectedProfile"));
const [showTagModal, setShowTagModal] = useState(false);

const [inputs, setInputs] = useState<Inputs>({
team: [selectedProfile],
status: "treated",
Expand All @@ -34,7 +36,6 @@ const EditModal: React.FC<EditModalProps> = ({
});
const [filteredTags, setFilteredTags] = useState<string[]>([]);
const [tagInput, setTagInput] = useState("");
const [showTagModal] = useState(false);

let basePath = "contacts";

Expand Down Expand Up @@ -149,6 +150,9 @@ const EditModal: React.FC<EditModalProps> = ({
setTagInput("");
}
};
const handleOpenTagModal = () => {
setShowTagModal(true);
};

const handleTagRemove = (tagToRemove: string) => {
handleInputChange(
Expand Down Expand Up @@ -208,6 +212,14 @@ const EditModal: React.FC<EditModalProps> = ({
))}
</Col>
</Row>
<Button
onClick={handleOpenTagModal}
variant="secondary"
size="sm"
className="fr-mt-2w"
>
Sélectionner des tags
</Button>
<Row gutters>
<Col md="6">
<TextArea
Expand Down Expand Up @@ -247,7 +259,10 @@ const EditModal: React.FC<EditModalProps> = ({
<TagSelectionModal
isOpen={showTagModal}
allTags={filteredTags}
onClose={(selectedTags) => handleInputChange("tags", selectedTags)}
onClose={(selectedTags) => {
handleInputChange("tags", selectedTags);
setShowTagModal(false);
}}
/>
</>
);
Expand Down

0 comments on commit 1ab2b65

Please sign in to comment.