This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99} from "./util" ;
1010
1111const axiosOptions = {
12- timeout : 20000 ,
12+ timeout : 30000 ,
1313 headers : {
1414 "Content-Type" : "application/json" ,
1515 } ,
Original file line number Diff line number Diff line change @@ -378,6 +378,10 @@ function Application(): JSX.Element | null {
378378 return < Loader /> ;
379379 }
380380
381+ if ( ! application ) {
382+ return null ;
383+ }
384+
381385 const notificationContent : { heading : string ; body : string } | undefined =
382386 statusNotification
383387 ? {
Original file line number Diff line number Diff line change @@ -214,6 +214,10 @@ function ApplicationDetails(): JSX.Element | null {
214214 return < Loader /> ;
215215 }
216216
217+ if ( ! application ) {
218+ return null ;
219+ }
220+
217221 const isOrganisation = Boolean ( application ?. organisation ) ;
218222
219223 const hasBillingAddress =
Original file line number Diff line number Diff line change @@ -151,6 +151,10 @@ function ReservationByApplicationEvent(): JSX.Element | null {
151151 return < Loader /> ;
152152 }
153153
154+ if ( ! application ) {
155+ return null ;
156+ }
157+
154158 const customerName = applicantName ( application ) ;
155159
156160 const applicationEvent : ApplicationEvent | undefined =
Original file line number Diff line number Diff line change @@ -9,12 +9,13 @@ import {
99} from "../../common/types" ;
1010import { formatDuration } from "../../common/util" ;
1111
12- export const applicantName = (
13- application : Application | null
14- ) : string | null | undefined =>
15- application ?. applicantType === "individual"
16- ? application ?. applicantName
17- : application ?. organisation ?. name ;
12+ export const applicantName = ( app : Application ) : string => {
13+ return app . applicantType === "individual"
14+ ? `${ app . contactPerson ?. firstName || "-" } ${
15+ app . contactPerson ?. lastName || "-"
16+ } `
17+ : app . organisation ?. name || "-" ;
18+ } ;
1819
1920export const getApplicationStatusColor = (
2021 status : ApplicationStatus ,
Original file line number Diff line number Diff line change @@ -410,7 +410,7 @@ function Review({ applicationRound }: IProps): JSX.Element | null {
410410 < StyledLink
411411 to = { `${ applicationDetailsUrl ( id ) } #${ eventId } ` }
412412 >
413- { applicant }
413+ { truncate ( applicant , 20 ) }
414414 </ StyledLink >
415415 ) ,
416416 } ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 Unit ,
1212} from "../../common/types" ;
1313import {
14+ applicantName ,
1415 applicationHours ,
1516 applicationTurns ,
1617 getNormalizedApplicationStatus ,
@@ -71,18 +72,14 @@ export const appMapper = (
7172 app . status ,
7273 applicationStatusView
7374 ) ;
75+
76+ const applicant = applicantName ( app ) ;
7477 return {
7578 key : `${ app . id } -${ eventId || "-" } ` ,
7679 id : app . id ,
7780 eventId,
78- applicant :
79- app . applicantType === "individual"
80- ? app . applicantName || ""
81- : app . organisation ?. name || "" ,
82- applicantSort : ( app . applicantType === "individual"
83- ? app . applicantName || ""
84- : app . organisation ?. name || ""
85- ) . toLowerCase ( ) ,
81+ applicant,
82+ applicantSort : applicant . toLowerCase ( ) ,
8683 type : app . applicantType
8784 ? t ( `Application.applicantTypes.${ app . applicantType } ` )
8885 : "" ,
Original file line number Diff line number Diff line change @@ -36,26 +36,30 @@ export const NotificationContextProvider: React.FC = ({ children }) => {
3636 setTimeout ( ( ) => setNotification ( null ) , 1000 * 5 ) ;
3737 } ;
3838
39+ function notifyError ( title : string , message ?: string ) {
40+ showDisappearingNotification ( {
41+ type : "error" ,
42+ title,
43+ message : message || null ,
44+ } ) ;
45+ }
46+
47+ function notifySuccess ( title : string , message ?: string ) {
48+ showDisappearingNotification ( {
49+ type : "success" ,
50+ title,
51+ message : message || null ,
52+ } ) ;
53+ }
54+
3955 return (
4056 < NotificationContext . Provider
4157 value = { {
4258 notification,
4359 setNotification : showDisappearingNotification ,
4460 clearNotification,
45- notifyError : ( title , message ?) => {
46- showDisappearingNotification ( {
47- type : "error" ,
48- title,
49- message : message || null ,
50- } ) ;
51- } ,
52- notifySuccess : ( title , message ?) => {
53- showDisappearingNotification ( {
54- type : "success" ,
55- title,
56- message : message || null ,
57- } ) ;
58- } ,
61+ notifyError,
62+ notifySuccess,
5963 } }
6064 >
6165 { children }
You can’t perform that action at this time.
0 commit comments