|
| 1 | +<script setup lang="ts"> |
| 2 | +const { data: allowedRepos, refresh } = useFetch('/api/repos', { default: () => [] }) |
| 3 | +
|
| 4 | +const isCallback = ref(!!useRoute().query.installation_id) |
| 5 | +const numRepos = allowedRepos.value?.length |
| 6 | +
|
| 7 | +if (import.meta.client && isCallback.value) { |
| 8 | + setInterval(() => { |
| 9 | + refresh() |
| 10 | + }, 1000) |
| 11 | + watch(allowedRepos, (newRepos) => { |
| 12 | + if (newRepos.length === numRepos) return |
| 13 | +
|
| 14 | + isCallback.value = false |
| 15 | + }, { once: true }) |
| 16 | +} |
| 17 | +</script> |
| 18 | + |
1 | 19 | <template>
|
2 | 20 | <section class="flex flex-col items-center flex-grow gap-4 md:gap-8">
|
3 | 21 | <p class="text-xl md:text-2xl lg:text-3xl mb-8 text-center mt-18 md:mt-36">
|
4 | 22 | cluster issues by similarity across multiple repositories
|
5 | 23 | </p>
|
6 | 24 | <NuxtLink
|
7 | 25 | class="bg-green-700 rounded-md px-5 py-3 font-medium flex flex-row gap-2 items-center color-white no-underline focus:bg-green-800 hover:bg-green-800 transition-colors shadow-lg"
|
8 |
| - href="https://github.com/apps/unsight-dev/installations/new" |
| 26 | + :href="isCallback ? null : 'https://github.com/apps/unsight-dev/installations/new'" |
| 27 | + :class="{ 'pointer-events-none opacity-50': isCallback }" |
9 | 28 | >
|
10 |
| - <span class="i-ri:github-fill inline-block w-5 h-5" /> |
11 |
| - install as a github app |
| 29 | + <template v-if="isCallback"> |
| 30 | + <span class="i-tabler-refresh animate-spin inline-block w-5 h-5" /> |
| 31 | + indexing repositories |
| 32 | + </template> |
| 33 | + <template v-else> |
| 34 | + <span class="i-ri:github-fill inline-block w-5 h-5" /> |
| 35 | + install as a github app |
| 36 | + </template> |
12 | 37 | </NuxtLink>
|
| 38 | + <hr> |
| 39 | + <section class="text-center"> |
| 40 | + or pick a repository to browse issue clusters |
| 41 | + <ul class="p-0"> |
| 42 | + <li |
| 43 | + v-for="repo in allowedRepos" |
| 44 | + :key="repo" |
| 45 | + class="list-none" |
| 46 | + > |
| 47 | + <NuxtLink |
| 48 | + :to="`/${repo}`" |
| 49 | + class="no-underline text-gray-400 hover:underline active:text-white" |
| 50 | + > |
| 51 | + {{ repo }} |
| 52 | + </NuxtLink> |
| 53 | + </li> |
| 54 | + </ul> |
| 55 | + </section> |
13 | 56 | </section>
|
14 | 57 | </template>
|
0 commit comments