1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { Grid, Typography } from '@material-ui/core';
7 import { FavoriteStar } from '../favorite-star/favorite-star';
8 import { ResourceKind } from '../../models/resource';
9 import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon } from '../../components/icon/icon';
10 import { formatDate, formatFileSize } from '../../common/formatters';
11 import { resourceLabel } from '../../common/labels';
14 export const renderName = (item: {name: string; uuid: string, kind: string}) =>
15 <Grid container alignItems="center" wrap="nowrap" spacing={16}>
20 <Typography color="primary">
25 <Typography variant="caption">
26 <FavoriteStar resourceUuid={item.uuid} />
32 export const renderIcon = (item: {kind: string}) => {
34 case ResourceKind.PROJECT:
35 return <ProjectIcon />;
36 case ResourceKind.COLLECTION:
37 return <CollectionIcon />;
38 case ResourceKind.PROCESS:
39 return <ProcessIcon />;
41 return <DefaultIcon />;
45 export const renderDate = (date: string) => {
46 return <Typography noWrap>{formatDate(date)}</Typography>;
49 export const renderFileSize = (fileSize?: number) =>
51 {formatFileSize(fileSize)}
54 export const renderOwner = (owner: string) =>
55 <Typography noWrap color="primary" >
59 export const renderType = (type: string) =>
64 export const renderStatus = (item: {status?: string}) =>
65 <Typography noWrap align="center" >