Index.js
3.36 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import React, { useEffect, useState } from 'react'
import {
BrowserRouter,
Route,
Redirect,
Switch,
Link,
useHistory,
} from 'react-router-dom'
import {
Container,
Heading,
Button,
Segment,
Message,
Form,
Input,
Transition,
Select,
Checkbox,
FormControl,
FormLabel,
FormErrorMessage,
FormHelperText,
VStack,
Stack,
StackDivider,
Box,
Text,
List, ListItem, ListIcon, OrderedList, UnorderedList,
Table,
Thead,
Tbody,
Tfoot,
Tr,
Th,
Td,
TableCaption,
Flex,
HStack,
Wrap,
} from '@chakra-ui/react'
import {
Tab,
Divider,
} from 'semantic-ui-react'
import http from '../utils/http'
const Feature = ({ title, desc, ...rest }) => {
return (
<Box p={5} shadow="md" borderWidth="1px" {...rest}>
<Heading fontSize="xl">{title}</Heading>
<Text mt={4}>{desc}</Text>
</Box>
)
}
const Index = () => {
const [token, setToken] = useState('')
const [currentTab, setCurrentTab] = useState('')
const [me, setMe] = useState({})
const history = useHistory()
const panes = [
{
menuItem: 'Tab 1',
render: () => <Tab.Pane attached={false}>Tab 1 Content</Tab.Pane>,
},
{
menuItem: 'Tab 2',
render: () => <Tab.Pane attached={false}>Tab 2 Content</Tab.Pane>,
},
{
menuItem: 'Tab 3',
render: () => <Tab.Pane attached={false}>Tab 3 Content</Tab.Pane>,
},
]
const whoAmI = () => {
http.get('/info/user', {
headers: {
Authorization: `token ${token}`,
},
}).then(response => {
const { success, code, data, message } = response.data
if (success) {
setMe(data)
}
})
}
useEffect(() => {
const token = localStorage.getItem('token')
setToken(token)
if (token) {
whoAmI()
}
})
return (
<Container>
<Divider hidden/>
{me.name ? (
<Heading size="md">
Hi {me.name}
</Heading>
) : (
<Wrap justify="right">
<Button size="xs" colorScheme="blue" variant="outline"
onClick={() => history.push('/sign-in')}
>
SIGN IN
</Button>
<Button size="xs" colorScheme="blue"
onClick={() => history.push('/sign-up')}
>
SIGN UP
</Button>
</Wrap>
)}
<Heading>The Infrastructure Cloud</Heading>
<Text>Easily deploy cloud servers, bare metal, and storage
worldwide!</Text>
<Divider hidden/>
<Stack spacing={8}>
<Feature
title="Cloud Compute"
desc="Powerful compute instances with Intel CPUs and 100% SSD storage."
/>
<Feature
title="Bare Metal"
desc="Fully automated dedicated servers with zero virtualization layer."
/>
</Stack>
<Divider hidden/>
<Stack spacing={8}>
<Feature
title="Block Storage"
desc="Fast SSD-backed scalable and redundant storage with up to 10TB volumes."
/>
<Feature
title="Dedicated Cloud"
desc="Dedicated cloud compute instances without the noisy neighbors."
/>
</Stack>
<Divider hidden/>
</Container>
)
}
export default Index