Skip to content

Commit

Permalink
use named export
Browse files Browse the repository at this point in the history
  • Loading branch information
barbalex committed Oct 27, 2024
1 parent 3c50f1d commit eab8eb4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/components/Projekte/Daten/Beob/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const ItemTypes = {
CARD: 'card',
}

const Field = ({ label, value, index, moveField }) => {
export const Field = ({ label, value, index, moveField }) => {
const ref = useRef(null)
const [{ handlerId }, drop] = useDrop({
accept: ItemTypes.CARD,
Expand Down Expand Up @@ -97,5 +97,3 @@ const Field = ({ label, value, index, moveField }) => {
</Row>
)
}

export default Field
23 changes: 11 additions & 12 deletions src/components/Projekte/Daten/Beob/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { arrayMoveImmutable } from 'array-move'

import { constants } from '../../../../modules/constants.js'
import { exists } from '../../../../modules/exists.js'
import query from './query.js'
import { query } from './query.js'
import { ErrorBoundary } from '../../../shared/ErrorBoundary.jsx'
import { Error } from '../../../shared/Error.jsx'
import { Spinner } from '../../../shared/Spinner.jsx'
import Beob from './Field'
import { Field as BeobField } from './Field.jsx'
import { StoreContext } from '../../../../storeContext.js'

const OuterContainer = styled.div`
Expand All @@ -36,15 +36,13 @@ const Explainer = styled.p`
color: rgba(0, 0, 0, 0.54);
`

const BeobsComponent = () => {
export const Beob = observer(() => {
const { beobId: id } = useParams()
const client = useApolloClient()

const store = useContext(StoreContext)
const {
sortedBeobFields: sortedBeobFieldsPassed,
setSortedBeobFields,
} = store
const { sortedBeobFields: sortedBeobFieldsPassed, setSortedBeobFields } =
store
const sortedBeobFields = sortedBeobFieldsPassed.slice()

const sortFn = useCallback(
Expand Down Expand Up @@ -122,7 +120,7 @@ const BeobsComponent = () => {
)
const renderField = useCallback(
(field, index) => (
<Beob
<BeobField
key={field[0]}
label={field[0]}
value={field[1]}
Expand All @@ -149,13 +147,14 @@ const BeobsComponent = () => {
Die Felder können beliebig sortiert werden (drag and drop).
</Explainer>
<Container>
<DndProvider backend={HTML5Backend} context={window}>
<DndProvider
backend={HTML5Backend}
context={window}
>
{fields.map((field, i) => renderField(field, i))}
</DndProvider>
</Container>
</OuterContainer>
</ErrorBoundary>
)
}

export default observer(BeobsComponent)
})
2 changes: 1 addition & 1 deletion src/components/Projekte/Daten/Beob/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'

import { beob } from '../../../shared/fragments.js'

export default gql`
export const query = gql`
query beobByIdQueryForBeob($id: UUID!) {
beobById(id: $id) {
...BeobFields
Expand Down
2 changes: 1 addition & 1 deletion src/components/Projekte/Daten/Beobzuordnung/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CheckboxWithInfo } from '../../../shared/CheckboxWithInfo.jsx'
import { Select } from '../../../shared/Select.jsx'
import { DateField } from '../../../shared/Date.jsx'
import { SelectLoadingOptions } from '../../../shared/SelectLoadingOptions.jsx'
import Beob from '../Beob'
import { Beob } from '../Beob/index.jsx'
import query from './query.js'
import queryAeTaxonomies from './queryAeTaxonomies'
import saveNichtZuordnenToDb from './saveNichtZuordnenToDb'
Expand Down

0 comments on commit eab8eb4

Please sign in to comment.