From db1d0ba6f8161d2db19ce5ab85dc90cd425d09db Mon Sep 17 00:00:00 2001 From: Yugay Vasiliy Date: Thu, 22 Feb 2024 11:23:49 +0000 Subject: [PATCH] refactoring --- src/fragmentarium/application/FragmentService.ts | 6 +++--- .../infrastructure/FragmentRepository.ts | 2 +- ...gySearchForm.sass => ProvenanceSearchForm.sass} | 2 +- ...logySearchForm.tsx => ProvenanceSearchForm.tsx} | 14 +++++++------- src/fragmentarium/ui/SearchForm.test.tsx | 8 +++----- src/fragmentarium/ui/SearchForm.tsx | 8 ++++---- .../ui/front-page/Fragmentarium.test.tsx | 2 +- .../ui/search/FragmentariumSearch.test.tsx | 2 +- src/query/FragmentQuery.ts | 2 +- 9 files changed, 22 insertions(+), 24 deletions(-) rename src/fragmentarium/ui/{ArchaeologySearchForm.sass => ProvenanceSearchForm.sass} (65%) rename src/fragmentarium/ui/{ArchaeologySearchForm.tsx => ProvenanceSearchForm.tsx} (72%) diff --git a/src/fragmentarium/application/FragmentService.ts b/src/fragmentarium/application/FragmentService.ts index c09ce61a1..78c07ed69 100644 --- a/src/fragmentarium/application/FragmentService.ts +++ b/src/fragmentarium/application/FragmentService.ts @@ -56,7 +56,7 @@ export interface FragmentRepository { ): Bluebird findInCorpus(number: string): Bluebird> fetchGenres(): Bluebird - fetchArchaeologies(): Bluebird + fetchProvenances(): Bluebird fetchPeriods(): Bluebird updateGenres(number: string, genres: Genres): Bluebird updateScript(number: string, script: Script): Bluebird @@ -177,8 +177,8 @@ export class FragmentService { fetchGenres(): Bluebird { return this.fragmentRepository.fetchGenres() } - fetchArchaeologies(): Bluebird { - return this.fragmentRepository.fetchArchaeologies() + fetchProvenances(): Bluebird { + return this.fragmentRepository.fetchProvenances() } fetchPeriods(): Bluebird { diff --git a/src/fragmentarium/infrastructure/FragmentRepository.ts b/src/fragmentarium/infrastructure/FragmentRepository.ts index 0cae0c5c3..c01cc2894 100644 --- a/src/fragmentarium/infrastructure/FragmentRepository.ts +++ b/src/fragmentarium/infrastructure/FragmentRepository.ts @@ -196,7 +196,7 @@ class ApiFragmentRepository fetchGenres(): Promise { return this.apiClient.fetchJson('/genres', false) } - fetchArchaeologies(): Promise { + fetchProvenances(): Promise { return this.apiClient.fetchJson('/provenances', false) } diff --git a/src/fragmentarium/ui/ArchaeologySearchForm.sass b/src/fragmentarium/ui/ProvenanceSearchForm.sass similarity index 65% rename from src/fragmentarium/ui/ArchaeologySearchForm.sass rename to src/fragmentarium/ui/ProvenanceSearchForm.sass index 9cc213404..df1687c0b 100644 --- a/src/fragmentarium/ui/ArchaeologySearchForm.sass +++ b/src/fragmentarium/ui/ProvenanceSearchForm.sass @@ -1,3 +1,3 @@ -.archaeology-selector +.provenance-selector &__menu z-index: 99 !important \ No newline at end of file diff --git a/src/fragmentarium/ui/ArchaeologySearchForm.tsx b/src/fragmentarium/ui/ProvenanceSearchForm.tsx similarity index 72% rename from src/fragmentarium/ui/ArchaeologySearchForm.tsx rename to src/fragmentarium/ui/ProvenanceSearchForm.tsx index d3e63a616..80ab2b3ad 100644 --- a/src/fragmentarium/ui/ArchaeologySearchForm.tsx +++ b/src/fragmentarium/ui/ProvenanceSearchForm.tsx @@ -2,7 +2,7 @@ import React from 'react' import withData from 'http/withData' import Select from 'react-select' import FragmentService from 'fragmentarium/application/FragmentService' -import './ArchaeologySearchForm.sass' +import './ProvenanceSearchForm.sass' export default withData< { @@ -13,15 +13,15 @@ export default withData< ReadonlyArray> >( ({ data, value, onChange }) => { - const options = data.map((archaeology) => ({ - value: archaeology[0], - label: archaeology[0], + const options = data.map((site) => ({ + value: site.join(' '), + label: site.join(' '), })) const defaultOption = value ? { value: value, label: value } : null return (