From 442e36530b74fb304ec6d7293c3d45a72087f62a Mon Sep 17 00:00:00 2001 From: William Wills Date: Tue, 27 Aug 2024 18:52:01 -0400 Subject: [PATCH 1/3] fix: leftnav readonly layout --- src/renderer/api/cadt/v1/index.ts | 30 ++++++------------- src/renderer/api/cadt/v1/system/system.api.ts | 2 +- .../blocks/widgets/SyncIndicator.tsx | 5 ++-- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/renderer/api/cadt/v1/index.ts b/src/renderer/api/cadt/v1/index.ts index 84202a24..c449d358 100644 --- a/src/renderer/api/cadt/v1/index.ts +++ b/src/renderer/api/cadt/v1/index.ts @@ -1,15 +1,15 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; import initialState from '@/store/slices/app/app.initialstate'; -const projectsTag = 'projects'; -const organizationsTag = 'organizations'; -const unitsTag = 'units'; -const auditTag = 'audit'; -const issuancesTag = 'issuances'; -const stagedProjectsTag = 'stagedProjects'; -const stagedUnitsTag = 'stagedUnits'; -const offerTag = 'offer'; -const importedOfferTag = 'importedTransferTag'; +export const projectsTag = 'projects'; +export const organizationsTag = 'organizations'; +export const unitsTag = 'units'; +export const auditTag = 'audit'; +export const issuancesTag = 'issuances'; +export const stagedProjectsTag = 'stagedProjects'; +export const stagedUnitsTag = 'stagedUnits'; +export const offerTag = 'offer'; +export const importedOfferTag = 'importedTransferTag'; const baseQuery = fetchBaseQuery({ baseUrl: '/', @@ -62,15 +62,3 @@ export const cadtApi = createApi({ ], endpoints: () => ({}), }); - -export { - projectsTag, - organizationsTag, - unitsTag, - auditTag, - stagedProjectsTag, - stagedUnitsTag, - issuancesTag, - offerTag, - importedOfferTag, -}; diff --git a/src/renderer/api/cadt/v1/system/system.api.ts b/src/renderer/api/cadt/v1/system/system.api.ts index 12d79ab0..e1c56993 100644 --- a/src/renderer/api/cadt/v1/system/system.api.ts +++ b/src/renderer/api/cadt/v1/system/system.api.ts @@ -32,7 +32,7 @@ const systemApi = cadtApi.injectEndpoints({ }), transformResponse: (response: BaseQueryResult, meta): ServerHealth => { const isHealthy = response?.message === 'OK'; - const readOnly = meta?.response?.headers.get('cw-readonly') === 'true'; + const readOnly = meta?.response?.headers.get('cw-read-only') === 'true'; return { isHealthy, readOnly }; }, }), diff --git a/src/renderer/components/blocks/widgets/SyncIndicator.tsx b/src/renderer/components/blocks/widgets/SyncIndicator.tsx index d3e2df9b..043e2d73 100644 --- a/src/renderer/components/blocks/widgets/SyncIndicator.tsx +++ b/src/renderer/components/blocks/widgets/SyncIndicator.tsx @@ -10,6 +10,7 @@ import { BiRefresh } from 'react-icons/bi'; import { useLocation } from 'react-router-dom'; import { useDispatch } from 'react-redux'; import { FormattedMessage } from 'react-intl'; +import { projectsTag, stagedProjectsTag, stagedUnitsTag, unitsTag } from '@/api/cadt/v1'; interface SyncIndicatorProps { detailed: boolean; @@ -68,11 +69,11 @@ const SyncIndicator: React.FC = ({ detailed, orgUid }) => { setShowRefreshBadge(true); if (location.pathname.includes('projects')) { - dispatch(invalidateProjectApiTag(['projects', 'stagedProjects'])); + dispatch(invalidateProjectApiTag([projectsTag, stagedProjectsTag])); } if (location.pathname.includes('units')) { - dispatch(invalidateUnitsApiTag(['units', 'stagedUnits'])); + dispatch(invalidateUnitsApiTag([unitsTag, stagedUnitsTag])); } } From 81c427c33e454c188f0ef8299fbc3ebe518d02f0 Mon Sep 17 00:00:00 2001 From: William Wills Date: Wed, 28 Aug 2024 11:05:02 -0400 Subject: [PATCH 2/3] fix: compiled app date display --- src/renderer/components/form/Field.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/form/Field.tsx b/src/renderer/components/form/Field.tsx index 3b8e2f5b..8564ecb1 100644 --- a/src/renderer/components/form/Field.tsx +++ b/src/renderer/components/form/Field.tsx @@ -72,7 +72,7 @@ const Field: React.FC = ({ ); case 'date': - return dayjs(new Date(initialValue)).format('MMMM D, YYYY'); + return `${dayjs(new Date(initialValue)).format('MMMM D, YYYY')}`; case 'tag': return ( setFieldValue(name, tags)} readonly={readonly} /> From 3b848227777f8a7268e6e90899bdfcc731d0426d Mon Sep 17 00:00:00 2001 From: William Wills Date: Wed, 28 Aug 2024 11:47:51 -0400 Subject: [PATCH 3/3] fix: merge --- src/renderer/components/form/Field.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/components/form/Field.tsx b/src/renderer/components/form/Field.tsx index 48c4560d..298b0245 100644 --- a/src/renderer/components/form/Field.tsx +++ b/src/renderer/components/form/Field.tsx @@ -4,6 +4,7 @@ import { FormikValues, useFormikContext } from 'formik'; import { Checkbox, Datepicker, Label, Textarea, TextInput } from 'flowbite-react'; import { TagInput } from './TagInput'; import { Select, SelectOption } from '@/components'; +import dayjs from 'dayjs'; interface FieldProps { name: string;