Skip to content

Commit 092468e

Browse files
revert: change theme parameter types from Theme back to any for Material-UI compatibility
- Changed all getStyles and styles functions from (theme: Theme) to (theme: any) in 69 files - Removed unused Theme imports from all modified files - Converted src/core_modules/capture-ui/DateAndTimeFields/DateField/getTheme.js to TypeScript - This reverts TypeScript migration changes that were incompatible with custom theme extensions - Custom grey color variants (lighter, lightest) remain intact in src/styles/uiTheme.ts - All linting and TypeScript compilation errors resolved Co-Authored-By: [email protected] <[email protected]>
1 parent c31ef80 commit 092468e

File tree

71 files changed

+100
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+100
-147
lines changed

src/components/App/AppContents.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { memo, type ComponentType } from 'react';
2-
import { withStyles, type WithStyles, type Theme } from '@material-ui/core/styles';
2+
import { withStyles, type WithStyles } from '@material-ui/core/styles';
33
import { systemSettingsStore } from 'capture-core/metaDataMemoryStores';
44
import { FeedbackBar } from 'capture-core/components/FeedbackBar';
55
import { AppPagesLoader } from './AppPagesLoader.component';
66

7-
const getStyles = (theme: Theme) => ({
7+
const getStyles = (theme: any) => ({
88
app: {
99
fontFamily: theme.typography.fontFamily,
1010
fontSize: theme.typography.pxToRem(16),

src/core_modules/capture-core/components/BorderBox/BorderBox.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as React from 'react';
22
import { withStyles, WithStyles } from '@material-ui/core/styles';
3-
import type { Theme } from '@material-ui/core/styles';
43

5-
const styles = (theme: Theme) => ({
4+
const styles = (theme: any) => ({
65
borderBox: {
76
borderRadius: theme.typography.pxToRem(6),
87
borderWidth: theme.typography.pxToRem(2),

src/core_modules/capture-core/components/Buttons/LinkButton.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react';
22
import { withStyles, WithStyles } from '@material-ui/core/styles';
33
import classNames from 'classnames';
4-
import { Theme } from '@material-ui/core/styles/createMuiTheme';
54

6-
const styles = (theme: Theme) => ({
5+
const styles = (theme: any) => ({
76
button: {
87
border: 'none',
98
fontSize: theme.typography.pxToRem(16),

src/core_modules/capture-core/components/CardList/CardList.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import { withStyles, type WithStyles } from '@material-ui/core/styles';
3-
import type { Theme } from '@material-ui/core/styles';
43
import { CardListItem } from './CardListItem.component';
54
import { makeElementsContainerSelector } from './CardList.selectors';
65
import { CardDataElementsInformation } from '../SearchBox';
@@ -16,7 +15,7 @@ type OwnProps = {
1615
renderCustomCardActions?: RenderCustomCardActions;
1716
};
1817

19-
const getStyles = (theme: Theme) => ({
18+
const getStyles = (theme: any) => ({
2019
noItemsContainer: {
2120
fontStyle: 'italic',
2221
padding: theme.typography.pxToRem(10),

src/core_modules/capture-core/components/CardList/CardListButtons.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { type FC, useCallback } from 'react';
2-
import { withStyles, type Theme, type WithStyles } from '@material-ui/core/styles';
2+
import { withStyles, type WithStyles } from '@material-ui/core/styles';
33
import i18n from '@dhis2/d2-i18n';
44
import { Button, type ButtonEventHandler } from '@dhis2/ui';
55
import { useDispatch } from 'react-redux';
@@ -20,7 +20,7 @@ type Props = {
2020

2121
type AvailableCardListButtonState = keyof typeof availableCardListButtonState;
2222

23-
const buttonStyles = (theme: Theme) => ({
23+
const buttonStyles = (theme: any) => ({
2424
buttonMargin: {
2525
'&:not(:first-child)': {
2626
marginLeft: theme.typography.pxToRem(8),

src/core_modules/capture-core/components/CardList/CardListItem.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import i18n from '@dhis2/d2-i18n';
22
import React from 'react';
33
import moment from 'moment';
4-
import { withStyles, type Theme, type WithStyles } from '@material-ui/core/styles';
4+
import { withStyles, type WithStyles } from '@material-ui/core/styles';
55
import { colors, Tag, IconCheckmark16, Tooltip } from '@dhis2/ui';
66
import { useTimeZoneConversion } from '@dhis2/app-runtime';
77
import { CardImage } from 'capture-ui/CardImage/CardImage.component';
@@ -33,7 +33,7 @@ type OwnProps = {
3333

3434
type Props = OwnProps & WithStyles<typeof styles>;
3535

36-
const styles = (theme: Theme) => ({
36+
const styles = (theme: any) => ({
3737
itemContainer: {
3838
maxWidth: theme.typography.pxToRem(600),
3939
display: 'flex',

src/core_modules/capture-core/components/CardList/ListEntry.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import { withStyles } from '@material-ui/core';
3-
import type { Theme, WithStyles } from '@material-ui/core/styles';
3+
import type { WithStyles } from '@material-ui/core/styles';
44
import { colors } from '@dhis2/ui';
55
import { convertValue } from '../../converters/clientToView';
66
import { DataElement, dataElementTypes } from '../../metaData';
77

8-
const styles = (theme: Theme) => ({
8+
const styles = (theme: any) => ({
99
elementName: {
1010
fontSize: theme.typography.pxToRem(13),
1111
color: colors.grey700,

src/core_modules/capture-core/components/DataEntries/SingleEventRegistrationEntry/DataEntryWrapper/RecentlyAddedEventsList/RecentlyAddedEventsList.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from 'react';
22
import { withStyles, type WithStyles } from '@material-ui/core/styles';
3-
import type { Theme } from '@material-ui/core/styles';
43
import { Card } from '@dhis2/ui';
54
import i18n from '@dhis2/d2-i18n';
65
import { OfflineEventsList } from '../../../../EventsList/OfflineEventsList/OfflineEventsList.component';
76
import { listId } from './RecentlyAddedEventsList.const';
87
import type { Props } from './RecentlyAddedEventsList.types';
98

10-
const styles = (theme: Theme) => ({
9+
const styles = (theme: any) => ({
1110
container: {
1211
padding: theme.typography.pxToRem(20),
1312
},

src/core_modules/capture-core/components/DataEntry/dataEntryField/withDefaultFieldContainer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import * as React from 'react';
22
import { withStyles, type WithStyles } from '@material-ui/core/styles';
3-
import type { Theme } from '@material-ui/core/styles';
43

54
type Props = WithStyles<typeof styles>;
65

7-
const styles = (theme: Theme) => ({
6+
const styles = (theme: any) => ({
87
container: {
98
marginLeft: theme.spacing.unit,
109
marginRight: theme.spacing.unit,

src/core_modules/capture-core/components/DataEntry/dataEntryField/withDefaultMessages.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react';
22
import { withStyles, type WithStyles } from '@material-ui/core/styles';
3-
import type { Theme } from '@material-ui/core/styles';
43
import classNames from 'classnames';
54

6-
const styles = (theme: Theme) => ({
5+
const styles = (theme: any) => ({
76
base: {
87
paddingTop: 10,
98
},

0 commit comments

Comments
 (0)