summaryrefslogtreecommitdiff
path: root/src/pages/index.astro
blob: c09609fb9e19d5d265c9a39d8ae0ba1c8c4d4eb3 (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
---
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 Minecraft plugin freelancer,
I love working with Rust, Golang and Java.
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();
---

<Terminal path="">
    <div id="content">
        <div id="left" class="column">
            <TerminalBorder header="Profile">
                <div class="flex items-center space-x-[1vw] h-[10vw]">
                    <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">Kyren223@proton.me</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="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+2</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 space-x-2 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 id="right" class="column">
            <TerminalBorder header="Status">
                <p>
                    Working on <Link href="https://github.com/KapiMC/Kapi"
                        >Kapi
                    </Link> | Learning Golang & Backend | Available for hire
                </p>
            </TerminalBorder>
            <TerminalBorder header="About Me" margin="2em 0">
                <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>
</Terminal>

<script>
    function copyToClipboard(text: string) {
        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 utcOffset = 2;
    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: 0.625vw;
        display: flex;
        justify-content: space-between;
    }

    #left {
        width: 30%;
    }
    #right {
        width: 67%;
    }

    .column {
        /* border-width: 10px; */
        /* border-color: var(--alt); */
    }

    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>