Skip to content

Commit

Permalink
🔄 synced local 'skyvern-frontend/src/' with remote 'skyvern-frontend/…
Browse files Browse the repository at this point in the history
…src/'

<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Enhance `FormsPage.tsx` with prompt editing and layout fixes, and refine tab management in `WorkflowBlockCollapsibleContent.tsx`.
>
>   - **FormsPage.tsx**:
>     - Added `navigationGoal` to `contactFormTaskSchema` and default values.
>     - Introduced `showAdvancedContent` state to toggle advanced settings visibility.
>     - Removed `ScrollArea` and `ScrollAreaViewport` for layout simplification.
>     - Added prompt editing functionality with a toggle button for advanced settings.
>   - **WorkflowBlockCollapsibleContent.tsx**:
>     - Changed `activeTab` state to use string literals for better clarity.
>     - Added `statusIsFinalized` check to conditionally render tabs.
>     - Improved tab navigation logic for task status handling.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for 8356b511e3332a06fdadbf8d4abba0abb0eff6be. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
wintonzheng committed Dec 6, 2024
1 parent 201065b commit b2a3a96
Showing 1 changed file with 33 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useState } from "react";
import { cn } from "@/util/utils";
import { CodeEditor } from "./components/CodeEditor";
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
import { statusIsFinalized } from "../tasks/types";

type Props = {
task: TaskApiResponse;
Expand All @@ -20,7 +21,9 @@ type Props = {

function WorkflowBlockCollapsibleContent({ task, onNavigate }: Props) {
const [open, setOpen] = useState(false);
const [activeTab, setActiveTab] = useState(0);
const [activeTab, setActiveTab] = useState<"output" | "goal" | "parameters">(
statusIsFinalized(task) ? "output" : "goal",
);

const showExtractedInformation = task?.status === Status.Completed;
const extractedInformation = showExtractedInformation ? (
Expand Down Expand Up @@ -120,32 +123,36 @@ function WorkflowBlockCollapsibleContent({ task, onNavigate }: Props) {
<TableCell colSpan={6} className="border-b">
<div className="space-y-2 px-6">
<div className="flex gap-1">
<div
className={cn(
"cursor-pointer rounded-sm px-3 py-2 text-slate-400 hover:bg-slate-700",
{
"bg-slate-700 text-foreground": activeTab === 0,
},
)}
onClick={() => {
setActiveTab(0);
}}
>
{showExtractedInformation
? "Extracted Information"
: showFailureReason
? "Failure Reason"
: ""}
</div>
{statusIsFinalized(task) && (
<div
className={cn(
"cursor-pointer rounded-sm px-3 py-2 text-slate-400 hover:bg-slate-700",
{
"bg-slate-700 text-foreground":
activeTab === "output",
},
)}
onClick={() => {
setActiveTab("output");
}}
>
{showExtractedInformation
? "Extracted Information"
: showFailureReason
? "Failure Reason"
: ""}
</div>
)}

<div
className={cn(
"cursor-pointer rounded-sm px-3 py-2 text-slate-400 hover:bg-slate-700 hover:text-foreground",
{
"bg-slate-700 text-foreground": activeTab === 1,
"bg-slate-700 text-foreground": activeTab === "goal",
},
)}
onClick={() => {
setActiveTab(1);
setActiveTab("goal");
}}
>
Navigation Goal
Expand All @@ -154,30 +161,31 @@ function WorkflowBlockCollapsibleContent({ task, onNavigate }: Props) {
className={cn(
"cursor-pointer rounded-sm px-3 py-2 text-slate-400 hover:bg-slate-700 hover:text-foreground",
{
"bg-slate-700 text-foreground": activeTab === 2,
"bg-slate-700 text-foreground":
activeTab === "parameters",
},
)}
onClick={() => {
setActiveTab(2);
setActiveTab("parameters");
}}
>
Parameters
</div>
</div>
<div>
{activeTab === 0 &&
{activeTab === "output" &&
(showExtractedInformation
? extractedInformation
: showFailureReason
? failureReason
: null)}
{activeTab === 1 && (
{activeTab === "goal" && (
<AutoResizingTextarea
value={task.request.navigation_goal ?? ""}
readOnly
/>
)}
{activeTab === 2 && (
{activeTab === "parameters" && (
<CodeEditor
language="json"
value={JSON.stringify(
Expand Down

0 comments on commit b2a3a96

Please sign in to comment.