fix ui update autoselect, allow to select inputted value (#2011)

also fix for inputs inside player
This commit is contained in:
Delirium 2024-03-28 16:33:42 +01:00 committed by GitHub
parent 9c3493cf87
commit e747551246
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View file

@ -57,6 +57,12 @@ function UserCard({ className, request, session, width, height, similarSessions,
React.useEffect(() => {
const handler = (e) => {
if (e.shiftKey) {
if (
e.target instanceof HTMLInputElement ||
e.target instanceof HTMLTextAreaElement
) {
return false;
}
e.preventDefault()
if (e.key === 'I') {
setShowMore(!showMore)

View file

@ -199,7 +199,6 @@ function CreateNote({
value={text}
autoFocus
onChange={(e) => {
console.log(e, e.target.value)
setText(e.target.value)}
}
className="text-area"

View file

@ -8,7 +8,7 @@ function AutoplayToggle() {
const { autoplay } = store.get()
return (
<Switch onChange={() => player.toggleAutoplay()} checked={autoplay} checkedChildren="Auto" />
<Switch onChange={() => player.toggleAutoplay()} checked={autoplay} unCheckedChildren="Auto" checkedChildren="Auto" />
);
}

View file

@ -12,6 +12,8 @@ const dropdownStyles = {
option: (provided: any, state: any) => ({
...provided,
whiteSpace: 'nowrap',
width: '100%',
minWidth: 150,
transition: 'all 0.3s',
overflow: 'hidden',
textOverflow: 'ellipsis',
@ -197,6 +199,8 @@ function FilterAutoComplete(props: Props) {
const selected = value ? options.find((i: any) => i.value === query) : null;
const uniqueOptions = options.filter((i: Record<string, string>) => i.value !== query)
const selectOptionsArr = query.length ? [{ value: query, label: query }, ...uniqueOptions] : options;
return (
<div className="relative flex items-center">
<div className={cn(stl.wrapper, 'relative')}>
@ -224,12 +228,11 @@ function FilterAutoComplete(props: Props) {
ref={(ref: any) => {
selectRef = ref;
}}
options={options}
options={selectOptionsArr}
value={selected}
onChange={(e: any) => onChange(e.value)}
menuIsOpen={initialFocus && menuIsOpen}
menuIsOpen={initialFocus && menuIsOpen && query !== ''}
menuPlacement="auto"
noOptionsMessage={() => loading ? 'Loading...' : 'No results found'}
styles={dropdownStyles}
components={{
Control: ({ children, ...props }: any) => <></>,