Skip to content

Commit 2577ea1

Browse files
committed
chore: improve UI/UX regarding Convex test
1 parent 3bd9ce7 commit 2577ea1

7 files changed

Lines changed: 13 additions & 8 deletions

File tree

apps/backend-convex/convex/crons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const crons = cronJobs()
55

66
crons.interval(
77
'clear tasks table',
8-
{ minutes: 10 }, // every 10 minutes
8+
{ hours: 1 },
99
internal.tasks.clearAll,
1010
)
1111

apps/backend-convex/convex/tasks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MINUTE, RateLimiter } from '@convex-dev/rate-limiter'
2-
import { v } from 'convex/values'
2+
import { ConvexError, v } from 'convex/values'
33
import { components } from './_generated/api'
44
import { internalMutation, mutation, query } from './_generated/server'
55

@@ -21,7 +21,7 @@ export const add = mutation({
2121
handler: async (ctx, args) => {
2222
const userIdentity = await ctx.auth.getUserIdentity()
2323
if (userIdentity === null)
24-
throw new Error('Not authenticated')
24+
throw new ConvexError({ msg: 'Not authenticated' })
2525

2626
await rateLimiter.limit(ctx, 'addTask', { key: userIdentity.subject, throws: true })
2727

apps/frontend/app/components/ConvexIntegrationTest.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
import { api } from 'backend-convex/convex/_generated/api'
3+
import { ConvexError } from 'convex/values'
34
45
const toast = useToast()
56
const { $apiClient } = useNuxtApp()
@@ -15,7 +16,7 @@ async function addTask() {
1516
await mutateAddTask({ text: taskInputRef.value })
1617
.then((r) => {
1718
if ('error' in r && r.error)
18-
return toast.add({ severity: 'error', detail: r.error.message, life: 10000 })
19+
return toast.add({ severity: 'error', detail: r.error instanceof ConvexError ? r.error.data.msg : r.error.message, life: 10000 })
1920
2021
taskInputRef.value = ''
2122
})
@@ -38,7 +39,7 @@ async function testConvexViaBackendTasksCTA() {
3839
<div>
3940
{{ $t('components.convexIntegrationTest.configuredUrl') }}: <code class="rounded bg-gray-100 px-1 py-0.5 text-base dark:bg-gray-800">{{ convexClient.client.url }}</code>
4041
</div>
41-
<div>{{ $t('components.convexIntegrationTest.authInfo') }}: <pre class="max-w-full w-full overflow-x-auto rounded bg-black p-2 px-4 text-left text-xs text-white">{{ authInfo ?? 'Not authenticated' }}</pre></div>
42+
<div>{{ $t('components.convexIntegrationTest.authenticated') }}: <code class="rounded bg-gray-100 px-1 py-0.5 text-base dark:bg-gray-800">{{ Boolean(authInfo) }}</code></div>
4243
</div>
4344
<div class="max-w-md w-full flex flex-col gap-5">
4445
<IftaLabel class="w-full">
@@ -51,7 +52,7 @@ async function testConvexViaBackendTasksCTA() {
5152
<h3 class="mb-2 text-lg font-semibold">
5253
{{ $t('components.convexIntegrationTest.tasksList.title') }}
5354
</h3>
54-
<ul v-if="tasks && tasks.length > 0" class="list-disc rounded-md bg-gray-50 p-3 pl-5 space-y-1 dark:bg-gray-800">
55+
<ul v-if="tasks && tasks.length > 0" class="list-disc rounded-md bg-gray-50 p-3 pl-5 text-left space-y-1 dark:bg-gray-800">
5556
<li v-for="task in tasks" :key="task._id" class="text-sm">
5657
{{ task.text }}
5758
</li>

apps/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"backend-convex": "workspace:*",
4242
"class-variance-authority": "^0.7.1",
4343
"clsx": "^2.1.1",
44+
"convex": "^1.24.8",
4445
"convex-nuxt": "0.0.7",
4546
"dayjs": "^1.11.13",
4647
"destr": "^2.0.5",

i18n.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ checksums:
66
components.convexIntegrationTest.addTask.label: 94bfce6a5916c8955cea8d04ad41c10e
77
components.convexIntegrationTest.addTask.placeholder: cfe9cb319a1f23515f7c2215dba202a3
88
components.convexIntegrationTest.configuredUrl: ca306d17f0a8f6bd7e0b9b2efcf23fe7
9-
components.convexIntegrationTest.authInfo: ae504fa548d6625c01f70b259601c382
9+
components.convexIntegrationTest.authenticated: 7aeaface3edc0f5dca2c8ebd6c7e1974
1010
components.convexIntegrationTest.tasksList.empty: 353f149e9225b37a2651116189d0bb78
1111
components.convexIntegrationTest.tasksList.title: efde951ded884b7dbf0f81e45d93a8f9
1212
components.convexIntegrationTest.testBackendButton.fetchTasks: 9f58d5b60b733446f4620c944400c102

locals/locales/src/sheets/frontend/i18n.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ KEY,Description,en,es,fr,ru,vi,zh-CN
22
components.convexIntegrationTest.addTask.label,,Add task entry (press enter),Añadir tarea (pulsar enter),Ajouter une tâche (appuyer sur Entrée),Добавить задачу (нажмите Enter),Thêm mục công việc (nhấn enter),添加任务条目(按回车键)
33
components.convexIntegrationTest.addTask.placeholder,,Enter new task...,Introducir nueva tarea...,Entrez une nouvelle tâche...,Введите новую задачу...,Nhập công việc mới...,输入新任务...
44
components.convexIntegrationTest.configuredUrl,,Convex URL,URL de Convex,URL Convex,URL Convex,URL Convex,Convex URL
5-
components.convexIntegrationTest.authInfo,,Convex Auth Info,Información de autenticación de Convex,Informations d'authentification Convex,Информация об аутентификации Convex,Thông tin xác thực Convex,Convex 认证信息
5+
components.convexIntegrationTest.authenticated,,Convex Authenticated,Convex autenticado,Authentifié par Convex,Аутентифицировано через Convex,Đã xác thực Convex,Convex 已认证
66
components.convexIntegrationTest.tasksList.empty,,No tasks yet.,Aún no hay tareas.,Aucune tâche pour le moment.,Задач пока нет.,Chưa có công việc nào.,暂无任务。
77
components.convexIntegrationTest.tasksList.title,,Tasks,Tareas,Tâches,Задачи,Công việc,任务列表
88
components.convexIntegrationTest.testBackendButton.fetchTasks,,Test Convex integration with `backend` (fetch tasks),Probar integración de Convex con `backend` (obtener tareas),Tester l'intégration de Convex avec `backend` (récupérer les tâches),Тестировать интеграцию Convex с `backend` (получить задачи),Kiểm tra tích hợp Convex với `backend` (lấy công việc),测试Convex与`backend`的集成(获取任务)

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)