diff options
author | kytwb <kytwb@pm.me> | 2021-12-16 12:02:18 +0100 |
---|---|---|
committer | kytwb <kytwb@pm.me> | 2021-12-16 12:02:18 +0100 |
commit | 36c23f67c3783b3986b21ea85d56fc0e37941a0c (patch) | |
tree | 3c9138790d672ff84071bba8e441149c245a80e7 /src/features/publishDebugInfo | |
parent | Bumped up ferdi to '5.6.3' (diff) | |
parent | Iterate on README [skip ci] (diff) | |
download | ferdium-app-36c23f67c3783b3986b21ea85d56fc0e37941a0c.tar.gz ferdium-app-36c23f67c3783b3986b21ea85d56fc0e37941a0c.tar.zst ferdium-app-36c23f67c3783b3986b21ea85d56fc0e37941a0c.zip |
Merge branch 'develop' into release
# Conflicts:
# package-lock.json
# package.json
Diffstat (limited to 'src/features/publishDebugInfo')
-rw-r--r-- | src/features/publishDebugInfo/Component.js | 160 | ||||
-rw-r--r-- | src/features/publishDebugInfo/index.ts (renamed from src/features/publishDebugInfo/index.js) | 0 |
2 files changed, 74 insertions, 86 deletions
diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index 30bdc13b6..2b9af01a7 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js | |||
@@ -8,7 +8,7 @@ import { state as ModalState } from './store'; | |||
8 | import { H1 } from '../../components/ui/headline'; | 8 | import { H1 } from '../../components/ui/headline'; |
9 | import { sendAuthRequest } from '../../api/utils/auth'; | 9 | import { sendAuthRequest } from '../../api/utils/auth'; |
10 | import Button from '../../components/ui/Button'; | 10 | import Button from '../../components/ui/Button'; |
11 | import Input from '../../components/ui/Input'; | 11 | import { Input } from '../../components/ui/input/index'; |
12 | import Modal from '../../components/ui/Modal'; | 12 | import Modal from '../../components/ui/Modal'; |
13 | import { DEBUG_API } from '../../config'; | 13 | import { DEBUG_API } from '../../config'; |
14 | import AppStore from '../../stores/AppStore'; | 14 | import AppStore from '../../stores/AppStore'; |
@@ -50,11 +50,18 @@ const messages = defineMessages({ | |||
50 | }); | 50 | }); |
51 | 51 | ||
52 | const styles = theme => ({ | 52 | const styles = theme => ({ |
53 | container: { | 53 | modal: { |
54 | minWidth: '70vw', | 54 | width: '80%', |
55 | maxWidth: 600, | ||
56 | background: theme.styleTypes.primary.contrast, | ||
57 | paddingTop: 30, | ||
58 | }, | ||
59 | headline: { | ||
60 | fontSize: 20, | ||
61 | marginBottom: 20, | ||
62 | marginTop: -27, | ||
55 | }, | 63 | }, |
56 | info: { | 64 | info: { |
57 | paddingTop: 20, | ||
58 | paddingBottom: 20, | 65 | paddingBottom: 20, |
59 | }, | 66 | }, |
60 | link: { | 67 | link: { |
@@ -67,32 +74,9 @@ const styles = theme => ({ | |||
67 | marginTop: 10, | 74 | marginTop: 10, |
68 | cursor: 'pointer', | 75 | cursor: 'pointer', |
69 | }, | 76 | }, |
70 | url: { | ||
71 | marginTop: 20, | ||
72 | width: '100%', | ||
73 | |||
74 | '& div': { | ||
75 | fontFamily: | ||
76 | 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace', | ||
77 | }, | ||
78 | |||
79 | '& input': { | ||
80 | width: '100%', | ||
81 | padding: 15, | ||
82 | borderRadius: 6, | ||
83 | border: `solid 1px ${theme.styleTypes.primary.accent}`, | ||
84 | }, | ||
85 | }, | ||
86 | }); | 77 | }); |
87 | 78 | ||
88 | @injectSheet(styles) | ||
89 | @inject('stores', 'actions') | ||
90 | @observer | ||
91 | class PublishDebugLogModal extends Component { | 79 | class PublishDebugLogModal extends Component { |
92 | static propTypes = { | ||
93 | classes: PropTypes.object.isRequired, | ||
94 | }; | ||
95 | |||
96 | state = { | 80 | state = { |
97 | log: null, | 81 | log: null, |
98 | error: false, | 82 | error: false, |
@@ -102,6 +86,11 @@ class PublishDebugLogModal extends Component { | |||
102 | // Close this modal | 86 | // Close this modal |
103 | close() { | 87 | close() { |
104 | ModalState.isModalVisible = false; | 88 | ModalState.isModalVisible = false; |
89 | this.setState({ | ||
90 | log: null, | ||
91 | error: false, | ||
92 | isSendingLog: false | ||
93 | }); | ||
105 | } | 94 | } |
106 | 95 | ||
107 | async publishDebugInfo() { | 96 | async publishDebugInfo() { |
@@ -157,77 +146,76 @@ class PublishDebugLogModal extends Component { | |||
157 | <Modal | 146 | <Modal |
158 | isOpen={isModalVisible} | 147 | isOpen={isModalVisible} |
159 | shouldCloseOnOverlayClick | 148 | shouldCloseOnOverlayClick |
149 | className={`${classes.modal} publish-debug`} | ||
160 | close={() => this.close()} | 150 | close={() => this.close()} |
161 | > | 151 | > |
162 | <div className={classes.container}> | 152 | <H1 className={classes.headline}>{intl.formatMessage(messages.title)}</H1> |
163 | <H1>{intl.formatMessage(messages.title)}</H1> | 153 | {log && ( |
164 | {log && ( | 154 | <> |
165 | <> | 155 | <p className={classes.info}> |
166 | <p className={classes.info}> | 156 | {intl.formatMessage(messages.published)} |
167 | {intl.formatMessage(messages.published)} | 157 | </p> |
168 | </p> | 158 | <Input |
169 | <Input | 159 | showLabel={false} |
170 | className={classes.url} | 160 | value={`${DEBUG_API}/${log}`} |
171 | showLabel={false} | 161 | readonly |
172 | field={{ | 162 | /> |
173 | type: 'url', | 163 | </> |
174 | value: `${DEBUG_API}/${log}`, | 164 | )} |
175 | disabled: true, | 165 | |
176 | }} | 166 | {error && ( |
177 | readonly | 167 | <p className={classes.info}>{intl.formatMessage(messages.error)}</p> |
178 | /> | 168 | )} |
179 | </> | 169 | |
180 | )} | 170 | {!log && !error && ( |
181 | 171 | <> | |
182 | {error && ( | 172 | <p className={classes.info}> |
183 | <p className={classes.info}>{intl.formatMessage(messages.error)}</p> | 173 | {intl.formatMessage(messages.info)} |
184 | )} | 174 | </p> |
185 | 175 | ||
186 | {!log && !error && ( | 176 | <a |
187 | <> | 177 | href={`${DEBUG_API}/privacy.html`} |
188 | <p className={classes.info}> | 178 | target="_blank" |
189 | {intl.formatMessage(messages.info)} | 179 | className={classes.link} |
190 | </p> | 180 | rel="noreferrer" |
191 | 181 | > | |
192 | <a | 182 | {intl.formatMessage(messages.privacy)} |
193 | href={`${DEBUG_API}/privacy.html`} | 183 | </a> |
194 | target="_blank" | 184 | <a |
195 | className={classes.link} | 185 | href={`${DEBUG_API}/terms.html`} |
196 | rel="noreferrer" | 186 | target="_blank" |
197 | > | 187 | className={classes.link} |
198 | {intl.formatMessage(messages.privacy)} | 188 | rel="noreferrer" |
199 | </a> | 189 | > |
200 | <a | 190 | {intl.formatMessage(messages.terms)} |
201 | href={`${DEBUG_API}/terms.html`} | 191 | </a> |
202 | target="_blank" | 192 | |
203 | className={classes.link} | 193 | <Button |
204 | rel="noreferrer" | 194 | type="button" |
205 | > | 195 | label={intl.formatMessage(messages.publish)} |
206 | {intl.formatMessage(messages.terms)} | 196 | className={classes.button} |
207 | </a> | 197 | onClick={() => this.publishDebugInfo()} |
208 | 198 | disabled={isSendingLog} | |
209 | <Button | 199 | /> |
210 | type="button" | 200 | </> |
211 | label={intl.formatMessage(messages.publish)} | 201 | )} |
212 | className={classes.button} | ||
213 | onClick={() => this.publishDebugInfo()} | ||
214 | disabled={isSendingLog} | ||
215 | /> | ||
216 | </> | ||
217 | )} | ||
218 | </div> | ||
219 | </Modal> | 202 | </Modal> |
220 | ); | 203 | ); |
221 | } | 204 | } |
222 | } | 205 | } |
223 | 206 | ||
224 | PublishDebugLogModal.wrappedComponent.propTypes = { | 207 | PublishDebugLogModal.propTypes = { |
225 | stores: PropTypes.shape({ | 208 | stores: PropTypes.shape({ |
226 | app: PropTypes.instanceOf(AppStore).isRequired, | 209 | app: PropTypes.instanceOf(AppStore).isRequired, |
227 | }).isRequired, | 210 | }).isRequired, |
228 | actions: PropTypes.shape({ | 211 | actions: PropTypes.shape({ |
229 | service: PropTypes.instanceOf(ServicesStore).isRequired, | 212 | service: PropTypes.instanceOf(ServicesStore).isRequired, |
230 | }).isRequired, | 213 | }).isRequired, |
214 | classes: PropTypes.object.isRequired, | ||
231 | }; | 215 | }; |
232 | 216 | ||
233 | export default injectIntl(PublishDebugLogModal); | 217 | export default injectIntl( |
218 | injectSheet(styles, { injectTheme: true })( | ||
219 | inject('stores', 'actions')(observer(PublishDebugLogModal)), | ||
220 | ), | ||
221 | ); | ||
diff --git a/src/features/publishDebugInfo/index.js b/src/features/publishDebugInfo/index.ts index 43841b530..43841b530 100644 --- a/src/features/publishDebugInfo/index.js +++ b/src/features/publishDebugInfo/index.ts | |||