diff --git a/core/search_parser.go b/core/search_parser.go index d2c5b63..d48623a 100644 --- a/core/search_parser.go +++ b/core/search_parser.go @@ -160,8 +160,8 @@ func parseLine(line string) (BookDetail, error) { } func ParseSearchV2(reader io.Reader) ([]BookDetail, []ParseError) { - var books []BookDetail - var parseErrors []ParseError + books := make([]BookDetail, 0) + parseErrors := make([]ParseError, 0) scanner := bufio.NewScanner(reader) for scanner.Scan() { diff --git a/server/app/src/components/ErrorsGrid/ErrorsGrid.tsx b/server/app/src/components/ErrorsGrid/ErrorsGrid.tsx index b6fbe58..34a299d 100644 --- a/server/app/src/components/ErrorsGrid/ErrorsGrid.tsx +++ b/server/app/src/components/ErrorsGrid/ErrorsGrid.tsx @@ -56,7 +56,11 @@ export default function ErrorsGrid({ errors }: Props) { ) .map((book, i) => ( - + {book.line} diff --git a/server/app/src/components/SideBar/SearchHistory.tsx b/server/app/src/components/SideBar/SearchHistory.tsx index 9fbb9b9..a79088c 100644 --- a/server/app/src/components/SideBar/SearchHistory.tsx +++ b/server/app/src/components/SideBar/SearchHistory.tsx @@ -99,7 +99,7 @@ const HistoryCard: React.FC = ({ activeTS, item, dispatch }: Props) => { textOverflow="ellipsis"> {item.query} - {!item.results?.length ? ( + {!item.results?.length && !item.errors?.length ? ( ) : ( {`${item.results?.length} RESULTS`} diff --git a/server/irc_events.go b/server/irc_events.go index 4cb6e2d..8ad4fcb 100644 --- a/server/irc_events.go +++ b/server/irc_events.go @@ -38,7 +38,7 @@ func (c *Client) searchResultHandler(downloadDir string) core.HandlerFunc { } } - if len(results) == 0 { + if len(results) == 0 && len(errors) == 0 { c.noResultsHandler(text) return } diff --git a/todo b/todo index 51345b7..8beb7f9 100644 --- a/todo +++ b/todo @@ -6,4 +6,10 @@ Future: after websocket disconnect. - Convert grid to use React Grid instead of Evergreen's built in one. - Things like styling are more difficult with Evergreen (ex. can't round the bottom corners) - - Send download progress updates to the browser like we show for the CLI \ No newline at end of file + - Send download progress updates to the browser like we show for the CLI + - Improve message formats. + - Don't need as many separate message types. Just have functions that create them with the appropriate status code. + - Log the address to access it in the browser on startup + - When the results contain only lines that couldn't be parsed, + the grid doesn't show and user can't manually download. + - Prevent double clicking the download button. \ No newline at end of file