code: tsx,nextjs,frontends (2 files)

This commit is contained in:
2025-12-26 01:15:19 +00:00
parent bc84907b84
commit 9569718c8f
2 changed files with 10 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
'use client'
import type { CodegenManifest } from '@/lib/codegen/codegen-types'
import { useMemo, useState, type ChangeEvent } from 'react'
import {
@@ -63,7 +64,11 @@ const fetchZip = async (values: FormState) => {
const blob = await response.blob()
const filename = createFilename(response.headers.get('content-disposition'), `${values.projectName}.zip`)
downloadBlob(blob, filename)
return filename
const manifestHeader = response.headers.get('x-codegen-manifest')
const manifest = manifestHeader
? (JSON.parse(decodeURIComponent(manifestHeader)) as CodegenManifest)
: null
return { filename, manifest }
}
export default function CodegenStudioClient() {
@@ -71,6 +76,7 @@ export default function CodegenStudioClient() {
const [status, setStatus] = useState<FetchStatus>('idle')
const [message, setMessage] = useState<string | null>(null)
const [error, setError] = useState<string | null>(null)
const [manifest, setManifest] = useState<CodegenManifest | null>(null)
const runtimeDescription = useMemo(() => {
switch (form.runtime) {

View File

@@ -64,9 +64,9 @@ describe('PowerTransferTab', () => {
renderComponent()
await waitFor(() => expect(fetchMock).toHaveBeenCalled())
expect(await screen.findByText(/Recent transfers/i)).toBeInTheDocument()
expect(screen.getByText(/Transfer to target-god/i)).toBeInTheDocument()
expect(screen.getByText(/Requested by supergod/i)).toBeInTheDocument()
await screen.findByText(/Recent transfers/i)
expect(screen.getByText(/Transfer to target-god/i)).toBeDefined()
expect(screen.getByText(/Requested by supergod/i)).toBeDefined()
})
it('fires onInitiateTransfer when a user card is clicked', async () => {