-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathindex.js
More file actions
128 lines (120 loc) · 3.41 KB
/
index.js
File metadata and controls
128 lines (120 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import React from "react";
import styled, { css } from "styled-components";
import Image from "@components/Image";
import {
Community,
Console,
Facebook,
GraphQL,
Jest,
ReactNative,
ReactLogo,
Redux,
Relay,
} from "@assets/logos";
import { ButtonLink, Layout, Link } from "@components";
import { isMobile } from "@utils/theme";
const P = styled.p`
${(props) =>
isMobile(props)
? css`
align-items: center;
display: flex;
flex-direction: column;
${ButtonLink} {
margin-right: 0;
}
`
: ""}
`;
const Index = ({ userCount }) => {
return (
<Layout title="Welcome" homepage>
<h1>
<span>Welcome to</span>
Reactiflux
</h1>
<p>
We’re a chat community of{" "}
{new Intl.NumberFormat("en-US").format(userCount)} React JS
<Link href="https://github.com/facebook/react" title="React JS">
<Image {...ReactLogo} alt="React JS" />
</Link>
, React Native
<Link
href="https://github.com/facebook/react-native"
title="React Native"
>
<Image {...ReactNative} alt="React Native" />
</Link>
, Redux
<Link href="https://github.com/reactjs/redux" title="Redux">
<Image {...Redux} alt="Redux" />
</Link>
, Jest
<Link href="https://github.com/facebook/jest" title="Jest">
<Image {...Jest} alt="Jest" />
</Link>
, Relay
<Link href="https://github.com/facebook/relay" title="Relay">
<Image {...Relay} alt="Relay" />
</Link>{" "}
and GraphQL
<Link href="https://github.com/facebook/graphql" title="GraphQL">
<Image {...GraphQL} alt="GraphQL" />
</Link>{" "}
developers. We hold Q&A’s with Facebook Engineers
<Link href="https://github.com/facebook" title="Facebook Organization">
<Image {...Facebook} alt="Facebook Organization" />
</Link>{" "}
and other developers
<Link
href="https://github.com/reactiflux"
title="Reactiflux Developers"
>
<Image {...Console} alt="Reactiflux Developers" />
</Link>{" "}
in the community
<Link href="https://discord.gg/reactiflux" title="Reactiflux Discord">
<Image {...Community} alt="Reactiflux Discord" />
</Link>
. Come chat about tech related to React & JavaScript or ask for help!
</p>
<P>
<ButtonLink
href="https://discord.gg/reactiflux"
title="Reactiflux Discord"
>
Join Reactiflux
</ButtonLink>
<ButtonLink href="/schedule/" title="Q&A Schedule" secondary>
Q&A Schedule
</ButtonLink>
</P>
</Layout>
);
};
export const getStaticProps = async () => {
const fallbackUserCount = 200_000;
try {
const r = await fetch(
`https://discord.com/api/v9/invites/reactiflux?with_counts=true&with_expiration=true`,
{ method: "get" },
);
const data = await r.json();
return {
revalidate: 60,
props: {
userCount: data?.approximate_member_count || fallbackUserCount,
},
};
} catch {
return {
revalidate: 60,
props: {
userCount: fallbackUserCount,
},
};
}
};
export default Index;