-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat Skip upscaling by probe input (#64)
* Skip upscaling by probe input * Added log expand or collapse
- Loading branch information
Showing
10 changed files
with
130 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const SKIP_JOB = "skipped"; | ||
|
||
export type SkippableJobResult<T> = typeof SKIP_JOB | T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useEffect, useLayoutEffect, useRef, useState } from "react"; | ||
import { cn } from "@/lib/utils"; | ||
import ArrowDownFromLine from "lucide-react/icons/arrow-down-from-line"; | ||
import ArrowUpFromLine from "lucide-react/icons/arrow-up-from-line"; | ||
|
||
type JobLogProps = { | ||
value: string; | ||
index: number; | ||
}; | ||
|
||
export function JobLog({ value, index }: JobLogProps) { | ||
const ref = useRef<HTMLDivElement>(null); | ||
const [showMore, setShowMore] = useState(false); | ||
const [expanded, setExpanded] = useState(false); | ||
|
||
useLayoutEffect(() => { | ||
const onResize = () => { | ||
if (!ref.current) { | ||
return; | ||
} | ||
setShowMore(ref.current.clientHeight < ref.current.scrollHeight); | ||
}; | ||
window.addEventListener("resize", onResize); | ||
onResize(); | ||
return () => { | ||
window.removeEventListener("resize", onResize); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div className="border border-border rounded-md p-2 break-all flex"> | ||
<div className="mr-2 font-medium">{index + 1}</div> | ||
<div> | ||
<div | ||
ref={ref} | ||
className={cn("overflow-hidden", !expanded && "max-h-12")} | ||
> | ||
{value} | ||
</div> | ||
{showMore ? ( | ||
<button | ||
className="text-xs font-medium" | ||
onClick={() => { | ||
setExpanded((v) => !v); | ||
}} | ||
> | ||
{expanded ? "collapse" : "expand"} | ||
</button> | ||
) : null} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters