Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes mobile search #5225

Merged
merged 5 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export default function ReferenceOverview({
const { t } = useTranslation([GLOBAL, PROFILE]);
const classes = useReferenceStyles();
const user = useProfileUser();
const isAboveMedium = useMediaQuery(theme.breakpoints.up("md"));
const isMobile = useMediaQuery(theme.breakpoints.down("md"));

return (
<>
<TextBody className={classes.text}>
{t("profile:leave_reference.thank_you_message")}
</TextBody>
{!isAboveMedium && (
{isMobile && (
Copy link
Contributor

@bakeiro bakeiro Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

giphy

<>
<TextBody className={classes.text}>
{t("profile:leave_reference.writing_for_text")}
Expand Down
11 changes: 8 additions & 3 deletions app/web/features/search/FilterDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,14 @@ export default function FilterDialog({
name="location"
defaultValue={""}
label={t("search:form.location_field_label")}
onChange={(e) => {
if (e) {
setLocationResult(e);
onChange={(event) => {
if (event) {
const { bbox } = event;
const newLocationResult: GeocodeResult = {
...event,
bbox: [bbox[2], bbox[3], bbox[0], bbox[1]], //sw long, sw lat, ne long, ne lat
};
setLocationResult(newLocationResult);
}
}}
fieldError={errors.location?.message}
Expand Down
11 changes: 10 additions & 1 deletion app/web/features/search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ export default function SearchPage({
const [selectedResult, setSelectedResult] = useState<
Pick<User.AsObject, "userId" | "lng" | "lat"> | undefined
>();

const hasSearchFilters = !!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

maybe makes sense to merge the logic? [line 150]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakeiro Oh good catch! Fixed it now!

hostingStatusFilter.length ||
lastActiveFilter !== 0 ||
(locationResult.location.lng !== 0 && locationResult.location.lat !== 0) ||
numberOfGuestFilter !== undefined ||
queryName !== ""
);

const [isFiltersOpen, setIsFiltersOpen] = useState(false);

// Loads the list of users
Expand Down Expand Up @@ -194,7 +203,7 @@ export default function SearchPage({
{/* Mobile */}
{isMobile && (
<Collapse
in={!!selectedResult}
in={hasSearchFilters || !!selectedResult}
timeout={theme.transitions.duration.standard}
className={classes.mobileCollapse}
>
Expand Down
4 changes: 2 additions & 2 deletions app/web/features/search/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ export default function SearchResult({
</div>
<Typography noWrap>{user.city}</Typography>
</UserSummary>
{!isMobile && (
{isMobile && (
<LinesEllipsis
text={stripMarkdown(aboutText(user, t))}
maxLine={3}
component="p"
className={classes.about}
/>
)}
{isMobile && (
{!isMobile && (
<>
<Typography variant="body1" className={classes.about}>
{stripMarkdown(aboutText(user, t))}
Expand Down
2 changes: 1 addition & 1 deletion app/web/features/search/SearchResultsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default function SearchResultsList({

{!isLoading && hasAtLeastOnePageResults && (
<HorizontalScroller
breakpoint="sm"
breakpoint="md" // below md, the scroller is disabled
className={classes.scroller}
isFetching={isLoading}
// fetchNext={fetchNextPage} // TODO: disabled for now (until pagination)
Expand Down