Skip to content

Commit

Permalink
Update name column for company groups
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlove committed Feb 9, 2024
1 parent a701687 commit 452d610
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions web/gui-v2/src/static_data/table_columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const endArticleIx = overall.years.findIndex(e => e === overall.endArticleYear);
const startPatentIx = overall.years.findIndex(e => e === overall.startPatentYear);
const endPatentIx = overall.years.findIndex(e => e === overall.endPatentYear);

// Start of the fake `cset_id` values used for company groups.
// TODO: Change this to 1000000 once #212 is merged.
const GROUP_OFFSET = 100000;

const styles = {
name: css`
.MuiTableSortLabel-root {
Expand Down Expand Up @@ -116,14 +120,20 @@ const columnDefinitions = [
title: "Company",
key: "name",
css: [styles.name, columnWidth(200)],
format: (name, row) => (
<a
target="_blank"
href={`company/${row.cset_id}-${slugifyCompanyName(name)}`}
>
{name}
</a>
),
format: (name, row) => {
if ( row.cset_id >= GROUP_OFFSET ) {
return <>{name} (average)</>;
} else {
return (
<a
target="_blank"
href={`company/${row.cset_id}-${slugifyCompanyName(name)}`}
>
{name}
</a>
)
}
},
initialCol: true,
dropdownWidth: 240,
sortable: true,
Expand Down

0 comments on commit 452d610

Please sign in to comment.