Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings and accordion update #217

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions skyvern-frontend/src/components/ui/accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { ChevronDownIcon } from "@radix-ui/react-icons";
import { ChevronRightIcon } from "@radix-ui/react-icons";

import { cn } from "@/util/utils";

Expand All @@ -26,13 +26,13 @@ const AccordionTrigger = React.forwardRef<
<AccordionPrimitive.Trigger
ref={ref}
className={cn(
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
"flex flex-1 items-center gap-2 py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-90",
className,
)}
{...props}
>
<ChevronRightIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
{children}
<ChevronDownIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
));
Expand Down
44 changes: 44 additions & 0 deletions skyvern-frontend/src/components/ui/hidden-copyable-input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useState } from "react";
import { Button } from "./button";
import { Input } from "./input";
import { CheckIcon, CopyIcon } from "@radix-ui/react-icons";

type Props = {
value: string;
};

function HiddenCopyableInput({ value }: Props) {
const [hidden, setHidden] = useState(true);
const [copied, setCopied] = useState(false);

const buttonText = hidden ? "Reveal" : copied ? "Copied" : "Copy";
const inputValue = hidden ? "**** **** **** ****" : value;

return (
<div className="relative w-full">
<Input value={inputValue} className="h-10" readOnly />
<div className="absolute flex inset-y-0 items-center right-1">
<Button
size="sm"
variant="secondary"
className="cursor-pointer"
onClick={async () => {
if (hidden) {
setHidden(false);
return;
}
await navigator.clipboard.writeText(value);
setCopied(true);
setTimeout(() => setCopied(false), 3000);
}}
>
{!hidden && !copied && <CopyIcon className="mr-2 h-4 w-4" />}
{!hidden && copied && <CheckIcon className="mr-2 h-4 w-4" />}
{buttonText}
</Button>
</div>
</div>
);
}

export { HiddenCopyableInput };
2 changes: 1 addition & 1 deletion skyvern-frontend/src/routes/root/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function RootLayout({ onLogout }: Props) {
return (
<>
<div className="w-full h-full px-4">
<aside className="fixed w-72 px-6 shrink-0 min-h-screen">
<aside className="fixed w-72 px-6 shrink-0 min-h-screen border-r-2">
<Link
to="https://skyvern.com"
target="_blank"
Expand Down
Loading