Skip to content

Commit 63b7636

Browse files
authored
Merge pull request #4 from NetCoreTemplates/feature/kamal-deployment
Fix npm build
2 parents 9267abb + 7100451 commit 63b7636

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

MyApp.Client/src/pages/weather.tsx

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import LayoutPage from "@/components/LayoutPage"
33
import SrcPage from "@/components/SrcPage"
44
import { useClient } from "@/gateway"
55
import { GetWeatherForecast, Forecast } from "@/dtos"
6-
import { columnDefs, DataTable, getCoreRowModel } from "@/components/DataTable.tsx"
6+
import { columnDefs, DataTable, getCoreRowModel } from "@/components/DataTable"
7+
import { CellContext } from "@tanstack/react-table"
78

89
export default (): JSX.Element => {
910
const client = useClient()
@@ -18,17 +19,30 @@ export default (): JSX.Element => {
1819
})()
1920
}, [])
2021

21-
const columns = columnDefs(['date', 'temperatureC', 'temperatureF', 'summary'],
22-
({ temperatureC, temperatureF}) => {
22+
const columns = columnDefs<Forecast>(['date', 'temperatureC', 'temperatureF', 'summary'],
23+
({ temperatureC, temperatureF }) => {
2324
temperatureC.header = "Temp. (C)"
2425
temperatureF.header = "Temp. (F)"
25-
temperatureC.cell = temperatureF.cell = ({ getValue }) => <>{getValue()}&deg;</>
26+
27+
// Properly type the cell renderer function
28+
const tempCellRenderer = ({ getValue }: CellContext<Forecast, number>) => (
29+
<>{getValue()}&deg;</>
30+
)
31+
32+
temperatureC.cell = tempCellRenderer
33+
temperatureF.cell = tempCellRenderer
2634
})
2735

28-
return (<LayoutPage title="Weather">
29-
<DataTable columns={columns} data={forecasts} getCoreRowModel={getCoreRowModel()} />
30-
<div className="mt-8 flex justify-center gap-x-4">
31-
<SrcPage path="weather.tsx" />
32-
</div>
33-
</LayoutPage>)
34-
}
36+
return (
37+
<LayoutPage title="Weather">
38+
<DataTable
39+
columns={columns}
40+
data={forecasts}
41+
getCoreRowModel={getCoreRowModel()}
42+
/>
43+
<div className="mt-8 flex justify-center gap-x-4">
44+
<SrcPage path="weather.tsx" />
45+
</div>
46+
</LayoutPage>
47+
)
48+
}

0 commit comments

Comments
 (0)