mirror of
https://github.com/privacy-scaling-explorations/pse.dev.git
synced 2026-01-10 14:48:13 -05:00
feat: minor fixes (#355)
This commit is contained in:
@@ -2,12 +2,26 @@
|
||||
|
||||
import { Search } from "lucide-react"
|
||||
import { Button, ButtonProps } from "@/components/ui/button"
|
||||
import { useEffect, useState } from "react"
|
||||
import { searchConfig } from "@/hooks/useGlobalSearch"
|
||||
|
||||
interface SearchButtonProps extends ButtonProps {
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
const { allIndexes, searchClient } = searchConfig
|
||||
|
||||
export function SearchButton({ onClick, ...props }: SearchButtonProps) {
|
||||
const [disabled, setDisabled] = useState(false)
|
||||
useEffect(() => {
|
||||
if (!searchClient || allIndexes.length === 0) {
|
||||
console.warn(
|
||||
"Algolia credentials (NEXT_PUBLIC_ALGOLIA_APP_ID, NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY) or indexes are not configured. Search will not work."
|
||||
)
|
||||
setDisabled(true)
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="search"
|
||||
@@ -15,6 +29,7 @@ export function SearchButton({ onClick, ...props }: SearchButtonProps) {
|
||||
onClick={onClick}
|
||||
aria-label="Open search"
|
||||
className="w-full text-left justify-start"
|
||||
disabled={disabled}
|
||||
{...props}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -327,10 +327,11 @@ export const SearchModal = ({ open, setOpen }: SearchModalProps) => {
|
||||
value={searchQuery}
|
||||
onChange={handleSearchInputChange}
|
||||
className="w-full p-2 text-black"
|
||||
disabled={directSearchMode}
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<div className="max-h-[60vh] overflow-y-auto mt-4">
|
||||
<div className="max-h-[80vh] lg:max-h-[60vh] overflow-y-auto mt-4">
|
||||
{directSearchMode ? (
|
||||
<DirectSearchResults query={searchQuery} setOpen={setOpen} />
|
||||
) : (
|
||||
|
||||
@@ -32,7 +32,7 @@ export const HomepageHeader = ({ lang }: { lang: any }) => {
|
||||
</div>
|
||||
}
|
||||
actions={
|
||||
<div className="flex flex-col lg:flex-row gap-10">
|
||||
<div className="flex flex-col gap-4 lg:flex-row lg:gap-10">
|
||||
<Link href={"/research"} className="flex items-center gap-2 group">
|
||||
<Button className="w-full sm:w-auto">
|
||||
<div className="flex items-center gap-1">
|
||||
|
||||
Reference in New Issue
Block a user