From ee3d0d98e19f1d8177d85af1866fd0ee431fe9ea Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 25 Nov 2018 22:19:15 +0100 Subject: moving stuff --- client/common/table.component.js | 121 --------------------------------------- 1 file changed, 121 deletions(-) delete mode 100644 client/common/table.component.js (limited to 'client/common/table.component.js') diff --git a/client/common/table.component.js b/client/common/table.component.js deleted file mode 100644 index 76a1d57c..00000000 --- a/client/common/table.component.js +++ /dev/null @@ -1,121 +0,0 @@ -import React from 'react' - -import { formatName } from '../util' - -const __HR__ = '__HR__' - -export function TableObject({ tag, object, order, summary }) { - if (!object) return null - if (object === 'loading') { - return
{tag}{': Loading'}
- } - if (object.err) { - return
{tag}{' Error: '}{object.err}
- } - let objects = Object.keys(object) - if (order) { - const grouped = objects.reduce((a, b) => { - const index = order.indexOf(b) - if (index !== -1) { - a.order.push([index, b]) - } else { - a.alpha.push(b) - } - return a - }, { order: [], alpha: [] }) - objects = grouped.order - .sort((a, b) => a[0] - b[0]) - .map(([i, s]) => s) - if (!summary) { - objects = objects - // .concat([__HR__]) - .concat(grouped.alpha.sort()) - } - } else { - objects = objects.sort() - } - return ( -
- {tag &&

{tag}

} - - - {objects.map((key, i) => ( - - ))} - -
-
- ) -} - -export function TableArray({ tag, list }) { - if (!list) return null - return ( -
- {tag &&

{tag}

} - - - {list.map((value, i) => ( - - - - ))} - -
-
- ) -} - -export function TableTuples({ tag, list }) { - if (!list) return null - return ( -
- {tag &&

{tag}

} - - - {list.map(([key, ...values], i) => ( - - - {values.map((value, j) => ( - - ))} - - ))} - -
{formatName(key)}
-
- ) -} - -export function TableRow({ name, value }) { - if (name === __HR__) { - return ( - - -
- - - ) - } - return ( - - {formatName(name)} - - - ) -} - -export function TableCell({ value }) { - if (value && typeof value === 'object') { - if (value._raw) { - value = value.value - } else if (value.length) { - value = - } else { - value = - } - } - return ( - {value} - ) -} -- cgit v1.2.3-70-g09d2