Merge pull request #1831 from janhq/fix/dropdown-api-server

fix: highlight menu dropdown server options
This commit is contained in:
Faisal Amir 2024-01-29 13:46:07 +07:00 committed by GitHub
commit edaf6bb5f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,6 +74,8 @@ const LocalServerScreen = () => {
const [host, setHost] = useAtom(hostAtom) const [host, setHost] = useAtom(hostAtom)
const [port, setPort] = useAtom(portAtom) const [port, setPort] = useAtom(portAtom)
const hostOptions = ['127.0.0.1', '0.0.0.0']
const FIRST_TIME_VISIT_API_SERVER = 'firstTimeVisitAPIServer' const FIRST_TIME_VISIT_API_SERVER = 'firstTimeVisitAPIServer'
const [firstTimeVisitAPIServer, setFirstTimeVisitAPIServer] = const [firstTimeVisitAPIServer, setFirstTimeVisitAPIServer] =
@ -167,8 +169,19 @@ const LocalServerScreen = () => {
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem value="127.0.0.1">127.0.0.1</SelectItem> {hostOptions.map((option, i) => {
<SelectItem value="0.0.0.0">0.0.0.0</SelectItem> return (
<SelectItem
key={i}
value={option}
className={twMerge(
host === option && 'bg-secondary'
)}
>
{option}
</SelectItem>
)
})}
</SelectContent> </SelectContent>
</Select> </Select>