Skip to content

Commit 6277ba0

Browse files
authored
Merge branch 'staging' into danshalev7-patch-1
2 parents 750f2fd + 5bf503e commit 6277ba0

32 files changed

Lines changed: 3210 additions & 2772 deletions

.github/workflows/playwright.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@ jobs:
3333
npm install
3434
npm run build
3535
NEXTAUTH_SECRET=SECRET npm start & npx playwright test --reporter=dot,list
36+
- name: Ensure required directories exist
37+
run: |
38+
mkdir -p playwright-report
39+
mkdir -p playwright-report/artifacts
3640
- uses: actions/upload-artifact@v4
37-
if: ${{ !cancelled() }}
41+
if: always()
3842
with:
3943
name: playwright-report
4044
path: playwright-report/
4145
retention-days: 30
46+
- name: Upload failed test screenshots
47+
if: always()
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: failed-test-screenshots
51+
path: playwright-report/artifacts/
52+
retention-days: 30

app/components/Input.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { toast } from "@/components/ui/use-toast"
22
import { getCategoryColorName, getCategoryColorValue, Graph } from "./model"
33
import { useEffect, useRef, useState } from "react"
4-
import { PathNode } from "../page"
4+
import { PathNode } from "@/lib/utils"
55
import { cn } from "@/lib/utils"
66
import { prepareArg } from "../utils"
77

88
interface Props extends React.InputHTMLAttributes<HTMLInputElement> {
9-
value?: string
109
graph: Graph
1110
onValueChange: (node: PathNode) => void
1211
handleSubmit?: (node: any) => void
@@ -16,7 +15,7 @@ interface Props extends React.InputHTMLAttributes<HTMLInputElement> {
1615
scrollToBottom?: () => void
1716
}
1817

19-
export default function Input({ value, onValueChange, handleSubmit, graph, icon, node, className, parentClassName, scrollToBottom, ...props }: Props) {
18+
export default function Input({ onValueChange, handleSubmit, graph, icon, node, className, parentClassName, scrollToBottom, ...props }: Props) {
2019

2120
const [open, setOpen] = useState(false)
2221
const [options, setOptions] = useState<any[]>([])
@@ -38,15 +37,13 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
3837
let isLastRequest = true
3938
const timeout = setTimeout(async () => {
4039

41-
if (!value || node?.id) {
42-
if (!value) {
43-
setOptions([])
44-
}
40+
if (!node?.name) {
41+
setOptions([])
4542
setOpen(false)
4643
return
4744
}
4845

49-
const result = await fetch(`/api/repo/${prepareArg(graph.Id)}/?prefix=${prepareArg(value)}`, {
46+
const result = await fetch(`/api/repo/${prepareArg(graph.Id)}/?prefix=${prepareArg(node?.name)}`, {
5047
method: 'POST'
5148
})
5249

@@ -66,7 +63,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
6663

6764
setOptions(completions || [])
6865

69-
if (completions?.length > 0) {
66+
if (completions?.length > 0 && !node?.id) {
7067
setOpen(true)
7168
} else {
7269
setOpen(false)
@@ -77,7 +74,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
7774
clearTimeout(timeout)
7875
isLastRequest = false
7976
}
80-
}, [value, graph.Id])
77+
}, [node?.name, graph.Id])
8178

8279
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
8380
const container = containerRef.current
@@ -87,6 +84,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
8784
const option = options.find((o, i) => i === selectedOption)
8885
if (!option) return
8986
if (handleSubmit) {
87+
onValueChange({ name: option.properties.name, id: option.id })
9088
handleSubmit(option)
9189
} else {
9290
if (!open) return
@@ -133,7 +131,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
133131

134132
return (
135133
<div
136-
className={cn("w-[20dvw] relative pointer-events-none rounded-md gap-4", parentClassName)}
134+
className={cn("w-full md:w-[20dvw] relative pointer-events-none rounded-md gap-4", parentClassName)}
137135
data-name='search-bar'
138136
>
139137
<input
@@ -144,7 +142,8 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
144142
}}
145143
onKeyDown={handleKeyDown}
146144
className={cn("w-full border p-2 rounded-md pointer-events-auto", className)}
147-
value={value || ""}
145+
placeholder="Search for nodes in the graph"
146+
value={node?.name || ""}
148147
onChange={(e) => {
149148
const newVal = e.target.value
150149
const invalidChars = /[%*()\-\[\]{};:"|~]/;
@@ -168,7 +167,7 @@ export default function Input({ value, onValueChange, handleSubmit, graph, icon,
168167
open &&
169168
<div
170169
ref={containerRef}
171-
className="z-10 w-full bg-white absolute flex flex-col pointer-events-auto border rounded-md max-h-[50dvh] overflow-y-auto overflow-x-hidden p-2 gap-2"
170+
className="z-10 w-full bg-white absolute flex flex-col pointer-events-auto border rounded-md md:max-h-[50dvh] h-[25dvh] overflow-y-auto overflow-x-hidden p-2 gap-2"
172171
data-name='search-bar-list'
173172
style={{
174173
top: inputHeight + 16

0 commit comments

Comments
 (0)