Skip to content

Commit

Permalink
fix: Tusk automated feedback for automated check failure
Browse files Browse the repository at this point in the history
  • Loading branch information
use-tusk[bot] authored Oct 8, 2024
1 parent b9bc435 commit 4650a14
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
3 changes: 3 additions & 0 deletions web/components/shared/themed/table/themedTableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import FiltersButton from "./filtersButton";
import { DragColumnItem } from "./columns/DragList";
import { UIFilterRowTree } from "../../../../services/lib/filters/uiFilterRowTree";
import { Button } from "@/components/ui/button";
import { DateRange } from "react-day-picker";

interface ThemedTableHeaderProps<T> {
rows?: T[];
Expand All @@ -39,6 +40,7 @@ interface ThemedTableHeaderProps<T> {
currentTimeFilter: TimeFilter;
defaultValue: "24h" | "7d" | "1m" | "3m" | "all";
onTimeSelectHandler: (key: TimeInterval, value: string) => void;
onDateChange: (date: DateRange | undefined) => void; // Add this line
};

// define this if you want a table and view toggle
Expand Down Expand Up @@ -112,6 +114,7 @@ export default function ThemedTableHeader<T>(props: ThemedTableHeaderProps<T>) {
isFetching={false}
defaultValue={getDefaultValue()}
custom={true}
onDateChange={timeFilter.onDateChange} // Add this line
/>
) : (
<div />
Expand Down
3 changes: 3 additions & 0 deletions web/components/shared/themed/themedTimeFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useSearchParams from "../utils/useSearchParams";
import { TimeFilter } from "../../templates/dashboard/dashboardPage";
import { ProFeatureWrapper } from "../ProBlockerComponents/ProFeatureWrapper";
import { ThemedTimeFilterShadCN } from "./themedTimeFilterShadCN";
import { DateRange } from "react-day-picker";

interface ThemedTimeFilterProps {
timeFilterOptions: { key: string; value: string }[];
Expand All @@ -14,6 +15,7 @@ interface ThemedTimeFilterProps {
defaultValue: string;
currentTimeFilter: TimeFilter;
custom?: boolean;
onDateChange: (date: DateRange | undefined) => void; // Add this line
}

function formatDateToInputString(date: Date): string {
Expand Down Expand Up @@ -99,6 +101,7 @@ const ThemedTimeFilter = (props: ThemedTimeFilterProps) => {
);
setActive("custom");
onSelect("custom", `${start.toISOString()}_${end.toISOString()}`);
props.onDateChange(newDate); // Add this line
}
}}
initialDateRange={{
Expand Down
20 changes: 1 addition & 19 deletions web/components/templates/dashboard/dashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -582,25 +582,7 @@ const DashboardPage = (props: DashboardPageProps) => {
customTimeFilter: true,
timeFilterOptions: [],
defaultTimeFilter: interval,
onTimeSelectHandler: (key: TimeInterval, value: string) => {
if ((key as string) === "custom") {
value = value.replace("custom:", "");
const start = new Date(value.split("_")[0]);
const end = new Date(value.split("_")[1]);
setInterval(key);
setTimeFilter({
start,
end,
});
} else {
setInterval(key);
setTimeFilter({
start: getTimeIntervalAgo(key),
end: new Date(),
});
}
},
onDateChange: onTimeSelectHandler,
onTimeSelectHandler: onTimeSelectHandler,
}}
advancedFilter={{
filterMap,
Expand Down

0 comments on commit 4650a14

Please sign in to comment.