1
+ <template >
2
+ <div class =" row" >
3
+ <div data-aos =" fade-right" data-aos-duration =" 1000" >
4
+ <div >
5
+ <h1 class =" display-4" >{{ skin!.name }}</h1 >
6
+ <p v-if =" skin?.description" >{{ skin.description }}</p >
7
+ </div >
8
+ <ul class =" nav nav-tabs mb-4" >
9
+ <li class =" nav-item" >
10
+ <button class =" nav-link text-light"
11
+ :class =" {'active': selector == 'splash'}" @click =" selector = 'splash'" >Splash</button >
12
+ </li >
13
+ <li class =" nav-item" >
14
+ <button class =" nav-link text-light"
15
+ :class =" {'active': selector == 'uncenteredSplash'}" @click =" selector = 'uncenteredSplash'" >Uncentered Splash</button >
16
+ </li >
17
+ <li class =" nav-item text-light" >
18
+ <button class =" nav-link text-light"
19
+ :class =" {'active': selector == 'tile'}" @click =" selector = 'tile'" >Tile</button >
20
+ </li >
21
+ </ul >
22
+ </div >
23
+ <div class =" d-flex justify-content-center align-items-center mb-4"
24
+ data-aos =" fade-left" data-aos-duration =" 1000" >
25
+ <img class =" img-fluid" :src =" selection" />
26
+ </div >
27
+ <div v-if =" skinUniverses.length > 0" >
28
+ <h5 class =" border-bottom border-light border-opacity-25 border-2 mb-2 pb-2" >Universes</h5 >
29
+ <div v-for =" skinUniverse in skinUniverses" >
30
+ <div v-if =" skinUniverse" :id =" `${skinUniverse!.id}`" >
31
+ <h6 class =" fw-bold" >{{ skinUniverse?.name }}</h6 >
32
+ <p class =" ms-2" >{{ skinUniverse?.description }}</p >
33
+ </div >
34
+ </div >
35
+ </div >
36
+ </div >
37
+ </template >
38
+
39
+ <script setup lang="ts">
40
+ import useClient from ' ~/composables/useClient' ;
41
+ import useLocale from ' ~/composables/useLocale' ;
42
+
43
+ const route = useRoute ();
44
+ const id = route .params .id as unknown ;
45
+
46
+ const { client } = useClient ();
47
+ const { currentLocale } = useLocale ();
48
+ const getSkins = async () => await client .skins .listAsync ({ locale: currentLocale .value , version: " latest" });
49
+ const getUniverses = async () => await client .universes .listAsync ({ locale: currentLocale .value , version: " latest" });
50
+
51
+ const skins = ref (await getSkins ());
52
+ const universes = ref (await getUniverses ());
53
+ watch (currentLocale , async () => {
54
+ skins .value = await getSkins ();
55
+ universes .value = await getUniverses ();
56
+ });
57
+
58
+ const skin = computed (() => skins .value .find ((x ) => x .id == id ));
59
+ const selector = ref (" splash" );
60
+ const selection = computed (() => {
61
+ switch (selector .value ) {
62
+ case " splash" :
63
+ return skin .value ! .getSplash ({locale: currentLocale .value , version: " latest" });
64
+ case " uncenteredSplash" :
65
+ return skin .value ! .getUncenteredSplash ({locale: currentLocale .value , version: " latest" });
66
+ case " tile" :
67
+ return skin .value ! .getTile ({locale: currentLocale .value , version: " latest" });
68
+ default :
69
+ return " /img/error.png" ;
70
+ }
71
+ });
72
+ const skinUniverses = computed (() => skin .value ?.skinLines
73
+ ?.map ((x ) => universes .value .find ((y ) => y .skinSets .includes (x .id )))
74
+ .filter (x => x != null ) ?? []);
75
+ </script >
0 commit comments