Skip to content

Commit

Permalink
Fix: collections pagination and other admin UX improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
polishq committed Apr 19, 2024
1 parent e543b1d commit 74011b3
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 23 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [Unreleased]

### Fixed

- Pagination bug on admin organization details collections assignment UI

### Added

- Loading indicators for admin organization details: cost centers, collections, payment terms, price tables, and sellers

## [1.31.2] - 2024-03-14

### Changed
Expand All @@ -23,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [1.31.0] - 2024-02-27

### Added

- Add help footer on bulk import upload modal

## [1.30.2] - 2024-01-31
Expand Down Expand Up @@ -70,7 +78,8 @@ Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Spanish, Finn
## [1.28.1] - 2023-11-06

### Fixed
- Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Spanish, Finnish, French, Indonesian, Italian, Japanese, Korean, Dutch, Norwegian, Polish, Portuguese, Romanian, Russian, Slovakian, Slovenian, Swedish, Thai and Ukrainian translations.

- Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Spanish, Finnish, French, Indonesian, Italian, Japanese, Korean, Dutch, Norwegian, Polish, Portuguese, Romanian, Russian, Slovakian, Slovenian, Swedish, Thai and Ukrainian translations.

## [1.28.0] - 2023-10-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ const OrganizationDetailsCollections = ({
const {
data: collectionsData,
refetch: refetchCollections,
} = useQuery(GET_COLLECTIONS, { ssr: false })
loading,
} = useQuery(GET_COLLECTIONS, {
notifyOnNetworkStatusChange: true,
ssr: false,
})

/**
* Effects
*/

useEffect(() => {
if (
!collectionsData?.collections?.items?.length ||
collectionOptions.length
) {
if (!collectionsData?.collections?.items?.length) {
return
}

Expand Down Expand Up @@ -171,6 +172,7 @@ const OrganizationDetailsCollections = ({
fullWidth
schema={getSchema('availableCollections')}
items={collectionOptions}
loading={loading}
pagination={{
onNextClick: handleCollectionsNextClick,
onPrevClick: handleCollectionsPrevClick,
Expand Down
21 changes: 12 additions & 9 deletions react/admin/OrganizationDetails/OrganizationDetailsCostCenters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ const OrganizationDetailsCostCenters = ({
* Mutations
*/
const [createCostCenter] = useMutation(CREATE_COST_CENTER)
const { data: costCentersData, refetch: refetchCostCenters } = useQuery(
GET_COST_CENTERS,
{
variables: { ...costCenterPaginationState, id: params?.id },
fetchPolicy: 'network-only',
skip: !params?.id,
ssr: false,
}
)
const {
data: costCentersData,
refetch: refetchCostCenters,
loading,
} = useQuery(GET_COST_CENTERS, {
variables: { ...costCenterPaginationState, id: params?.id },
fetchPolicy: 'network-only',
notifyOnNetworkStatusChange: true,
skip: !params?.id,
ssr: false,
})

//! CUSTOM FIELDS
const {
Expand Down Expand Up @@ -286,6 +288,7 @@ const OrganizationDetailsCostCenters = ({
<Table
fullWidth
schema={getCostCenterSchema()}
loading={loading}
items={costCentersData?.getCostCentersByOrganizationId?.data}
onRowClick={({
rowData: { id },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const OrganizationDetailsPayTerms = ({
* Queries
*/

const { data: paymentTermsData } = useQuery<{
const { data: paymentTermsData, loading } = useQuery<{
getPaymentTerms: PaymentTerm[]
}>(GET_PAYMENT_TERMS, { ssr: false })

Expand All @@ -47,10 +47,7 @@ const OrganizationDetailsPayTerms = ({
*/

useEffect(() => {
if (
!paymentTermsData?.getPaymentTerms?.length ||
paymentTermsOptions.length
) {
if (!paymentTermsData?.getPaymentTerms?.length) {
return
}

Expand Down Expand Up @@ -131,6 +128,7 @@ const OrganizationDetailsPayTerms = ({
fullWidth
schema={getSchema('availablePayments')}
items={paymentTermsOptions}
loading={loading}
bulkActions={organizationBulkAction(
handleAddPaymentTerms,
messages.addToOrg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const OrganizationDetailsPriceTables = ({
/**
* Queries
*/
const { data: priceTablesData } = useQuery(GET_PRICE_TABLES, { ssr: false })
const { data: priceTablesData, loading } = useQuery(GET_PRICE_TABLES, {
ssr: false,
})

/**
* Effects
Expand Down Expand Up @@ -120,6 +122,7 @@ const OrganizationDetailsPriceTables = ({
fullWidth
schema={getSchema('availablePriceTables')}
items={priceTableOptions}
loading={loading}
bulkActions={organizationBulkAction(
handleAddPriceTables,
messages.addToOrg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const OrganizationDetailsSellers = ({
/**
* Queries
*/
const { data: sellersData } = useQuery(GET_SELLERS)
const { data: sellersData, loading } = useQuery(GET_SELLERS)

/**
* Effects
Expand Down Expand Up @@ -107,6 +107,7 @@ const OrganizationDetailsSellers = ({
fullWidth
schema={getSchema()}
items={sellersState}
loading={loading}
bulkActions={organizationBulkAction(
handleRemoveSellers,
messages.removeFromOrg,
Expand Down

0 comments on commit 74011b3

Please sign in to comment.