Fix styling issues in various components

This commit is contained in:
n4ze3m 2024-03-10 12:52:53 +05:30
parent b7e940d57d
commit 00bd19374a
7 changed files with 26 additions and 40 deletions

View File

@ -70,7 +70,7 @@ export default function OptionLayout({
<div> <div>
<div> <div>
<div className="flex flex-col"> <div className="flex flex-col">
<div className="sticky top-0 z-[999] flex h-16 p-3 bg-white border-b border-gray-200 dark:bg-[#171717] dark:border-gray-600"> <div className="sticky top-0 z-[999] flex h-16 p-3 bg-white border-b dark:bg-[#171717] dark:border-gray-600">
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
{pathname !== "/" && ( {pathname !== "/" && (
<div> <div>
@ -91,7 +91,7 @@ export default function OptionLayout({
<div> <div>
<button <button
onClick={clearChat} onClick={clearChat}
className="inline-flex items-center rounded-lg border dark:border-gray-700 bg-transparent px-3 py-3 text-sm font-medium leading-4 text-gray-800 shadow-sm dark:text-white disabled:opacity-50 "> className="inline-flex items-center rounded-lg border dark:border-gray-700 bg-transparent px-3 py-3 text-sm font-medium leading-4 text-gray-800 dark:text-white disabled:opacity-50 ">
<SquarePen className="h-4 w-4 mr-3" /> <SquarePen className="h-4 w-4 mr-3" />
New Chat New Chat
</button> </button>
@ -161,13 +161,6 @@ export default function OptionLayout({
{pathname === "/" && messages.length > 0 && !streaming && ( {pathname === "/" && messages.length > 0 && !streaming && (
<ShareBtn messages={messages} /> <ShareBtn messages={messages} />
)} )}
{/* <Tooltip title="Manage Prompts">
<NavLink
to="/prompts"
className="!text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
<Book className="w-6 h-6" />
</NavLink>
</Tooltip> */}
<Tooltip title="Github Repository"> <Tooltip title="Github Repository">
<a <a
href="https://github.com/n4ze3m/page-assist" href="https://github.com/n4ze3m/page-assist"
@ -176,13 +169,6 @@ export default function OptionLayout({
<GithubIcon className="w-6 h-6" /> <GithubIcon className="w-6 h-6" />
</a> </a>
</Tooltip> </Tooltip>
{/* <Tooltip title="Manage Ollama Models">
<NavLink
to="/models"
className="!text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
<BrainCircuit className="w-6 h-6" />
</NavLink>
</Tooltip> */}
<Tooltip title="Manage Ollama Models"> <Tooltip title="Manage Ollama Models">
<NavLink <NavLink
to="/settings" to="/settings"
@ -204,7 +190,9 @@ export default function OptionLayout({
closeIcon={null} closeIcon={null}
onClose={() => setSidebarOpen(false)} onClose={() => setSidebarOpen(false)}
open={sidebarOpen}> open={sidebarOpen}>
<Sidebar /> <Sidebar
onClose={() => setSidebarOpen(false)}
/>
</Drawer> </Drawer>
</div> </div>
) )

View File

@ -23,15 +23,15 @@ const LinkComponent = (item: {
to={item.href} to={item.href}
className={classNames( className={classNames(
item.current === item.href item.current === item.href
? "bg-gray-100 text-indigo-600 dark:bg-[#262626] dark:text-white" ? "bg-gray-100 text-gray-600 dark:bg-[#262626] dark:text-white"
: "text-gray-700 hover:text-indigo-600 hover:bg-gray-100 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]", : "text-gray-700 hover:text-gray-600 hover:bg-gray-100 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
"group flex gap-x-3 rounded-md py-2 pl-2 pr-3 text-sm leading-6 font-semibold" "group flex gap-x-3 rounded-md py-2 pl-2 pr-3 text-sm leading-6 font-semibold"
)}> )}>
<item.icon <item.icon
className={classNames( className={classNames(
item.current === item.href item.current === item.href
? "text-indigo-600 dark:text-white" ? "text-gray-600 dark:text-white"
: "text-gray-400 group-hover:text-indigo-600 dark:text-gray-200 dark:group-hover:text-white", : "text-gray-400 group-hover:text-gray-600 dark:text-gray-200 dark:group-hover:text-white",
"h-6 w-6 shrink-0" "h-6 w-6 shrink-0"
)} )}
aria-hidden="true" aria-hidden="true"

View File

@ -35,7 +35,7 @@ export const PlaygroundEmpty = () => {
return ( return (
<div className="mx-auto sm:max-w-xl px-4 mt-10"> <div className="mx-auto sm:max-w-xl px-4 mt-10">
<div className="rounded-lg justify-center items-center flex flex-col border p-8 bg-white dark:bg-[#262626] shadow-sm dark:border-gray-600"> <div className="rounded-lg justify-center items-center flex flex-col border p-8 bg-white dark:bg-[#262626] dark:border-gray-600">
{(ollamaStatus === "pending" || isRefetching) && ( {(ollamaStatus === "pending" || isRefetching) && (
<div className="inline-flex items-center space-x-2"> <div className="inline-flex items-center space-x-2">
<div className="w-3 h-3 bg-blue-500 rounded-full animate-bounce"></div> <div className="w-3 h-3 bg-blue-500 rounded-full animate-bounce"></div>

View File

@ -154,7 +154,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => {
} }
} }
return ( return (
<div className="px-3 pt-3 md:px-6 md:pt-6 md:bg-white dark:bg-[#262626] border rounded-t-xl border-black/10 dark:border-gray-600"> <div className="px-3 pt-3 md:px-6 md:pt-6 md:bg-white dark:bg-[#262626] border rounded-t-xl dark:border-gray-600">
<div <div
className={`h-full rounded-md shadow relative ${ className={`h-full rounded-md shadow relative ${
form.values.image.length === 0 ? "hidden" : "block" form.values.image.length === 0 ? "hidden" : "block"

View File

@ -24,7 +24,7 @@ export const SettingOther = () => {
<div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div> <div className="border border-b border-gray-200 dark:border-gray-600 mt-3"></div>
</div> </div>
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-gray-400 text-lg"> <span className="text-gray-500 dark:text-neutral-50">
Speech Recognition Language Speech Recognition Language
</span> </span>
@ -44,9 +44,7 @@ export const SettingOther = () => {
/> />
</div> </div>
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-gray-400 text-lg"> <span className="text-gray-500 dark:text-neutral-50 ">Change Theme</span>
Change Theme
</span>
<button <button
onClick={toggleDarkMode} onClick={toggleDarkMode}
@ -59,8 +57,9 @@ export const SettingOther = () => {
{mode === "dark" ? "Light" : "Dark"} {mode === "dark" ? "Light" : "Dark"}
</button> </button>
</div> </div>
<SearchModeSettings />
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-gray-400 text-lg"> <span className="text-gray-500 dark:text-neutral-50 ">
Delete Chat History Delete Chat History
</span> </span>
@ -83,7 +82,6 @@ export const SettingOther = () => {
Delete Delete
</button> </button>
</div> </div>
<SearchModeSettings />
</dl> </dl>
) )
} }

View File

@ -19,7 +19,7 @@ export const SearchModeSettings = () => {
return ( return (
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
<span className="text-gray-500 dark:text-gray-400 text-lg"> <span className="text-gray-500 dark:text-neutral-50 ">
Perform Simple Internet Search Perform Simple Internet Search
</span> </span>

View File

@ -10,14 +10,17 @@ import { Empty, Skeleton } from "antd"
import { useMessageOption } from "~hooks/useMessageOption" import { useMessageOption } from "~hooks/useMessageOption"
import { useState } from "react" import { useState } from "react"
import { PencilIcon, Trash2 } from "lucide-react" import { PencilIcon, Trash2 } from "lucide-react"
import { useNavigate } from "react-router-dom"
type Props = {} type Props = {
onClose: () => void
}
export const Sidebar = ({}: Props) => { export const Sidebar = ({ onClose }: Props) => {
const { setMessages, setHistory, setHistoryId, historyId, clearChat } = const { setMessages, setHistory, setHistoryId, historyId, clearChat } =
useMessageOption() useMessageOption()
const [processingId, setProcessingId] = useState<string>("")
const client = useQueryClient() const client = useQueryClient()
const navigate = useNavigate()
const { data: chatHistories, status } = useQuery({ const { data: chatHistories, status } = useQuery({
queryKey: ["fetchChatHistory"], queryKey: ["fetchChatHistory"],
@ -28,21 +31,20 @@ export const Sidebar = ({}: Props) => {
} }
}) })
const { isPending: isDeleting, mutate: deleteHistory } = useMutation({ const { mutate: deleteHistory } = useMutation({
mutationKey: ["deleteHistory"], mutationKey: ["deleteHistory"],
mutationFn: deleteByHistoryId, mutationFn: deleteByHistoryId,
onSuccess: (history_id) => { onSuccess: (history_id) => {
client.invalidateQueries({ client.invalidateQueries({
queryKey: ["fetchChatHistory"] queryKey: ["fetchChatHistory"]
}) })
setProcessingId("")
if (historyId === history_id) { if (historyId === history_id) {
clearChat() clearChat()
} }
} }
}) })
const { isPending: isEditing, mutate: editHistory } = useMutation({ const { mutate: editHistory } = useMutation({
mutationKey: ["editHistory"], mutationKey: ["editHistory"],
mutationFn: async (data: { id: string; title: string }) => { mutationFn: async (data: { id: string; title: string }) => {
return await updateHistory(data.id, data.title) return await updateHistory(data.id, data.title)
@ -51,7 +53,6 @@ export const Sidebar = ({}: Props) => {
client.invalidateQueries({ client.invalidateQueries({
queryKey: ["fetchChatHistory"] queryKey: ["fetchChatHistory"]
}) })
setProcessingId("")
} }
}) })
@ -86,6 +87,8 @@ export const Sidebar = ({}: Props) => {
setHistoryId(chat.id) setHistoryId(chat.id)
setHistory(formatToChatHistory(history)) setHistory(formatToChatHistory(history))
setMessages(formatToMessage(history)) setMessages(formatToMessage(history))
navigate("/")
onClose()
}}> }}>
<span className="flex-grow truncate">{chat.title}</span> <span className="flex-grow truncate">{chat.title}</span>
</button> </button>
@ -97,8 +100,6 @@ export const Sidebar = ({}: Props) => {
if (newTitle) { if (newTitle) {
editHistory({ id: chat.id, title: newTitle }) editHistory({ id: chat.id, title: newTitle })
} }
setProcessingId(chat.id)
}} }}
className="text-gray-500 dark:text-gray-400 opacity-80"> className="text-gray-500 dark:text-gray-400 opacity-80">
<PencilIcon className="w-4 h-4" /> <PencilIcon className="w-4 h-4" />
@ -111,7 +112,6 @@ export const Sidebar = ({}: Props) => {
) )
return return
deleteHistory(chat.id) deleteHistory(chat.id)
setProcessingId(chat.id)
}} }}
className="text-red-500 dark:text-red-400 opacity-80"> className="text-red-500 dark:text-red-400 opacity-80">
<Trash2 className=" w-4 h-4 " /> <Trash2 className=" w-4 h-4 " />