Skip to content

Commit

Permalink
theme-related cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsalar committed Jan 4, 2023
1 parent 34f1c92 commit aa51693
Show file tree
Hide file tree
Showing 57 changed files with 46 additions and 243 deletions.
5 changes: 0 additions & 5 deletions plugins/src/components/Dialog/DesktopDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Dialog extends PureComponent {
closeButton: PropTypes.func,
onCloseDialog: PropTypes.func,
children: PropTypes.node.isRequired,
disableTheme: PropTypes.bool,
};

onRequestClose = (e) => {
Expand All @@ -30,9 +29,7 @@ class Dialog extends PureComponent {
shouldCloseOnOverlayClick,
showCloseText,
dialogId,
theme,
className,
disableTheme,
bodyOpenClassName,
strings: STRINGS,
} = this.props;
Expand Down Expand Up @@ -76,10 +73,8 @@ class Dialog extends PureComponent {
Modal.setAppElement('#root');

Dialog.defaultProps = {
disableTheme: false,
shouldCloseOnOverlayClick: true,
showCloseText: true,
theme: '',
className: '',
strings: {},
};
Expand Down
1 change: 0 additions & 1 deletion web/src/components/AppFooter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const generateSectionsText = (links = {}, ICONS) => {

const AppFooter = ({
className,
theme,
constants = { description: '' },
constants: { links = {} },
icons: ICONS,
Expand Down
1 change: 0 additions & 1 deletion web/src/components/Chat/ChatMessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class ChatMessageList extends Component {
}

const mapStateToProps = (store) => ({
// activeTheme: store.app.theme,
is_hap: store.user.is_hap,
});

Expand Down
15 changes: 3 additions & 12 deletions web/src/components/Dialog/DesktopDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Ionicon from 'react-ionicons';
import { Button, ActionNotification } from 'components';
import STRINGS from 'config/localizedStrings';
import { getClasesForLanguage, getLanguage } from 'utils/string';
import { getThemeClass } from 'utils/theme';
import withEdit from 'components/EditProvider/withEdit';

class Dialog extends PureComponent {
Expand All @@ -16,7 +15,6 @@ class Dialog extends PureComponent {
closeButton: PropTypes.func,
onCloseDialog: PropTypes.func,
children: PropTypes.node.isRequired,
disableTheme: PropTypes.bool,
};

onRequestClose = (e) => {
Expand All @@ -35,9 +33,7 @@ class Dialog extends PureComponent {
shouldCloseOnOverlayClick,
showCloseText,
dialogId,
theme,
className,
disableTheme,
bodyOpenClassName,
isEditMode,
} = this.props;
Expand All @@ -49,12 +45,9 @@ class Dialog extends PureComponent {
contentLabel={label}
onRequestClose={this.onRequestClose}
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
portalClassName={classnames(
className,
languageClasses,
disableTheme ? '' : getThemeClass(theme),
{ 'layout-edit': isEditMode }
)}
portalClassName={classnames(className, languageClasses, {
'layout-edit': isEditMode,
})}
bodyOpenClassName={bodyOpenClassName}
>
{showCloseText && !closeButton && (
Expand Down Expand Up @@ -84,10 +77,8 @@ class Dialog extends PureComponent {
Modal.setAppElement('#root');

Dialog.defaultProps = {
disableTheme: false,
shouldCloseOnOverlayClick: true,
showCloseText: true,
theme: '',
className: '',
};

Expand Down
4 changes: 0 additions & 4 deletions web/src/components/Dialog/MobileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Modal from 'react-modal';
import { isLoggedIn } from 'utils/token';
import { MobileBarBack } from 'components';
import { getClasesForLanguage, getLanguage } from 'utils/string';
import { getThemeClass } from 'utils/theme';
import { ICONS } from 'config/constants';
import { ReactSVG } from 'react-svg';

Expand Down Expand Up @@ -58,7 +57,6 @@ class Dialog extends PureComponent {
children,
label,
dialogId,
theme,
className,
useFullScreen = false,
compressed = false,
Expand All @@ -75,7 +73,6 @@ class Dialog extends PureComponent {
portalClassName={classnames(
className,
languageClasses,
getThemeClass(theme),
'layout-mobile',
{
compressed,
Expand Down Expand Up @@ -103,7 +100,6 @@ Modal.setAppElement('#root');
Dialog.defaultProps = {
shouldCloseOnOverlayClick: true,
showCloseText: true,
theme: '',
className: '',
};

Expand Down
5 changes: 1 addition & 4 deletions web/src/components/Loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ Loader.defaultProps = {
className: '',
};

const mapStateToProps = ({
app: { theme: activeTheme, constants: { color = {} } = {} },
}) => ({
activeTheme,
const mapStateToProps = ({ app: { constants: { color = {} } = {} } }) => ({
color,
});

Expand Down
1 change: 1 addition & 0 deletions web/src/components/Table/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TableRow extends Component {
const { isExpanded } = this.state;
const isRemoveData = cancelDelayData.filter((data) => data === row.id);
const isExpandable = rowExpandable(row);
//TODO: hard-coded colors
const subTrClsName =
activeTheme === 'white' ? 'sub-tr-bg-white' : 'sub-tr-bg';

Expand Down
44 changes: 12 additions & 32 deletions web/src/containers/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import querystring from 'query-string';
// import { CaretLeftOutlined, CaretRightOutlined } from '@ant-design/icons';
// import { Button } from 'antd';
import { setSideBarState, getSideBarState } from 'utils/sideBar';
import AppMenuSidebar from '../../components/AppMenuSidebar';
import AppMenuSidebar from 'components/AppMenuSidebar';
import { addElements, injectHTML } from 'utils/script';
import { SuccessDisplay } from 'components';

Expand All @@ -29,13 +29,9 @@ import {
import { storeTools } from 'actions/toolsAction';
import STRINGS from 'config/localizedStrings';

import {
getThemeClass,
getChatMinimized,
setChatMinimized,
} from '../../utils/theme';
import { checkUserSessionExpired } from '../../utils/utils';
import { getTokenTimestamp, isLoggedIn, isAdmin } from '../../utils/token';
import { getChatMinimized, setChatMinimized } from 'utils/theme';
import { checkUserSessionExpired } from 'utils/utils';
import { getTokenTimestamp, isLoggedIn, isAdmin } from 'utils/token';
import {
AppBar,
AppMenuBar,
Expand All @@ -47,7 +43,7 @@ import {
SnackNotification,
SnackDialog,
PairTabs,
} from '../../components';
} from 'components';
import {
ContactForm,
HelpfulResourcesForm,
Expand All @@ -66,11 +62,8 @@ import MarketSelector from 'components/AppBar/MarketSelector';
import ConnectViaDesktop from 'containers/Stake/components/ConnectViaDesktop';
import ConfigureApps from 'containers/Apps/ConfigureApps';

import {
getClasesForLanguage,
getFontClassForLanguage,
} from '../../utils/string';
import { getExchangeInitialized } from '../../utils/initialize';
import { getClasesForLanguage, getFontClassForLanguage } from 'utils/string';
import { getExchangeInitialized } from 'utils/initialize';

import Socket from './Socket';
import Container from './Container';
Expand Down Expand Up @@ -491,7 +484,6 @@ class App extends Component {
type={type}
data={data}
onClose={this.onCloseDialog}
activeTheme={this.props.activeTheme}
/>
);
case MARKET_SELECTOR:
Expand Down Expand Up @@ -651,7 +643,6 @@ class App extends Component {
// verification_level,
activeLanguage,
// openContactForm,
activeTheme,
// unreadMessages,
router,
location,
Expand Down Expand Up @@ -728,7 +719,6 @@ class App extends Component {
/>
<div
className={classnames(
getThemeClass(activeTheme),
activePath,
symbol,
fontClass,
Expand All @@ -744,7 +734,6 @@ class App extends Component {
className={classnames(
'app_container',
'd-flex',
getThemeClass(activeTheme),
activePath,
symbol,
fontClass,
Expand Down Expand Up @@ -881,7 +870,6 @@ class App extends Component {
)}
onCloseDialog={this.onCloseDialog}
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
theme={activeTheme}
showCloseText={
!(
activeNotification.type === NOTIFICATIONS.STAKE ||
Expand Down Expand Up @@ -911,7 +899,6 @@ class App extends Component {
this.renderDialogContent(
activeNotification
// prices,
// activeTheme
)}
</Dialog>
{!isMobile && !isHome && features && features.chat && (
Expand Down Expand Up @@ -942,18 +929,12 @@ class App extends Component {
<SnackDialog />
</div>
<div
className={classnames(
getThemeClass(activeTheme),
languageClasses[0],
{
'layout-mobile': isMobile,
'layout-desktop': isBrowser,
}
)}
className={classnames(languageClasses[0], {
'layout-mobile': isMobile,
'layout-desktop': isBrowser,
})}
>
{showFooter && !isChartEmbed && (
<AppFooter theme={activeTheme} constants={constants} />
)}
{showFooter && !isChartEmbed && <AppFooter constants={constants} />}
</div>
</div>
{isAdmin() && isBrowser && !isChartEmbed && (
Expand All @@ -963,7 +944,6 @@ class App extends Component {
label="successful_dialog"
isOpen={isCustomNotification}
onCloseDialog={this.onCloseNotification}
theme={activeTheme}
>
<SuccessDisplay
onClick={this.onCloseNotification}
Expand Down
1 change: 0 additions & 1 deletion web/src/containers/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const mapStateToProps = (store) => ({
activeNotification: store.app.activeNotification,
// verification_level: store.user.verification_level,
activeLanguage: store.app.language,
activeTheme: store.app.theme,
// user: store.user,
pair: store.app.pair,
pairs: store.app.pairs,
Expand Down
14 changes: 2 additions & 12 deletions web/src/containers/AuthContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { AppFooter, Dialog } from 'components';
import { HelpfulResourcesForm } from 'containers';
import { FLEX_CENTER_CLASSES } from 'config/constants';
import { getClasesForLanguage } from 'utils/string';
import { getThemeClass } from 'utils/theme';
import {
getExchangeInfo,
closeNotification,
Expand Down Expand Up @@ -86,7 +85,6 @@ class AuthContainer extends Component {
const { dialogIsOpen } = this.state;
const {
activeLanguage,
activeTheme,
children,
constants = { captcha: {} },
icons: ICONS = {},
Expand All @@ -105,7 +103,6 @@ class AuthContainer extends Component {
'auth-wrapper',
'w-100',
'h-100',
getThemeClass(activeTheme),
{
'layout-mobile': isMobile,
'layout-desktop': isBrowser,
Expand All @@ -129,7 +126,6 @@ class AuthContainer extends Component {
className="app-dialog"
onCloseDialog={this.onCloseDialog}
shouldCloseOnOverlayClick={false}
theme={activeTheme}
showCloseText={false}
compressed={false}
style={{ 'z-index': 100 }}
Expand All @@ -144,13 +140,8 @@ class AuthContainer extends Component {
)}
</Dialog>
{!isMobile ? (
<div
className={classnames(
'footer-wrapper',
getThemeClass(activeTheme)
)}
>
<AppFooter theme={activeTheme} constants={constants} />
<div className={classnames('footer-wrapper')}>
<AppFooter constants={constants} />
</div>
) : null}
</div>
Expand All @@ -161,7 +152,6 @@ class AuthContainer extends Component {

const mapStateToProps = (store) => ({
activeLanguage: store.app.language,
activeTheme: store.app.theme,
info: store.app.info,
constants: store.app.constants,
activeNotification: store.app.activeNotification,
Expand Down
9 changes: 2 additions & 7 deletions web/src/containers/ChartEmbed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ChartEmbed extends PureComponent {
};

render() {
const { pair, pairData, activeTheme } = this.props;
const { pair, pairData } = this.props;
const { chartHeight, symbol } = this.state;

if (symbol !== pair || !pairData) {
Expand Down Expand Up @@ -101,11 +101,7 @@ class ChartEmbed extends PureComponent {
pair={pair}
>
{pair && chartHeight > 0 && (
<TVChartContainer
activeTheme={activeTheme}
symbol={symbol}
pairData={pairData}
/>
<TVChartContainer symbol={symbol} pairData={pairData} />
)}
</TradeBlock>
</div>
Expand All @@ -122,7 +118,6 @@ const mapStateToProps = (state) => {
return {
pair,
pairData,
activeTheme: state.app.theme,
isReady: state.app.isReady,
constants: state.app.constants,
};
Expand Down
8 changes: 1 addition & 7 deletions web/src/containers/ConfirmChangePassword/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';

import { Dialog } from 'components';
import ResetPasswordSuccess from 'containers/ResetPassword/ResetPasswordSuccess';
Expand Down Expand Up @@ -37,7 +36,6 @@ class ConfirmChangePassword extends Component {
isOpen={this.state.showContactForm}
label="confirm-change-pwd-modal"
onCloseDialog={this.onCloseDialog}
theme={this.props.activeTheme}
>
{this.state.showContactForm && (
<div className="confirm-change-pwd-wrapper">
Expand All @@ -54,8 +52,4 @@ class ConfirmChangePassword extends Component {
}
}

const mapStateToProps = (store) => ({
activeTheme: store.app.theme,
});

export default connect(mapStateToProps)(ConfirmChangePassword);
export default ConfirmChangePassword;
Loading

0 comments on commit aa51693

Please sign in to comment.