Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Dec 22, 2022
1 parent 923a502 commit e0f09f8
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 25 deletions.
6 changes: 4 additions & 2 deletions searchlib/components/Facets/Unconnected/MultiTermFacet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Select = ({ options, value, onChange, className }) => {
);
};

const ViewComponent = (props) => {
const MultiTermFacetViewComponent = (props) => {
const {
className,
label,
Expand All @@ -91,6 +91,8 @@ const ViewComponent = (props) => {
filterType = 'any',
} = props;

console.log('optiosn', options);

const filterTypes = [
{ key: 2, text: 'Match any', value: 'any' },
{ key: 1, text: 'Match all', value: 'all' },
Expand Down Expand Up @@ -195,4 +197,4 @@ const ViewComponent = (props) => {
);
};

export default ViewComponent;
export default MultiTermFacetViewComponent;
24 changes: 9 additions & 15 deletions searchlib/components/SearchApp/FacetApp.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react';
import { Facet as SUIFacet } from '@eeacms/search/components';
import {
useSearchContext,
SearchContext,
useAppConfig,
} from '@eeacms/search/lib/hocs';
import { useSearchContext, useAppConfig } from '@eeacms/search/lib/hocs';
import BasicSearchApp from './BasicSearchApp';
import { atom, useAtom } from 'jotai';
import { atomFamily } from 'jotai/utils';
Expand All @@ -21,6 +17,7 @@ function BoostrapFacetView(props) {
// const { appConfig, registry } = props;
const { appConfig, registry } = useAppConfig();
const searchContext = useSearchContext();
console.log('searchContext', searchContext);

const { filters } = searchContext;

Expand Down Expand Up @@ -76,19 +73,16 @@ function BoostrapFacetView(props) {
setSavedFilters,
value,
searchContext,
// applySearch,
]);

return (
<SearchContext.Provider value={searchContext}>
<SUIFacet
{...props}
active={true}
filterType={localFilterType}
onChangeFilterType={setLocalFilterType}
view={FacetComponent}
/>
</SearchContext.Provider>
<SUIFacet
{...props}
active={true}
view={FacetComponent}
filterType={localFilterType}
onChangeFilterType={setLocalFilterType}
/>
);
}

Expand Down
2 changes: 2 additions & 0 deletions searchlib/lib/search/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function markSelectedFacetValuesFromFilters(
const facetValues = facet.data;
const filterValuesForField =
findFilterValues(filters, fieldName, filterType) || [];
console.log({ facetValues, filterValuesForField });
return {
...facet,
data: facetValues.map((facetValue) => {
Expand Down Expand Up @@ -98,6 +99,7 @@ function getFilterValueDisplay(filterValue) {
* @param {FilterValue} filterValue2
*/
export function doFilterValuesMatch(filterValue1, filterValue2) {
console.log({ filterValue1, filterValue2 });
if (filterValue1?.name || filterValue2?.name)
// If two filters have matching names, then they are the same filter, there
// is no need to do a more expensive deep equal comparison.
Expand Down
2 changes: 1 addition & 1 deletion src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function SearchBlockView(props) {
<div>
{mode !== 'view' && 'EEA Semantic Search block'}
<Variation registry={registry} appName={appName} mode={mode}>
{children}
{mode !== 'view' ? children : null}
</Variation>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/SearchBlock/templates/FullView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const overlayStyle = {

function FullView(props) {
const { appName, mode } = props;
console.log('children', props.children);

// TODO: (about bodyclass) this is a hack, please solve it properly

Expand All @@ -21,6 +22,7 @@ function FullView(props) {
<div className="overlay" style={overlayStyle}></div>
)}
<SearchApp {...props} />
{props.children}
</div>
</BodyClass>
);
Expand Down
7 changes: 6 additions & 1 deletion src/SearchBlock/templates/LandingPageView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React from 'react';
import { LandingPageApp } from '@eeacms/search';

function LandingPageView(props) {
return <LandingPageApp {...props} />;
return (
<>
<LandingPageApp {...props} />
{props.children}
</>
);
}

LandingPageView.schemaEnhancer = ({ schema }) => {
Expand Down
15 changes: 9 additions & 6 deletions src/SearchBlock/templates/SearchInputView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ function SearchInputView(props) {
const url = flattenToAppURL(appConfig.url || '');

return (
<SearchInputApp
{...props}
onSubmitSearch={(searchTerm) => {
history.push(`${url}?q=${searchTerm}`);
}}
/>
<>
<SearchInputApp
{...props}
onSubmitSearch={(searchTerm) => {
history.push(`${url}?q=${searchTerm}`);
}}
/>
{props.children}
</>
);
}

Expand Down

0 comments on commit e0f09f8

Please sign in to comment.