How to expand search field for web version

smsoousa2 years ago

Hello everyone, can anyone give me a tip and how to change the font so that the search field also expands to the web version and not just the mobile version as it is today? Thanks

Track-trace2 years ago

What are you missing ? Show a screenshot.

I can see a search field on the web version.

Anton Tananaev2 years ago

My guess is that the question is about settings menu. You can use the standard browser search functionality, but in mobile version we have a search field there.

smsoousa2 years ago

In the WEB version, the search field is not displayed.
Version WEB

In the MOBILE version, the search field is displayed.
Version MOBILE

smsoousa2 years ago

Yes Anton, that would be exactly it. In the web view the field is shown perfectly, however, when I expand the screen the field disappears.

Oluwatobi2 years ago

use the conventional Ctrl+F to search in browser. works perfectly....
search bar is only available on mobile

Track-trace2 years ago

Indeed CTRL+F is the best option for that settings menu.
But you can also use the Search Field above device details on the Map.
Then when you click on the device, you can click on edit in the Popup window which leads to the same device details to edit.

A search field would hurt no one though on the settings page / devices
you can do a feature request for it: https://github.com/traccar/traccar-web/issues

Cristian2 years ago

you can make the changes in SearchHeader.js file

https://ibb.co/8xZRJGV

smsoousa2 years ago

Thanks for the tip Christian. However, even changing the style to XL, the field is still hidden on 1920p monitors. Could you share your configuration? Thanks

Cristian2 years ago

SearchHeader.js

  const phone = useMediaQuery(theme.breakpoints.down('sm'));
  const notphone = useMediaQuery(theme.breakpoints.down('xl'));

  return (phone || notphone) ? (

I made that change. I don't know if it's the best for the code but it shows the search bar.

change affects all searches (devices, users, calendars, etc.)

if someone can improve it, it would be appreciated

smsoousa2 years ago

It stayed the same for me, it shows the field up to 1535px, after that, the field is hidden. It should show normal as the XL option goes up to 1920px

Cristian2 years ago

Apply this

return phone ? (
    <div className={classes.header}>
      <TextField
        variant="outlined"
        placeholder={t('sharedSearch')}
        value={keyword}
        onChange={(e) => setKeyword(e.target.value)}
      />
    </div>
  ) :
    (
      <div className={classes.header}>
        <TextField
          variant="outlined"
          placeholder={t('sharedSearch')}
          value={keyword}
          onChange={(e) => setKeyword(e.target.value)}
        />
      </div>
    );
Cristian2 years ago

I don't really like this solution because it repeats the code, but it should work in any resolution.

smsoousa2 years ago

I did it another way, it worked perfectly on Full HD monitors

const phone = useMediaQuery(theme.breakpoints.down('sm'));
const notphone = useMediaQuery('(max-width:1920px)');

return (phone || notphone) ? (
smsoousa2 years ago

Thank you Cristian, your help was of great value.