* fix(projects): restore folder search and browsing * fix(projects): preserve fuzzy search edge cases * test(projects): move picker cleanup into fixture * fix(projects): preserve absolute path descendants * test(server): compare canonical search paths * fix(projects): anchor root path suggestions * fix(projects): anchor Windows root suggestions * fix(projects): anchor directory search paths * test(server): canonicalize directory search root * fix(app): anchor rooted basename suggestions * refactor(search): unify directory suggestions Use one parameterized daemon search engine for project paths and workspace entries. Keep local recommendations as a small client overlay and remove unnecessary response metadata. * fix(search): preserve filesystem root semantics Accept absolute queries through configured root aliases while keeping traversal and output canonical. Keep blank suffix browsing matcher-independent and avoid metadata-keyed listing caches where Windows cannot invalidate them reliably.
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { useCallback } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { FolderOpen } from "lucide-react-native";
|
|
import { Button } from "@/components/ui/button";
|
|
import { pickDirectory } from "@/desktop/pick-directory";
|
|
import { useIsLocalDaemon } from "@/hooks/use-is-local-daemon";
|
|
import type { ProjectPickerBrowseButtonProps } from "./project-picker-browse-button.types";
|
|
|
|
export function ProjectPickerBrowseButton({
|
|
serverId,
|
|
disabled,
|
|
onSelect,
|
|
onError,
|
|
}: ProjectPickerBrowseButtonProps) {
|
|
const { t } = useTranslation();
|
|
const isLocalDaemon = useIsLocalDaemon(serverId);
|
|
const handlePress = useCallback(() => {
|
|
void (async () => {
|
|
try {
|
|
const path = await pickDirectory();
|
|
if (path) {
|
|
onSelect(path);
|
|
}
|
|
} catch {
|
|
onError();
|
|
}
|
|
})();
|
|
}, [onError, onSelect]);
|
|
|
|
if (!isLocalDaemon) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
leftIcon={FolderOpen}
|
|
disabled={disabled}
|
|
onPress={handlePress}
|
|
>
|
|
{t("projectPicker.browse")}
|
|
</Button>
|
|
);
|
|
}
|