|
|
@@ -17,6 +17,11 @@ import {
|
|
|
CommandItem,
|
|
|
CommandList,
|
|
|
} from "@/components/ui/command";
|
|
|
+import {
|
|
|
+ Tooltip,
|
|
|
+ TooltipContent,
|
|
|
+ TooltipTrigger,
|
|
|
+} from "@/components/ui/tooltip";
|
|
|
|
|
|
function toBranchShort(value) {
|
|
|
const normalized = String(value || "").trim().toUpperCase();
|
|
|
@@ -92,13 +97,10 @@ export default function SearchQueryBox({
|
|
|
setOpen(false);
|
|
|
}, [hasHistory]);
|
|
|
|
|
|
- const handleInputFocus = React.useCallback(() => {
|
|
|
- const trimmedDraft = typeof qDraft === "string" ? qDraft.trim() : "";
|
|
|
- if (trimmedDraft) return;
|
|
|
- if (!hasHistory) return;
|
|
|
-
|
|
|
- setOpen(true);
|
|
|
- }, [qDraft, hasHistory]);
|
|
|
+ React.useEffect(() => {
|
|
|
+ if (!isSubmitting) return;
|
|
|
+ setOpen(false);
|
|
|
+ }, [isSubmitting]);
|
|
|
|
|
|
return (
|
|
|
// Important for flex layouts:
|
|
|
@@ -114,26 +116,30 @@ export default function SearchQueryBox({
|
|
|
name="q"
|
|
|
value={qDraft}
|
|
|
onChange={(e) => onQDraftChange(e.target.value)}
|
|
|
- onFocus={handleInputFocus}
|
|
|
placeholder="z. B. Bridgestone, Rechnung, Kundennummer…"
|
|
|
disabled={isSubmitting}
|
|
|
// Make the input take the remaining space next to the buttons.
|
|
|
className="flex-1 min-w-0"
|
|
|
/>
|
|
|
|
|
|
- <PopoverTrigger asChild>
|
|
|
- <Button
|
|
|
- type="button"
|
|
|
- variant="outline"
|
|
|
- size="icon"
|
|
|
- disabled={isSubmitting}
|
|
|
- aria-label="Letzte Suchen öffnen"
|
|
|
- title="Letzte Suchen öffnen"
|
|
|
- className="shrink-0"
|
|
|
- >
|
|
|
- <Clock3 className="h-4 w-4" />
|
|
|
- </Button>
|
|
|
- </PopoverTrigger>
|
|
|
+ <Tooltip>
|
|
|
+ <PopoverTrigger asChild>
|
|
|
+ <TooltipTrigger asChild>
|
|
|
+ <Button
|
|
|
+ type="button"
|
|
|
+ variant="outline"
|
|
|
+ size="icon"
|
|
|
+ disabled={isSubmitting}
|
|
|
+ aria-label="Letzte Suchen anzeigen"
|
|
|
+ title="Letzte Suchen anzeigen"
|
|
|
+ className="shrink-0"
|
|
|
+ >
|
|
|
+ <Clock3 className="h-4 w-4" />
|
|
|
+ </Button>
|
|
|
+ </TooltipTrigger>
|
|
|
+ </PopoverTrigger>
|
|
|
+ <TooltipContent side="bottom">Letzte Suchen anzeigen</TooltipContent>
|
|
|
+ </Tooltip>
|
|
|
|
|
|
<Button
|
|
|
type="submit"
|