Fixed visual things at the meeting
This commit is contained in:
parent
886a938b98
commit
521cecf2c1
4 changed files with 102 additions and 18 deletions
35
src/frontend/src/components/ui/badge.tsx
Normal file
35
src/frontend/src/components/ui/badge.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
|
import { cn } from "../../utils";
|
||||||
|
|
||||||
|
const badgeVariants = cva(
|
||||||
|
"inline-flex items-center border rounded-full px-2.5 h-6 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"bg-primary hover:bg-primary/80 border-transparent text-primary-foreground",
|
||||||
|
secondary:
|
||||||
|
"bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground",
|
||||||
|
destructive:
|
||||||
|
"bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground",
|
||||||
|
outline: "text-foreground",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface BadgeProps
|
||||||
|
extends React.HTMLAttributes<HTMLDivElement>,
|
||||||
|
VariantProps<typeof badgeVariants> {}
|
||||||
|
|
||||||
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
||||||
|
return (
|
||||||
|
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Badge, badgeVariants };
|
||||||
|
|
@ -8,7 +8,7 @@ const Card = React.forwardRef<
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
"rounded-lg border bg-card text-card-foreground shadow-sm hover:shadow-lg transition-all",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
@ -22,7 +22,7 @@ const CardHeader = React.forwardRef<
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
className={cn("flex flex-col space-y-1.5 p-4", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
@ -59,7 +59,7 @@ const CardContent = React.forwardRef<
|
||||||
HTMLDivElement,
|
HTMLDivElement,
|
||||||
React.HTMLAttributes<HTMLDivElement>
|
React.HTMLAttributes<HTMLDivElement>
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
<div ref={ref} className={cn("p-4 pt-0", className)} {...props} />
|
||||||
));
|
));
|
||||||
CardContent.displayName = "CardContent";
|
CardContent.displayName = "CardContent";
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ const CardFooter = React.forwardRef<
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(" flex items-center p-6 pt-0", className)}
|
className={cn(" flex items-center p-4 pt-0", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,14 @@ export default function RenameLabel(props) {
|
||||||
? [props.rename, props.setRename]
|
? [props.rename, props.setRename]
|
||||||
: [internalState, setInternalState];
|
: [internalState, setInternalState];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (props.value) setMyValue(props.value);
|
||||||
|
}, [props.value]);
|
||||||
|
|
||||||
const [myValue, setMyValue] = useState(props.value);
|
const [myValue, setMyValue] = useState(props.value);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isRename) {
|
if (isRename) {
|
||||||
|
setMyValue(props.value);
|
||||||
document.addEventListener("keydown", (e) => {
|
document.addEventListener("keydown", (e) => {
|
||||||
if (e.key === "Escape") {
|
if (e.key === "Escape") {
|
||||||
setIsRename(false);
|
setIsRename(false);
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import { PopUpContext } from "../../contexts/popUpContext";
|
||||||
import { typesContext } from "../../contexts/typesContext";
|
import { typesContext } from "../../contexts/typesContext";
|
||||||
import {
|
import {
|
||||||
ArrowDownTrayIcon,
|
ArrowDownTrayIcon,
|
||||||
|
ArrowTopRightOnSquareIcon,
|
||||||
ArrowUpTrayIcon,
|
ArrowUpTrayIcon,
|
||||||
ChevronDownIcon,
|
ChevronDownIcon,
|
||||||
CodeBracketSquareIcon,
|
CodeBracketSquareIcon,
|
||||||
|
|
@ -44,11 +45,15 @@ import { FaGithub } from "react-icons/fa";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
CardFooter,
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "../../components/ui/card";
|
} from "../../components/ui/card";
|
||||||
import RenameLabel from "../../components/ui/rename-label";
|
import RenameLabel from "../../components/ui/rename-label";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { Badge } from "../../components/ui/badge";
|
||||||
|
import { OpenAiIcon } from "../../icons/OpenAi";
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const {
|
const {
|
||||||
|
|
@ -61,6 +66,7 @@ export default function HomePage() {
|
||||||
downloadFlow,
|
downloadFlow,
|
||||||
} = useContext(TabsContext);
|
} = useContext(TabsContext);
|
||||||
const { openPopUp } = useContext(PopUpContext);
|
const { openPopUp } = useContext(PopUpContext);
|
||||||
|
const { updateFlow } = useContext(TabsContext);
|
||||||
const { templates } = useContext(typesContext);
|
const { templates } = useContext(typesContext);
|
||||||
const AlertWidth = 384;
|
const AlertWidth = 384;
|
||||||
const { dark, setDark } = useContext(darkContext);
|
const { dark, setDark } = useContext(darkContext);
|
||||||
|
|
@ -89,7 +95,13 @@ export default function HomePage() {
|
||||||
<TabsTrigger value="myflow" className="flex items-center gap-2">
|
<TabsTrigger value="myflow" className="flex items-center gap-2">
|
||||||
<RenameLabel
|
<RenameLabel
|
||||||
value={flows[tabIndex].name}
|
value={flows[tabIndex].name}
|
||||||
setValue={() => {}}
|
setValue={(value) => {
|
||||||
|
if (value !== "") {
|
||||||
|
let newFlow = _.cloneDeep(flows[tabIndex]);
|
||||||
|
newFlow.name = value;
|
||||||
|
updateFlow(newFlow);
|
||||||
|
}
|
||||||
|
}}
|
||||||
rename={rename}
|
rename={rename}
|
||||||
setRename={setRename}
|
setRename={setRename}
|
||||||
/>
|
/>
|
||||||
|
|
@ -251,28 +263,60 @@ export default function HomePage() {
|
||||||
{flows.map((flow, idx) => (
|
{flows.map((flow, idx) => (
|
||||||
<Card className="group">
|
<Card className="group">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="flex justify-between items-center h-6">
|
<CardTitle className="flex justify-between items-start">
|
||||||
{flow.name}
|
<div className="flex gap-4 items-center">
|
||||||
|
<span
|
||||||
|
className={
|
||||||
|
"rounded-md w-10 h-10 flex items-center justify-center text-2xl " +
|
||||||
|
(idx === 0 ? "bg-blue-100" : " bg-orange-100")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{idx === 0 ? "🤖" : "🛠️"}
|
||||||
|
</span>
|
||||||
|
{flow.name}
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
removeFlow(flow.id);
|
removeFlow(flow.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TrashIcon className="w-5 text-primary hidden group-hover:block " />
|
<TrashIcon className="w-5 text-primary opacity-0 group-hover:opacity-100 transition-all" />
|
||||||
</button>
|
</button>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
|
<CardDescription className="pt-2 pb-8">
|
||||||
|
{/* {flow.description} */}
|
||||||
|
{idx === 0 ? "This is a new agent" : "This is a new tool"}
|
||||||
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|
||||||
<CardFooter>
|
<CardFooter>
|
||||||
<Button
|
<div className="flex gap-2 w-full justify-between items-end">
|
||||||
variant="outline"
|
<div className="flex flex-wrap gap-2">
|
||||||
className=""
|
<Badge variant="secondary">
|
||||||
onClick={() => {
|
{idx === 0 ? "Agent" : "Tool"}
|
||||||
setTabIndex(idx);
|
</Badge>
|
||||||
setActiveTab("myflow");
|
{idx === 0 && (
|
||||||
}}
|
<Badge variant="secondary">
|
||||||
>
|
<div className="w-3">
|
||||||
Open Flow
|
<OpenAiIcon />
|
||||||
</Button>
|
</div>
|
||||||
|
<span className="text-base"> </span>OpenAI+
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
className="whitespace-nowrap opacity-0 group-hover:opacity-100 transition-all"
|
||||||
|
onClick={() => {
|
||||||
|
setTabIndex(idx);
|
||||||
|
setActiveTab("myflow");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowTopRightOnSquareIcon className="w-4 mr-2" />
|
||||||
|
Edit Flow
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue