diff --git a/pages/index.js b/pages/index.js
index 1e6c299..a4f8682 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -3,59 +3,109 @@ import styles from '../styles/Index.module.css'
import Header from '../components/header';
import Footer from '../components/footer';
import Socials from '../components/socials';
+import TwitchPopup from '../components/twitchpopup';
-function RandomMotto(props) {
- const Mottos = [
- "Yesterday is history, tomorrow is a mystery and today is a gift that's why it's called the present",
- "Just have fun!",
- "Live and let go",
- "Keep calm and carry on"
- ];
- const randomNumber = Math.floor(Math.random() * Mottos.length);
- return
-
-
Trick - Index
-
-
-
+const client_id = "edpx4oisrkpnrlx47b7a2p3govy6qm";
+const client_secret = "dqr2glvdhr7uyn3bf3biu48977rfwo";
-
-
+export default function Index({ motto, twitch_online }) {
+ return (
+
+
+
Trick - Index
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
Hi, I'm Trick!
+ {motto}
+
+
-
Hi, I'm Trick!
-
+
About me
+
+
+ I'm a gay femboy nurse fox who likes figure skating, running and dancing,
+ addicted to vr and video making and I'm always listening to music,
+ oh and I play dnd... And that's just about me in a nutshell.
+
+
-
-
-
-
About me
-
- I'm a gay femboy nurse fox who likes figure skating, running and dancing,
- addicted to vr and video making and I'm always listening to music,
- oh and I play dnd... And that's just about me in a nutshell.
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
-
-
+async function getAccessToken() {
+ const req = await fetch("https://id.twitch.tv/oauth2/token?client_id=" + client_id + "&client_secret=" + client_secret + "&grant_type=client_credentials", {
+ method: "POST",
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ })
+ const data = await req.json();
+ return data['access_token'];
+}
+
+async function getIsUserLive() {
+ const access_token = await getAccessToken();
+ let userId = 268280947; // trick_the_fox;
-
+ const req = await fetch("https://api.twitch.tv/helix/streams?user_id=" + userId, {
+ method: "GET",
+ headers: {
+ 'Content-Type': 'application/json',
+ "Authorization": "Bearer " + access_token,
+ "Client-ID": client_id,
+ }
+ });
+ const data = await req.json();
+ if(data['data'].length > 0) {
+ return true;
+ }
+ return false;
+}
-
-
- )
+function RandomMotto() {
+ const Mottos = [
+ "Yesterday is history, tomorrow is a mystery and today is a gift that's why it's called the present",
+ "Just have fun!",
+ "Live and let go",
+ "Keep calm and carry on"
+ ];
+ const randomNumber = Math.floor(Math.random() * Mottos.length);
+ return Mottos[randomNumber];
+}
+
+export async function getServerSideProps() {
+ return {
+ props: {
+ motto: RandomMotto(),
+ twitch_online: await getIsUserLive()
+ }
+ };
}
+
diff --git a/styles/Index.module.css b/styles/Index.module.css
index 5699a86..10a4090 100644
--- a/styles/Index.module.css
+++ b/styles/Index.module.css
@@ -1,9 +1,20 @@
.avatar {
- height: 200px;
display: flex;
gap: 2em;
}
+.avatar div:last-child {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ gap: 0.5em;
+ width: 90%;
+}
+
+.avatar div:last-child > * {
+ margin: unset;
+}
+
.avatar h1 {
font-size: 2em;
}
@@ -12,17 +23,18 @@
font-weight: normal;
}
-.avatar > .icon {
- width: 25%;
+.avatar > div:first-child {
+ min-width: 100px;
+ max-width: 200px;
transition-duration: 0.3s;
}
-.avatar > .icon > img {
+.avatar > div:first-child > img {
box-shadow: var(--box-shadow);
border-radius: 100%;
}
-.avatar > .icon:hover {
+.avatar > div:first-child:hover {
transition-duration: 0.3s;
transform: scale(1.1) rotate(-20deg);
}
@@ -37,8 +49,8 @@
gap: unset;
}
- .avatar > .icon {
- width: 100%;
+ .avatar > div:first-child {
+ margin: auto;
}
.avatar h1 {
diff --git a/styles/components/Socials.module.css b/styles/components/Socials.module.css
index 32b97b8..d1bc94d 100644
--- a/styles/components/Socials.module.css
+++ b/styles/components/Socials.module.css
@@ -17,7 +17,7 @@
color: white;
transition-duration: 0.1s;
font-family: 'Dela Gothic One', cursive;
- width: 300px;
+ width: 100%;
}
.buttons > a:hover {
@@ -26,8 +26,8 @@
}
/* mobile */
-@media(max-aspect-ratio: 4/3) {
+/* @media(max-aspect-ratio: 4/3) {
.buttons > a {
width: 100%;
}
-}
\ No newline at end of file
+} */
\ No newline at end of file
diff --git a/styles/components/TwitchPopup.module.css b/styles/components/TwitchPopup.module.css
new file mode 100644
index 0000000..d724268
--- /dev/null
+++ b/styles/components/TwitchPopup.module.css
@@ -0,0 +1,3 @@
+.h1 {
+ text-align: center;
+}
\ No newline at end of file
diff --git a/styles/globals.css b/styles/globals.css
index b671ddf..65c7a1c 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -34,6 +34,7 @@ h1, h2, h3 {
img {
max-width: 100%;
+ border-radius: 10px;
}
hr {
@@ -66,6 +67,11 @@ hr {
flex-direction: row;
}
+.flex {
+ display: flex;
+ gap: 1em;
+}
+
/* page elements */
.card {