-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
197 lines (171 loc) · 7.29 KB
/
index.html
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Project Maker</title>
<link rel="stylesheet" href="styles.css">
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
<script src="/script.js" defer></script>
<style>
.typing-bar {
width: 20px; /* Width of the typing indicator */
height: 1em; /* Height of the typing indicator */
background-color: white; /* Color of the typing indicator */
animation: blink-caret 1s step-end infinite;
}
@keyframes blink-caret {
50% {
opacity: 0;
}
}
.big-text {
color: #ffffff;
font-size: 20px; /* Adjust size as needed */
margin-bottom: 10px;
}
.error-message {
color: red;
font-size: 14px;
margin-top: 10px;
}
.success-message {
color: green;
font-size: 14px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="top-bar">
<a href="/login/index.html" class="login-btn">Login</a>
<a href="/get-started/index.html" class="signup-btn">Sign Up</a>
<div id="login-btn" style="display:none;">
<button onclick="login()">Log In</button>
</div>
</div>
<div class="menu-container">
<div class="menu">
<a href="#">Home</a>
<a href="#">Projects</a>
<a href="#">Pricing</a>
<a href="#">Contact</a>
</div>
</div>
<div class="grid"></div>
<div class="additional-text">
<div class="big-text">
Welcome To
<span class="bold-text">Project Maker</span>
</div>
<div class="subtitle">
An All-In-One Project Creation Tool<br>
For <span id="typing-text"></span><span class="typing-bar"></span>
</div>
<!-- "Get Started" button -->
<a href="/get-started/index.html" class="get-started-btn">Get Started</a>
</div>
<div id="message-container"></div>
<script>
function setCookie(name, value, days) {
const d = new Date();
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + (value || "") + ";" + expires + ";path=/";
}
function getCookie(name) {
const nameEQ = name + "=";
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') c = c.substring(1);
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
document.addEventListener('DOMContentLoaded', async () => {
const supabaseUrl = 'https://lllitinjwarzhqnfxkur.supabase.co';
const supabaseKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxsbGl0aW5qd2FyemhxbmZ4a3VyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTk3Nzk0MjUsImV4cCI6MjAzNTM1NTQyNX0.jXiEA7f-cpOBD_1N-UaVrtCDGE7ovglAzHvT_L1LAug';
const supabase = window.supabase.createClient(supabaseUrl, supabaseKey);
const urlParams = new URLSearchParams(window.location.hash.substring(1));
const accessToken = urlParams.get('access_token');
const refreshToken = urlParams.get('refresh_token');
const type = urlParams.get('type');
const messageContainer = document.getElementById('message-container');
if (accessToken && refreshToken && type === 'recovery') {
try {
const { error: signInError } = await supabase.auth.setSession({
access_token: accessToken,
refresh_token: refreshToken,
});
if (signInError) {
throw new Error('Failed to sign in: ' + signInError.message);
}
setCookie('accessToken', accessToken, 2);
setCookie('refreshToken', refreshToken, 2);
const successMessage = document.createElement('div');
successMessage.className = 'success-message';
successMessage.textContent = 'Logged in!';
messageContainer.appendChild(successMessage);
window.location.href = "/app";
} catch (error) {
const errorElement = document.createElement('div');
errorElement.className = 'error-message';
errorElement.textContent = 'An error occurred while processing the token.';
messageContainer.appendChild(errorElement);
}
} else {
const savedAccessToken = getCookie('accessToken');
const savedRefreshToken = getCookie('refreshToken');
if (savedAccessToken && savedRefreshToken) {
try {
const { error: signInError } = await supabase.auth.setSession({
access_token: savedAccessToken,
refresh_token: savedRefreshToken,
});
if (signInError) {
throw new Error('Failed to restore session: ' + signInError.message);
}
window.location.href = '/app';
} catch (error) {
const errorElement = document.createElement('div');
errorElement.className = 'error-message';
errorElement.textContent = 'Session expired or invalid. Please log in again.';
messageContainer.appendChild(errorElement);
}
}
}
});
// Typing effect for multiple words
const typingElement = document.getElementById('typing-text');
const words = ['Coders', 'Architects', 'Enthusiast'];
let currentWordIndex = 0;
let currentCharIndex = 0;
let isTypingForward = true;
function typeText() {
const currentWord = words[currentWordIndex];
if (isTypingForward) {
if (currentCharIndex < currentWord.length) {
typingElement.textContent += currentWord.charAt(currentCharIndex);
currentCharIndex++;
setTimeout(typeText, 200);
} else {
isTypingForward = false;
setTimeout(typeText, 1000);
}
} else {
if (currentCharIndex >= 0) {
typingElement.textContent = currentWord.substring(0, currentCharIndex);
currentCharIndex--;
setTimeout(typeText, 100);
} else {
isTypingForward = true;
currentWordIndex = (currentWordIndex + 1) % words.length;
setTimeout(typeText, 1000);
}
}
}
typeText();
</script>
</body>
</html>