summaryrefslogtreecommitdiff
path: root/old_stuff/src/pages/index.astro
blob: e286117cfe91479f1074de2d2426150439cf4c96 (plain)
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
---
import { getCollection } from "astro:content";
import Terminal from "@layouts/Terminal.astro";
import TerminalBorder from "@components/TerminalBorder.astro";
import Link from "@components/Link.astro";
import BlogItem from "@components/BlogItem.astro";

const latestBlog = (await getCollection("blogs")).reduce((latest, blog) => {
    const blogDate = new Date(blog.data.date);
    return blogDate > new Date(latest.data.date) ? blog : latest;
});

const sshKey = `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO7P9K9D5RkBk+JCRRS6AtHuTAc6cRpXfRfRMg/Kyren`;
const fingerprint = `
+--[ED25519 256]--+
|       +. ..  +.B|
|      + o..o . BB|
|     ..o oo.o =+E|
|     ... oo. + o.|
|      . S .   =  |
|  .  .   +   o   |
| o    o o .      |
|  oo .o+ +       |
|  ++ooo+=        |
+----[SHA256]-----+`.trimStart();

const aboutMe = `
Hi! I'm Kyren, a software engineer and Game developer freelancer.
I love working with low level languages and learning things deeply.
I am also a terminal nerd and Linux enthusiast who uses NVIM btw.
And when I am not coding I am most likely playing video games,
watching Anime or solving Rubik's cubes fast.`.trimStart();

const utcOffset = 3;

const email = "contact at kyren.codes";

---

<Terminal path="/home/kyren/">
    <!-- ================= -->
    <!-- ==== Desktop ==== -->
    <!-- ================= -->
    <div id="content" class="w-0 h-0 invisible sm:w-full sm:h-full sm:visible">
        <div class="w-[30%]">
            <TerminalBorder header="Profile">
                <div class="flex items-center space-x-[1.25vw] h-[9.5vw]">
                    <img
                        src="favicon.svg"
                        alt="picture"
                        class="h-[100%] object-cover"
                    />
                    <pre
                        class="sshKeyCopy text-[60%] hover:text-[var(--secondary)]">{fingerprint}</pre>
                </div>
            </TerminalBorder>
            <TerminalBorder header="Email">
                <span id="email" class="flex-1">{email}</span>
                <button class="emailCopy hover:text-gray-700">
                    <svg
                        width="100%"
                        height="100%"
                        viewBox="0 0 24 24"
                        xmlns="http://www.w3.org/2000/svg"
                        fill="none"
                    >
                        <path
                            fill="currentColor"
                            fill-rule="evenodd"
                            d="M4 2a2 2 0 00-2 2v9a2 2 0 002 2h2v2a2 2 0 002 2h9a2 2 0 002-2V8a2 2 0 00-2-2h-2V4a2 2 0 00-2-2H4zm9 4V4H4v9h2V8a2 2 0 012-2h5zM8 8h9v9H8V8z"
                        ></path>
                    </svg>
                </button>
            </TerminalBorder>
            <TerminalBorder header="Git Repos (main)">
                <Link href="https://git.kyren.codes/Kyren223">
                    git.kyren.codes/Kyren223
                </Link>
            </TerminalBorder>
            <TerminalBorder header="GitHub (secondary)">
                <Link href="https://github.com/Kyren223">
                    github.com/Kyren223
                </Link>
            </TerminalBorder>
            <TerminalBorder header="Discord">
                <Link href="https://discord.com/users/481884415090229258">
                    Kyren223
                </Link>
            </TerminalBorder>
            <!-- <TerminalBorder header="Timezone"> -->
            <!--     <div class="flex justify-between w-full"> -->
            <!--         <span class="text-left">UTC+{utcOffset}</span> -->
            <!--         <span id="time" class="text-right">Loading...</span> -->
            <!--     </div> -->
            <!-- </TerminalBorder> -->
            <div class="w-[334%]">
                <TerminalBorder header="SSH Key">
                    <div class="sshKeyCopy w-[100%] flex items-center group">
                        <span
                            id="sshKey"
                            class="hover:text-[var(--alt)] cursor-pointer truncate flex-1 group-hover:text-[var(--alt)]"
                            >{sshKey}</span
                        >
                        <button class="group-hover:text-gray-700">
                            <svg
                                width="100%"
                                height="100%"
                                viewBox="0 0 24 24"
                                xmlns="http://www.w3.org/2000/svg"
                                fill="none"
                            >
                                <path
                                    fill="currentColor"
                                    fill-rule="evenodd"
                                    d="M4 2a2 2 0 00-2 2v9a2 2 0 002 2h2v2a2 2 0 002 2h9a2 2 0 002-2V8a2 2 0 00-2-2h-2V4a2 2 0 00-2-2H4zm9 4V4H4v9h2V8a2 2 0 012-2h5zM8 8h9v9H8V8z"
                                ></path>
                            </svg>
                        </button>
                    </div>
                </TerminalBorder>
            </div>
        </div>
        <div class="w-[67%]">
            <TerminalBorder header="Status">
                <p class="text-[0.96vw]">
                    Working on <Link href="https://git.kyren.codes/kyren223/Krypton"
                        >Krypton
                    </Link> | Learning Langdev & Compiler Design | Available for hire
                </p>
            </TerminalBorder>
            <TerminalBorder header="About Me" extra="my-[2.5vw]">
                <p>{aboutMe}</p>
            </TerminalBorder>
            <BlogItem
                header="Latest Blog Post"
                title={latestBlog.data.title}
                description={latestBlog.data.description ?? ""}
                date={latestBlog.data.date}
                href={"/blogs/" + latestBlog.slug}
            />
        </div>
    </div>

    <!-- ================ -->
    <!-- ==== Mobile ==== -->
    <!-- ================ -->
    <div
        class="w-full h-[80svh] visible sm:w-0 sm:h-0 sm:invisible overflow-y-auto overflow-x-hidden sm:overflow-visible"
    >
        <div class="mx-[1vw] mt-[1vw]">
            <TerminalBorder header="Status">
                <p>
                    Working on <Link href="https://github.com/kyren223/eko"
                        >EKO
                    </Link> | Learning Langdev & Compiler Design | Available for hire
                </p>
            </TerminalBorder>
            <TerminalBorder header="About Me" extra="my-[5vw] sm:my-[2.5vw]">
                <p>{aboutMe}</p>
            </TerminalBorder>
            <BlogItem
                header="Latest Blog Post"
                title={latestBlog.data.title}
                description={latestBlog.data.description ?? ""}
                date={latestBlog.data.date}
                href={"/blogs/" + latestBlog.slug}
            />
            <div class="mt-[8vw]">
                <TerminalBorder header="Email">
                    <span id="email" class="flex-1">{email}</span>
                    <button class="emailCopy hover:text-gray-700">
                        <svg
                            class="ml-[-4vw]"
                            xmlns="http://www.w3.org/2000/svg"
                            fill="none"
                        >
                            <path
                                fill="currentColor"
                                fill-rule="evenodd"
                                d="M4 2a2 2 0 00-2 2v9a2 2 0 002 2h2v2a2 2 0 002 2h9a2 2 0 002-2V8a2 2 0 00-2-2h-2V4a2 2 0 00-2-2H4zm9 4V4H4v9h2V8a2 2 0 012-2h5zM8 8h9v9H8V8z"
                            ></path>
                        </svg>
                    </button>
                </TerminalBorder>
            </div>
            <TerminalBorder header="GitHub">
                <Link href="https://github.com/Kyren223">
                    github.com/Kyren223
                </Link>
            </TerminalBorder>
            <TerminalBorder header="Discord">
                <Link href="https://discord.com/users/481884415090229258">
                    Kyren223
                </Link>
            </TerminalBorder>
            <TerminalBorder header="Timezone">
                <div class="flex justify-between w-full">
                    <span class="text-left">UTC+{utcOffset}</span>
                    <span id="time" class="text-right">Loading...</span>
                </div>
            </TerminalBorder>
            <TerminalBorder header="SSH Key">
                <div class="sshKeyCopy w-[100%] flex items-center group">
                    <span
                        id="sshKey"
                        class="hover:text-[var(--alt)] cursor-pointer truncate flex-1 group-hover:text-[var(--alt)]"
                        >{sshKey}</span
                    >
                </div>
            </TerminalBorder>
        </div>
    </div>
</Terminal>

<script define:vars={{ utcOffset }}>
    function copyToClipboard(text) {
        return function () {
            console.log("Clicked");
            navigator.clipboard
                .writeText(text)
                .then(() => {
                    console.log("Copied");
                    // TODO: show some feedback for copying
                })
                .catch((_err) => {
                    console.log("Error copying!");
                    // TODO: show same feedback but with err
                });
        };
    }

    const sshKey = document.getElementById("sshKey");
    document.querySelectorAll(".sshKeyCopy").forEach((elem) => {
        elem.addEventListener("click", copyToClipboard(sshKey.innerHTML));
    });

    const email = document.getElementById("email");
    document.querySelectorAll(".emailCopy").forEach((elem) => {
        elem.addEventListener("click", copyToClipboard(email.innerHTML));
    });

    const time = document.getElementById("time");
    setInterval(
        () => {
            const now = new Date();
            const myTime = new Date(now.getTime() + utcOffset * 3600 * 1000);
            const hours = String(myTime.getUTCHours()).padStart(2, "0");
            const minutes = String(myTime.getUTCMinutes()).padStart(2, "0");
            const formattedTime = `${hours}:${minutes}`;
            time.innerHTML = formattedTime;
        },
        0,
        60 * 1000,
    );
</script>

<style>
    #content {
        margin-top: 1.5vw;
        display: flex;
        justify-content: space-between;
    }

    button {
        background-color: var(--background);
        color: var(--text);
        border: 0;
        font-size: 1.25vw;
        cursor: pointer;
        width: 1.5vw;
        height: 1.5vw;
        padding: 0;
        line-height: 2.3vw;
    }
</style>