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 d31edb2 commit 6429b44
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 28 deletions.
4 changes: 1 addition & 3 deletions src/components/AppBar/Bar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MenuDiv = styled.div`
flex-wrap: wrap;
`

const AbbBarComponentBar = () => {
export const Bar = () => {
const isMobile = isMobilePhone()

const { search, pathname } = useLocation()
Expand Down Expand Up @@ -61,5 +61,3 @@ const AbbBarComponentBar = () => {
</>
)
}

export default AbbBarComponentBar
4 changes: 1 addition & 3 deletions src/components/AppBar/EkfBar/EkfYear.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Jahr = styled.p`
const ekfRefDate = new Date() //.setMonth(new Date().getMonth() - 2)
const ekfRefYear = new Date(ekfRefDate).getFullYear()

const EkfYear = () => {
export const EkfYear = () => {
const { search } = useLocation()
const { ekfYear, userId } = useParams()
const navigate = useNavigate()
Expand Down Expand Up @@ -57,5 +57,3 @@ const EkfYear = () => {
</Container>
)
}

export default EkfYear
22 changes: 10 additions & 12 deletions src/components/AppBar/EkfBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import Badge from '@mui/material/Badge'
import { useParams, useLocation } from 'react-router-dom'

import { isMobilePhone } from '../../../modules/isMobilePhone.js'
import EkfYear from './EkfYear.jsx'
import { EkfYear } from './EkfYear.jsx'
import User from './User/index.jsx'
import { StoreContext } from '../../../storeContext.js'
import userQuery from './query.js'
import dataByUserIdQuery from '../../Ekf/dataByUserId.js'
import dataWithDateByUserIdQuery from '../../Ekf/dataWithDateByUserId.js'
import { query } from './query.js'
import { dataByUserId as dataByUserIdQuery } from '../../Ekf/dataByUserId.js'
import { dataWithDateByUserId as dataWithDateByUserIdQuery } from '../../Ekf/dataWithDateByUserId.js'

const SiteTitle = styled(Button)`
display: none !important;
Expand Down Expand Up @@ -95,7 +95,7 @@ const ProjekteAppBar = () => {
// if no ekfAdresseId
// need to fetch adresse.id for this user
// and use that instead
const { data: userData } = useQuery(userQuery, {
const { data: userData } = useQuery(query, {
variables: { userId: userId ?? '99999999-9999-9999-9999-999999999999' },
})

Expand Down Expand Up @@ -144,9 +144,9 @@ const ProjekteAppBar = () => {
to={`/${search}`}
title="Home"
>
{userName
? `AP Flora: EKF von ${userName}`
: 'AP Flora: Erfolgs-Kontrolle Freiwillige'}
{userName ?
`AP Flora: EKF von ${userName}`
: 'AP Flora: Erfolgs-Kontrolle Freiwillige'}
</SiteTitle>
)}
<MenuDiv>
Expand All @@ -157,11 +157,9 @@ const ProjekteAppBar = () => {
onClick={onClickPrintAll}
title={`Alle ${ekfCount} EKF drucken`}
>
{preparingEkfMultiprint ? (
{preparingEkfMultiprint ?
<StyledMdHourglassEmpty />
) : (
<MdPrint />
)}
: <MdPrint />}
</StyledIconButton>
</StyledBadge>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppBar/EkfBar/query.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { gql } from '@apollo/client'

export default gql`
query ekfUser($userId: UUID!) {
export const query = gql`
query ekfUser($userId: UUID!) {
userById(id: $userId) {
id
name
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Toolbar from '@mui/material/Toolbar'
import { Outlet, useLocation, useParams, useNavigate } from 'react-router-dom'
import { observer } from 'mobx-react-lite'

import Bar from './Bar/index.jsx'
import { Bar } from './Bar/index.jsx'
import EkfBar from './EkfBar/index.jsx'
import { inIframe } from '../../modules/inIframe.js'
import { Spinner } from '../shared/Spinner.jsx'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Ekf/dataByUserId.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'

import { aeTaxonomies, projekt } from '../shared/fragments.js'

export default gql`
export const dataByUserId = gql`
query ekfDataByUserQuery($id: UUID!, $jahr: Int!) {
userById(id: $id) {
id
Expand Down
2 changes: 1 addition & 1 deletion src/components/Ekf/dataWithDateByUserId.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'

import { aeTaxonomies, projekt } from '../shared/fragments.js'

export default gql`
export const dataWithDateByUserId = gql`
query ekfDataWithDateByUseridQuery($id: UUID!, $jahr: Int!) {
userById(id: $id) {
id
Expand Down
19 changes: 14 additions & 5 deletions src/components/Ekf/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import EkfList from './List'
import Tpopfreiwkontr from '../Projekte/Daten/Tpopfreiwkontr'
import { StoreContext } from '../../storeContext.js'
import { StyledSplitPane } from '../shared/StyledSplitPane'
import dataByUserIdGql from './dataByUserId'
import dataWithDateByUserIdGql from './dataWithDateByUserId'
import { dataByUserId as dataByUserIdGql } from './dataByUserId.js'
import { dataWithDateByUserId as dataWithDateByUserIdGql } from './dataWithDateByUserId.js'
import { Error } from '../shared/Error.jsx'

const Container = styled.div`
Expand Down Expand Up @@ -113,17 +113,26 @@ const Ekf = () => {
return (
<>
{ekf.map((e) => (
<Tpopfreiwkontr id={e.id} key={e.id} />
<Tpopfreiwkontr
id={e.id}
key={e.id}
/>
))}
</>
)
}

return (
<Container>
<StyledSplitPane split="vertical" size="350px" minSize={100}>
<StyledSplitPane
split="vertical"
size="350px"
minSize={100}
>
<EkfList ekf={ekf} />
{ekfId ? <Tpopfreiwkontr id={ekfId} /> : <InnerContainer />}
{ekfId ?
<Tpopfreiwkontr id={ekfId} />
: <InnerContainer />}
</StyledSplitPane>
</Container>
)
Expand Down

0 comments on commit 6429b44

Please sign in to comment.