import React from 'react'; import { numberWithCommas } from 'App/utils'; import FilterSelection from "Shared/Filters/FilterSelection/FilterSelection"; import User from './data/User'; import { Pagination } from 'UI'; import { Segmented, Input, Table, Button, Dropdown, Tabs } from 'antd'; import { MoreOutlined } from '@ant-design/icons'; import { TabsProps } from ".store/antd-virtual-7db13b4af6/package"; import { useHistory } from 'react-router-dom'; import { useStore } from 'App/mstore'; import { observer } from 'mobx-react-lite'; import { withSiteId, dataManagement } from "App/routes"; import { Filter } from "lucide-react"; const customTabBar: TabsProps['renderTabBar'] = (props, DefaultTabBar) => ( ); function ListPage() { const { projectsStore } = useStore(); const siteId = projectsStore.activeSiteId; const history = useHistory(); const toUser = (id: string) => history.push(withSiteId(dataManagement.userPage(id), siteId)); const [view, setView] = React.useState('users'); const views = [ { key: 'users', label:
Users
, content:
placeholder
, }, { key: 'events', label:
Events
, content:
placeholder
, }, ]; return (
setView(key)} items={views} renderTabBar={customTabBar} />
{view === 'users' ? : null}
); } function UsersList({ toUser }: { toUser: (id: string) => void }) { const [editCols, setEditCols] = React.useState(false); const testUsers = [ new User({ name: 'test123', userId: 'email@id.com', distinctId: ['123123123'], userLocation: 'NY', cohorts: ['test'], properties: { email: 'sad;jsadk', }, updatedAt: Date.now(), }), new User({ name: 'test123', userId: 'email@id.com', distinctId: ['123123123'], userLocation: 'NY', cohorts: ['test'], properties: { email: 'sad;jsadk', }, updatedAt: Date.now(), }), new User({ name: 'test123', userId: 'email@id.com', distinctId: ['123123123123'], userLocation: 'NY', cohorts: ['test'], properties: { email: 'sad;jsadk', }, updatedAt: Date.now(), }), new User({ name: 'test123', userId: 'email@id.com', distinctId: ['1231214143123'], userLocation: 'NY', cohorts: ['test'], properties: { email: 'sad;jsadk', }, updatedAt: Date.now(), }) ] const dropdownItems = [ { label: 'Show/Hide Columns', key: 'edit-columns', onClick: () => setTimeout(() => setEditCols(true), 1), }, ]; const columns = [ { title: 'Name', dataIndex: 'name', key: 'name', showSorterTooltip: { target: 'full-header' }, sorter: (a, b) => a.name.localeCompare(b.name), }, { title: 'Email', dataIndex: 'userId', key: 'userId', showSorterTooltip: { target: 'full-header' }, sorter: (a, b) => a.userId.localeCompare(b.userId), }, { title: 'Distinct ID', dataIndex: 'distinctId', key: 'distinctId', showSorterTooltip: { target: 'full-header' }, sorter: (a, b) => a.distinctId[0].localeCompare(b.distinctId[0]), }, { title: 'Updated', dataIndex: 'updatedAt', key: 'updatedAt', showSorterTooltip: { target: 'full-header' }, sorter: (a, b) => a.updatedAt.localeCompare(b.updatedAt), }, { title: (
), dataIndex: '$__opts__$', key: '$__opts__$', width: 50, }, ]; const page = 1; const total = 10; const onPageChange = (page: number) => {}; const limit = 10; const list = []; const onAddFilter = () => console.log('add filter'); const excludeFilterKeys = [] const excludeCategory = [] return (
{/* 1.23 -- Show by*/} {/**/}
({ onClick: () => toUser(record.userId), })} pagination={false} rowClassName={'cursor-pointer'} dataSource={testUsers} columns={columns} />
{'Showing '} {(page - 1) * limit + 1} {' to '} {(page - 1) * limit + list.length} {' of '} {numberWithCommas(total)} {' users.'}
); } export default observer(ListPage);