From 2134847990b398632a4bb8fd0abca2bcb968e6f3 Mon Sep 17 00:00:00 2001 From: Jesiel Viana Date: Mon, 18 Sep 2023 20:35:57 -0300 Subject: [PATCH] =?UTF-8?q?add=20toggle=20entre=20busca=20b=C3=A1sica=20e?= =?UTF-8?q?=20busca=20avan=C3=A7ada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AdvancedSearchBox.tsx | 14 +-- src/components/BasicSearchBox.tsx | 95 +++++++++++++++++++ src/components/CustomSearchBox.tsx | 88 ++++------------- src/components/DefaultQueryConfig.ts | 1 + ...ndicatorsContext.tsx => CustomContext.tsx} | 17 ++-- .../indicators/GroupsIndicators.tsx | 2 +- .../indicators/JornalsIndicators.tsx | 2 +- .../indicators/OrgUnitIndicators.tsx | 2 +- .../indicators/PatentsIndicators.tsx | 2 +- .../indicators/PeopleIndicators.tsx | 2 +- .../indicators/ProgramsIndicators.tsx | 2 +- .../indicators/PublicationsIndicators.tsx | 4 +- .../indicators/SoftwaresIndicators.tsx | 2 +- src/pages/api/search.ts | 2 +- src/pages/groups.tsx | 6 +- src/pages/institutions.tsx | 9 +- src/pages/journals.tsx | 9 +- src/pages/patents.tsx | 9 +- src/pages/people.tsx | 9 +- src/pages/programs.tsx | 11 ++- src/pages/publications.tsx | 40 ++++---- src/pages/software.tsx | 11 ++- src/styles/Indicators.module.css | 4 +- src/styles/globals.scss | 11 ++- src/types/Entities.ts | 3 +- 25 files changed, 216 insertions(+), 141 deletions(-) create mode 100644 src/components/BasicSearchBox.tsx rename src/components/context/{IndicatorsContext.tsx => CustomContext.tsx} (62%) diff --git a/src/components/AdvancedSearchBox.tsx b/src/components/AdvancedSearchBox.tsx index d0f20d8..d1d0655 100644 --- a/src/components/AdvancedSearchBox.tsx +++ b/src/components/AdvancedSearchBox.tsx @@ -7,13 +7,13 @@ import { useRouter } from 'next/router'; import { useState } from 'react'; interface CustomSearchBoxProps extends SearchContextState { - updateQueryConfig: (advancedQuery: string) => void; + toogleAdvancedConfig: (advanced: boolean) => void; } -const AdvancedSearchBox = ({ searchTerm, setSearchTerm, updateQueryConfig }: CustomSearchBoxProps) => { +const AdvancedSearchBox = ({ searchTerm, setSearchTerm, toogleAdvancedConfig }: CustomSearchBoxProps) => { const { t } = useTranslation('common'); const router = useRouter(); - const [field, setField] = useState('All fields'); + const [field, setField] = useState('title_text'); const [value, setValue] = useState(''); const [op, setOp] = useState('&'); const [fullQuery, setFullQuery] = useState(searchTerm || ''); @@ -25,7 +25,6 @@ const AdvancedSearchBox = ({ searchTerm, setSearchTerm, updateQueryConfig }: Cus return (
- Basic Search
+ {getAutocomplete()} +
+ +
+ toogleAdvancedConfig(true)} className="link-color"> + Advanced Search + + + )} + > + ); +}; + +export default BasicSearchBox; diff --git a/src/components/CustomSearchBox.tsx b/src/components/CustomSearchBox.tsx index 90a68a4..adcd296 100644 --- a/src/components/CustomSearchBox.tsx +++ b/src/components/CustomSearchBox.tsx @@ -1,13 +1,10 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { SearchBox } from '@elastic/react-search-ui'; -import { useTranslation } from 'next-i18next'; -import { useRouter } from 'next/router'; -import { useEffect, useState } from 'react'; -import ElasticSearchStatsService from '../services/ElasticSearchStatsService'; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { useContext } from 'react'; +import AdvancedSearchBox from './AdvancedSearchBox'; +import BasicSearchBox from './BasicSearchBox'; +import CustomContext from './context/CustomContext'; -const VIVO_URL_ITEM_BASE = process.env.VIVO_URL_ITEM_BASE; - -type CustomSearchBoxProps = { +export type CustomSearchBoxProps = { titleFieldName: string; itemLinkPrefix: string; indexName: string; @@ -15,68 +12,19 @@ type CustomSearchBoxProps = { }; const CustomSearchBox = ({ titleFieldName, itemLinkPrefix, indexName, updateOpetatorConfig }: CustomSearchBoxProps) => { - const { t } = useTranslation('common'); - const router = useRouter(); - const [docsCount, setDocsCount] = useState(localStorage.getItem(indexName)); - - useEffect(() => { - ElasticSearchStatsService(indexName) - .then((res) => { - const count = res['docs.count']; - localStorage.setItem(indexName, count); - setDocsCount(count); - }) - .catch((err) => { - console.error(err); - }); - }, []); + const { advanced, setAdvanced } = useContext(CustomContext); - return ( - { - updateOpetatorConfig('OR'); - router.query.q = searchTerm; - router.push(router); - }} - onSelectAutocomplete={(selection: any, item: any, defaultOnSelectAutocomplete: any) => { - if (selection.suggestion) { - updateOpetatorConfig('AND'); - defaultOnSelectAutocomplete(selection); - } else { - router.push(`${VIVO_URL_ITEM_BASE}/${itemLinkPrefix}${selection.id.raw}&lang=${router.locale}`); - } - }} - inputView={({ getAutocomplete, getInputProps, getButtonProps }) => ( - <> -
- - {getAutocomplete()} -
- - - )} - >
+ return advanced ? ( + //@ts-ignore + + ) : ( + ); }; diff --git a/src/components/DefaultQueryConfig.ts b/src/components/DefaultQueryConfig.ts index 51cf6bc..ef1bf1a 100644 --- a/src/components/DefaultQueryConfig.ts +++ b/src/components/DefaultQueryConfig.ts @@ -5,6 +5,7 @@ const DefaultQueryConfig = (indexName: string) => { return { debug: false, indicators: [], + advanced: false, urlPushDebounceLength: 500, alwaysSearchOnInitialLoad: false, hasA11yNotifications: true, diff --git a/src/components/context/IndicatorsContext.tsx b/src/components/context/CustomContext.tsx similarity index 62% rename from src/components/context/IndicatorsContext.tsx rename to src/components/context/CustomContext.tsx index bbc7d39..9dd856c 100644 --- a/src/components/context/IndicatorsContext.tsx +++ b/src/components/context/CustomContext.tsx @@ -1,17 +1,20 @@ import { PropsWithChildren, createContext, useState } from 'react'; import { IndicatorType } from '../../types/Entities'; -interface IndicadorContextProps { +interface CustomContextProps { indicators: IndicatorType[][]; setIndicatorsData: (data: Array) => void; isEmpty: () => boolean; + advanced: boolean; + setAdvanced: (advanced: boolean) => void; } -const IndicatorContext = createContext({} as IndicadorContextProps); -export default IndicatorContext; +const CustomContext = createContext({} as CustomContextProps); +export default CustomContext; -export function IndicatorProvider(props: PropsWithChildren) { +export function CustomProvider(props: PropsWithChildren) { const [indicators, setIndicators] = useState>([] as Array); + const [advanced, setAdvanced] = useState(false); function setIndicatorsData(data: Array) { setIndicators(data); @@ -22,14 +25,16 @@ export function IndicatorProvider(props: PropsWithChildren) { } return ( - {props.children} - + ); } diff --git a/src/components/indicators/GroupsIndicators.tsx b/src/components/indicators/GroupsIndicators.tsx index 66d1066..78a1304 100644 --- a/src/components/indicators/GroupsIndicators.tsx +++ b/src/components/indicators/GroupsIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar, OptionsPie } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/JornalsIndicators.tsx b/src/components/indicators/JornalsIndicators.tsx index 55561b3..bcec356 100644 --- a/src/components/indicators/JornalsIndicators.tsx +++ b/src/components/indicators/JornalsIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/OrgUnitIndicators.tsx b/src/components/indicators/OrgUnitIndicators.tsx index db2fffa..bd2629c 100644 --- a/src/components/indicators/OrgUnitIndicators.tsx +++ b/src/components/indicators/OrgUnitIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/PatentsIndicators.tsx b/src/components/indicators/PatentsIndicators.tsx index c44ff0c..0e8a221 100644 --- a/src/components/indicators/PatentsIndicators.tsx +++ b/src/components/indicators/PatentsIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar, OptionsPie } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/PeopleIndicators.tsx b/src/components/indicators/PeopleIndicators.tsx index 248a2f4..60946d9 100644 --- a/src/components/indicators/PeopleIndicators.tsx +++ b/src/components/indicators/PeopleIndicators.tsx @@ -17,7 +17,7 @@ import { useTranslation } from 'next-i18next'; import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Utils'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsPie } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/ProgramsIndicators.tsx b/src/components/indicators/ProgramsIndicators.tsx index 8fac92c..6425520 100644 --- a/src/components/indicators/ProgramsIndicators.tsx +++ b/src/components/indicators/ProgramsIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/components/indicators/PublicationsIndicators.tsx b/src/components/indicators/PublicationsIndicators.tsx index 63452b5..22f7060 100644 --- a/src/components/indicators/PublicationsIndicators.tsx +++ b/src/components/indicators/PublicationsIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar, OptionsPie } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; @@ -48,7 +48,7 @@ function PublicationsIndicators({ filters, searchTerm, isLoading }: IndicatorsPr options.plugins.title.text = t(options.title); // @ts-ignore optionsType.plugins.title.text = t(optionsType.title); - + console.log(isLoading); isLoading ? ElasticSearchService( [ diff --git a/src/components/indicators/SoftwaresIndicators.tsx b/src/components/indicators/SoftwaresIndicators.tsx index cba34e2..594e508 100644 --- a/src/components/indicators/SoftwaresIndicators.tsx +++ b/src/components/indicators/SoftwaresIndicators.tsx @@ -14,7 +14,7 @@ import { CHART_BACKGROUD_COLORS, CHART_BORDER_COLORS } from '../../../utils/Util import ElasticSearchService from '../../services/ElasticSearchService'; import { CustomSearchQuery, IndicatorType } from '../../types/Entities'; import { IndicatorsProps } from '../../types/Propos'; -import IndicatorContext from '../context/IndicatorsContext'; +import IndicatorContext from '../context/CustomContext'; import { OptionsBar, OptionsPie } from './options/ChartsOptions'; import getFormatedQuery from './query/Query'; diff --git a/src/pages/api/search.ts b/src/pages/api/search.ts index bbce890..880ae36 100644 --- a/src/pages/api/search.ts +++ b/src/pages/api/search.ts @@ -18,7 +18,7 @@ function builConnector(index: string) { // transforming the query before sending to Elasticsearch using the requestState and queryConfig const searchFields: any = queryConfig.search_fields; // @ts-ignore - if (queryConfig.advanced) { + if (requestState.searchTerm.indexOf('=') > 0) { if (requestState.searchTerm.indexOf('(') >= 0) { let fullQuery = stringify(parseElasticsearchQuery(requestState.searchTerm)); fullQuery = fullQuery.replace(',null', ''); diff --git a/src/pages/groups.tsx b/src/pages/groups.tsx index 91fb26e..616cd34 100644 --- a/src/pages/groups.tsx +++ b/src/pages/groups.tsx @@ -21,7 +21,7 @@ import Head from 'next/head'; import styles from '../styles/Home.module.css'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewGroups from '../components/customResultView/CustomResultViewGroups'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import GroupsIndicators from '../components/indicators/GroupsIndicators'; @@ -184,7 +184,7 @@ export default function App() { {`BrCris - ${t('Research groups')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -264,7 +264,7 @@ export default function App() { }} - +
); diff --git a/src/pages/institutions.tsx b/src/pages/institutions.tsx index 927cd26..050edb4 100644 --- a/src/pages/institutions.tsx +++ b/src/pages/institutions.tsx @@ -18,13 +18,13 @@ import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; import { useState } from 'react'; -import CustomSearchBox from '../components/CustomSearchBox'; +import CustomSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; import CustomResultViewInstitutions from '../components/customResultView/CustomResultViewInstitutions'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import OrgUnitIndicators from '../components/indicators/OrgUnitIndicators'; import styles from '../styles/Home.module.css'; +import { CustomProvider } from '../components/context/CustomContext'; type Props = { // Add custom props here }; @@ -143,7 +143,7 @@ export default function App() { {`BrCris - ${t('Institutions')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -164,6 +164,7 @@ export default function App() { itemLinkPrefix="pers_" updateOpetatorConfig={updateOpetatorConfig} indexName={INDEX_NAME} + toogleAdvancedConfig={() => null} /> } sideContent={ @@ -202,7 +203,7 @@ export default function App() { }} - +
); diff --git a/src/pages/journals.tsx b/src/pages/journals.tsx index 8ddd26d..6b1a7bf 100644 --- a/src/pages/journals.tsx +++ b/src/pages/journals.tsx @@ -21,11 +21,11 @@ import { GetStaticProps } from 'next'; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; -import CustomSearchBox from '../components/CustomSearchBox'; +import CustomSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import JornalsIndicators from '../components/indicators/JornalsIndicators'; +import { CustomProvider } from '../components/context/CustomContext'; type Props = { // Add custom props here }; @@ -164,7 +164,7 @@ export default function App() { {`BrCris - ${t('Journals')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -185,6 +185,7 @@ export default function App() { itemLinkPrefix="journ_" updateOpetatorConfig={updateOpetatorConfig} indexName={INDEX_NAME} + toogleAdvancedConfig={() => null} /> } sideContent={ @@ -223,7 +224,7 @@ export default function App() { }} - +
); diff --git a/src/pages/patents.tsx b/src/pages/patents.tsx index 7aca203..fd388e7 100644 --- a/src/pages/patents.tsx +++ b/src/pages/patents.tsx @@ -21,9 +21,9 @@ import { GetStaticProps } from 'next'; import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; -import CustomSearchBox from '../components/CustomSearchBox'; +import CustomSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewPatents from '../components/customResultView/CustomResultViewPatents'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import PatentsIndicators from '../components/indicators/PatentsIndicators'; @@ -157,7 +157,7 @@ export default function App() { {`BrCris - ${t('Patents')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -178,6 +178,7 @@ export default function App() { itemLinkPrefix="pat_" updateOpetatorConfig={updateOpetatorConfig} indexName={INDEX_NAME} + toogleAdvancedConfig={() => null} /> } sideContent={ @@ -216,7 +217,7 @@ export default function App() { }} - +
); diff --git a/src/pages/people.tsx b/src/pages/people.tsx index 85345bd..49a6b62 100644 --- a/src/pages/people.tsx +++ b/src/pages/people.tsx @@ -18,9 +18,9 @@ import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; import { useState } from 'react'; -import CustomSearchBox from '../components/CustomSearchBox'; +import CustomSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewPeople from '../components/customResultView/CustomResultViewPeople'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import IndicatorsPeople from '../components/indicators/PeopleIndicators'; @@ -143,7 +143,7 @@ export default function App() { {`BrCris - ${t('People')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -164,6 +164,7 @@ export default function App() { itemLinkPrefix="pers_" updateOpetatorConfig={updateOpetatorConfig} indexName={INDEX_NAME} + toogleAdvancedConfig={() => null} /> } sideContent={ @@ -198,7 +199,7 @@ export default function App() { }} - +
); diff --git a/src/pages/programs.tsx b/src/pages/programs.tsx index 4f7246a..9557ee4 100644 --- a/src/pages/programs.tsx +++ b/src/pages/programs.tsx @@ -18,9 +18,9 @@ import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; import React, { useState } from 'react'; -import CustomSearchBox from '../components/CustomSearchBox'; +import BasicSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewPrograms from '../components/customResultView/CustomResultViewPrograms'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import ProgramsIndicators from '../components/indicators/ProgramsIndicators'; @@ -144,7 +144,7 @@ export default function App() { {`BrCris - ${t('Programs')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -160,11 +160,12 @@ export default function App() {
null} /> } sideContent={ @@ -204,7 +205,7 @@ export default function App() { }} - +
); diff --git a/src/pages/publications.tsx b/src/pages/publications.tsx index 5fc8f14..a2555e4 100644 --- a/src/pages/publications.tsx +++ b/src/pages/publications.tsx @@ -19,9 +19,9 @@ import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; import { useState } from 'react'; -import AdvancedSearchBox from '../components/AdvancedSearchBox'; +import CustomSearchBox from '../components/CustomSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewPublications from '../components/customResultView/CustomResultViewPublications'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import Indicators from '../components/indicators/PublicationsIndicators'; @@ -41,7 +41,6 @@ const configDefault: CustomSearchDriverOptions = { ...DefaultQueryConfig(INDEX_NAME), searchQuery: { operator: 'OR', - advanced: false, search_fields: { title_text: { weight: 3, @@ -204,11 +203,11 @@ export default function App() { //@ts-ignore setConfig({ ...config, searchQuery: { ...config.searchQuery, operator: op } }); } - function updateAdvancedConfig(advancedQuery: string) { + function toogleAdvancedConfig(advanced: boolean) { //@ts-ignore setConfig({ ...config, - searchQuery: { ...config.searchQuery, advanced: true, advancedQuery: advancedQuery }, + advanced: true, }); } @@ -218,7 +217,7 @@ export default function App() { {`BrCris - ${t('Publications')}`}
- + ({ wasSearched, results })}> {({ wasSearched, results }) => { @@ -230,18 +229,27 @@ export default function App() {

{t('Publications')}

-
- //@ts-ignore - + + // config.advanced ? ( + // //@ts-ignore + // + // ) : ( + // + // ) } sideContent={
@@ -311,7 +319,7 @@ export default function App() { }} - +
); diff --git a/src/pages/software.tsx b/src/pages/software.tsx index b825a29..2ed22b1 100644 --- a/src/pages/software.tsx +++ b/src/pages/software.tsx @@ -18,13 +18,13 @@ import { useTranslation } from 'next-i18next'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import Head from 'next/head'; import { useState } from 'react'; -import CustomSearchBox from '../components/CustomSearchBox'; +import BasicSearchBox from '../components/BasicSearchBox'; import DefaultQueryConfig from '../components/DefaultQueryConfig'; +import { CustomProvider } from '../components/context/CustomContext'; import CustomResultViewSoftwares from '../components/customResultView/CustomResultViewSoftwares'; import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo'; import SoftwaresIndicators from '../components/indicators/SoftwaresIndicators'; import styles from '../styles/Home.module.css'; -import { IndicatorProvider } from '../components/context/IndicatorsContext'; type Props = { // Add custom props here }; @@ -169,7 +169,7 @@ export default function App() { {`BrCris - ${t('Softwares')}`}
- + ({ wasSearched })}> {({ wasSearched }) => { @@ -185,11 +185,12 @@ export default function App() {
null} /> } sideContent={ @@ -227,7 +228,7 @@ export default function App() { }} - +
); diff --git a/src/styles/Indicators.module.css b/src/styles/Indicators.module.css index 64862b1..060c4ac 100644 --- a/src/styles/Indicators.module.css +++ b/src/styles/Indicators.module.css @@ -1,7 +1,6 @@ .charts { margin-top: 200px; width: calc(25% - 16px); - } .chart { @@ -33,5 +32,8 @@ margin-right: 0; margin-bottom: 32px; max-width: 100%; + width: 100%; + padding: 0 16px; + margin-top: 20px; } } \ No newline at end of file diff --git a/src/styles/globals.scss b/src/styles/globals.scss index ce8ae18..478cc96 100644 --- a/src/styles/globals.scss +++ b/src/styles/globals.scss @@ -458,7 +458,7 @@ li .sui-result__key:after { } .flex-gap-1 { - gap: 1rem; + gap: 5px; } .d-flex .sui-search-box__submit { @@ -485,6 +485,13 @@ li .sui-result__key:after { .advanced .close:hover { border: 1px solid var(--accent-color); } +.link-color { + color: var(--text-secondary-color); + cursor: pointer; +} +.basic-search { + width: 100%; +} .collapse.show { display: block; @@ -722,6 +729,8 @@ footer { } .page-search .sui-layout { + padding: 0 16px; + width: 100%; margin-left: 0; } diff --git a/src/types/Entities.ts b/src/types/Entities.ts index 19089a4..1ee1b86 100644 --- a/src/types/Entities.ts +++ b/src/types/Entities.ts @@ -28,12 +28,11 @@ export type MemberType = { export interface CustomSearchQuery extends SearchQuery { operator: 'AND' | 'OR'; - advanced?: boolean; - advancedQuery?: string; } export interface CustomSearchDriverOptions extends SearchDriverOptions { searchQuery: CustomSearchQuery; + advanced: boolean; } export type AdvancedFieldType = {