* 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, { useEffect } from 'react';
|
|
import { Icon } from 'UI';
|
|
import { Button } from 'antd';
|
|
import { connect } from 'react-redux';
|
|
import { fetchList as fetchListSavedSearch } from 'Duck/search';
|
|
import cn from 'classnames';
|
|
import stl from './SavedSearch.module.css';
|
|
import { useModal } from 'App/components/Modal';
|
|
import SavedSearchModal from './components/SavedSearchModal'
|
|
|
|
interface Props {
|
|
fetchListSavedSearch: () => void;
|
|
list: any;
|
|
savedSearch: any;
|
|
fetchedMeta: boolean
|
|
}
|
|
function SavedSearch(props: Props) {
|
|
const { list } = props;
|
|
const { savedSearch } = props;
|
|
const { showModal } = useModal();
|
|
|
|
useEffect(() => {
|
|
if (list.size === 0 && props.fetchedMeta) {
|
|
props.fetchListSavedSearch()
|
|
}
|
|
}, [props.fetchedMeta])
|
|
|
|
return (
|
|
<div className={cn("flex items-center", { [stl.disabled] : list.size === 0})}>
|
|
<Button
|
|
// variant="outline"
|
|
type='primary'
|
|
ghost
|
|
onClick={() => showModal(<SavedSearchModal />, { right: true, width: 450 })}
|
|
className='flex gap-1'
|
|
>
|
|
<span className="mr-1">Saved Search</span>
|
|
<span className="font-meidum">{list.size}</span>
|
|
<Icon name="ellipsis-v" color="teal" size="14" />
|
|
</Button>
|
|
{ savedSearch.exists() && (
|
|
<div className="flex items-center ml-2">
|
|
<Icon name="search" size="14" />
|
|
<span className="color-gray-medium px-1">Viewing:</span>
|
|
<span className="font-medium" style={{ whiteSpace: 'nowrap', width: '30%' }}>
|
|
{savedSearch.name.length > 15 ? `${savedSearch.name.slice(0, 15)}...` : savedSearch.name}
|
|
</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default connect((state: any) => ({
|
|
list: state.getIn([ 'search', 'list' ]),
|
|
savedSearch: state.getIn([ 'search', 'savedSearch' ]),
|
|
fetchedMeta: state.getIn(['customFields', 'fetchedMetadata'])
|
|
}), { fetchListSavedSearch })(SavedSearch);
|