123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import {useState} from 'react';
- import styled from '@emotion/styled';
- import AssigneeSelectorDropdown, {
- AssigneeWrapper,
- } from 'sentry/components/assigneeSelectorDropdown';
- import GridEditable, {type GridColumnOrder} from 'sentry/components/gridEditable';
- import {Grid} from 'sentry/components/gridEditable/styles';
- import {GroupSummary} from 'sentry/components/group/groupSummary';
- import TimeSince from 'sentry/components/timeSince';
- import type {Group} from 'sentry/types/group';
- function IssuesList() {
- const [activeRowKey, setActiveRowKey] = useState<number | undefined>(undefined);
- const columnOrder: Array<GridColumnOrder<keyof Group>> = [
- {key: 'title', name: 'Issue'},
- {key: 'lastSeen', name: 'Age'},
- {key: 'assignedTo', name: 'Assignee'},
- ];
- const renderHeadCell = (column: GridColumnOrder) => column.name;
- const renderBodyCell = (column: GridColumnOrder<keyof Group>, dataRow: Group) => {
- switch (column.key) {
- case 'title':
- return (
- <GroupSummary
- group={dataRow}
- event={dataRow.latestEvent}
- project={dataRow.project}
- />
- );
- case 'lastSeen':
- return <TimeSince date={dataRow.lastSeen} unitStyle="extraShort" suffix="" />;
- case 'assignedTo':
- return <AssigneeSelectorDropdown group={dataRow} loading={false} />;
- default:
- return null;
- }
- };
- return (
- <Wrapper>
- <GridEditable
- data={[]}
- columnOrder={columnOrder}
- columnSortBy={[]}
- grid={{
- renderHeadCell,
- renderBodyCell,
- }}
- onRowMouseOver={(_dataRow, key) => {
- setActiveRowKey(key);
- }}
- onRowMouseOut={() => {
- setActiveRowKey(undefined);
- }}
- highlightedRowKey={activeRowKey}
- />
- </Wrapper>
- );
- }
- const Wrapper = styled('div')`
- ${Grid} {
- grid-template-columns: 3fr 1fr 1fr !important;
- }
- ${AssigneeWrapper} {
- justify-content: flex-start;
- }
- `;
- export default IssuesList;
|