import React, { useState, useEffect, forwardRef } from 'react'; import { Tabs, TabsList, TabsTrigger } from '../ui/Tabs.tsx'; import { useRecoilValue, useRecoilState } from 'recoil'; // import { setConversation } from '~/store/convoSlice'; import store from '~/store'; function BingStyles(props, ref) { const [value, setValue] = useState('fast'); const [conversation, setConversation] = useRecoilState(store.conversation) || {}; const { model, conversationId } = conversation; const messages = useRecoilValue(store.messages); const isBing = model === 'bingai' || model === 'sydney'; useEffect(() => { if ((model === 'bingai' && !conversationId) || model === 'sydney') { setConversation(prevState => ({ ...prevState, toneStyle: value })); } }, [conversationId, model, value]); const show = isBing && (!conversationId || messages?.length === 0 || props.show); const defaultClasses = 'p-2 rounded-md min-w-[75px] font-normal bg-white/[.60] dark:bg-gray-700 text-black text-xs'; const defaultSelected = defaultClasses + 'font-medium data-[state=active]:text-white text-xs'; const selectedClass = val => val + '-tab ' + defaultSelected; const changeHandler = value => { setValue(value); setConversation(prevState => ({ ...prevState, toneStyle: value })); }; return ( {'Creative'} {'Fast'} {'Balanced'} {'Precise'} ); } export default forwardRef(BingStyles);