aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2024-02-11 09:50:32 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2024-02-11 04:39:55 +0000
commitbeb1f1c28adc9872b179a2169e4f8d34adf125c7 (patch)
tree86dbd13e3ef6365d0e28fe4d23de7c6b7828f692 /src/components
parentremove unused '@types/react-loader' pkg (diff)
downloadferdium-app-beb1f1c28adc9872b179a2169e4f8d34adf125c7.tar.gz
ferdium-app-beb1f1c28adc9872b179a2169e4f8d34adf125c7.tar.zst
ferdium-app-beb1f1c28adc9872b179a2169e4f8d34adf125c7.zip
minor refactoring to remove duplication with a constant
Diffstat (limited to 'src/components')
-rw-r--r--src/components/settings/account/AccountDashboard.tsx8
-rw-r--r--src/components/settings/team/TeamDashboard.tsx4
-rw-r--r--src/components/ui/InfoBar.tsx7
-rw-r--r--src/components/ui/Infobox.tsx7
-rw-r--r--src/components/ui/button/index.tsx3
-rw-r--r--src/components/ui/loader/index.tsx3
6 files changed, 24 insertions, 8 deletions
diff --git a/src/components/settings/account/AccountDashboard.tsx b/src/components/settings/account/AccountDashboard.tsx
index ffa684458..eab019084 100644
--- a/src/components/settings/account/AccountDashboard.tsx
+++ b/src/components/settings/account/AccountDashboard.tsx
@@ -7,7 +7,11 @@ import { H1, H2 } from '../../ui/headline';
7import Loader from '../../ui/loader'; 7import Loader from '../../ui/loader';
8import Button from '../../ui/button'; 8import Button from '../../ui/button';
9import Infobox from '../../ui/infobox/index'; 9import Infobox from '../../ui/infobox/index';
10import { LOCAL_SERVER, LIVE_FRANZ_API } from '../../../config'; 10import {
11 DEFAULT_LOADER_COLOR,
12 LOCAL_SERVER,
13 LIVE_FRANZ_API,
14} from '../../../config';
11import User from '../../../models/User'; 15import User from '../../../models/User';
12 16
13const messages = defineMessages({ 17const messages = defineMessages({
@@ -123,7 +127,7 @@ class AccountDashboard extends Component<IProp> {
123 )} 127 )}
124 {!isUsingWithoutAccount && ( 128 {!isUsingWithoutAccount && (
125 <> 129 <>
126 {isLoading && <Loader color="#FFFFFF" />} 130 {isLoading && <Loader color={DEFAULT_LOADER_COLOR} />}
127 131
128 {!isLoading && userInfoRequestFailed && ( 132 {!isLoading && userInfoRequestFailed && (
129 <Infobox 133 <Infobox
diff --git a/src/components/settings/team/TeamDashboard.tsx b/src/components/settings/team/TeamDashboard.tsx
index 406656160..96613373e 100644
--- a/src/components/settings/team/TeamDashboard.tsx
+++ b/src/components/settings/team/TeamDashboard.tsx
@@ -10,7 +10,7 @@ import Loader from '../../ui/loader';
10import Button from '../../ui/button'; 10import Button from '../../ui/button';
11import Infobox from '../../ui/Infobox'; 11import Infobox from '../../ui/Infobox';
12import { H1 } from '../../ui/headline'; 12import { H1 } from '../../ui/headline';
13import { LIVE_FRANZ_API } from '../../../config'; 13import { DEFAULT_LOADER_COLOR, LIVE_FRANZ_API } from '../../../config';
14 14
15const messages = defineMessages({ 15const messages = defineMessages({
16 headline: { 16 headline: {
@@ -128,7 +128,7 @@ class TeamDashboard extends Component<IProps> {
128 </span> 128 </span>
129 </div> 129 </div>
130 <div className="settings__body"> 130 <div className="settings__body">
131 {isLoading && <Loader color="#FFFFFF" />} 131 {isLoading && <Loader color={DEFAULT_LOADER_COLOR} />}
132 132
133 {!isLoading && userInfoRequestFailed && ( 133 {!isLoading && userInfoRequestFailed && (
134 <Infobox 134 <Infobox
diff --git a/src/components/ui/InfoBar.tsx b/src/components/ui/InfoBar.tsx
index ae37546df..f3f1adbe7 100644
--- a/src/components/ui/InfoBar.tsx
+++ b/src/components/ui/InfoBar.tsx
@@ -8,6 +8,7 @@ import { noop } from 'lodash';
8import Loader from './loader/index'; 8import Loader from './loader/index';
9import Appear from './effects/Appear'; 9import Appear from './effects/Appear';
10import Icon from './icon'; 10import Icon from './icon';
11import { DEFAULT_LOADER_COLOR } from '../../config';
11 12
12const messages = defineMessages({ 13const messages = defineMessages({
13 hide: { 14 hide: {
@@ -71,7 +72,11 @@ class InfoBar extends Component<IProps> {
71 className="contentWrapper" 72 className="contentWrapper"
72 style={{ display: 'flex', gap: '8px' }} 73 style={{ display: 'flex', gap: '8px' }}
73 > 74 >
74 <Loader size={18} loaded={!ctaLoading} color="#FFFFFF" /> 75 <Loader
76 size={18}
77 loaded={!ctaLoading}
78 color={DEFAULT_LOADER_COLOR}
79 />
75 {ctaLabel} 80 {ctaLabel}
76 </div> 81 </div>
77 </button> 82 </button>
diff --git a/src/components/ui/Infobox.tsx b/src/components/ui/Infobox.tsx
index 742717ed7..14e1a581c 100644
--- a/src/components/ui/Infobox.tsx
+++ b/src/components/ui/Infobox.tsx
@@ -6,6 +6,7 @@ import { noop } from 'lodash';
6import { observer } from 'mobx-react'; 6import { observer } from 'mobx-react';
7import Loader from './loader/index'; 7import Loader from './loader/index';
8import Icon from './icon'; 8import Icon from './icon';
9import { DEFAULT_LOADER_COLOR } from '../../config';
9 10
10const icons = { 11const icons = {
11 'checkbox-marked-circle-outline': mdiCheckboxMarkedCircleOutline, 12 'checkbox-marked-circle-outline': mdiCheckboxMarkedCircleOutline,
@@ -84,7 +85,11 @@ class Infobox extends Component<IProps, IState> {
84 className="contentWrapper" 85 className="contentWrapper"
85 style={{ display: 'flex', gap: '8px' }} 86 style={{ display: 'flex', gap: '8px' }}
86 > 87 >
87 <Loader size={18} loaded={!ctaLoading} color="#FFFFFF" /> 88 <Loader
89 size={18}
90 loaded={!ctaLoading}
91 color={DEFAULT_LOADER_COLOR}
92 />
88 {ctaLabel} 93 {ctaLabel}
89 </div> 94 </div>
90 </button> 95 </button>
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx
index a2194e34d..3247072a9 100644
--- a/src/components/ui/button/index.tsx
+++ b/src/components/ui/button/index.tsx
@@ -8,6 +8,7 @@ import withStyles, { WithStylesProps } from 'react-jss';
8import Loader from '../loader/index'; 8import Loader from '../loader/index';
9import { Theme } from '../../../themes'; 9import { Theme } from '../../../themes';
10import { IFormField } from '../typings/generic'; 10import { IFormField } from '../typings/generic';
11import { DEFAULT_LOADER_COLOR } from '../../../config';
11 12
12type ButtonType = 13type ButtonType =
13 | 'primary' 14 | 'primary'
@@ -194,7 +195,7 @@ class ButtonComponent extends Component<IProps, IState> {
194 <> 195 <>
195 {showLoader && ( 196 {showLoader && (
196 <div className={classes.loaderContainer}> 197 <div className={classes.loaderContainer}>
197 <Loader size={18} color="#FFFFFF" /> 198 <Loader size={18} color={DEFAULT_LOADER_COLOR} />
198 </div> 199 </div>
199 )} 200 )}
200 <div className={classes.label}> 201 <div className={classes.label}>
diff --git a/src/components/ui/loader/index.tsx b/src/components/ui/loader/index.tsx
index 2c6e2bff4..c0ae15028 100644
--- a/src/components/ui/loader/index.tsx
+++ b/src/components/ui/loader/index.tsx
@@ -4,6 +4,7 @@ import injectStyle, { WithStylesProps } from 'react-jss';
4import { Oval } from 'react-loader-spinner'; 4import { Oval } from 'react-loader-spinner';
5import { inject } from 'mobx-react'; 5import { inject } from 'mobx-react';
6import { FerdiumStores } from '../../../@types/stores.types'; 6import { FerdiumStores } from '../../../@types/stores.types';
7import { DEFAULT_LOADER_COLOR } from '../../../config';
7 8
8const styles = () => ({ 9const styles = () => ({
9 container: { 10 container: {
@@ -33,7 +34,7 @@ class LoaderComponent extends Component<IProps> {
33 color = this.props.stores?.settings.app.accentColor, 34 color = this.props.stores?.settings.app.accentColor,
34 loaded = false, 35 loaded = false,
35 } = this.props; 36 } = this.props;
36 const loaderColor = color ?? '#FFFFFF'; 37 const loaderColor = color ?? DEFAULT_LOADER_COLOR;
37 38
38 return ( 39 return (
39 <div 40 <div