Skip to content

Commit

Permalink
update past year filter constant
Browse files Browse the repository at this point in the history
  • Loading branch information
aswallace committed Feb 22, 2024
1 parent 61b6d61 commit 15f3dbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 5 additions & 12 deletions packages/core/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@ const DATE_LAST_MONTH = new Date(BEGINNING_OF_TODAY);
DATE_LAST_MONTH.setMonth(BEGINNING_OF_TODAY.getMonth() - 1);
const DATE_LAST_WEEK = new Date(BEGINNING_OF_TODAY);
DATE_LAST_WEEK.setDate(BEGINNING_OF_TODAY.getDate() - 7);
export const PAST_YEAR_FILTER = new FileFilter(
AnnotationName.UPLOADED,
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
);
export const RELATIVE_DATE_RANGES = [
{
name: "Uploaded in last year",
description:
"This will automatically filter files down to those uploaded within the last year",
filters: [
new FileFilter(
AnnotationName.UPLOADED,
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
),
],
filters: [PAST_YEAR_FILTER],
hierarchy: undefined,
sort: undefined,
},
Expand Down Expand Up @@ -106,12 +105,6 @@ export const RELATIVE_DATE_RANGES = [
sort: undefined,
},
];
export const INITIAL_DATE_FILTER = [
new FileFilter(
AnnotationName.UPLOADED,
`RANGE(${DATE_LAST_YEAR.toISOString()},${END_OF_TODAY.toISOString()})`
),
];

export const TOP_LEVEL_FILE_ANNOTATIONS = [
new Annotation({
Expand Down
4 changes: 2 additions & 2 deletions packages/core/state/selection/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { makeReducer } from "@aics/redux-utils";
import { castArray, difference, omit, without } from "lodash";

import interaction from "../interaction";
import { AnnotationName, INITIAL_DATE_FILTER } from "../../constants";
import { AnnotationName, PAST_YEAR_FILTER } from "../../constants";
import Annotation from "../../entity/Annotation";
import FileFilter from "../../entity/FileFilter";
import FileFolder from "../../entity/FileFolder";
Expand Down Expand Up @@ -58,7 +58,7 @@ export const initialState = {
},
displayAnnotations: [],
fileSelection: new FileSelection(),
filters: [...INITIAL_DATE_FILTER],
filters: [PAST_YEAR_FILTER],
openFileFolders: [],
shouldDisplaySmallFont: false,
sortColumn: new FileSort(AnnotationName.UPLOADED, SortOrder.DESC),
Expand Down

0 comments on commit 15f3dbb

Please sign in to comment.