Skip to content

Commit 0495973

Browse files
committed
feat: add vscode status to header
1 parent aea25a2 commit 0495973

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

src/components/Header.vue

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { ref, onMounted, onUnmounted } from "vue";
33
44
const ws = ref(null);
55
const status = ref("text-gruvbox-gray");
6+
7+
const vscode = ref(null);
68
const spotify = ref(null);
79
810
const connectWebSocket = () => {
@@ -22,6 +24,9 @@ const connectWebSocket = () => {
2224
if (data.t === "INIT_STATE" || data.t === "PRESENCE_UPDATE") {
2325
const presence = data.d;
2426
spotify.value = presence.spotify;
27+
vscode.value = presence.activities.find(
28+
(activity) => activity.name === "Visual Studio Code",
29+
);
2530
2631
switch (presence.discord_status) {
2732
case "online":
@@ -66,39 +71,32 @@ onUnmounted(() => {
6671
</div>
6772
<div>
6873
emirhan (aka larei), 18 years-old. self-taught developer,
69-
<a
70-
href="https://www.youtube.com/watch?v=9sJUDx7iEJw"
71-
target="_blank"
72-
class="underline"
73-
>open-source</a
74-
>
74+
<a href="https://www.youtube.com/watch?v=9sJUDx7iEJw" target="_blank" class="underline">open-source</a>
7575
enthusiast. programming, music, math.
7676
</div>
77-
<div class="flex gap-2 text-sm text-gruvbox-gray">
78-
<font-awesome-icon :icon="['fab', 'spotify']" class="mt-[3px]" />
77+
<div class="flex items-center gap-2 text-sm text-gruvbox-gray">
78+
<font-awesome-icon :icon="['fab', 'spotify']" class="w-4 h-4 mr-0.5" />
7979
<div v-if="spotify">
8080
i'm currently listening to
81-
<a
82-
:href="`https://open.spotify.com/track/${spotify.track_id}`"
83-
target="_blank"
84-
class="font-black underline"
85-
>{{ spotify.song }} - {{ spotify.artist }}</a
86-
>.
81+
<a :href="`https://open.spotify.com/track/${spotify.track_id}`" target="_blank" class="font-black underline">{{
82+
spotify.song }} - {{ spotify.artist }}</a>.
8783
</div>
8884
<div v-else>i'm not listening to anything right now.</div>
8985
</div>
86+
<div class="flex items-center gap-2 text-sm text-gruvbox-gray">
87+
<font-awesome-icon :icon="['fas', 'code']" class="w-4 h-4 mr-0.5" />
88+
<div v-if="vscode">
89+
i'm currently working on
90+
<span class="font-black">{{ vscode.details }}</span>
91+
<span v-if="vscode.state"> in <span class="font-black">{{ vscode.state }}</span></span>
92+
</div>
93+
<div v-else>i'm not working on anything right now.</div>
94+
</div>
9095
<div class="flex gap-10 mt-5 text-xl">
91-
<a href="https://github.com/lareii/" target="_blank"
92-
><font-awesome-icon :icon="['fab', 'github']"
93-
/></a>
94-
<a href="https://www.linkedin.com/in/larei/" target="_blank"
95-
><font-awesome-icon :icon="['fab', 'linkedin']"
96-
/></a>
97-
<a href="https://discord.gg/taMRRAHb6y" target="_blank"
98-
><font-awesome-icon :icon="['fab', 'discord']"
99-
/></a>
100-
<a href="https://mastodon.com.tr/@larei" target="_blank" rel="me"
101-
><font-awesome-icon :icon="['fab', 'mastodon']"
102-
/></a>
96+
<a href="https://github.com/lareii/" target="_blank"><font-awesome-icon :icon="['fab', 'github']" /></a>
97+
<a href="https://www.linkedin.com/in/larei/" target="_blank"><font-awesome-icon :icon="['fab', 'linkedin']" /></a>
98+
<a href="https://discord.gg/taMRRAHb6y" target="_blank"><font-awesome-icon :icon="['fab', 'discord']" /></a>
99+
<a href="https://mastodon.com.tr/@larei" target="_blank" rel="me"><font-awesome-icon
100+
:icon="['fab', 'mastodon']" /></a>
103101
</div>
104102
</template>

src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import App from './App.vue'
55

66
import { library } from '@fortawesome/fontawesome-svg-core'
77
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
8-
import { faStar, faCodeBranch } from '@fortawesome/free-solid-svg-icons'
8+
import { faStar, faCodeBranch, faCode } from '@fortawesome/free-solid-svg-icons'
99
import { faGithub, faLinkedin, faDiscord, faSpotify, faMastodon } from '@fortawesome/free-brands-svg-icons'
1010

11-
library.add(faGithub, faLinkedin, faDiscord, faSpotify, faMastodon, faStar, faCodeBranch)
11+
library.add(faGithub, faLinkedin, faDiscord, faSpotify, faMastodon, faStar, faCodeBranch, faCode)
1212

1313
createApp(App)
1414
.component('font-awesome-icon', FontAwesomeIcon)

0 commit comments

Comments
 (0)