* feat ui: dashboards redesign start * more cards * fix ui: more different cards... * feat ui: finish cards, all trigger, all icons * change(ui): added missin const * feature(ui): new dashboard modal * feature(ui): new dashboard modal * change(ui): new cards * change(ui): dashboard redesign * change(ui): dashboard redesign * change(ui): dashboard redesign * change(ui): modal context and alert form * change(ui): table card show more with modal * change(ui): examples * change(ui): example categorize and other improvements * change(ui): example categorize and other improvements * change(ui): performance cards * change(ui): insights card * Various style updates in dashboards and other pages. (#2308) * Various minor style updates * Various style improvements * Update ExampleCards.tsx * change(ui): fixed an issue with card create * change(ui): fixed an issue with card create * change(ui): default filters and events order * change(ui): random data * Dashboards redesign - improvments (#2313) * Various minor style updates * Various style improvements * Update ExampleCards.tsx * various minor improvements in dashbaords. * revised dashboard widget header * change(ui): sessions by user * change(ui): funnel example * change(ui): modal height and scroll * change(ui): example cards with data * change(ui): example cards with data * change(ui): funnel bar text color * change(ui): example cards overlay click * change(ui): path analysis filter card --------- Co-authored-by: Shekar Siri <sshekarsiri@gmail.com> Co-authored-by: Sudheer Salavadi <connect.uxmaster@gmail.com>
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import stl from './LiveSessionSearchField.module.css';
|
|
import { Input } from 'UI';
|
|
import LiveFilterModal from 'Shared/Filters/LiveFilterModal';
|
|
import { fetchFilterSearch } from 'Duck/search';
|
|
import { debounce } from 'App/utils';
|
|
import { edit as editFilter, addFilterByKeyAndValue } from 'Duck/liveSearch';
|
|
|
|
interface Props {
|
|
fetchFilterSearch: (query: any) => void;
|
|
editFilter: typeof editFilter;
|
|
addFilterByKeyAndValue: (key: string, value: string) => void;
|
|
}
|
|
function LiveSessionSearchField(props: Props) {
|
|
const debounceFetchFilterSearch = debounce(props.fetchFilterSearch, 1000)
|
|
const [showModal, setShowModal] = useState(false)
|
|
const [searchQuery, setSearchQuery] = useState('')
|
|
|
|
const onSearchChange = (e, { value }) => {
|
|
setSearchQuery(value)
|
|
debounceFetchFilterSearch({ q: value });
|
|
}
|
|
|
|
const onAddFilter = (filter) => {
|
|
props.addFilterByKeyAndValue(filter.key, filter.value)
|
|
}
|
|
|
|
return (
|
|
<div className="relative">
|
|
<Input
|
|
// inputProps={ { "data-openreplay-label": "Search", "autocomplete": "off" } }
|
|
className={stl.searchField}
|
|
onFocus={ () => setShowModal(true) }
|
|
onBlur={ () => setTimeout(setShowModal, 200, false) }
|
|
onChange={ onSearchChange }
|
|
icon="search"
|
|
placeholder={ 'Find live sessions by user or metadata.'}
|
|
fluid
|
|
id="search"
|
|
type="search"
|
|
autoComplete="off"
|
|
/>
|
|
|
|
{ showModal && (
|
|
<div className="absolute left-0 shadow-sm rounded-lg bg-white z-50">
|
|
<LiveFilterModal
|
|
searchQuery={searchQuery}
|
|
isMainSearch={true}
|
|
onFilterClick={onAddFilter}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default connect(null, { fetchFilterSearch, editFilter, addFilterByKeyAndValue })(LiveSessionSearchField);
|