Skip to content

Commit 56428b7

Browse files
author
Ives van Hoorne
committed
Change Patron input
1 parent 44d4494 commit 56428b7

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

src/app/pages/Sandbox/Editor/Workspace/SandboxActions/index.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Button from 'app/components/buttons/Button';
77

88
import modalActionCreators from 'app/store/modal/actions';
99
import Alert from 'app/components/Alert';
10+
import Relative from 'app/components/Relative';
1011

1112
import WorkspaceInputContainer from '../WorkspaceInputContainer';
1213

@@ -24,6 +25,12 @@ const PrivacySelect = styled.select`
2425
box-sizing: border-box;
2526
`;
2627

28+
const PatronMessage = styled.div`
29+
margin: 0.5rem 1rem;
30+
color: rgba(255, 255, 255, 0.6);
31+
font-size: 0.875rem;
32+
`;
33+
2734
const mapDispatchToProps = dispatch => ({
2835
modalActions: bindActionCreators(modalActionCreators, dispatch),
2936
});
@@ -83,21 +90,25 @@ class SandboxSettings extends React.PureComponent {
8390
const { isPatron, privacy } = this.props;
8491
return (
8592
<div>
93+
<WorkspaceSubtitle>Sandbox Privacy</WorkspaceSubtitle>
94+
{!isPatron && (
95+
<PatronMessage>
96+
Private and unlisted Sandboxes are available as a{' '}
97+
<a href="/patron" target="_blank">
98+
Patron
99+
</a>.
100+
</PatronMessage>
101+
)}
86102
{isPatron && (
87-
<div>
88-
<WorkspaceSubtitle>Sandbox Privacy</WorkspaceSubtitle>
89-
<WorkspaceInputContainer>
90-
<PrivacySelect
91-
value={privacy}
92-
onChange={this.updateSandboxPrivacy}
93-
>
94-
<option value={0}>Public</option>
95-
<option value={1}>Unlisted (only findable with url)</option>
96-
<option value={2}>Private</option>
97-
</PrivacySelect>
98-
</WorkspaceInputContainer>
99-
</div>
103+
<WorkspaceInputContainer>
104+
<PrivacySelect value={privacy} onChange={this.updateSandboxPrivacy}>
105+
<option value={0}>Public</option>
106+
<option value={1}>Unlisted (only findable with url)</option>
107+
<option value={2}>Private</option>
108+
</PrivacySelect>
109+
</WorkspaceInputContainer>
100110
)}
111+
101112
<WorkspaceSubtitle>Delete Sandbox</WorkspaceSubtitle>
102113
<WorkspaceInputContainer>
103114
<Button

src/app/store/api/actions.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ const getMessage = (error: Error & { response: ?Object }) => {
3030
sendError(error);
3131
}
3232

33-
if (response && response.data && response.data.errors) {
34-
const errors = values(response.data.errors)[0];
35-
if (Array.isArray(errors)) {
36-
if (errors[0]) {
37-
error.message = errors[0]; // eslint-disable-line no-param-reassign
33+
if (response && response.data) {
34+
if (response.data.errors) {
35+
const errors = values(response.data.errors)[0];
36+
if (Array.isArray(errors)) {
37+
if (errors[0]) {
38+
error.message = errors[0]; // eslint-disable-line no-param-reassign
39+
}
40+
} else {
41+
error.message = errors; // eslint-disable-line no-param-reassign
3842
}
39-
} else {
40-
error.message = errors; // eslint-disable-line no-param-reassign
41-
}
42-
43-
if (response.data.error) {
43+
} else if (response.data.error) {
4444
error.message = response.data.error; // eslint-disable-line no-param-reassign
4545
}
4646
}

0 commit comments

Comments
 (0)