From a617bd8ecda7a07cffe0b7381f2b2bbed0b80810 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 18 Jan 2023 03:25:00 -0500 Subject: [PATCH] select TTS model with dropdown --- .../view/tts/tts_model_list/SelectSearch.tsx | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/packages/fakeyou.com/src/v2/view/tts/tts_model_list/SelectSearch.tsx b/packages/fakeyou.com/src/v2/view/tts/tts_model_list/SelectSearch.tsx index bac56277df..06ddda518c 100644 --- a/packages/fakeyou.com/src/v2/view/tts/tts_model_list/SelectSearch.tsx +++ b/packages/fakeyou.com/src/v2/view/tts/tts_model_list/SelectSearch.tsx @@ -1,13 +1,10 @@ -import React, { useState } from "react"; +import React from "react"; import { TtsModelListItem } from "@storyteller/components/src/api/tts/ListTtsModels"; import { TtsCategoryType } from "../../../../AppWrapper"; -import Autocomplete from "react-autocomplete"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faMicrophone, faSearch } from "@fortawesome/free-solid-svg-icons"; -import { t } from "i18next"; -import { Analytics } from "../../../../common/Analytics"; -import Select from "react-select"; -import AsyncSelect from "react-select/async"; +import { faMicrophone } from "@fortawesome/free-solid-svg-icons"; +import Select, { ActionMeta } from "react-select"; +import Option from "react-select"; import { SearchFieldClass } from "./SearchFieldClass"; // NB: This probably is not the best autocomplete library in the world @@ -31,16 +28,37 @@ interface Props { } export function SelectSearch(props: Props) { - // const [searchValue, setSearchValue] = useState(""); + const options : any = props.allTtsModels.map((ttsModel) => { + return { value: ttsModel.model_token, label: ttsModel.title } + }); - const options = [ - { value: "chocolate", label: "Chocolate" }, - { value: "strawberry", label: "Strawberry" }, - { value: "vanilla", label: "Vanilla" }, - { value: "chocolate", label: "Chocolate" }, - { value: "strawberry", label: "Strawberry" }, - { value: "vanilla", label: "Vanilla" }, - ]; + + const handleChange = (option: any, actionMeta: ActionMeta