Skip to content

Adding goToPage(0) to Filters from within the Table and the Stats Bar #1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/events/partials/EventsDateCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { editFilterValue } from "../../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../../thunks/tableThunks";
import { getFilters } from "../../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../../store";
import { fetchEvents } from "../../../slices/eventSlice";
Expand Down Expand Up @@ -35,6 +35,7 @@ const EventsDateCell = ({
endDate.setMinutes(59);
endDate.setSeconds(59);

dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: startDate.toISOString() + "/" + endDate.toISOString()}));
await dispatch(fetchEvents());
dispatch(loadEventsIntoTable());
Expand Down
3 changes: 2 additions & 1 deletion src/components/events/partials/EventsLocationCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { getFilters } from "../../../selectors/tableFilterSelectors";
import { editFilterValue } from "../../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../../thunks/tableThunks";
import { useAppDispatch, useAppSelector } from "../../../store";
import { fetchEvents } from "../../../slices/eventSlice";
import { Event } from "../../../slices/eventSlice";
Expand All @@ -23,6 +23,7 @@ const EventsLocationCell = ({
const addFilter = (location: string) => {
let filter = filterMap.find(({ name }) => name === "location");
if (!!filter) {
dispatch(goToPage(0));
dispatch(editFilterValue({filterName: filter.name, value: location}));
dispatch(fetchEvents());
dispatch(loadEventsIntoTable());
Expand Down
3 changes: 2 additions & 1 deletion src/components/events/partials/EventsPresentersCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { getFilters } from "../../../selectors/tableFilterSelectors";
import { editFilterValue } from "../../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../../thunks/tableThunks";
import { useAppDispatch, useAppSelector } from "../../../store";
import { fetchEvents } from "../../../slices/eventSlice";
import { Event } from "../../../slices/eventSlice";
Expand All @@ -25,6 +25,7 @@ const EventsPresentersCell = ({
({ name }) => name === "presentersBibliographic"
);
if (!!filter) {
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: presenter}));
Comment on lines +28 to 29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the indentation:

Suggested change
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: presenter}));
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: presenter}));

await dispatch(fetchEvents());
dispatch(loadEventsIntoTable());
Expand Down
3 changes: 2 additions & 1 deletion src/components/events/partials/EventsSeriesCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { getFilters } from "../../../selectors/tableFilterSelectors";
import { editFilterValue } from "../../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../../thunks/tableThunks";
import { useAppDispatch, useAppSelector } from "../../../store";
import { fetchEvents } from "../../../slices/eventSlice";
import { Event } from "../../../slices/eventSlice";
Expand All @@ -23,6 +23,7 @@ const EventsSeriesCell = ({
const addFilter = async (seriesId: string) => {
let filter = filterMap.find(({ name }) => name === "series");
if (!!filter) {
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: seriesId}));
Comment on lines +26 to 27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation:

Suggested change
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: seriesId}));
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: seriesId}));

await dispatch(fetchEvents());
dispatch(loadEventsIntoTable());
Expand Down
3 changes: 2 additions & 1 deletion src/components/events/partials/EventsTechnicalDateCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { useTranslation } from "react-i18next";
import { getFilters } from "../../../selectors/tableFilterSelectors";
import { editFilterValue } from "../../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../../thunks/tableThunks";
import { useAppDispatch, useAppSelector } from "../../../store";
import { fetchEvents } from "../../../slices/eventSlice";
import { renderValidDate } from "../../../utils/dateUtils";
Expand All @@ -26,6 +26,7 @@ const EventsTechnicalDateCell = ({
const addFilter = async (date: string) => {
let filter = filterMap.find(({ name }) => name === "technicalStart");
if (!!filter) {
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: date + "/" + date}));
Comment on lines +29 to 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation:

Suggested change
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: date + "/" + date}));
dispatch(goToPage(0));
await dispatch(editFilterValue({filterName: filter.name, value: date + "/" + date}));

await dispatch(fetchEvents());
dispatch(loadEventsIntoTable());
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
editTextFilter,
removeTextFilter,
} from "../../slices/tableFilterSlice";
import { loadEventsIntoTable } from "../../thunks/tableThunks";
import { loadEventsIntoTable, goToPage } from "../../thunks/tableThunks";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchEvents } from "../../slices/eventSlice";
import { ParseKeys } from "i18next";
Expand Down Expand Up @@ -38,6 +38,7 @@ const Stats = () => {
let filter = filterMap.find(({ name }) => name === f.name);
filterValue = f.value;
if (!!filter) {
dispatch(goToPage(0));
dispatch(editFilterValue({filterName: filter.name, value: filterValue}));
Comment on lines +41 to 42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation:

Suggested change
dispatch(goToPage(0));
dispatch(editFilterValue({filterName: filter.name, value: filterValue}));
dispatch(goToPage(0));
dispatch(editFilterValue({filterName: filter.name, value: filterValue}));

}
});
Expand Down
Loading