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

Commit

Permalink
Merge pull request #474 from openchatai/falta/clean-ups
Browse files Browse the repository at this point in the history
use local TS version instead of VS code one's
  • Loading branch information
faltawy authored Dec 29, 2023
2 parents e901ed7 + 98fcca9 commit e072f08
Show file tree
Hide file tree
Showing 17 changed files with 84 additions and 76 deletions.
3 changes: 3 additions & 0 deletions dashboard/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
}
2 changes: 1 addition & 1 deletion dashboard/app/(copilot)/_parts/LogoMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "@/components/ui/dropdown-menu";
import { ChevronRight } from "lucide-react";
import { Link } from "@/lib/router-events";
import { useSearchModal } from "@/app/_store/searchModal";
import { useSearchModal } from "@/app/search-modal-atom";

// i'm bad at naming things
export default function LogoMenu() {
Expand Down
3 changes: 1 addition & 2 deletions dashboard/app/(copilot)/_parts/SearchBtn.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client';
import { useSearchModal } from '@/app/_store/searchModal';
import { useSearchModal } from '@/app/search-modal-atom';
import { Button } from '@/components/ui/button';
import { Search } from 'lucide-react'
import React from 'react'


export function SearchBtn() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default function Widget({
"X-Copilot": "copilot"
},
}}
containerProps={{
className: "border rounded-lg overflow-hidden",
}}
>
<CopilotWidget triggerSelector="#triggerSelector" />
</Root>
Expand Down
24 changes: 20 additions & 4 deletions dashboard/app/(copilot)/copilot/[copilot_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Link } from "@/lib/router-events";
import React from "react";
import { useCopilot } from "../_context/CopilotProvider";
import dynamic from "next/dynamic";
import { useSearchModal } from "@/app/_store/searchModal";
import { useSearchModal } from "@/app/search-modal-atom";

const Widget = dynamic(() => import("./CopilotWidget"));

Expand All @@ -38,17 +38,20 @@ function InstallationSection() {
</div>
</AccordionTrigger>
<AccordionContent className="px-8 py-6">
<p className="mb-2 font-medium">
<p className="mb-1 font-medium">
Paste this code snippet before the closing <strong> {`</body>`}</strong> tag on all pages you want the widget to
appear. <a href="https://docs.opencopilot.so/widget/embed">Read more</a>
</p>
<p className="mb-2 font-medium">
<b>Note that: </b> the widget is fluid by default and will take the full width of the container. You can change this by passing a containerProps object to the initAiCoPilot function.
</p>
<CodeBlock
code={`
<script src="${baseUrl}/pilot.js"></script>
<script>
const options = {
apiUrl: "${baseUrl}/backend",
initialMessages: ["How are the things"],
initialMessage: "How are the things",
token: "${CopilotToken}",
triggerSelector: "#triggerSelector",
headers: {
Expand All @@ -58,6 +61,19 @@ function InstallationSection() {
},
user:{
name:"Default User"
},
containerProps:{
style:{
// optional: you can pass any style you want to the container
width: "400px",
height: "500px",
position: "fixed",
bottom: "0",
right: "0",
zIndex: "9999",
},
className:"your class name" // if u are using tailwindcss or any className you can use the class name here
}
}
}
window.addEventListener("DOMContentLoaded", ()=>initAiCoPilot(options));
Expand Down Expand Up @@ -111,7 +127,7 @@ export default function CopilotPage() {
const [, setSearch] = useSearchModal()
return (
<div className="flex h-full w-full flex-col overflow-hidden">
<HeaderShell className="justify-between bg-white">
<HeaderShell className="justify-between">
<h1 className="text-lg font-bold text-accent-foreground">
{CopilotName}
</h1>
Expand Down
6 changes: 3 additions & 3 deletions dashboard/app/(main)/_parts/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function Search() {

return (
<div className="flex items-center justify-between gap-5 py-5">
<div className="flex flex-1 max-w-sm gap-5 items-center">
<Label htmlFor="search-copilots">
<div className="flex-1 max-w-md relative">
<Label htmlFor="search-copilots" className="absolute left-2 top-1/2 -translate-y-1/2">
<SearchIcon className="h-5 w-5 opacity-50" />
</Label>
<DebounceInput
Expand All @@ -53,7 +53,7 @@ export function Search() {
});
}}
id="search-copilots"
className="w-full font-medium rounded-none border-x-0 border-t-0 px-0 border-b shadow-none focus-visible:!ring-transparent"
className="font-medium rounded-none border-x-0 ps-8 border-t-0 border-b shadow-none focus-visible:!ring-transparent"
placeholder="Search Copilots..."
/>
</div>
Expand Down
4 changes: 1 addition & 3 deletions dashboard/app/(main)/_parts/SearchModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"use client";
import * as React from "react";
import {
Bot,
BotIcon,
FileStack,
HelpCircle,
User,
} from "lucide-react";
import {
CommandDialog,
Expand All @@ -22,7 +20,7 @@ import useSwr from "swr";
import { listCopilots } from "@/data/copilot";
import { useRouter } from "next/navigation";
import { Link } from "@/lib/router-events";
import { useSearchModal } from "@/app/_store/searchModal";
import { useSearchModal } from "@/app/search-modal-atom";

export function SearchModal() {
const [open, setOpen] = useSearchModal();
Expand Down
13 changes: 0 additions & 13 deletions dashboard/app/_store/confetti.ts

This file was deleted.

24 changes: 18 additions & 6 deletions dashboard/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

@layer base {
* {
@apply !border-border;
@apply border-border;
}
body {
@apply bg-background text-foreground;
Expand Down Expand Up @@ -135,10 +135,22 @@
color: hsl(var(--destructive));
margin-left: 0.25rem;
}
#opencopilot-aicopilot {
position: static !important;
}

.reset-input {
@apply m-0 h-10 rounded-md border border-border bg-background bg-white px-3 py-2 text-sm shadow-sm ring-offset-accent transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus:outline-none focus-visible:border-primary focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[valid=false]:!border-destructive;
}
}

.glass {
position: relative;
overflow: hidden;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(5px);
}
.glass::after {
content: "";
position: absolute;
inset: 0;
z-index: -1;
background: inherit;
color: transparent;
backdrop-filter: inherit;
}
8 changes: 1 addition & 7 deletions dashboard/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ import { SWRProvider } from "./swr-provider";
import { Toaster } from "@/components/ui/toaster";
import { HandleOnComplete } from "@/lib/router-events";
import { TopLoader } from "@/lib/Toploader";
import dynamic from "next/dynamic";
import { JotaiProvider } from "./jotai-provider";

const Confetti = dynamic(() => import("@/components/domain/confetti-canvas"), {
ssr: false,
});

const opensans = Open_Sans({
subsets: ["latin"],
weight: ["400", "500", "600", "700", "800"],
Expand All @@ -39,7 +34,7 @@ export default function RootLayout({
<body
className={cn(
opensans.className,
"h-screen min-h-[100svh] max-h-[100svh] w-screen overflow-hidden scroll-smooth bg-background text-accent-foreground antialiased",
"h-svh min-h-svh max-h-svh w-svw overflow-hidden scroll-smooth bg-background text-accent-foreground antialiased",
IS_DEV && "debug-screens",
)}
>
Expand All @@ -64,7 +59,6 @@ export default function RootLayout({
<TopLoader
color="hsl(var(--primary))"
/>
<Confetti />
<HandleOnComplete />
</body>
</html>
Expand Down
32 changes: 32 additions & 0 deletions dashboard/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';
import { Button } from "@/components/ui/button"
import Image from "next/image"
import { useRouter } from "next/navigation"

export const metadata = {
title: "404",
description: "Page not found",
keywords: "404, page not found, not found",
robots: "noindex, nofollow",
}

export default function NotFoundPage() {
const router = useRouter()
return (
<div className="w-full h-full flex-center">
<div className="flex flex-col items-center gap-2 justify-center">
<div className="aspect-square relative w-56 mx-auto">
<Image
src='/404.gif'
alt="404"
fill
/>
</div>
<h1 className="text-5xl font-bold">404</h1>
<Button onClick={router.back}>
Go back
</Button>
</div>
</div>
)
}
File renamed without changes.
2 changes: 1 addition & 1 deletion dashboard/components/domain/HeaderShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function HeaderShell({
return (
<header
className={cn(
"flex h-header w-full shrink-0 flex-row items-center border-b border-border px-8 bg-white",
"flex h-header w-full shrink-0 flex-row items-center border-b border-border px-8 bg-white glass",
className,
)}
{...props}
Expand Down
18 changes: 0 additions & 18 deletions dashboard/components/domain/confetti-canvas.tsx

This file was deleted.

1 change: 0 additions & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"nprogress": "^0.2.0",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-confetti": "^6.1.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-error-boundary": "^4.0.11",
Expand Down
17 changes: 0 additions & 17 deletions dashboard/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added dashboard/public/404.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e072f08

Please sign in to comment.