Skip to content

Commit a6679e0

Browse files
authored
Merge pull request #1946 from hpe-dev-incubator/Slack-signup
Slack signup
2 parents 1feee38 + e3c0051 commit a6679e0

File tree

14 files changed

+266
-31273
lines changed

14 files changed

+266
-31273
lines changed

content/assets/favicon.png

100755100644
44.6 KB
Loading

content/assets/favicon1.png

1.37 KB
Loading

content/community/Slack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "HPE Developer Slack Channel"
3-
link: https://slack.hpedev.io/
3+
link: /slack-signup
44
linkname: Join us on Slack
55
description: Have questions or just want to chat with other devs who work at HPE?
66
priority: 1

package-lock.json

Lines changed: 0 additions & 31249 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"remark": "^11.0.2",
5757
"strip-markdown": "^3.1.2",
5858
"styled-components": "^5.2.1",
59+
"sweetalert2": "^11.7.12",
5960
"typescript": "^4.2.2",
6061
"yup": "^0.32.11"
6162
},

src/components/Header/index.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ function Header() {
4141
/* const leftColumn = greenlake.filter((gl, index) => index % 2 === 0); */
4242
const leftColumn = greenlake;
4343
const rightColumn = greenlake.filter((gl, index) => index % 2);
44-
45-
// const externalLinks = [
46-
// {
47-
// title: 'HPE GreenLake API Portal',
48-
// slug: 'https://developer.greenlake.hpe.com/',
49-
// },
50-
// {
51-
// title: 'HPE GreenLake Test Drive',
52-
// slug: 'https://testdrive.greenlake.hpe.com/',
53-
// },
54-
// ];
44+
const externalLinks = [
45+
{
46+
title: 'HPE GreenLake API Portal',
47+
slug: 'https://developer.greenlake.hpe.com/',
48+
},
49+
{
50+
title: 'HPE GreenLake Test Drive',
51+
slug: 'https://testdrive.greenlake.hpe.com/',
52+
},
53+
];
5554

5655
// const externalLeftColumn = externalLinks.filter(
5756
// (el, index) => index % 2 === 0,
@@ -75,18 +74,19 @@ function Header() {
7574
/>
7675
);
7776
});
78-
// const elColumns = externalLinksColumn.map((el, index) => {
79-
// const { slug, title } = el;
80-
// return (
81-
// <ExternalButtonLink
82-
// key={index}
83-
// label={title}
84-
// to={`${slug}`}
85-
// alignSelf="start"
86-
// fill="horizontal"
87-
// />
88-
// );
89-
// });
77+
78+
const elColumns = externalLinksColumn.map((el, index) => {
79+
const { slug, title } = el;
80+
return (
81+
<ExternalButtonLink
82+
key={index}
83+
label={title}
84+
to={`${slug}`}
85+
alignSelf="start"
86+
fill="horizontal"
87+
/>
88+
);
89+
});
9090
const allLinks = [/* ...elColumns, */ ...glColumns];
9191
return allLinks;
9292
};

src/fonts/Metric-Bold.woff

30.3 KB
Binary file not shown.

src/fonts/Metric-Light.woff

30.7 KB
Binary file not shown.

src/fonts/Metric-Medium.woff

29 KB
Binary file not shown.

src/pages/slack-signup/index.js

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
import React, { useState } from 'react';
2+
// import '../../css/style.css';
3+
import Swal from 'sweetalert2';
4+
import { Box, Image, Button, TextInput, Text } from 'grommet';
5+
import PropTypes from 'prop-types';
6+
import { graphql } from 'gatsby';
7+
import { Layout, SEO } from '../../components';
8+
9+
const { GATSBY_SLACK_TOKEN } = process.env;
10+
const { GATSBY_SLACK_INVITE_URL } = process.env;
11+
const image = '/images/hero-pic.png';
12+
const buttonstyle = {
13+
backgroundColor: '#dcdcdc',
14+
borderRadius: '100px',
15+
align: 'center',
16+
height: '50px',
17+
fontSize: '15px',
18+
fontFamily: 'sans-serif',
19+
};
20+
export default function Slacksignup() {
21+
const [email, setemail] = useState('');
22+
const onsubmit = (evt) => {
23+
evt.preventDefault();
24+
if (email) {
25+
const doInvite = () => {
26+
const formData = new FormData();
27+
formData.append('email', email);
28+
formData.append('token', GATSBY_SLACK_TOKEN);
29+
formData.append('set_active', true);
30+
return fetch(GATSBY_SLACK_INVITE_URL, {
31+
method: 'POST',
32+
body: formData,
33+
json: true,
34+
})
35+
.then((res) => res.json())
36+
.then((res) => {
37+
if (res.ok) {
38+
const el = document.createElement('div');
39+
el.innerHTML = `Please check <b> ${email}</b>
40+
for an invite from slack`;
41+
Swal.fire({
42+
title: 'SUCCESS !',
43+
html: el,
44+
icon: 'success',
45+
});
46+
} else {
47+
let { error } = res;
48+
if (error === 'already_invited' || error === 'already_in_team') {
49+
const el = document.createElement('div');
50+
el.innerHTML =
51+
"It seems like you are already member of our slack.<br>Visit <a href=https://hpedev.slack.com target='_blank' > <b> HPE Developer Community</b></a> on slack";
52+
Swal.fire({
53+
title: 'Success',
54+
html: el,
55+
icon: 'success',
56+
});
57+
} else if (error === 'already_in_team_invited_user') {
58+
const l = document.createElement('div');
59+
l.innerHTML = `Please check again <b style="font-size:large;" > ${email} </b> for an invite from Slack.<br>Visit <a href=https://developer.hpe.com/ target="_blank"> HPE Developer Community</a>`;
60+
Swal.fire({
61+
title: 'It seems like we already sent you our slack invite',
62+
html: l,
63+
icon: 'info',
64+
});
65+
} else {
66+
if (error === 'invalid_email') {
67+
error = 'The email you entered is an invalid email.';
68+
} else if (error === 'invalid_auth') {
69+
error =
70+
'Something has gone wrong. Please' +
71+
' contact a system administrator.';
72+
}
73+
Swal.fire({
74+
title: 'Error',
75+
html: error,
76+
icon: 'error',
77+
});
78+
}
79+
}
80+
})
81+
.catch((err) => {
82+
Swal.fire({
83+
title: 'Error !',
84+
html: err,
85+
icon: 'error',
86+
});
87+
});
88+
}; // end of doInvite
89+
doInvite();
90+
} // end of if statement
91+
else {
92+
const errMsg = [];
93+
if (!email) {
94+
errMsg.push('your email is required');
95+
}
96+
Swal.fire({
97+
html: `Failed! ${errMsg.join(' and ')}.`,
98+
icon: 'info',
99+
});
100+
}
101+
setTimeout(() => {
102+
setemail('');
103+
}, 2500);
104+
};
105+
const handlechange = (event) => {
106+
setemail(event.target.value);
107+
};
108+
return (
109+
<Layout>
110+
<SEO title="Slack-signup" />
111+
<Box direction="row-responsive" pad="xlarge" gap="xlarge" align="center">
112+
<Box>
113+
<Box style={{ marginTop: '-30px' }}>
114+
<Text size="xlarge" style={{ margingTop: '-10px', color: 'grey' }}>
115+
Sign up for
116+
</Text>
117+
<h1
118+
style={{
119+
fontFamily: 'sans-serif',
120+
color: '#220',
121+
fontWeight: 550,
122+
letterSpacing: '0.5px',
123+
fontSize: '63px',
124+
lineHeight: '5rem',
125+
}}
126+
>
127+
HPE Developer Community <br /> Slack
128+
</h1>
129+
<Image
130+
style={{
131+
height: '80px',
132+
width: '100px',
133+
float: 'right',
134+
marginTop: '-120px',
135+
marginLeft: '170px',
136+
}}
137+
src="/img/community/slack.svg"
138+
alt="slack logo"
139+
/>
140+
<p style={{ fontWeight: 400, fontSize: '22px' }}>
141+
Where you’ll find all things software at HPE. Join us to
142+
collaborate and build applications and integrations with HPE
143+
products using the latest software and open source technologies
144+
</p>
145+
</Box>
146+
<Text size="large">Email</Text>
147+
<form className="form" id="join-form" onSubmit={onsubmit}>
148+
<Box align="center" border={{ side: 'bottom', size: 'small' }}>
149+
<TextInput
150+
type="email"
151+
placeholder="[email protected]"
152+
value={email}
153+
name="email"
154+
onChange={handlechange}
155+
style={{ position: 'relative', marginLeft: '-10px' }}
156+
required
157+
plain
158+
/>
159+
</Box>
160+
<br />
161+
<Button
162+
label="Join us on Slack"
163+
primary
164+
reverse
165+
type="submit"
166+
onSubmit={onsubmit}
167+
icon={
168+
<Image
169+
src="/img/home/hpe-element.png"
170+
style={{ width: '50px' }}
171+
/>
172+
}
173+
style={{
174+
backgroundColor: '#01A982',
175+
borderRadius: '100px',
176+
color: '#ffffff',
177+
width: '250px',
178+
position: 'relative',
179+
height: '40px',
180+
}}
181+
/>
182+
</form>
183+
</Box>
184+
<Box align="center">
185+
<Image src={image} alt="hpedev logo" />
186+
</Box>
187+
</Box>
188+
<Box
189+
direction="row-responsive"
190+
pad="xlarge"
191+
gap="medium"
192+
align="center"
193+
style={{ marginTop: '-120px' }}
194+
>
195+
<Button label="50+ Channels" style={buttonstyle} />
196+
<Button label="Over 4,000 members" style={buttonstyle} />
197+
<Button label="6 Years+ Community" style={buttonstyle} />
198+
</Box>
199+
</Layout>
200+
);
201+
}
202+
203+
Slacksignup.propTypes = {
204+
data: PropTypes.shape({
205+
site: PropTypes.shape({
206+
siteMetadata: PropTypes.shape({
207+
title: PropTypes.string.isRequired,
208+
}).isRequired,
209+
}).isRequired,
210+
markdownRemark: PropTypes.shape({
211+
frontmatter: PropTypes.shape({
212+
title: PropTypes.string.isRequired,
213+
image: PropTypes.string,
214+
}).isRequired,
215+
rawMarkdownBody: PropTypes.string,
216+
}).isRequired,
217+
}),
218+
};
219+
export const slack = graphql`
220+
query {
221+
site {
222+
siteMetadata {
223+
title
224+
}
225+
}
226+
markdownRemark(fields: { slug: { eq: "/" } }) {
227+
excerpt
228+
frontmatter {
229+
title
230+
image
231+
}
232+
rawMarkdownBody
233+
}
234+
}
235+
`;

0 commit comments

Comments
 (0)