aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/services/content/Services.js
diff options
context:
space:
mode:
authorLibravatar Ricardo Cino <ricardo@cino.io>2022-07-07 09:31:50 +0200
committerLibravatar GitHub <noreply@github.com>2022-07-07 09:31:50 +0200
commit71c52373f81cace664047edd19d9d289f45a4dff (patch)
tree69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/components/services/content/Services.js
parent6.0.0-nightly.91 [skip ci] (diff)
downloadferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.gz
ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.zst
ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.zip
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/components/services/content/Services.js')
-rw-r--r--src/components/services/content/Services.js163
1 files changed, 0 insertions, 163 deletions
diff --git a/src/components/services/content/Services.js b/src/components/services/content/Services.js
deleted file mode 100644
index b38b0e3c3..000000000
--- a/src/components/services/content/Services.js
+++ /dev/null
@@ -1,163 +0,0 @@
1import { Component } from 'react';
2import PropTypes from 'prop-types';
3import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react';
4import { Link } from 'react-router';
5import { defineMessages, injectIntl } from 'react-intl';
6import Confetti from 'react-confetti';
7import ms from 'ms';
8import injectSheet from 'react-jss';
9
10import ServiceView from './ServiceView';
11import Appear from '../../ui/effects/Appear';
12
13const messages = defineMessages({
14 getStarted: {
15 id: 'services.getStarted',
16 defaultMessage: 'Get started',
17 },
18 login: {
19 id: 'services.login',
20 defaultMessage: 'Please login to use Ferdium.',
21 },
22 serverless: {
23 id: 'services.serverless',
24 defaultMessage: 'Use Ferdium without an Account',
25 },
26 serverInfo: {
27 id: 'services.serverInfo',
28 defaultMessage:
29 'Optionally, you can change your Ferdium server by clicking the cog in the bottom left corner. If you are switching over (from one of the hosted servers) to using Ferdium without an account, please be informed that you can export your data from that server and subsequently import it using the Help menu to resurrect all your workspaces and configured services!',
30 },
31});
32
33const styles = {
34 confettiContainer: {
35 position: 'absolute',
36 width: '100%',
37 zIndex: 9999,
38 pointerEvents: 'none',
39 },
40};
41
42class Services extends Component {
43 static propTypes = {
44 services: MobxPropTypes.arrayOrObservableArray,
45 setWebviewReference: PropTypes.func.isRequired,
46 detachService: PropTypes.func.isRequired,
47 handleIPCMessage: PropTypes.func.isRequired,
48 openWindow: PropTypes.func.isRequired,
49 reload: PropTypes.func.isRequired,
50 openSettings: PropTypes.func.isRequired,
51 update: PropTypes.func.isRequired,
52 userHasCompletedSignup: PropTypes.bool.isRequired,
53 classes: PropTypes.object.isRequired,
54 isSpellcheckerEnabled: PropTypes.bool.isRequired,
55 };
56
57 static defaultProps = {
58 services: [],
59 };
60
61 state = {
62 showConfetti: true,
63 };
64
65 _confettiTimeout = null;
66
67 componentDidMount() {
68 this._confettiTimeout = window.setTimeout(() => {
69 this.setState({
70 showConfetti: false,
71 });
72 }, ms('8s'));
73 }
74
75 componentWillUnmount() {
76 if (this._confettiTimeout) {
77 clearTimeout(this._confettiTimeout);
78 }
79 }
80
81 render() {
82 const {
83 services,
84 handleIPCMessage,
85 setWebviewReference,
86 detachService,
87 openWindow,
88 reload,
89 openSettings,
90 update,
91 userHasCompletedSignup,
92 classes,
93 isSpellcheckerEnabled,
94 } = this.props;
95
96 const { showConfetti } = this.state;
97
98 const { intl } = this.props;
99
100 return (
101 <div className="services">
102 {userHasCompletedSignup && (
103 <div className={classes.confettiContainer}>
104 <Confetti
105 width={window.width}
106 height={window.height}
107 numberOfPieces={showConfetti ? 200 : 0}
108 />
109 </div>
110 )}
111 {services.length === 0 && (
112 <Appear timeout={1500} transitionName="slideUp">
113 <div className="services__no-service">
114 <img
115 src="./assets/images/logo-beard-only.svg"
116 alt="Logo"
117 style={{ maxHeight: '50vh' }}
118 />
119 <Appear timeout={300} transitionName="slideUp">
120 <Link
121 to='/settings/recipes'
122 className="button"
123 >
124 {intl.formatMessage(messages.getStarted)}
125 </Link>
126 </Appear>
127 </div>
128 </Appear>
129 )}
130 {services
131 .filter(service => !service.isTodosService)
132 .map(service => (
133 <ServiceView
134 key={service.id}
135 service={service}
136 handleIPCMessage={handleIPCMessage}
137 setWebviewReference={setWebviewReference}
138 detachService={detachService}
139 openWindow={openWindow}
140 reload={() => reload({ serviceId: service.id })}
141 edit={() => openSettings({ path: `services/edit/${service.id}` })}
142 enable={() =>
143 update({
144 serviceId: service.id,
145 serviceData: {
146 isEnabled: true,
147 },
148 redirect: false,
149 })
150 }
151 isSpellcheckerEnabled={isSpellcheckerEnabled}
152 />
153 ))}
154 </div>
155 );
156 }
157}
158
159export default injectIntl(
160 injectSheet(styles, { injectTheme: true })(
161 inject('actions')(observer(Services)),
162 ),
163);