"use client";
import { Input } from "@/components/ui/input";
import { useAuthenticatedData } from "../common/auth";
import { useEffect, useRef, useState } from "react";
import SidePanel from "../components/sidePanel/chatHistorySidePanel";
import styles from "./search.module.css";
import { ScrollArea } from "@/components/ui/scroll-area";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
ArrowLeft,
ArrowRight,
FileDashed,
FileMagnifyingGlass,
Folder,
FolderOpen,
GithubLogo,
Lightbulb,
LinkSimple,
MagnifyingGlass,
NoteBlank,
NotionLogo,
} from "@phosphor-icons/react";
import { Button } from "@/components/ui/button";
import Link from "next/link";
interface AdditionalData {
file: string;
source: string;
compiled: string;
heading: string;
}
interface SearchResult {
type: string;
additional: AdditionalData;
entry: string;
score: number;
"corpus-id": string;
}
function getNoteTypeIcon(source: string) {
if (source === "notion") {
return ;
}
if (source === "github") {
return ;
}
return ;
}
const naturalLanguageSearchQueryExamples = [
"What does the paper say about climate change?",
"Making a cappuccino at home",
"Benefits of eating mangoes",
"How to plan a wedding on a budget",
"Appointment with Dr. Makinde on 12th August",
"Class notes lecture 3 on quantum mechanics",
"Painting concepts for acrylics",
"Abstract from the paper attention is all you need",
"Climbing Everest without oxygen",
"Solving a rubik's cube in 30 seconds",
"Facts about the planet Mars",
"How to make a website using React",
"Fish at the bottom of the ocean",
"Fish farming Kenya 2021",
"How to make a cake without an oven",
"Installing a solar panel at home",
];
interface NoteResultProps {
note: SearchResult;
setFocusSearchResult: (note: SearchResult) => void;
}
function Note(props: NoteResultProps) {
const note = props.note;
const isFileNameURL = (note.additional.file || "").startsWith("http");
const fileName = isFileNameURL
? note.additional.heading
: note.additional.file.split("/").pop();
return (
{getNoteTypeIcon(note.additional.source)}
{fileName}