Skip to content

Commit

Permalink
lint / cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nofurtherinformation committed May 1, 2024
1 parent c083794 commit fedef16
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const Map: React.FC<MapProps> = ({ initialFilter }) => {
<Select.ItemIndicator className="SelectItemIndicator">
<CheckboxIcon />
</Select.ItemIndicator>
</Select.Item>
</Select.Item>
))}
</>
</SelectMenu>
Expand Down
1 change: 1 addition & 0 deletions utils/data/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export const tooltipConfig: Array<{
],
},
]

export const defaultColumnGroup: keyof typeof columnGroups = Object.entries(columnGroups).find(([_k, v]) =>
v.columns.includes(defaultColumn)
)![0]
Expand Down
4 changes: 2 additions & 2 deletions utils/data/service/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ export class DataService {
for (const column of section.columns) {
// @ts-ignore
const columnConfig = columnsDict[column.col]
const data = await this.runQuery(`
SELECT "${columnConfig.column}" as "${columnConfig.name}" FROM ${this.getFromQueryString(columnConfig.table)} WHERE "${columnConfig.idColumn}" LIKE '${id}%'
// @ts-ignore
const data = await this.runQuery(`SELECT "${columnConfig.column}" as "${columnConfig.name}" FROM ${this.getFromQueryString(columnConfig.table)} WHERE "${columnConfig.idColumn}" LIKE '${id}%'
`)
sectionData.columns.push({
...column,
Expand Down
55 changes: 31 additions & 24 deletions utils/hooks/useDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,48 @@ export const useDataService = () => {
}
const currentColumn = useAppSelector((state) => state.map.currentColumn)
const currentColumnGroup = useAppSelector((state) => state.map.currentColumnGroup)
// @ts-ignore
const currentColumnSpec = columnsDict[currentColumn]!
if (!currentColumnSpec) {
throw new Error(`Invalid column ${currentColumn}`)
}
const currentData = currentColumnSpec?.bivariate ? currentColumnSpec.tables : currentColumnSpec.table
const isReady = Array.isArray(currentData) ? currentData.every(t => completeData.includes(t)) : completeData.includes(currentData)
const isReady = Array.isArray(currentData)
// @ts-ignore
? currentData.every((t) => completeData.includes(t))
: completeData.includes(currentData)
const isBivariate = currentColumnSpec?.bivariate || false
const column = currentColumnSpec.column
const manualBreaks = isBivariate ? undefined : currentColumnSpec?.manualBreaks
const colorScheme = currentColumnSpec?.colorScheme || "schemeYlOrRd"
const reversed = currentColumnSpec?.reversed || false
const nBins = isBivariate ? 3 : (currentColumnSpec?.nBins || 5)
const colorScheme = currentColumnSpec?.colorScheme || "schemeYlOrRd"
const reversed = currentColumnSpec?.reversed || false
const nBins = isBivariate ? 3 : currentColumnSpec?.nBins || 5
const table = currentColumnSpec?.bivariate ? currentColumnSpec?.tables : currentColumnSpec.table
const idColumn = currentColumnSpec?.bivariate ? currentColumnSpec?.idColumns : currentColumnSpec.idColumn

const { colorFunc, breaks, colors } = useMapColor({
bivariate: currentColumnSpec?.bivariate || false,
table,
column,
idColumn,
// @ts-ignore
colorScheme,
reversed,
filter,
nBins,
// breaksSchema: manualBreaks ? {
// type: "manual",
// breaks: manualBreaks
// } : {
// type: "quantile",
// nBins
// }
}, isReady)
const { colorFunc, breaks, colors } = useMapColor(
{
bivariate: currentColumnSpec?.bivariate || false,
table,
column,
idColumn,
// @ts-ignore
colorScheme,
reversed,
filter,
nBins,
// breaksSchema: manualBreaks ? {
// type: "manual",
// breaks: manualBreaks
// } : {
// type: "quantile",
// nBins
// }
},
isReady
)
// console.log(breaks, colors)

return {
testfn: () => {},
ds,
Expand All @@ -69,6 +76,6 @@ export const useDataService = () => {
currentColumnGroup,
filter,
setCurrentData,
isBivariate
isBivariate,
}
}

0 comments on commit fedef16

Please sign in to comment.