/** * Copyright (c) 2026-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { useRef, useLayoutEffect } from 'react'; import { observer } from 'mobx-react-lite'; import { SendIcon, LoadingIcon, TimesIcon } from '@finos/legend-art'; import { useLegendMarketplaceAIChatStore } from '../../application/providers/LegendMarketplaceAIChatStoreProvider.js'; import { MarketplaceAIScopeSelector } from './MarketplaceAIScopeSelector.js'; export const MarketplaceAIInputBar = observer( (props: { placeholder: string; onSubmit: () => void }): React.ReactNode => { const { placeholder, onSubmit } = props; const store = useLegendMarketplaceAIChatStore(); const textareaRef = useRef(null); useLayoutEffect(() => { const el = textareaRef.current; if (el) { el.style.height = 'auto'; el.style.height = `${el.scrollHeight}px`; } }, [store.questionText]); return ( <> {store.scopeProducts.length > 0 && (
{store.scopeProducts.map((sp, idx) => (
{sp.name}
))}
)}