mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 01:19:24 +00:00

* Added footer with blank links to be filled * Cookie consent to match V1 * Made scrolling work on tool search results * Made scrolling the same on tool search, tool picker and workbench * Cleaned up height variables, view height only used at workbench level <img width="1525" height="1270" alt="{F3C1B15F-A4BE-4DF0-A5A8-92D2A3B14443}" src="https://github.com/user-attachments/assets/0c23fe35-9973-45c0-85af-0002c5ff58d2" /> <img width="1511" height="1262" alt="{4DDD51C0-4BC5-4E9F-A4F2-E5F49AF5F5FD}" src="https://github.com/user-attachments/assets/2596d980-0312-4cd7-ad34-9fd3a8d1869e" /> --------- Co-authored-by: Connor Yoh <connor@stirlingpdf.com> Co-authored-by: James Brunton <jbrunton96@gmail.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import React, { useMemo } from 'react';
|
|
import { Box, Stack, Text } from '@mantine/core';
|
|
import { getSubcategoryLabel, ToolRegistryEntry } from '../../data/toolsTaxonomy';
|
|
import ToolButton from './toolPicker/ToolButton';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useToolSections } from '../../hooks/useToolSections';
|
|
import SubcategoryHeader from './shared/SubcategoryHeader';
|
|
import NoToolsFound from './shared/NoToolsFound';
|
|
import "./toolPicker/ToolPicker.css";
|
|
|
|
interface SearchResultsProps {
|
|
filteredTools: [string, ToolRegistryEntry][];
|
|
onSelect: (id: string) => void;
|
|
}
|
|
|
|
const SearchResults: React.FC<SearchResultsProps> = ({ filteredTools, onSelect }) => {
|
|
const { t } = useTranslation();
|
|
const { searchGroups } = useToolSections(filteredTools);
|
|
|
|
if (searchGroups.length === 0) {
|
|
return <NoToolsFound />;
|
|
}
|
|
|
|
return (
|
|
<Stack p="sm" gap="xs"
|
|
className="tool-picker-scrollable">
|
|
{searchGroups.map(group => (
|
|
<Box key={group.subcategoryId} w="100%">
|
|
<SubcategoryHeader label={getSubcategoryLabel(t, group.subcategoryId)} />
|
|
<Stack gap="xs">
|
|
{group.tools.map(({ id, tool }) => (
|
|
<ToolButton
|
|
key={id}
|
|
id={id}
|
|
tool={tool}
|
|
isSelected={false}
|
|
onSelect={onSelect}
|
|
/>
|
|
))}
|
|
</Stack>
|
|
</Box>
|
|
))}
|
|
{/* global spacer to allow scrolling past last row in search mode */}
|
|
<div aria-hidden style={{ height: 200 }} />
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
export default SearchResults;
|
|
|
|
|