Skip to content

Commit 36f1f05

Browse files
authored
fix: general fixes (#25)
* fix: update db:studio command to include configuration flag * feat: API Key Copy Functionality with Status Feedback * feat: add push sucess
1 parent 44f641a commit 36f1f05

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

app/pages/apps/[id]/index.vue

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import {
33
Activity,
4+
Check,
45
Copy,
56
Eye,
67
EyeOff,
@@ -34,6 +35,7 @@ const stats = computed(() => (app as any)?.stats || {
3435
})
3536
const recentActivity = ref<any[]>([])
3637
const showApiKey = ref(false)
38+
const isApiKeyCopied = ref(false)
3739
3840
// Methods
3941
function _initializeRecentActivity() {
@@ -78,8 +80,15 @@ function formatTime(timestamp: Date) {
7880
7981
async function copyApiKey() {
8082
try {
81-
await navigator.clipboard.writeText((app as any)?.apiKey || '')
82-
// TODO: Show success toast
83+
await navigator.clipboard.writeText((app as any).value?.apiKey || '')
84+
85+
push.success('API key copied to clipboard!')
86+
87+
isApiKeyCopied.value = true
88+
89+
setTimeout(() => {
90+
isApiKeyCopied.value = false
91+
}, 2000)
8392
}
8493
catch (error) {
8594
console.error('Failed to copy API key:', error)
@@ -158,21 +167,23 @@ onMounted(() => {
158167
</CardHeader>
159168
<CardContent>
160169
<div class="flex items-center space-x-2">
161-
<Input
162-
:model-value="showApiKey ? app.apiKey : '•'.repeat(32)"
163-
readonly
164-
class="font-mono"
165-
/>
170+
<Input :model-value="showApiKey ? app.apiKey : '•'.repeat(32)" readonly class="font-mono" />
166171
<Button variant="outline" size="icon" @click="showApiKey = !showApiKey">
167172
<Eye v-if="!showApiKey" class="h-4 w-4" />
168173
<EyeOff v-else class="h-4 w-4" />
169174
</Button>
170-
<Button variant="outline" size="icon" @click="copyApiKey">
171-
<Copy class="h-4 w-4" />
175+
<Button
176+
variant="outline" size="icon" :class="isApiKeyCopied ? 'text-green-600 border-green-600' : ''"
177+
@click="copyApiKey"
178+
>
179+
<Check v-if="isApiKeyCopied" class="h-4 w-4" />
180+
<Copy v-else class="h-4 w-4" />
172181
</Button>
173182
</div>
174183
<p class="text-xs text-muted-foreground mt-2">
175-
Use as: <code class="bg-muted px-1 rounded">Authorization: ApiKey {{ app.apiKey?.substring(0, 8) }}...</code>
184+
Use as: <code class="bg-muted px-1 rounded">
185+
Authorization: ApiKey {{ app.apiKey?.substring(0, 8) }}...
186+
</code>
176187
</p>
177188
</CardContent>
178189
</Card>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"db:drop": "drizzle-kit drop --config ./server/drizzle.config.ts",
2020
"db:up": "drizzle-kit up --config ./server/drizzle.config.ts",
2121
"db:check": "drizzle-kit check --config ./server/drizzle.config.ts",
22-
"db:studio": "drizzle-kit studio",
22+
"db:studio": "drizzle-kit studio --config ./server/drizzle.config.ts",
2323
"test": "vitest",
2424
"test:ui": "vitest --ui"
2525
},

0 commit comments

Comments
 (0)