{"version":3,"sources":["webpack:///./wwwroot/Scripts/src/components/ChaptersListingRedirect.tsx"],"names":["buildInitialState","props","initialState","keywords","selectedCategory","undefined","selectedChapter","Chapters","length","selectedYearMonth","redirectUrl","ChaptersListingRedirect","_useReducer","useReducer","prevState","Chapterstate","_objectSpread","_useReducer2","_slicedToArray","state","setState","search","filter","getHashParams","window","location","href","Value","Utils","cat","Title","ym","q","useEffect","ListingUrl","React","className","style","backgroundImage","concat","BackgroundImage","GenericDropdown","dataSource","getId","x","renderItem","renderSelectedItem","nullSelectionText","allowNullSelection","selectedValue","onSelectedItemChanged","Categories","YearMonths","Input","onChange","e","target","value","onKeyPress","key","preventDefault","placeholder","Button","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA+B;AACe;AACO;AACI;AAKvB;AAwBlC,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAmC,EAAK;EAE/D,IAAIC,YAA0C,GAAG;IAC7CC,QAAQ,EAAE,EAAE;IACZC,gBAAgB,EAAEC,SAAS;IAC3BC,eAAe,EAAE,CAACL,KAAK,CAACM,QAAQ,IAAI,EAAE,EAAEC,MAAM,GAAG,CAAC,GAAGP,KAAK,CAACM,QAAQ,CAAC,CAAC,CAAC,GAAGF,SAAS;IAClFI,iBAAiB,EAAEJ,SAAS;IAC5BK,WAAW,EAAE;EACjB,CAAC;EAED,OAAOR,YAAY;AACvB,CAAC;AAED,IAAMS,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAIV,KAAmC,EAAK;EAErE,IAAAW,WAAA,GAA0BC,wDAAU,CAChC,UAACC,SAAuC,EAAEC,YAAmD;MAAA,OAAAC,aAAA,CAAAA,aAAA,KAAWF,SAAS,GAAKC,YAAY;IAAA,CAAG,EACrIf,iBAAiB,CAACC,KAAK,CAC3B,CAAC;IAAAgB,YAAA,GAAAC,cAAA,CAAAN,WAAA;IAHMO,KAAK,GAAAF,YAAA;IAAEG,QAAQ,GAAAH,YAAA;EAKtB,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AK;MACf,IAAIA,CAAC,CAACI,GAAG,KAAK,OAAO,EAAE;QACnBJ,CAAC,CAACK,cAAc,CAAC,CAAC;QAClBvC,MAAM,CAAC,CAAC;MACZ;IACJ,CAAE;IACFoC,KAAK,EAAEtC,KAAK,CAAChB,QAAS;IACtBiC,SAAS,EAAC,cAAc;IACxByB,WAAW,EAAC;EAAqC,CAAE,CAAC,eAExD1B,mDAAA,CAAC2B,iDAAM;IAACC,OAAO,EAAE1C;EAAO,GAAC,QAAc,CACtC,CACH,CACL,CACJ,CACJ,CACJ,CACJ,CAAC;AAEV,CAAC;AAEcV,sFAAuB,E","file":"ChaptersListingRedirect.bundle.js","sourcesContent":["import * as React from \"react\";\r\nimport { useReducer, useEffect } from \"react\";\r\nimport { Row, Col, Button, Input } from 'reactstrap';\r\nimport GenericDropdown from './controls/GenericDropdown';\r\nimport { LookupItem } from \"../Models/LookupItem\";\r\nimport { ChapterArticle } from \"../Models/ChapterArticle\";\r\nimport ChaptersListingResults, { SearchFilter } from './ChaptersListingResult';\r\nimport FeaturedChapter from \"./FeaturedChapter\";\r\nimport * as Utils from '../Utils';\r\nimport { HashParams } from \"./ChaptersListing\";\r\n\r\ntype OrderBy = 'date' | 'alpha';\r\n\r\ntype ChaptersListingRedirectProps = {\r\n Categories: LookupItem[];\r\n Chapters: LookupItem[];\r\n YearMonths: LookupItem[];\r\n BackgroundImage: string;\r\n Title: string;\r\n ListingUrl: string;\r\n}\r\n\r\ntype ChaptersListingRedirectState = {\r\n keywords: string;\r\n selectedCategory: LookupItem;\r\n selectedChapter: LookupItem;\r\n selectedYearMonth: LookupItem;\r\n redirectUrl: string;\r\n}\r\n\r\n\r\n\r\nconst buildInitialState = (props: ChaptersListingRedirectProps) => {\r\n\r\n let initialState: ChaptersListingRedirectState = {\r\n keywords: '',\r\n selectedCategory: undefined,\r\n selectedChapter: (props.Chapters || []).length > 0 ? props.Chapters[0] : undefined,\r\n selectedYearMonth: undefined,\r\n redirectUrl: ''\r\n }\r\n\r\n return initialState;\r\n}\r\n\r\nconst ChaptersListingRedirect = (props: ChaptersListingRedirectProps) => {\r\n\r\n const [state, setState] = useReducer(\r\n (prevState: ChaptersListingRedirectState, Chapterstate: Partial) => ({ ...prevState, ...Chapterstate }),\r\n buildInitialState(props)\r\n );\r\n\r\n const search = () => {\r\n\r\n const filter = getHashParams();\r\n\r\n window.location.href = state.selectedChapter.Value + Utils.buildHash(filter);\r\n };\r\n\r\n const getHashParams = () => {\r\n\r\n const filter: HashParams = {\r\n //chap: state.selectedChapter ? state.selectedChapter.Title : undefined,\r\n cat: state.selectedCategory ? state.selectedCategory.Title : undefined,\r\n ym: state.selectedYearMonth ? state.selectedYearMonth.Title : undefined,\r\n q: state.keywords.length > 0 ? state.keywords : undefined\r\n }\r\n\r\n return filter;\r\n }\r\n\r\n useEffect(() => {\r\n\r\n const filter = getHashParams();\r\n\r\n setState({ redirectUrl: props.ListingUrl + Utils.buildHash(filter) });\r\n\r\n }, [state.keywords, state.selectedCategory, state.selectedChapter, state.selectedYearMonth]);\r\n\r\n // return\r\n return
\r\n
\r\n

{props.Title}

\r\n
\r\n
\r\n\r\n
\r\n
Select Chapter
\r\n x.Value}\r\n renderItem={x => x.Title}\r\n renderSelectedItem={x => x.Title}\r\n nullSelectionText=\"All Chapters\"\r\n allowNullSelection={false}\r\n selectedValue={state.selectedChapter ? state.selectedChapter.Value : undefined}\r\n onSelectedItemChanged={x => setState({ selectedChapter: x })}\r\n />\r\n
\r\n\r\n x.Value}\r\n renderItem={x => x.Title}\r\n renderSelectedItem={x => x.Title}\r\n nullSelectionText=\"All Events\"\r\n allowNullSelection={true}\r\n selectedValue={state.selectedCategory ? state.selectedCategory.Value : undefined}\r\n onSelectedItemChanged={x => setState({ selectedCategory: x })}\r\n />\r\n\r\n x.Value}\r\n renderItem={x => x.Title}\r\n renderSelectedItem={x => x.Title}\r\n nullSelectionText=\"All Dates\"\r\n allowNullSelection={true}\r\n selectedValue={state.selectedYearMonth ? state.selectedYearMonth.Value : undefined}\r\n onSelectedItemChanged={x => setState({ selectedYearMonth: x })}\r\n />\r\n\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n { setState({ keywords: e.target.value }) }}\r\n onKeyPress={(e) => {\r\n if (e.key === 'Enter') {\r\n e.preventDefault();\r\n search();\r\n }\r\n }}\r\n value={state.keywords}\r\n className=\"form-control\"\r\n placeholder=\"Search for keywords and description\" />\r\n\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n}\r\n\r\nexport default ChaptersListingRedirect;"],"sourceRoot":""}