Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Commit 7946669

Browse files
authored
Merge pull request #164 from openchatai/major/new-dashboard
The new Dashboard
2 parents ad3ca3a + 7cfd586 commit 7946669

File tree

260 files changed

+7114
-13437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+7114
-13437
lines changed

.github/workflows/build-widget.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ jobs:
1414
with:
1515
node-version: 18
1616

17-
- name: install pnpm
18-
run: npm install -g pnpm
19-
2017
- name: Install dependencies
21-
run: cd copilot-widget/ && pnpm install
18+
run: cd copilot-widget/ && npm install
2219

2320
- name: Build copilot-widget
24-
run: cd copilot-widget/ && pnpm build:embed
21+
run: cd copilot-widget/ && npm run build
2522

2623
- name: Upload embed as artifact.
2724
uses: actions/upload-artifact@v3

dashboard/.eslintrc.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
2-
"extends": ["next","next/core-web-vitals"],
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:react/recommended",
5+
"next/core-web-vitals"
6+
],
37
"rules": {
4-
"react/no-unescaped-entities":0
8+
"react/no-unescaped-entities": "off",
9+
"no-unused-vars": "warn"
510
}
611
}

dashboard/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7-
.idea/
7+
88
# testing
99
/coverage
1010

dashboard/.nvmrc

-1
This file was deleted.

dashboard/.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"plugins": [
5+
"prettier-plugin-tailwindcss"
6+
]
7+
}

dashboard/.vscode/launch.json

-35
This file was deleted.

dashboard/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ EXPOSE 8000
4141
ENV PORT 8000
4242
ENV HOSTNAME "0.0.0.0"
4343

44-
CMD ["node", "server.js"]
44+
CMD ["node", "server.js"]

dashboard/README.md

+36-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
1-
# OpenCopilot Dashboard
2-
3-
## project structure
4-
5-
- schemas/
6-
valibot schemas for the api responses, and form validation.(brand new zod alternative few bytes and faster).
7-
8-
- ui/
9-
- components => small piece that renders markup(most are client components).
10-
- partials => large components.
11-
- hooks(custom hooks that can do magic).
12-
- charts (need more work, but we can use it for now).
13-
- providers (context providers).
14-
- utils (helper functions and constants for the ui purpose).
15-
- app/
16-
- pages and layouts [we are using nextjs13 app router]
17-
- Layout Groups.
18-
- (dashboard)
19-
- the dashboard pages
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

dashboard/api/copilots.ts

-91
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { buttonVariants } from "@/components/ui/button";
2+
import { NavLink } from "@/components/ui/NavLink";
3+
import {
4+
Tooltip,
5+
TooltipContent,
6+
TooltipProvider,
7+
TooltipTrigger,
8+
} from "@/components/ui/tooltip";
9+
import { LucideIcon } from "lucide-react";
10+
import React from "react";
11+
12+
export function CopilotLayoutNavLink({
13+
IconComponent,
14+
label,
15+
href,
16+
segment,
17+
}: {
18+
label: React.ReactNode;
19+
IconComponent: LucideIcon;
20+
href: string;
21+
segment?: string;
22+
}) {
23+
return (
24+
<TooltipProvider delayDuration={100}>
25+
<Tooltip>
26+
<TooltipTrigger asChild>
27+
<NavLink
28+
href={href}
29+
segment={segment}
30+
className={buttonVariants({
31+
size: "icon",
32+
variant: "link",
33+
})}
34+
activeClassName="text-primary"
35+
inactiveClassName="hover:text-primary text-accent-foreground/50 hover:bg-accent"
36+
>
37+
<IconComponent className="h-5 w-5" />
38+
</NavLink>
39+
</TooltipTrigger>
40+
<TooltipContent side="right">{label}</TooltipContent>
41+
</Tooltip>
42+
</TooltipProvider>
43+
);
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"use client";
2+
import React from "react";
3+
import {
4+
DropdownMenu,
5+
DropdownMenuContent,
6+
DropdownMenuItem,
7+
DropdownMenuSeparator,
8+
DropdownMenuTrigger,
9+
} from "@/components/ui/dropdown-menu";
10+
import { Button } from "@/components/ui/button";
11+
import { ChevronRight } from "lucide-react";
12+
import Link from "next/link";
13+
import { useSetAtom } from "jotai";
14+
import { searchModalAtom } from "@/app/_store/atoms/searchModal";
15+
export default function LogoMenu() {
16+
const setSearchModal = useSetAtom(searchModalAtom);
17+
return (
18+
<DropdownMenu>
19+
<DropdownMenuTrigger asChild>
20+
<Button
21+
size="icon"
22+
variant="ghost"
23+
className="group relative h-full w-full text-xl text-primary/90"
24+
>
25+
O
26+
<ChevronRight className="absolute bottom-0 right-0 h-4 w-4 rotate-45 fill-current transition-transform group-hover:translate-x-0.5 group-hover:translate-y-0.5" />
27+
</Button>
28+
</DropdownMenuTrigger>
29+
<DropdownMenuContent side="bottom" sideOffset={2} className="ms-5">
30+
<DropdownMenuItem asChild>
31+
<Link href="/">Back to dashboard</Link>
32+
</DropdownMenuItem>
33+
<DropdownMenuSeparator />
34+
<DropdownMenuItem onClick={() => setSearchModal(true)}>
35+
Search
36+
</DropdownMenuItem>
37+
<DropdownMenuItem>Open example Dashboard</DropdownMenuItem>
38+
<DropdownMenuItem asChild>
39+
<Link href={"/create/copilot"}>Create New Copilot</Link>
40+
</DropdownMenuItem>
41+
</DropdownMenuContent>
42+
</DropdownMenu>
43+
);
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { NavLink } from "@/components/ui/NavLink";
2+
import { LucideIcon } from "lucide-react";
3+
import React from "react";
4+
5+
export function SubNavLink({
6+
href,
7+
Icon,
8+
label,
9+
}: {
10+
href: string;
11+
Icon: LucideIcon;
12+
label: React.ReactNode;
13+
}) {
14+
return (
15+
<li className="w-full cursor-pointer select-none ">
16+
<NavLink
17+
href={href}
18+
className="flex items-center rounded-md border px-3 py-2 text-sm text-accent-foreground transition duration-150 ease-in-out"
19+
activeClassName="border-gray-300 bg-accent font-semibold"
20+
inactiveClassName="border-transparent hover:border-gray-300 font-normal opacity-80 hover:bg-accent"
21+
>
22+
<Icon className="mr-2 h-5 w-5" />
23+
{label}
24+
</NavLink>
25+
</li>
26+
);
27+
}
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { HeaderShell } from "@/components/domain/HeaderShell";
2+
import { Button } from "@/components/ui/button";
3+
import { RefreshCcw } from "lucide-react";
4+
import React from "react";
5+
6+
type Props = {
7+
children: React.ReactNode;
8+
params: {
9+
copilot_id: string;
10+
};
11+
};
12+
13+
export default function SettingsLayout({ children, params }: Props) {
14+
const copilotBase = `/copilot/${params.copilot_id}/conversations`;
15+
return (
16+
<div className="flex h-full flex-col overflow-hidden">
17+
<HeaderShell className="justify-between">
18+
<h1 className="text-lg font-bold text-secondary-foreground">
19+
Conversations
20+
</h1>
21+
<Button size="icon" variant="secondary" className="hidden">
22+
<RefreshCcw className="h-6 w-6" />
23+
</Button>
24+
</HeaderShell>
25+
<div className="h-full flex-1 overflow-auto">{children}</div>
26+
</div>
27+
);
28+
}

0 commit comments

Comments
 (0)