Skip to content

Commit 4737827

Browse files
authored
Merge pull request #37 from dev-five-git/ui
UI
2 parents 49f450d + a32febf commit 4737827

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3856
-104
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"changes":{"packages/core/package.json":"Patch","packages/rsbuild-plugin/package.json":"Patch","packages/webpack-plugin/package.json":"Patch","packages/zod/package.json":"Patch","packages/generator/package.json":"Patch","packages/next-plugin/package.json":"Patch","packages/fetch/package.json":"Patch","packages/hookform/package.json":"Patch","packages/utils/package.json":"Patch","packages/vite-plugin/package.json":"Patch","packages/react-query/package.json":"Patch","packages/ui/package.json":"Minor"},"note":"Implement ui","date":"2026-01-05T04:19:18.456233400Z"}

bun.lock

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

examples/next-webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"next": "^16.1.0",
12+
"next": "^16.1.1",
1313
"react": "^19.2.3",
1414
"react-dom": "^19.2.3",
1515
"@devup-api/next-plugin": "workspace:*",

examples/next/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Metadata } from 'next'
2+
import { Providers } from './providers'
23

34
export const metadata: Metadata = {
45
title: 'Next.js Example - devup-api',
@@ -12,7 +13,9 @@ export default function RootLayout({
1213
}) {
1314
return (
1415
<html lang="en">
15-
<body>{children}</body>
16+
<body>
17+
<Providers>{children}</Providers>
18+
</body>
1619
</html>
1720
)
1821
}

examples/next/app/page.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { createApi, type DevupObject } from '@devup-api/fetch'
44
import { createQueryClient } from '@devup-api/react-query'
5+
import { ApiCrud } from '@devup-api/ui'
56
import { schemas } from '@devup-api/zod'
67
import { Box, Text } from '@devup-ui/react'
78
import { useEffect } from 'react'
@@ -37,20 +38,20 @@ export default function Home() {
3738
console.info(data, isLoading, error)
3839

3940
const {
40-
data: data2,
41-
error: error2,
41+
data: _data2,
42+
error: _error2,
4243
mutateAsync,
4344
} = queryClient.useMutation('GET', '/users/{id}', {})
44-
mutateAsync({
45-
params: { id: 1 },
46-
query: {
47-
name: 'John Doe',
48-
},
49-
})
5045

51-
console.info(data2, error2)
46+
// console.info(data2, error2)
5247

5348
useEffect(() => {
49+
mutateAsync({
50+
params: { id: 1 },
51+
query: {
52+
name: 'John Doe',
53+
},
54+
})
5455
api2.get('getUsers2').then((res) => {
5556
console.log(res)
5657
})
@@ -79,11 +80,12 @@ export default function Home() {
7980
.then((res) => {
8081
console.log(res)
8182
})
82-
}, [])
83+
}, [mutateAsync])
8384
return (
8485
<Box>
8586
<Text>Next.js Example (Turbopack)</Text>
8687
<Box>
88+
<ApiCrud api={'user'} apiClient={api} />
8789
<Box>
8890
<Box>
8991
<Box>

examples/next/app/providers.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use client'
2+
3+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
4+
import { type ReactNode, useState } from 'react'
5+
6+
export function Providers({ children }: { children: ReactNode }) {
7+
const [queryClient] = useState(() => new QueryClient())
8+
9+
return (
10+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
11+
)
12+
}

examples/next/openapi2.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"post": {
3030
"summary": "Create a new user",
3131
"operationId": "createUser2",
32+
"tags": ["devup:user:create"],
3233
"requestBody": {
3334
"required": true,
3435
"content": {
@@ -57,6 +58,7 @@
5758
"get": {
5859
"summary": "Get user by ID",
5960
"operationId": "getUserById2",
61+
"tags": ["devup:user:one"],
6062
"parameters": [
6163
{
6264
"name": "id",
@@ -79,6 +81,80 @@
7981
}
8082
}
8183
}
84+
},
85+
"put": {
86+
"summary": "Update user (full replacement)",
87+
"operationId": "updateUser2",
88+
"tags": ["devup:user:edit"],
89+
"parameters": [
90+
{
91+
"name": "id",
92+
"in": "path",
93+
"required": true,
94+
"schema": {
95+
"type": "integer"
96+
}
97+
}
98+
],
99+
"requestBody": {
100+
"required": true,
101+
"content": {
102+
"application/json": {
103+
"schema": {
104+
"$ref": "#/components/schemas/UpdateUserRequest"
105+
}
106+
}
107+
}
108+
},
109+
"responses": {
110+
"200": {
111+
"description": "User updated",
112+
"content": {
113+
"application/json": {
114+
"schema": {
115+
"$ref": "#/components/schemas/User"
116+
}
117+
}
118+
}
119+
}
120+
}
121+
},
122+
"patch": {
123+
"summary": "Patch user (partial update)",
124+
"operationId": "patchUser2",
125+
"tags": ["devup:user:fix"],
126+
"parameters": [
127+
{
128+
"name": "id",
129+
"in": "path",
130+
"required": true,
131+
"schema": {
132+
"type": "integer"
133+
}
134+
}
135+
],
136+
"requestBody": {
137+
"required": true,
138+
"content": {
139+
"application/json": {
140+
"schema": {
141+
"$ref": "#/components/schemas/PatchUserRequest"
142+
}
143+
}
144+
}
145+
},
146+
"responses": {
147+
"200": {
148+
"description": "User patched",
149+
"content": {
150+
"application/json": {
151+
"schema": {
152+
"$ref": "#/components/schemas/User"
153+
}
154+
}
155+
}
156+
}
157+
}
82158
}
83159
}
84160
},
@@ -131,6 +207,31 @@
131207
}
132208
},
133209
"required": ["name", "email"]
210+
},
211+
"UpdateUserRequest": {
212+
"type": "object",
213+
"properties": {
214+
"name": {
215+
"type": "string"
216+
},
217+
"email": {
218+
"type": "string",
219+
"format": "email"
220+
}
221+
},
222+
"required": ["name", "email"]
223+
},
224+
"PatchUserRequest": {
225+
"type": "object",
226+
"properties": {
227+
"name": {
228+
"type": "string"
229+
},
230+
"email": {
231+
"type": "string",
232+
"format": "email"
233+
}
234+
}
134235
}
135236
}
136237
}

0 commit comments

Comments
 (0)