Skip to content

Commit bc26a98

Browse files
committed
feat: implement as github app
1 parent c41b6df commit bc26a98

File tree

14 files changed

+547
-233
lines changed

14 files changed

+547
-233
lines changed

app/app.vue

+33-31
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,39 @@ useSeoMeta({
66
</script>
77

88
<template>
9-
<main class="font-sans m-2">
10-
<nav class="flex flex-row items-center gap-2 ">
11-
<h1 class="text-lg">
12-
<NuxtLink
13-
to="/"
14-
class="no-underline color-current"
15-
>
16-
unsight.dev
17-
</NuxtLink>
18-
</h1>
19-
<p class="flex gap-1 items-center bg-yellow-400 rounded-full color-black px-2 py-[2px] text-xs font-bold">
20-
proof of concept
21-
</p>
22-
</nav>
23-
<NuxtPage />
24-
</main>
25-
<footer class="justify-center flex gap-2 font-sans mt-auto p-2 text-center text-sm opacity-75 hover:opacity-100">
26-
<a
27-
class="no-underline hover:underline text-white"
28-
href="https://github.com/danielroe/unsight.dev"
29-
>
30-
source
31-
</a>
32-
&middot;
33-
made with ❤️ by <a
34-
class="no-underline font-semibold hover:underline text-white"
35-
href="https://bsky.app/profile/danielroe.dev"
36-
>
37-
@danielroe.dev
38-
</a>
39-
</footer>
9+
<div class="min-h-screen flex flex-col">
10+
<main class="flex flex-col font-sans m-2 flex-grow">
11+
<nav class="flex flex-row items-center gap-2 ">
12+
<h1 class="text-lg">
13+
<NuxtLink
14+
to="/"
15+
class="no-underline color-current"
16+
>
17+
unsight.dev
18+
</NuxtLink>
19+
</h1>
20+
<p class="flex gap-1 items-center bg-yellow-400 rounded-full color-black px-2 py-[2px] text-xs font-bold">
21+
proof of concept
22+
</p>
23+
</nav>
24+
<NuxtPage />
25+
</main>
26+
<footer class="justify-center flex gap-2 font-sans p-2 text-center text-sm opacity-75 hover:opacity-100 mb-4">
27+
<a
28+
class="no-underline hover:underline text-white"
29+
href="https://github.com/danielroe/unsight.dev"
30+
>
31+
source
32+
</a>
33+
&middot;
34+
made with ❤️ by <a
35+
class="no-underline font-semibold hover:underline text-white"
36+
href="https://bsky.app/profile/danielroe.dev"
37+
>
38+
@danielroe.dev
39+
</a>
40+
</footer>
41+
</div>
4042
</template>
4143

4244
<style>

app/pages/[[owner]]/[[repo]]/index.vue app/pages/[owner]/[repo]/index.vue

+4-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import rgbToHSL from 'rgb-to-hsl'
44
55
import { allowedRepos } from '#shared/repos'
66
7+
const { data: allowedRepos } = useFetch('/api/repos')
8+
79
const route = useRoute('owner-repo')
810
const selectedRepo = computed(() => route.params.owner && route.params.repo ? `${route.params.owner}/${route.params.repo}` : 'nuxt/nuxt')
911
@@ -44,11 +46,6 @@ function labelColors(color: string) {
4446
}
4547
}
4648
47-
const stateColors: Record<string, string> = {
48-
open: 'text-green-500',
49-
closed: 'text-purple-500',
50-
}
51-
5249
const openState = reactive<Record<string, boolean>>({})
5350
</script>
5451

@@ -142,14 +139,11 @@ const openState = reactive<Record<string, boolean>>({})
142139
:key="i"
143140
class="flex flex-row gap-2 leading-tightest"
144141
>
145-
<span
146-
class="flex-shrink-0 inline-block w-5 h-5"
147-
:class="[stateColors[issue.state] || 'text-gray-400', issue.pull_request ? 'i-tabler-git-pull-request' : issue.state === 'closed' ? 'i-tabler-circle-check' : 'i-tabler-circle-dot']"
148-
/>
142+
<span class="flex-shrink-0 inline-block w-5 h-5 i-tabler-circle-dot text-green-500" />
149143
<div class="flex flex-row gap-2 flex-wrap md:flex-nowrap md:pb-6 flex-grow">
150144
<NuxtLink
151145
class="line-clamp-1 flex-grow text-sm md:text-base lg:flex-grow-0 no-underline color-current hover:underline"
152-
:href="issue.html_url"
146+
:href="issue.url"
153147
>
154148
{{ issue.title }}
155149
</NuxtLink>

app/pages/index.vue

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<section class="flex flex-col items-center flex-grow gap-4 md:gap-8">
3+
<p class="text-xl md:text-2xl lg:text-3xl mb-8 text-center mt-18 md:mt-36">
4+
cluster issues by similarity across multiple repositories
5+
</p>
6+
<NuxtLink
7+
class="bg-green-700 rounded-md px-5 py-3 font-medium flex flex-row gap-2 items-center"
8+
href="https://github.com/apps/unsight-dev"
9+
>
10+
<span class="i-ri:github-fill inline-block w-5 h-5" />
11+
install as a github app
12+
</NuxtLink>
13+
</section>
14+
</template>

nuxt.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default defineNuxtConfig({
77
'nuxt-time',
88
'@nuxtjs/html-validator',
99
// TODO: 'nuxt-og-image',
10+
'nuxt-webhook-validators',
1011
],
1112
devtools: { enabled: true },
1213
app: {
@@ -20,6 +21,8 @@ export default defineNuxtConfig({
2021
},
2122
runtimeConfig: {
2223
github: {
24+
appId: '',
25+
privateKey: '',
2326
token: '',
2427
},
2528
},
@@ -40,6 +43,10 @@ export default defineNuxtConfig({
4043
issues: {
4144
dimensions: 1024,
4245
metric: 'euclidean',
46+
metadataIndexes: {
47+
owner: 'string',
48+
repository: 'string',
49+
},
4350
},
4451
},
4552
kv: true,

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
"@iconify-json/tabler": "1.2.10",
1717
"@nuxthub/core": "^0.8.7",
1818
"@nuxtjs/html-validator": "1.8.2",
19-
"@octokit/rest": "^21.0.2",
19+
"@octokit/webhooks-types": "^7.6.1",
2020
"@unocss/nuxt": "^0.65.1",
2121
"hex-rgb": "^5.0.0",
2222
"ml-distance": "^4.0.1",
2323
"ml-kmeans": "^6.0.0",
2424
"nuxt": "latest",
2525
"nuxt-time": "1.0.3",
26+
"nuxt-webhook-validators": "0.1.4",
27+
"octokit": "^4.0.2",
2628
"ohash": "^1.1.4",
2729
"openai": "^4.76.0",
2830
"rgb-to-hsl": "^0.0.3",
@@ -31,6 +33,7 @@
3133
},
3234
"devDependencies": {
3335
"@nuxt/eslint": "0.7.2",
36+
"@octokit/rest": "^21.0.2",
3437
"lint-staged": "15.2.10",
3538
"simple-git-hooks": "2.11.1",
3639
"typescript": "5.6.3",

0 commit comments

Comments
 (0)