import {ColumnConfig} from '@common/datatable/column-config'; import {Trans} from '@common/i18n/trans'; import {FormattedDate} from '@common/i18n/formatted-date'; import {Link} from 'react-router-dom'; import {IconButton} from '@common/ui/buttons/icon-button'; import {EditIcon} from '@common/icons/material/Edit'; import React from 'react'; import {Channel} from '@common/channels/channel'; import {Chip} from '@common/ui/forms/input-field/chip-field/chip'; import {Tooltip} from '@common/ui/tooltip/tooltip'; import {useSettings} from '@common/core/settings/use-settings'; import {HomeIcon} from '@common/icons/material/Home'; export const ChannelsDatatableColumns: ColumnConfig[] = [ { key: 'name', allowsSorting: true, width: 'flex-3', visibleInMode: 'all', header: () => , body: channel => { return (
{channel.config.adminDescription && (

{channel.config.adminDescription}

)}
); }, }, { key: 'content', allowsSorting: false, header: () => , body: channel => , }, { key: 'content_type', allowsSorting: false, header: () => , body: channel => ( {channel.config.contentModel ? ( ) : undefined} ), }, { key: 'internal', allowsSorting: true, maxWidth: 'max-w-100', hideHeader: true, header: () => , body: channel => , }, { key: 'updated_at', allowsSorting: true, maxWidth: 'max-w-100', header: () => , body: channel => channel.updated_at ? : '', }, { key: 'actions', header: () => , hideHeader: true, visibleInMode: 'all', align: 'end', width: 'w-42 flex-shrink-0', body: channel => ( ), }, ]; interface ContentTypeProps { channel: Channel; } function ContentType({channel}: ContentTypeProps) { switch (channel.config.contentType) { case 'listAll': return ; case 'manual': return ; case 'autoUpdate': return ; } } interface ChannelNameProps { channel: Channel; } function ChannelName({channel}: ChannelNameProps) { // link will not work without specific genre name in channel url if ( channel.config.restriction && channel.config.restrictionModelId === 'urlParam' ) { return channel.name; } return ( {channel.name} ); } function InternalColumn({channel}: ChannelNameProps) { const {homepage} = useSettings(); const internalLabel = channel.internal ? ( } >
) : ( '' ); const isHomepage = homepage?.type === 'channels' && `${homepage.value}` === `${channel.id}`; return (
{internalLabel} {isHomepage ? : null}
); }