Skip to content

Commit 290665c

Browse files
committed
fixed:bug of stream mesage
1 parent 4ce55a1 commit 290665c

6 files changed

Lines changed: 254 additions & 143 deletions

File tree

package-lock.json

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"react-syntax-highlighter": "^15.6.1",
5959
"reactflow": "^11.11.4",
6060
"sonner": "^2.0.1",
61-
"tailwind-merge": "^2.6.0"
61+
"tailwind-merge": "^2.6.0",
62+
"vaul": "^1.1.2"
6263
},
6364
"devDependencies": {
6465
"@tauri-apps/cli": "^2.0.0",

src/assets/globals.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
--danger: 120 50% 50%;
4343
--info: 25 100% 50%;
4444
}
45-
[data-theme=dark] {
45+
[data-theme="dark"] {
4646
--background: 224 71% 4%;
4747
--foreground: 213 33% 80%;
4848
--muted: 223 47% 11%;
@@ -126,7 +126,7 @@ textarea,
126126
select,
127127
option {
128128
-moz-user-select: none !important;
129-
user-select: none !important;
129+
user-select: none !important;
130130
-webkit-user-select: none !important;
131131
}
132132

@@ -145,4 +145,4 @@ option {
145145

146146
.react-flow__attribution {
147147
display: none !important;
148-
}/*# sourceMappingURL=globals.css.map */
148+
} /*# sourceMappingURL=globals.css.map */

src/components/custom/Header.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
import { cmd } from "@/utils/shell"
2-
import { TbX } from "react-icons/tb"
3-
import { Button } from "../ui/button"
1+
import { cmd } from "@/utils/shell";
2+
import { TbX } from "react-icons/tb";
3+
import { Button } from "../ui/button";
44

5-
export const Header = ({ title, close = () => cmd.close() }: { title: string, close?: () => void }) => {
6-
return (
7-
<div className="flex select-none draggable justify-between items-center p-3" >
8-
<span className="text-xs pl-2 text-muted-foreground">
9-
<img src="/icon.png" className="w-6 h-6" />
10-
</span>
11-
<div className="text-sm pl-3 flex-1 font-medium text-foreground">
12-
{title}
13-
</div>
14-
<Button size="icon" onClick={close} >
15-
<TbX className="w-4 h-4" />
16-
</Button>
17-
18-
</div>
19-
20-
)
21-
}
5+
export const Header = ({
6+
title,
7+
close = () => cmd.close(),
8+
extra,
9+
}: {
10+
title: string;
11+
close?: () => void;
12+
extra?: React.ReactNode;
13+
}) => {
14+
return (
15+
<div className="flex select-none draggable justify-between items-center p-3">
16+
<span className="text-xs pl-2 text-muted-foreground">
17+
<img src="/icon.png" className="w-6 h-6" />
18+
</span>
19+
<div className="text-sm pl-3 flex-1 font-medium text-foreground">
20+
{title}
21+
</div>
22+
<div className="flex items-center gap-2">
23+
{extra}
24+
<Button size="icon" onClick={close}>
25+
<TbX className="w-4 h-4" />
26+
</Button>
27+
</div>
28+
</div>
29+
);
30+
};

src/components/ui/drawer.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"use client";
2+
3+
import { cn } from "@/lib/utils";
4+
import * as React from "react";
5+
import { Drawer as DrawerPrimitive } from "vaul";
6+
7+
export function Drawer({
8+
direction = "right",
9+
open,
10+
onOpenChange,
11+
children,
12+
className,
13+
}: {
14+
direction?: "right" | "left";
15+
open: boolean;
16+
onOpenChange: (open: boolean) => void;
17+
children: React.ReactNode;
18+
className?: string;
19+
}) {
20+
return (
21+
<DrawerPrimitive.Root
22+
direction={direction}
23+
open={open}
24+
onOpenChange={onOpenChange}
25+
>
26+
<DrawerPrimitive.Portal>
27+
<DrawerPrimitive.Overlay className="fixed inset-0 bg-black/40" />
28+
<DrawerPrimitive.Content
29+
className={cn(
30+
"right-2 top-2 bottom-2 fixed z-10 outline-none flex w-[320px]",
31+
className,
32+
)}
33+
// The gap between the edge of the screen and the drawer is 8px in this case.
34+
style={
35+
{ "--initial-transform": "calc(100% + 8px)" } as React.CSSProperties
36+
}
37+
>
38+
<div className="bg-zinc-50 h-full w-full grow p-5 flex flex-col rounded-lg">
39+
{children}
40+
</div>
41+
</DrawerPrimitive.Content>
42+
</DrawerPrimitive.Portal>
43+
</DrawerPrimitive.Root>
44+
);
45+
}

0 commit comments

Comments
 (0)