Skip to content

Commit

Permalink
fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Oct 14, 2024
1 parent c02127a commit 10fed3a
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,7 @@ function ListTable ({
}) {
const list = useList(listKey)
const { query } = useRouter()
const shouldShowLinkIcon =
!list.fields[selectedFields.keys().next().value].views.Cell.supportsLinkTo
const shouldShowLinkIcon = selectedFields.keys().some((k, i) => !list.fields[k].views.Cell.supportsLinkTo && i === 0)
return (
<Box paddingBottom="xlarge">
<TableContainer>
Expand Down Expand Up @@ -620,9 +619,7 @@ function ListTable ({
{shouldShowLinkIcon && <TableHeaderCell />}
{[...selectedFields].map(path => {
const label = list.fields[path].label
if (!orderableFields.has(path)) {
return <TableHeaderCell key={path}>{label}</TableHeaderCell>
}
if (!orderableFields.has(path)) return <TableHeaderCell key={path}>{label}</TableHeaderCell>
return (
<TableHeaderCell key={path}>
<Link
Expand Down Expand Up @@ -706,11 +703,9 @@ function ListTable ({
)}
{[...selectedFields].map((path, i) => {
const field = list.fields[path]
let { Cell } = list.fields[path].views
const { Cell } = list.fields[path].views
const itemForField: Record<string, any> = {}
for (const graphqlField of getRootGraphQLFieldsFromFieldController(
field.controller
)) {
for (const graphqlField of getRootGraphQLFieldsFromFieldController(field.controller)) {
const fieldGetter = itemGetter.get(graphqlField)
if (fieldGetter.errors) {
const errorMessage = fieldGetter.errors[0].message
Expand Down Expand Up @@ -759,7 +754,7 @@ function ListTable ({
)
}

const TableContainer = ({ children }: { children: ReactNode }) => {
function TableContainer ({ children }: { children: ReactNode }) {
return (
<table
css={{
Expand All @@ -775,15 +770,15 @@ const TableContainer = ({ children }: { children: ReactNode }) => {
)
}

const TableHeaderRow = ({ children }: { children: ReactNode }) => {
function TableHeaderRow ({ children }: { children: ReactNode }) {
return (
<thead>
<tr>{children}</tr>
</thead>
)
}

const TableHeaderCell = (props: HTMLAttributes<HTMLElement>) => {
function TableHeaderCell (props: HTMLAttributes<HTMLElement>) {
const { colors, spacing, typography } = useTheme()
return (
<th
Expand All @@ -803,7 +798,7 @@ const TableHeaderCell = (props: HTMLAttributes<HTMLElement>) => {
)
}

const TableBodyCell = (props: HTMLAttributes<HTMLElement>) => {
function TableBodyCell (props: HTMLAttributes<HTMLElement>) {
const { colors, typography } = useTheme()
return (
<td
Expand Down

0 comments on commit 10fed3a

Please sign in to comment.