-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.ts
More file actions
168 lines (156 loc) Β· 4.33 KB
/
config.ts
File metadata and controls
168 lines (156 loc) Β· 4.33 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
164
165
166
167
168
const siteMetadata = {
title: `NUS Rover Team`,
siteUrl: `http://localhost`,
capitalizeTitleOnHome: false,
logo: `/images/logo.jpeg`,
icon: `/images/icon.jpeg`,
titleImage: `/images/wall.jpg`,
ogImage: `/images/wall.jpg`,
twoColumnWall: true,
cookiePolicy: false,
introTag: `A FLAGSHIP PROJECT UNDER NUS SEDS`,
description: `β¨ per aspera ad astra β¨`,
about:
"We are a multidisciplinary team from FoE, FoS and SoC intending to participate in the prestigious University Rover Challenge 2021 held annually at the Mars Desert Research Station (MDRS) in Utah, USA. In AY19/20, our team was the only team to get selected for the second round of competition from South East Asia. This year, we are aiming for the big prize - reaching the finals held in MDRS!",
author: `@nusroverteam`,
blogItemsPerPage: 10,
portfolioItemsPerPage: 10,
darkmode: true,
switchTheme: true,
navLinks: [
{
name: "HOME",
url: "/",
},
{
name: "ABOUT",
url: "/about",
},
{
name: "SUB-TEAMS",
url: "/blog",
},
{
name: "NEWS",
url: "/portfolio",
},
{
name: "CONTACT",
url: "/contact",
},
],
footerLinks: [
{
name: "PRIVACY POLICY",
url: "/privacy-policy",
},
{
name: "GitHub",
url: "https://github.com/NUS-Rover-Team/new-website",
},
],
social: [
{
name: "Facebook",
icon: "/images/Facebook.svg",
url: "https://www.facebook.com/nusseds/",
},
{
name: "Github",
icon: "/images/Github.png",
url: "https://github.com/NUS-Rover-Team",
},
{
name: "Instagram",
icon: "/images/Instagram.svg",
url: "https://www.instagram.com/nusroverteam/?hl=en",
},
{
name: "Youtube",
icon: "/images/Youtube.svg",
url: "https://www.youtube.com/channel/UCUbobZWvBIYmCOsc_33vwGQ",
},
],
contact: {
// leave empty ('') or false to hide form
api_url: "https://getform.io/f/6276494c-50e5-45ca-ae2c-c13c2a5ddf6c",
description: `Do contact us via our socials or drop us a question in the form so we can get back to you!`,
mail: "roverteam.nus@gmail.com",
phone: "000-000-0000",
address: "EW1A, 1 Engineering Drive 2, Singapore 117576",
},
disqus: ""
}
const beforeContactFormSubmit = data => {
// Code 0 - success
// Code 1 - Name
// Code 2 - Email
// Code 3 - Message
// Code 4 - Other
const errors = []
if (data.name.trim().length < 2) {
errors.push({
code: 1,
message: "Please enter a valid name!",
})
}
if (!data.email.match(/[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+/)) {
errors.push({
code: 2,
message: "Please enter a valid email address!",
})
}
if (data.message.trim().length < 15) {
errors.push({
code: 3,
message: "Please enter a message with atleast 15 characters!",
})
}
if (errors.length > 0)
return {
result: false,
errors: errors,
}
return {
data: {
name: data.name,
email: data.email,
message: data.message,
},
result: true,
}
}
const contactFormSubmit = async (api, data) => {
let res: any = await fetch(api, {
method: "POST",
body: JSON.stringify(data),
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
})
res = await res.json()
if (res.success) {
return {
result: true,
}
}
return {
result: false,
...res,
}
}
const defaults = {
disqus: null,
twoColumnWall: true,
darkmode: false,
switchTheme: true,
capitalizeTitleOnHome: true,
cookiePolicy: false
}
Object.keys(defaults).forEach(item => {
if (siteMetadata[item] === undefined) {
siteMetadata[item] = defaults[item]
}
})
export { siteMetadata, beforeContactFormSubmit, contactFormSubmit }