import React from 'react';
import { Input, Table, Button, Dropdown } from 'antd';
import { MoreOutlined } from '@ant-design/icons';
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, Album } from 'lucide-react';
import { list } from '../Activity/Page';
import OutsideClickDetectingDiv from 'Shared/OutsideClickDetectingDiv';
import ColumnsModal from 'Components/DataManagement/Activity/ColumnsModal';
import FullPagination from 'Shared/FullPagination';
import Tabs from 'Shared/Tabs'
function ListPage() {
const [view, setView] = React.useState('users');
const views = [
{
key: 'users',
label:
Users
,
},
{
key: 'events',
label: Events
,
},
];
const { projectsStore } = useStore();
const siteId = projectsStore.activeSiteId;
const history = useHistory();
const toUser = (id: string) =>
history.push(withSiteId(dataManagement.userPage(id), siteId));
const toEvent = (id: string) =>
history.push(withSiteId(dataManagement.eventPage(id), siteId));
return (
setView(key)}
items={views}
/>
}>
Docs
{view === 'users' ?
:
}
);
}
function EventPropsList({ toEvent }: { toEvent: (id: string) => void }) {
const columns = [
{
title: 'Property',
dataIndex: 'name',
key: 'name',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.name.localeCompare(b.name),
},
{
title: 'Display Name',
dataIndex: 'displayName',
key: 'displayName',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.displayName.localeCompare(b.displayName),
},
{
title: 'Description',
dataIndex: 'description',
key: 'description',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.description.localeCompare(b.description),
},
{
title: '30 Day Volume',
dataIndex: 'monthVolume',
key: 'monthVolume',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.monthVolume.localeCompare(b.monthVolume),
},
];
const page = 1;
const total = 100;
const onPageChange = (page: number) => {};
const limit = 10;
return (
({
onClick: () => toEvent(record.eventId),
})}
/>
);
}
function UserPropsList({ toUser }: { toUser: (id: string) => void }) {
const [editCols, setEditCols] = React.useState(false);
const [hiddenCols, setHiddenCols] = React.useState([]);
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: 'Display Name',
dataIndex: 'displayName',
key: 'displayName',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.displayName.localeCompare(b.displayName),
},
{
title: 'Description',
dataIndex: 'description',
key: 'description',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.description.localeCompare(b.description),
},
{
title: '# Users',
dataIndex: 'users',
key: 'users',
showSorterTooltip: { target: 'full-header' },
sorter: (a, b) => a.users.localeCompare(b.users),
},
{
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 = [];
const shownCols = columns.map((col) => ({
...col,
hidden: hiddenCols.includes(col.key),
}));
const onUpdateVisibleCols = (cols: string[]) => {
setHiddenCols((_) => {
return columns
.map((col) =>
cols.includes(col.key) || col.key === '$__opts__$' ? null : col.key
)
.filter(Boolean);
});
setEditCols(false);
};
return (
{editCols ? (
setEditCols(false)}>
col.key !== '$__opts__$')}
onSelect={onUpdateVisibleCols}
hiddenCols={hiddenCols}
topOffset={'top-24 -mt-4'}
/>
) : null}
({
onClick: () => toUser(record.userId),
})}
pagination={false}
rowClassName={'cursor-pointer'}
dataSource={[]}
columns={shownCols}
/>
);
}
export default observer(ListPage);