mirror of
https://github.com/zhigang1992/devhub.git
synced 2026-06-18 12:14:42 +08:00
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import React, { useState } from 'react'
|
|
|
|
import {
|
|
NotificationCardsContainer,
|
|
NotificationCardsContainerProps,
|
|
} from '../../containers/NotificationCardsContainer'
|
|
import { getColumnHeaderDetails } from '../../utils/helpers/github/events'
|
|
import { Column } from './Column'
|
|
import { ColumnHeader } from './ColumnHeader'
|
|
import { ColumnHeaderItem } from './ColumnHeaderItem'
|
|
import { EventColumnOptions } from './ColumnOptions'
|
|
|
|
export interface NotificationColumnProps
|
|
extends NotificationCardsContainerProps {
|
|
columnIndex: number
|
|
pagingEnabled?: boolean
|
|
}
|
|
|
|
export function NotificationColumn(props: NotificationColumnProps) {
|
|
const [showColumnOptions, setShowColumnOptions] = useState(false)
|
|
|
|
const { column, columnIndex, pagingEnabled, subscriptions } = props
|
|
|
|
const requestTypeIconAndData = getColumnHeaderDetails(column, subscriptions)
|
|
|
|
return (
|
|
<Column
|
|
key={`notification-column-${column.id}-inner`}
|
|
columnId={column.id}
|
|
pagingEnabled={pagingEnabled}
|
|
>
|
|
<ColumnHeader>
|
|
<ColumnHeaderItem
|
|
iconName={requestTypeIconAndData.icon}
|
|
style={{ flex: 1 }}
|
|
subtitle={requestTypeIconAndData.subtitle}
|
|
title={requestTypeIconAndData.title}
|
|
/>
|
|
|
|
<ColumnHeaderItem
|
|
iconName="settings"
|
|
onPress={() => setShowColumnOptions(!showColumnOptions)}
|
|
/>
|
|
</ColumnHeader>
|
|
|
|
{!!showColumnOptions && (
|
|
<EventColumnOptions column={column} columnIndex={columnIndex} />
|
|
)}
|
|
|
|
<NotificationCardsContainer
|
|
repoIsKnown={requestTypeIconAndData.repoIsKnown}
|
|
{...props}
|
|
/>
|
|
</Column>
|
|
)
|
|
}
|