Skip to content

Commit

Permalink
web: make shooters in classifier runs table cliclabke
Browse files Browse the repository at this point in the history
  • Loading branch information
Howler Monkey committed Feb 24, 2024
1 parent db0df34 commit 071a97d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
14 changes: 11 additions & 3 deletions web/src/components/RunsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ const DropdownFilter = ({
/>
);

export const useRunsTableData = ({ division, classifier }) => {
export const useRunsTableData = ({
division,
classifier,
onShooterSelection,
}) => {
const {
query: pageQuery,
reset: resetPage,
Expand Down Expand Up @@ -132,6 +136,7 @@ const RunsTable = ({
setFilter,
setFilterHHF,
setFilterClub,
onShooterSelection,
}) => {
return (
<DataTable
Expand Down Expand Up @@ -172,7 +177,10 @@ const RunsTable = ({
header="Shooter"
sortable
body={(run) => (
<>
<div
style={{ cursor: "pointer" }}
onClick={() => onShooterSelection?.(run.memberNumber)}
>
<div style={{ position: "relative" }}>
{run.memberNumber}
<Tag
Expand All @@ -191,7 +199,7 @@ const RunsTable = ({
/>
</div>
<div style={{ fontSize: 14 }}>{run.name}</div>
</>
</div>
)}
/>
<Column
Expand Down
12 changes: 10 additions & 2 deletions web/src/pages/ClassifiersPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const ClassifiersPage = () => {
() => navigate(`/classifiers/${division}`),
[navigate, division]
);
const onShooterSelection = (memberNumber) =>
navigate(`/shooters/${division}/${memberNumber}`);

const onClubSelection = (club) => navigate("/clubs/" + club);

return (
<div className="mx-">
Expand All @@ -37,6 +41,8 @@ const ClassifiersPage = () => {
division={division}
classifier={classifier}
onBackToClassifiers={onBackToClassifiers}
onShooterSelection={onShooterSelection}
onClubSelection={onClubSelection}
/>
)}
</div>
Expand All @@ -47,6 +53,8 @@ export const ClassifierRunsAndInfo = ({
division,
classifier,
onBackToClassifiers,
onShooterSelection,
onClubSelection,
}) => {
const { info, ...useRunsTableDataResults } = useRunsTableData({
division,
Expand Down Expand Up @@ -79,8 +87,8 @@ export const ClassifierRunsAndInfo = ({

<RunsTable
{...useRunsTableDataResults}
onShooterSelection={(shooter) => navigate("/shooters/" + shooter)}
onClubSelection={(club) => navigate("/clubs/" + club)}
onShooterSelection={onShooterSelection}
onClubSelection={onClubSelection}
/>
</>
);
Expand Down

0 comments on commit 071a97d

Please sign in to comment.