Skip to content

Commit 363a1e9

Browse files
authored
Merge pull request #11 from WaifuAPI/staging
Staging
2 parents 76f2625 + 3203e63 commit 363a1e9

8 files changed

Lines changed: 610 additions & 8 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "waifu-it-website",
3-
"version": "2.1.2",
3+
"version": "2.2.2",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
@@ -25,11 +25,13 @@
2525
"js-cookie": "^3.0.5",
2626
"mongoose": "^7.4.2",
2727
"next": "^15.0.3",
28+
"nprogress": "^0.2.0",
2829
"postcss": "^8.4.27",
2930
"react": "18.2.0",
3031
"react-confirm-alert": "^3.0.6",
3132
"react-dom": "18.2.0",
3233
"react-icons": "^4.10.1",
34+
"react-progressbar": "^15.4.1",
3335
"react-query": "^3.39.3",
3436
"react-table": "^7.8.0",
3537
"react-toastify": "^9.1.3",

src/pages/_app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// pages/_app.js
21
import { QueryClient, QueryClientProvider } from "react-query";
32
import { ReactQueryDevtools } from "react-query/devtools";
43
import "tailwindcss/tailwind.css";
54
import "../styles/globals.css";
65
import "tailwind-scrollbar";
76
import Head from "next/head";
87
import Script from "next/script";
8+
import ProgressBar from "./components/ProgressBar"; // Import ProgressBar
99

1010
const queryClient = new QueryClient();
1111

@@ -31,6 +31,7 @@ function MyApp({ Component, pageProps }) {
3131
gtag('js', new Date()); gtag('config', 'G-7CXJQ1G63J');
3232
`}
3333
</Script>
34+
<ProgressBar /> {/* Global Progress Bar */}
3435
<Component {...pageProps} />
3536
<ReactQueryDevtools />
3637
</QueryClientProvider>

src/pages/api/membership.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export default async function handler(req, res) {
2+
try {
3+
// Construct the external API URL with query parameters
4+
const queryParams = req.url.includes("?") ? req.url.split("?")[1] : "";
5+
const apiUrl = `${process.env.API_URL}/membership${
6+
queryParams ? `?${queryParams}` : ""
7+
}`;
8+
9+
// Call the external API with the required headers
10+
const response = await fetch(apiUrl, {
11+
method: "GET",
12+
headers: {
13+
"Content-Type": "application/json",
14+
key: process.env.ACCESS_KEY,
15+
},
16+
});
17+
18+
// Handle errors from the external API
19+
if (!response.ok) {
20+
const errorData = await response.text(); // Capture the error response
21+
console.error("API Error Response:", errorData);
22+
return res
23+
.status(response.status)
24+
.json({ message: "Error fetching membership data", error: errorData });
25+
}
26+
27+
// Parse and return the response
28+
const data = await response.json();
29+
res.status(200).json(data);
30+
} catch (error) {
31+
console.error("Internal Server Error:", error); // Log full error details
32+
res
33+
.status(500)
34+
.json({ message: "Internal Server Error", error: error.message });
35+
}
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { useEffect } from "react";
2+
import { useRouter } from "next/router";
3+
import NProgress from "nprogress";
4+
import "nprogress/nprogress.css";
5+
6+
// Customizing the progress bar speed and look
7+
NProgress.configure({ showSpinner: false, speed: 500, minimum: 0.2 });
8+
9+
const ProgressBar = () => {
10+
const router = useRouter();
11+
12+
useEffect(() => {
13+
const handleStart = () => {
14+
NProgress.start();
15+
};
16+
const handleStop = () => {
17+
setTimeout(() => NProgress.done(), 500); // Delay finishing to prevent flashing
18+
};
19+
20+
router.events.on("routeChangeStart", handleStart);
21+
router.events.on("routeChangeComplete", handleStop);
22+
router.events.on("routeChangeError", handleStop);
23+
24+
return () => {
25+
router.events.off("routeChangeStart", handleStart);
26+
router.events.off("routeChangeComplete", handleStop);
27+
router.events.off("routeChangeError", handleStop);
28+
};
29+
}, [router]);
30+
31+
return null;
32+
};
33+
34+
export default ProgressBar;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { useState, useEffect } from "react";
2+
3+
export function useTypewriter(
4+
text,
5+
speed = 150,
6+
eraseSpeed = 75,
7+
delay = 1000
8+
) {
9+
const [displayText, setDisplayText] = useState("");
10+
const [index, setIndex] = useState(0);
11+
const [isDeleting, setIsDeleting] = useState(false);
12+
const [cursorVisible, setCursorVisible] = useState(true);
13+
14+
useEffect(() => {
15+
let timeout;
16+
17+
if (!isDeleting && index < text.length) {
18+
// Typing effect
19+
timeout = setTimeout(() => {
20+
setDisplayText((prev) => prev + text[index]);
21+
setIndex(index + 1);
22+
}, speed);
23+
} else if (isDeleting && index > 0) {
24+
// Erasing effect
25+
timeout = setTimeout(() => {
26+
setDisplayText((prev) => prev.slice(0, -1));
27+
setIndex(index - 1);
28+
}, eraseSpeed);
29+
} else {
30+
// Pause before deleting or restarting
31+
timeout = setTimeout(() => {
32+
setIsDeleting((prev) => !prev);
33+
}, delay);
34+
}
35+
36+
return () => clearTimeout(timeout);
37+
}, [index, isDeleting, text, speed, eraseSpeed, delay]);
38+
39+
// Cursor blinking effect
40+
useEffect(() => {
41+
const cursorInterval = setInterval(() => {
42+
setCursorVisible((prev) => !prev);
43+
}, 500);
44+
45+
return () => clearInterval(cursorInterval);
46+
}, []);
47+
48+
return `${displayText}${cursorVisible ? "|" : ""}`;
49+
}

src/pages/dashboard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ const Dashboard = () => {
307307
} p-4 rounded-md mb-4`}
308308
style={{ marginTop: "140px" }}
309309
>
310-
<div className="flex justify-between items-center mb-2">
310+
<div className="flex justify-between items-center mb-2 select-none">
311311
<span className="text-sm font-medium">Token:</span>
312312
</div>
313313
<div className="relative max-w-xs md:max-w-full">
@@ -322,7 +322,7 @@ const Dashboard = () => {
322322
? "bg-gray-700 border border-gray-600 placeholder-gray-400 text-white"
323323
: "bg-white border border-gray-300 placeholder-gray-400 text-black"
324324
}
325-
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500
325+
focus:outline-none
326326
`}
327327
/>
328328
<div
@@ -332,7 +332,7 @@ const Dashboard = () => {
332332
{getEyeIcon()}
333333
</div>
334334
</div>
335-
<div className="mt-4 flex justify-end space-x-2">
335+
<div className="mt-4 flex justify-end space-x-2 select-none">
336336
<button
337337
onClick={handleRegenerateToken}
338338
className="bg-blue-500 text-white px-3 py-1 rounded hover:bg-blue-600"

src/pages/index.js

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
FaArrowRight,
1010
FaChevronDown,
1111
FaChevronUp,
12+
FaCrown,
1213
} from "react-icons/fa";
1314
import { CiLocationArrow1 } from "react-icons/ci";
1415
import { Transition } from "@headlessui/react";
@@ -62,6 +63,30 @@ const Home = () => {
6263
setHoveredButton(null);
6364
};
6465

66+
const premiumButtonTexts = [
67+
"🌟 Upgrade to Premium!",
68+
"🚀 Go Premium Now!",
69+
"💎 Unlock Premium!",
70+
"🔥 Get Premium Access!",
71+
"🎉 Join Premium Today!",
72+
"🌟 Level Up with Premium!",
73+
"💖 Treat Yourself to Premium!",
74+
"🚀 Blast Off with Premium!",
75+
"🎁 Exclusive Perks Await!",
76+
"⭐ Access Premium Features",
77+
"💼 Upgrade More Benefits",
78+
"🔓 Unlock Exclusive Features",
79+
"🎯 Get Best Experience",
80+
];
81+
82+
const [premiumButtonText, setPremiumButtonText] = useState("");
83+
// Select a random button text on each render
84+
useEffect(() => {
85+
setPremiumButtonText(
86+
premiumButtonTexts[Math.floor(Math.random() * premiumButtonTexts.length)]
87+
);
88+
}, []);
89+
6590
return (
6691
<>
6792
<Head>
@@ -112,24 +137,36 @@ const Home = () => {
112137
)}
113138
</button>
114139
<div className="hidden lg:flex lg:items-center lg:space-x-6">
140+
<Link href="/" className="text-white hover:text-gray-300">
141+
Home
142+
</Link>
115143
<Link
144+
target="_blank"
116145
href="https://discord.gg/yyW389c"
117146
className="text-white hover:text-gray-300"
118147
>
119148
Support
120149
</Link>
121150
<Link
151+
target="_blank"
122152
href="https://ko-fi.com/Aeryk"
123153
className="text-white hover:text-gray-300"
124154
>
125155
Donate Us
126156
</Link>
127157
<Link
158+
target="_blank"
128159
href="https://github.com/WaifuAPI"
129160
className="text-white hover:text-gray-300"
130161
>
131162
GitHub
132163
</Link>
164+
<Link
165+
href="/premium"
166+
className="text-white font-medium px-4 py-2 rounded-md bg-gray-800 hover:bg-white hover:text-gray-900 transition duration-300 border border-gray-600"
167+
>
168+
<span className="text-lg">{premiumButtonText}</span>
169+
</Link>
133170
</div>
134171
</div>
135172
<Transition
@@ -147,6 +184,12 @@ const Home = () => {
147184
className="absolute w-full top-full left-0 lg:hidden bg-gray-900 z-50"
148185
>
149186
<div className="px-7 pt-2 pb-3 space-y-1">
187+
<Link
188+
href="/"
189+
className="block text-white mt-1 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-base font-medium"
190+
>
191+
Home
192+
</Link>
150193
<Link
151194
href="https://discord.gg/yyW389c"
152195
className="block text-white mt-1 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-base font-medium"
@@ -165,6 +208,13 @@ const Home = () => {
165208
>
166209
GitHub
167210
</Link>
211+
<Link
212+
href="/premium"
213+
className="inline-flex items-center gap-2 text-white font-semibold px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-600 transition duration-300"
214+
>
215+
{/* <span className="text-lg">💎 Unlock Premium!</span> */}
216+
<span className="text-lg">{premiumButtonText}</span>
217+
</Link>
168218
</div>
169219
</div>
170220
)}
@@ -331,21 +381,24 @@ const Home = () => {
331381
<footer className="bg-gray-900 py-4 px-12 lg:px-18 mt-auto">
332382
<div className="container mx-auto px-5 text-center lg:text-left -translate-y-2">
333383
<div className="flex flex-col space-y-4 lg:flex-row lg:items-center lg:justify-between">
334-
<div className="text-white">&copy; Waifu.it 2024</div>
384+
<div className="text-white">&copy; Waifu.it 2025</div>
335385
<div className="flex justify-center lg:justify-start space-x-4">
336386
<Link
387+
target="_blank"
337388
href="https://raw.githubusercontent.com/WaifuAPI/Waifu.it/production/PRIVACY_POLICY.md"
338389
className="text-gray-400 hover:text-white"
339390
>
340391
Privacy
341392
</Link>
342393
<Link
343-
href="https://raw.githubusercontent.com/WaifuAPI/Waifu.it/production/LICENCE.md"
394+
target="_blank"
395+
href="https://docs.waifu.it/tos"
344396
className="text-gray-400 hover:text-white"
345397
>
346-
Terms
398+
Terms of Service
347399
</Link>
348400
<Link
401+
target="_blank"
349402
href="https://ko-fi.com/Aeryk"
350403
className="text-gray-400 hover:text-white"
351404
>

0 commit comments

Comments
 (0)