generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.6.9' into CE-1254-rebranch
- Loading branch information
Showing
31 changed files
with
388 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { createParamDecorator, ExecutionContext } from "@nestjs/common"; | ||
|
||
// Returns the user off of the request object. | ||
// Sample usage: foo(@User() user) {...} | ||
export const User = createParamDecorator((data: unknown, ctx: ExecutionContext) => { | ||
const request = ctx.switchToHttp().getRequest(); | ||
return request.user; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { FC } from "react"; | ||
import DatePicker from "react-datepicker"; | ||
|
||
interface Props { | ||
id: string; | ||
label: string; | ||
startDate: Date | undefined; | ||
endDate: Date | undefined; | ||
handleDateChange: (dates: [Date, Date]) => void; | ||
} | ||
|
||
export const FilterDate: FC<Props> = ({ id, label, startDate, endDate, handleDateChange }) => { | ||
// manual entry of date change listener. Looks for a date range format of {yyyy-mm-dd} - {yyyy-mm-dd} | ||
const handleManualDateChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
if (e?.target?.value?.includes(" - ")) { | ||
const [startDateStr, endDateStr] = e.target.value.split(" - "); | ||
const startDate = new Date(startDateStr); | ||
const endDate = new Date(endDateStr); | ||
|
||
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) { | ||
// Invalid date format | ||
return [null, null]; | ||
} else { | ||
// add 1 to date because days start at 0 | ||
startDate.setDate(startDate.getDate() + 1); | ||
endDate.setDate(endDate.getDate() + 1); | ||
|
||
handleDateChange([startDate, endDate]); | ||
} | ||
} | ||
return [null, null]; | ||
}; | ||
|
||
return ( | ||
<div id={id}> | ||
<label htmlFor="date-range-picker-id">{label}</label> | ||
<div className="filter-select-padding"> | ||
<DatePicker | ||
id={`date-range-picker-${id}`} | ||
showIcon={true} | ||
renderCustomHeader={({ monthDate, customHeaderCount, decreaseMonth, increaseMonth }) => ( | ||
<div> | ||
<button | ||
aria-label="Previous Month" | ||
className={`react-datepicker__navigation react-datepicker__navigation--previous ${ | ||
customHeaderCount === 1 ? "datepicker-nav-hidden" : "datepicker-nav-visible" | ||
}`} | ||
onClick={decreaseMonth} | ||
> | ||
<span | ||
className={ | ||
"react-datepicker__navigation-icon react-datepicker__navigation-icon--previous datepicker-nav-icon" | ||
} | ||
> | ||
{"<"} | ||
</span> | ||
</button> | ||
<span className="react-datepicker__current-month"> | ||
{monthDate.toLocaleString("en-US", { | ||
month: "long", | ||
year: "numeric", | ||
})} | ||
</span> | ||
<button | ||
aria-label="Next Month" | ||
className={`react-datepicker__navigation react-datepicker__navigation--next ${ | ||
customHeaderCount === 1 ? "datepicker-nav-hidden" : "datepicker-nav-visible" | ||
}`} | ||
onClick={increaseMonth} | ||
> | ||
<span | ||
className={ | ||
"react-datepicker__navigation-icon react-datepicker__navigation-icon--next datepicker-nav-icon" | ||
} | ||
> | ||
{">"} | ||
</span> | ||
</button> | ||
</div> | ||
)} | ||
selected={startDate} | ||
onChange={handleDateChange} | ||
onChangeRaw={handleManualDateChange} | ||
startDate={startDate} | ||
endDate={endDate} | ||
dateFormat="yyyy-MM-dd" | ||
monthsShown={2} | ||
selectsRange={true} | ||
isClearable={true} | ||
wrapperClassName="comp-filter-calendar-input" | ||
showPreviousMonths | ||
maxDate={new Date()} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.