Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

Add feedback to mobile and upgrade shadcn-ui (#30)

Marc Klingen33e11fa3436c
diff --git a/components.json b/components.json
new file mode 100644
index 0000000000..a9772f779f
--- /dev/null
+++ b/components.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://ui.shadcn.com/schema.json",
+ "style": "default",
+ "rsc": true,
+ "tailwind": {
+ "config": "tailwind.config.ts",
+ "css": "src/styles/globals.css",
+ "baseColor": "slate",
+ "cssVariables": true
+ },
+ "aliases": {
+ "components": "@/src/components",
+ "utils": "@/src/utils/tailwind"
+ }
+}
diff --git a/src/components/layouts/layout.tsx b/src/components/layouts/layout.tsx
index dd7a5337fb..918c0c910d 100644
--- a/src/components/layouts/layout.tsx
+++ b/src/components/layouts/layout.tsx
@@ -24,6 +24,7 @@ import {
import { api } from "@/src/utils/api";
import { NewProjectButton } from "@/src/features/projects/components/NewProjectButton";
import { FeedbackButtonWrapper } from "@/src/features/feedback/component/FeedbackButton";
+import { Button } from "@/src/components/ui/button";
const userNavigation = [
{
@@ -210,6 +211,15 @@ export default function Layout(props: PropsWithChildren) {
</Link>
</li>
))}
+ <FeedbackButtonWrapper className="w-full">
+ <li className="group flex gap-x-3 rounded-md p-2 text-sm font-semibold leading-6 text-gray-700 hover:bg-gray-50 hover:text-indigo-600">
+ <MessageSquarePlus
+ className="h-6 w-6 shrink-0 text-gray-400 group-hover:text-indigo-600"
+ aria-hidden="true"
+ />
+ Feedback
+ </li>
+ </FeedbackButtonWrapper>
</ul>
</li>
<li>
@@ -413,6 +423,15 @@ export default function Layout(props: PropsWithChildren) {
<div className="flex-1 font-mono text-sm font-bold leading-6 text-gray-900">
🪢 langfuse
</div>
+ <FeedbackButtonWrapper>
+ <Button variant="outline" color="gray" size="sm">
+ <MessageSquarePlus
+ className="mr-2 h-4 w-4 shrink-0 text-primary"
+ aria-hidden="true"
+ />
+ <span>Feedback</span>
+ </Button>
+ </FeedbackButtonWrapper>
<Menu as="div" className="relative">
<Menu.Button className="flex items-center gap-x-4 text-sm font-semibold leading-6 text-gray-900">
<span className="sr-only">Open user menu</span>
diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx
new file mode 100644
index 0000000000..da18ed18c1
--- /dev/null
+++ b/src/components/ui/textarea.tsx
@@ -0,0 +1,25 @@
+import * as React from "react";
+
+import { cn } from "@/src/utils/tailwind";
+
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
+export interface TextareaProps
+ extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
+
+const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
+ ({ className, ...props }, ref) => {
+ return (
+ <textarea
+ className={cn(
+ "flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ ref={ref}
+ {...props}
+ />
+ );
+ }
+);
+Textarea.displayName = "Textarea";
+
+export { Textarea };
diff --git a/src/features/feedback/component/FeedbackButton.tsx b/src/features/feedback/component/FeedbackButton.tsx
index bc2fffaefc..8bb87651c3 100644
--- a/src/features/feedback/component/FeedbackButton.tsx
+++ b/src/features/feedback/component/FeedbackButton.tsx
@@ -18,16 +18,16 @@ import {
FormItem,
FormMessage,
} from "@/src/components/ui/form";
-import { Input } from "@/src/components/ui/input";
import { type PropsWithChildren, useState } from "react";
import { useSession } from "next-auth/react";
+import { Textarea } from "@/src/components/ui/textarea";
const formSchema = z.object({
feedback: z.string().min(3, "Must have at least 3 characters"),
});
export function FeedbackButtonWrapper(
- props: PropsWithChildren<{ className: string }>
+ props: PropsWithChildren<{ className?: string }>
) {
const [open, setOpen] = useState(false);
const session = useSession();
@@ -106,7 +106,7 @@ export function FeedbackButtonWrapper(
What do you think about this project? What can be improved?
</FormDescription>
<FormControl>
- <Input {...field} />
+ <Textarea {...field} />
</FormControl>
<FormMessage />
</FormItem>
diff --git a/src/styles/globals.css b/src/styles/globals.css
index c3df8d509c..a615d8d14f 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -5,16 +5,16 @@
@layer base {
:root {
--background: 0 0% 100%;
- --foreground: 222.2 47.4% 11.2%;
+ --foreground: 222.2 84% 4.9%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--popover: 0 0% 100%;
- --popover-foreground: 222.2 47.4% 11.2%;
+ --popover-foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
- --card-foreground: 222.2 47.4% 11.2%;
+ --card-foreground: 222.2 84% 4.9%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
@@ -26,9 +26,9 @@
--secondary-foreground: 222.2 47.4% 11.2%;
--accent: 210 40% 96.1%;
- --accent-foreground: 222.2 47.4% 11.2%;
+ --accent-foreground: ;
- --destructive: 0 100% 50%;
+ --destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--ring: 215 20.2% 65.1%;
@@ -37,36 +37,34 @@
}
.dark {
- --background: 224 71% 4%;
- --foreground: 213 31% 91%;
+ --background: 222.2 84% 4.9%;
+ --foreground: 210 40% 98%;
- --muted: 223 47% 11%;
- --muted-foreground: 215.4 16.3% 56.9%;
+ --muted: 217.2 32.6% 17.5%;
+ --muted-foreground: 215 20.2% 65.1%;
- --popover: 224 71% 4%;
- --popover-foreground: 215 20.2% 65.1%;
+ --popover: 222.2 84% 4.9%;
+ --popover-foreground: 210 40% 98%;
- --card: 224 71% 4%;
- --card-foreground: 213 31% 91%;
+ --card: 222.2 84% 4.9%;
+ --card-foreground: 210 40% 98%;
- --border: 216 34% 17%;
- --input: 216 34% 17%;
+ --border: 217.2 32.6% 17.5%;
+ --input: 217.2 32.6% 17.5%;
--primary: 210 40% 98%;
- --primary-foreground: 222.2 47.4% 1.2%;
+ --primary-foreground: 222.2 47.4% 11.2%;
- --secondary: 222.2 47.4% 11.2%;
+ --secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
- --accent: 216 34% 17%;
- --accent-foreground: 210 40% 98%;
+ --accent: 217.2 32.6% 17.5%;
+ --accent-foreground: ;
- --destructive: 0 63% 31%;
- --destructive-foreground: 210 40% 98%;
-
- --ring: 216 34% 17%;
+ --destructive: 0 62.8% 30.6%;
+ --destructive-foreground: 0 85.7% 97.3%;
- --radius: 0.5rem;
+ --ring: 217.2 32.6% 17.5%;
}
}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index c32e2ae205..4a5f931dc7 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,13 +1,13 @@
-import { type Config } from "tailwindcss";
-// import { fontFamily } from "tailwindcss/defaultTheme";
-
-// Based on: https://ui.shadcn.com/docs/installation#configure-tailwindconfigjs
-export default {
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ darkMode: ["class"],
content: [
+ "./pages/**/*.{ts,tsx,jsx,tsx}",
+ "./components/**/*.{ts,tsx,jsx,tsx}",
+ "./app/**/*.{ts,tsx,jsx,tsx}",
"./src/**/*.{js,ts,jsx,tsx}",
- "./node_modules/@tremor/**/*.{js,ts,jsx,tsx}", // Tremor module
+ "./node_modules/@tremor/**/*.{js,ts,jsx,tsx}",
],
- darkMode: ["class"],
theme: {
container: {
center: true,
@@ -129,8 +129,8 @@ export default {
"tremor-small": "0.375rem",
"tremor-default": "0.5rem",
"tremor-full": "9999px",
- lg: `var(--radius)`,
- md: `calc(var(--radius) - 2px)`,
+ lg: "var(--radius)",
+ md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
fontSize: {
@@ -139,17 +139,14 @@ export default {
"tremor-title": ["1.125rem", { lineHeight: "1.75rem" }],
"tremor-metric": ["1.875rem", { lineHeight: "2.25rem" }],
},
- // fontFamily: {
- // sans: ["var(--font-sans)", ...fontFamily.sans],
- // },
keyframes: {
"accordion-down": {
- from: { height: "0" },
+ from: { height: 0 },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
- to: { height: "0" },
+ to: { height: 0 },
},
},
animation: {
@@ -187,9 +184,5 @@ export default {
/^(fill-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
},
],
- plugins: [
- require("@tailwindcss/forms"),
- require("tailwindcss-animate"),
- require("@tailwindcss/line-clamp"),
- ],
-} satisfies Config;
+ plugins: [require("@tailwindcss/forms"), require("tailwindcss-animate")],
+};