Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alnasir7 committed Mar 5, 2021
1 parent 6eb0b83 commit b2ec735
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 65 deletions.
7 changes: 6 additions & 1 deletion frontend/components/ClubEditPage/EventsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ const eventTableFields = [
{
name: 'is_ics_event',
label: 'ICS',
converter: (a: boolean): ReactElement => <Icon className={`has-text-${a ? 'has-text-success' : 'has-text-danger'}`} name={a ? 'check' : 'x'} />,
converter: (a: boolean): ReactElement => (
<Icon
className={`has-text-${a ? 'has-text-success' : 'has-text-danger'}`}
name={a ? 'check' : 'x'}
/>
),
},
]

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/ClubEditPage/MembersCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function MembersCard({ club }: MembersCardProps): ReactElement {
filterFunction: (selection, object) => object.active === selection,
},
]}
searchableColumns = {["name", "email"]}
searchableColumns={['name', 'email']}
currentTitle={(obj) =>
obj != null ? `${obj.name} (${obj.email})` : 'Kicked Member'
}
Expand Down
4 changes: 1 addition & 3 deletions frontend/components/ModelForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ export const ModelTable = ({
? objects?.filter((item) => item.id === id)[0]
: objects?.[id]
const value = obj?.[column.name]
return obj && !(value === null)
? renderFunction(value, obj)
: 'None'
return obj && !(value === null) ? renderFunction(value, obj) : 'None'
},
}
} else return column
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/PaginatedClubDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const PaginatedClubDisplay = ({
if (nextUrl == null) {
return null
}

setLoading(true)

// fetch the entry
Expand Down
126 changes: 67 additions & 59 deletions frontend/components/common/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const Table = ({
}

const handleColumnsSort = (target) => {
if (sortedColumn && (sortedColumn.name === target)) {
if (sortedColumn && sortedColumn.name === target) {
if (sortedColumn.status === 'asc') {
setSortedColumn({ name: target, status: 'desc' })
} else {
Expand All @@ -218,7 +218,7 @@ const Table = ({

return (
<Styles>
<Toolbar className = "is-clearfix">
<Toolbar className="is-clearfix">
<div className="is-pulled-right">
<SearchWrapper>
<Input
Expand All @@ -231,39 +231,41 @@ const Table = ({
/>
</SearchWrapper>
</div>
<div className="is-pulled-left is-clearfix" style={{ width: '70%'}}>
{filterOptions &&
filterOptions.map((filterOption) => (
<span style={{ marginRight: '10px', width:"40%", float:"left"}}>
<Select
value={
selectedFilter[filterOption.label]
? {
label: selectedFilter[filterOption.label].label,
value: selectedFilter[filterOption.label].key,
}
: null
}
styles={styles}
components={components}
onChange={(value) =>
handleFilterChange({
value: value || null,
label: filterOption.label ? filterOption.label : null,
})
}
isClearable={true}
placeholder={`Filter by ${titleize(filterOption.label)}`}
options={filterOption.options.map((option) => {
return { value: option.key, label: option.label }
})}
/>
</span>
))}
<div className="is-pulled-left is-clearfix" style={{ width: '70%' }}>
{filterOptions &&
filterOptions.map((filterOption) => (
<span
style={{ marginRight: '10px', width: '40%', float: 'left' }}
>
<Select
value={
selectedFilter[filterOption.label]
? {
label: selectedFilter[filterOption.label].label,
value: selectedFilter[filterOption.label].key,
}
: null
}
styles={styles}
components={components}
onChange={(value) =>
handleFilterChange({
value: value || null,
label: filterOption.label ? filterOption.label : null,
})
}
isClearable={true}
placeholder={`Filter by ${titleize(filterOption.label)}`}
options={filterOption.options.map((option) => {
return { value: option.key, label: option.label }
})}
/>
</span>
))}
</div>
</Toolbar>

{tableData.length > 0 ? (
{headerGroups.length > 0 ? (
<table className="table is-fullwidth" {...getTableProps()}>
<thead>
{headerGroups.map((headerGroup) => (
Expand Down Expand Up @@ -291,35 +293,41 @@ const Table = ({
</tr>
))}
</thead>
<tbody {...getTableBodyProps()}>
{page.map((row) => {
prepareRow(row)
return (
<tr key={row.id} {...row.getRowProps()}>
{columns.map((column, i) => {
return (
<td key={i}>
{column.render ? (
column.render(row.original.id) ? (
column.render(row.original.id)
{tableData.length > 0 ? (
<tbody {...getTableBodyProps()}>
{page.map((row) => {
prepareRow(row)
return (
<tr key={row.id} {...row.getRowProps()}>
{columns.map((column, i) => {
return (
<td key={i}>
{column.render ? (
column.render(row.original.id) ? (
column.render(row.original.id)
) : (
<GreyText>None</GreyText>
)
) : row.original[column.name] ? (
row.original[column.name]
) : (
<GreyText>None</GreyText>
)
) : row.original[column.name] ? (
row.original[column.name]
) : (
<GreyText>None</GreyText>
)}
</td>
)
})}
</tr>
)
})}
</tbody>
)}
</td>
)
})}
</tr>
)
})}
</tbody>
) : data.length === 0 ? (
<h1>No items to show</h1>
) : (
<h1>No matches were found. Please change your filters.</h1>
)}
</table>
) : data.length === 0 ? ( <h1>No items to show</h1> ) : (
<h1>No matches were found. Please change your filters.</h1>
) : (
<h1>Nothing to Show</h1>
)}
{pageOptions.length > 1 && (
<div className="is-clearfix">
Expand All @@ -334,7 +342,7 @@ const Table = ({
<button
style={{ marginRight: '0.5rem' }}
className="is-light is-small"
onClick={() => previousPage()}
onClick={() => previousPage()}
disabled={!canPreviousPage}
>
{'<'}
Expand Down

0 comments on commit b2ec735

Please sign in to comment.