Skip to content

Commit ab1baa3

Browse files
authored
feat: quality of life improvements (#19)
1 parent ddcef93 commit ab1baa3

17 files changed

Lines changed: 93 additions & 43 deletions

File tree

src/app/[userName]/NewProjectForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { useRouter } from 'next/navigation'
55
import { useState } from 'react'
66
import useSWR from 'swr'

src/app/[userName]/ProjectRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { Route } from 'next'
55
import Link from 'next/link'
66
import { useRouter } from 'next/navigation'

src/app/admin/components/AllowlistEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { useRouter } from 'next/navigation'
55
import { startTransition, useRef } from 'react'
66
import { addAllowedUser, removeAllowedUser } from '../actions'

src/app/admin/components/HealthMonitor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { startTransition, useState } from 'react'
55
import useSWR from 'swr'
66
import { fetchDiskUsage, fetchHealth } from '../actions'

src/app/admin/components/OAuthConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { useState } from 'react'
55
import useSWR from 'swr'
66
import { fetchOAuthConfig, updateOAuthConfig } from '../actions'

src/app/admin/components/RegistrationModeControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

3+
import { useServerAction } from '@/lib/client/util'
34
import type { RegistrationMode } from '@/lib/server/config'
4-
import { useServerAction } from '@/lib/util'
55
import { useRouter } from 'next/navigation'
66
import { startTransition, useState } from 'react'
77
import { setRegistrationMode } from '../actions'

src/app/admin/components/SessionRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

3+
import { useServerAction } from '@/lib/client/util'
34
import type { EditorSessionInfo } from '@/lib/server/editorSessions'
4-
import { useServerAction } from '@/lib/util'
55
import { useRouter } from 'next/navigation'
66
import { startTransition } from 'react'
77
import { killEditorSession } from '../actions'

src/app/admin/components/UserRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { useServerAction } from '@/lib/util'
3+
import { useServerAction } from '@/lib/client/util'
44
import { useRouter } from 'next/navigation'
55
import { startTransition, useState } from 'react'
66
import { deleteUser, toggleAdmin } from '../actions'

src/app/api/setup-events/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { getSeedState } from '@/lib/server/seed'
33
export async function GET() {
44
const encoder = new TextEncoder()
55

6+
let interval: ReturnType<typeof setInterval> | undefined
67
const stream = new ReadableStream({
78
start(controller) {
89
let cursor = 0
910

10-
const interval = setInterval(() => {
11+
interval = setInterval(() => {
1112
const st = getSeedState()
1213
while (cursor < st.events.length) {
1314
const event = st.events[cursor++]
@@ -24,6 +25,9 @@ export async function GET() {
2425
}
2526
}, 500)
2627
},
28+
cancel() {
29+
clearInterval(interval)
30+
},
2731
})
2832

2933
return new Response(stream, {

src/app/setup/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { initAuth } from '@/lib/server/auth'
44
import { getConfig, hasGithubAuth, saveConfig, zGithubAuthConfig } from '@/lib/server/config'
55
import { startSeed as doStartSeed, getSeedState } from '@/lib/server/seed'
6-
import { ActionResponse } from '@/lib/util'
6+
import type { ActionResponse } from '@/lib/util'
77
import z from 'zod'
88

99
const zSetupConfig = z.object({
@@ -33,8 +33,8 @@ export async function saveSetupConfig(formData: FormData): Promise<ActionRespons
3333
return { ok: true }
3434
}
3535

36-
export async function startSeed(): Promise<ActionResponse<boolean>> {
37-
return doStartSeed()
36+
export async function startSeed(leanVersion: string | undefined): Promise<ActionResponse<boolean>> {
37+
return doStartSeed(leanVersion)
3838
}
3939

4040
export async function fetchSetupStatus() {

0 commit comments

Comments
 (0)