tangled
alpha
login
or
join now
finxol.io
/
blog
0
fork
atom
Personal blog
finxol.io
blog
0
fork
atom
overview
issues
pulls
pipelines
feat: add "currently in" badge
finxol.io
6 months ago
56fbd26c
7d9cf402
verified
This commit was signed with the committer's
known signature
.
finxol.io
SSH Key Fingerprint:
SHA256:olFE3asYdoBMScuJOt60UxXdJ0RFdGv5kVKrdOtIcPI=
1/1
deploy.yaml
success
35s
+41
2 changed files
expand all
collapse all
unified
split
app
app.vue
components
Country.vue
+1
app/app.vue
···
80
80
</div>
81
81
82
82
<div class="flex items-center gap-4 sm:gap-8">
83
83
+
<Country />
83
84
<div
84
85
class="cursor-pointer"
85
86
@click="toggleDark()"
+40
app/components/Country.vue
···
1
1
+
<script setup lang="ts">
2
2
+
const data = await $fetch("https://hook.finxol.io/sensors/country")
3
3
+
.then((res) => {
4
4
+
return res as { country: string; country_code: string };
5
5
+
})
6
6
+
.catch((e) => {
7
7
+
console.error(e);
8
8
+
});
9
9
+
10
10
+
const country = data?.country;
11
11
+
12
12
+
const letterA = "a".codePointAt(0);
13
13
+
//biome-ignore format: breaks emoji
14
14
+
const regionalIndicatorA = '🇦'.codePointAt(0);
15
15
+
16
16
+
const toRegionalIndicator = (char: string) =>
17
17
+
//@ts-ignore
18
18
+
String.fromCodePoint(char.codePointAt(0) - letterA + regionalIndicatorA);
19
19
+
20
20
+
const emoji = data?.country_code
21
21
+
.split("")
22
22
+
.map((char) => toRegionalIndicator(char))
23
23
+
.join("");
24
24
+
</script>
25
25
+
26
26
+
<template>
27
27
+
<div class="hidden md:flex flex-row items-center gap-2">
28
28
+
<span>
29
29
+
Currently in:
30
30
+
</span>
31
31
+
<div class="flex flex-row items-center gap-2 bg-stone-200/50 dark:bg-stone-700/60 py-1 px-2 rounded-lg">
32
32
+
<span>
33
33
+
{{ emoji }}
34
34
+
</span>
35
35
+
<span>
36
36
+
{{ country }}
37
37
+
</span>
38
38
+
</div>
39
39
+
</div>
40
40
+
</template>