File size: 1,777 Bytes
0163a2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<script lang="ts">
import { GithubOutlined, StarOutlined } from '@ant-design/icons-vue';
import { onMounted, ref } from 'vue';

export default {
    name: 'Header',
    components: {
        GithubOutlined,
        StarOutlined,
    },
    setup(props) {
        let stars = ref<number | null>(null);
        onMounted(async () => {
            const repoOwner = "huchenlei";
            const repoName = "sd-webui-openpose-editor";

            try {
                const response = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}`);
                if (response.ok) {
                    const data = await response.json();
                    stars.value = data.stargazers_count;
                } else {
                    console.error("Failed to fetch star count from GitHub");
                }
            } catch (error) {
                console.error("Error fetching star count:", error);
            }
        });

        return {
            stars,
        };
    },
};
</script>

<template>
    <header>
        <a-affix :offset-top="0">
            <a-page-header>
                <template #title>
                    <a-space>
                        <a href="https://github.com/huchenlei/sd-webui-openpose-editor"
                            target="_blank"><github-outlined /></a>
                        <span><b>SD-WEBUI-OPENPOSE-EDITOR</b></span>
                        <a v-if="stars !== null" href="https://github.com/huchenlei/sd-webui-openpose-editor/stargazers"
                            target="_blank">
                            {{ stars }} <star-outlined />
                        </a>
                    </a-space>
                </template>
            </a-page-header>
        </a-affix>
    </header>
</template>