Skip to content

Commit

Permalink
Usability fixes for search
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Dec 19, 2024
1 parent 84053d7 commit d60d3ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/web/src/Search.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, useRef, useEffect } from "react";
import SwipeableDrawer from "@mui/material/SwipeableDrawer";
import { ChatsSVG } from "./icons.jsx";
import { isIOS } from "./session.mjs";

const UpvoteSVG = (props) => (
<svg
Expand All @@ -14,6 +15,7 @@ const UpvoteSVG = (props) => (

const SearchInterface = () => {
const [isOpen, setIsOpen] = useState(false);
window.drawerIsOpen = isOpen;
const [query, setQuery] = useState("");
const [results, setResults] = useState([]);
const [isLoading, setIsLoading] = useState(false);
Expand Down Expand Up @@ -98,7 +100,7 @@ const SearchInterface = () => {
>
<a
href={result.url}
target="_blank"
target={isIOS() ? "_self" : "_blank"}
style={{
fontSize: "13pt",
lineHeight: "1.4",
Expand Down Expand Up @@ -158,7 +160,6 @@ const SearchInterface = () => {
viewBox="0 0 256 256"
style={{
fill: "currentColor",
stroke: "currentColor",
width: "1.5rem",
}}
>
Expand Down
3 changes: 3 additions & 0 deletions src/web/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,9 @@ async function start() {
PullToRefresh.init({
mainElement: "body",
onRefresh() {
// NOTE: If the user is searching in the search drawer, we don't want
// them to accidentially reload the page
if (window.drawerIsOpen) return;
window.location.reload();
},
});
Expand Down

0 comments on commit d60d3ab

Please sign in to comment.