@tscircuit/fake-snippets 0.0.86 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun-tests/fake-snippets-api/routes/ai_reviews/create.test.ts +2 -2
- package/bun-tests/fake-snippets-api/routes/ai_reviews/get.test.ts +1 -1
- package/bun-tests/fake-snippets-api/routes/ai_reviews/list.test.ts +2 -2
- package/bun-tests/fake-snippets-api/routes/ai_reviews/process_review.test.ts +1 -1
- package/bun-tests/fake-snippets-api/routes/package_releases/get.test.ts +2 -2
- package/dist/bundle.js +4 -4
- package/fake-snippets-api/routes/api/ai_reviews/create.ts +6 -4
- package/package.json +1 -1
- package/src/components/SearchComponent.tsx +11 -1
- package/src/hooks/use-request-ai-review-mutation.ts +2 -2
|
@@ -5,14 +5,16 @@ import { aiReviewSchema } from "fake-snippets-api/lib/db/schema"
|
|
|
5
5
|
export default withRouteSpec({
|
|
6
6
|
methods: ["POST"],
|
|
7
7
|
auth: "session",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
jsonBody: z
|
|
9
|
+
.object({
|
|
10
|
+
package_release_id: z.string().optional(),
|
|
11
|
+
})
|
|
12
|
+
.optional(),
|
|
11
13
|
jsonResponse: z.object({
|
|
12
14
|
ai_review: aiReviewSchema,
|
|
13
15
|
}),
|
|
14
16
|
})(async (req, ctx) => {
|
|
15
|
-
const { package_release_id } = req.
|
|
17
|
+
const { package_release_id } = req.jsonBody ?? {}
|
|
16
18
|
|
|
17
19
|
if (package_release_id) {
|
|
18
20
|
const release = ctx.db.getPackageReleaseById(package_release_id)
|
package/package.json
CHANGED
|
@@ -19,11 +19,13 @@ const LinkWithNewTabHandling = ({
|
|
|
19
19
|
shouldOpenInNewTab,
|
|
20
20
|
href,
|
|
21
21
|
className,
|
|
22
|
+
onClick,
|
|
22
23
|
children,
|
|
23
24
|
}: {
|
|
24
25
|
shouldOpenInNewTab: boolean
|
|
25
26
|
href: string
|
|
26
27
|
className?: string
|
|
28
|
+
onClick?: () => void
|
|
27
29
|
children: React.ReactNode
|
|
28
30
|
}) => {
|
|
29
31
|
if (shouldOpenInNewTab) {
|
|
@@ -33,13 +35,14 @@ const LinkWithNewTabHandling = ({
|
|
|
33
35
|
target="_blank"
|
|
34
36
|
rel="noopener noreferrer"
|
|
35
37
|
className={className}
|
|
38
|
+
onClick={onClick}
|
|
36
39
|
>
|
|
37
40
|
{children}
|
|
38
41
|
</a>
|
|
39
42
|
)
|
|
40
43
|
}
|
|
41
44
|
return (
|
|
42
|
-
<PrefetchPageLink className={className} href={href}>
|
|
45
|
+
<PrefetchPageLink onClick={onClick} className={className} href={href}>
|
|
43
46
|
{children}
|
|
44
47
|
</PrefetchPageLink>
|
|
45
48
|
)
|
|
@@ -171,6 +174,9 @@ const SearchComponent: React.FC<SearchComponentProps> = ({
|
|
|
171
174
|
setLocation(href)
|
|
172
175
|
}
|
|
173
176
|
setShowResults(false)
|
|
177
|
+
if (closeOnClick) {
|
|
178
|
+
closeOnClick()
|
|
179
|
+
}
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
}}
|
|
@@ -209,6 +215,10 @@ const SearchComponent: React.FC<SearchComponentProps> = ({
|
|
|
209
215
|
}
|
|
210
216
|
shouldOpenInNewTab={shouldOpenInNewTab}
|
|
211
217
|
className="flex"
|
|
218
|
+
onClick={() => {
|
|
219
|
+
setShowResults(false)
|
|
220
|
+
if (closeOnClick) closeOnClick()
|
|
221
|
+
}}
|
|
212
222
|
>
|
|
213
223
|
<div className="w-12 h-12 overflow-hidden mr-2 flex-shrink-0 rounded-sm bg-gray-50 border flex items-center justify-center">
|
|
214
224
|
<img
|
|
@@ -12,8 +12,8 @@ export const useRequestAiReviewMutation = ({
|
|
|
12
12
|
|
|
13
13
|
return useMutation(
|
|
14
14
|
async ({ package_release_id }: { package_release_id: string }) => {
|
|
15
|
-
await axios.post("/ai_reviews/create",
|
|
16
|
-
|
|
15
|
+
await axios.post("/ai_reviews/create", {
|
|
16
|
+
package_release_id,
|
|
17
17
|
})
|
|
18
18
|
const { data } = await axios.post(
|
|
19
19
|
"/package_releases/get",
|