aboutsummaryrefslogtreecommitdiffstats
path: root/packages/renderer/src/components/locationBar/LocationTextField.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/renderer/src/components/locationBar/LocationTextField.tsx')
-rw-r--r--packages/renderer/src/components/locationBar/LocationTextField.tsx13
1 files changed, 8 insertions, 5 deletions
diff --git a/packages/renderer/src/components/locationBar/LocationTextField.tsx b/packages/renderer/src/components/locationBar/LocationTextField.tsx
index 30953de..85cf794 100644
--- a/packages/renderer/src/components/locationBar/LocationTextField.tsx
+++ b/packages/renderer/src/components/locationBar/LocationTextField.tsx
@@ -20,6 +20,7 @@
20 20
21import FilledInput from '@mui/material/FilledInput'; 21import FilledInput from '@mui/material/FilledInput';
22import { styled } from '@mui/material/styles'; 22import { styled } from '@mui/material/styles';
23import { SecurityLabelKind } from '@sophie/shared';
23import { autorun } from 'mobx'; 24import { autorun } from 'mobx';
24import { observer } from 'mobx-react-lite'; 25import { observer } from 'mobx-react-lite';
25import React, { useCallback, useEffect, useState } from 'react'; 26import React, { useCallback, useEffect, useState } from 'react';
@@ -30,7 +31,6 @@ import GoButton from './GoButton';
30import LocationOverlayInput from './LocationOverlayInput'; 31import LocationOverlayInput from './LocationOverlayInput';
31import SecurityLabel from './SecurityLabel'; 32import SecurityLabel from './SecurityLabel';
32import UrlOverlay from './UrlOverlay'; 33import UrlOverlay from './UrlOverlay';
33import splitUrl from './splitUrl';
34 34
35const LocationTextFieldRoot = styled(FilledInput, { 35const LocationTextFieldRoot = styled(FilledInput, {
36 name: 'LocationTextField', 36 name: 'LocationTextField',
@@ -75,8 +75,6 @@ function LocationTextField({
75 [setInputFocused], 75 [setInputFocused],
76 ); 76 );
77 77
78 const splitResult = splitUrl(service?.currentUrl);
79
80 return ( 78 return (
81 <LocationTextFieldRoot 79 <LocationTextFieldRoot
82 inputComponent={LocationOverlayInput} 80 inputComponent={LocationOverlayInput}
@@ -84,7 +82,12 @@ function LocationTextField({
84 'aria-label': 'Location', 82 'aria-label': 'Location',
85 spellCheck: false, 83 spellCheck: false,
86 overlayVisible: !inputFocused && !changed, 84 overlayVisible: !inputFocused && !changed,
87 overlay: <UrlOverlay splitResult={splitResult} />, 85 overlay: (
86 <UrlOverlay
87 url={service?.currentUrl ?? ''}
88 alert={service?.hasSecurityLabelWarning ?? false}
89 />
90 ),
88 }} 91 }}
89 inputRef={inputRefCallback} 92 inputRef={inputRefCallback}
90 onFocus={() => setInputFocused(true)} 93 onFocus={() => setInputFocused(true)}
@@ -114,8 +117,8 @@ function LocationTextField({
114 disableUnderline 117 disableUnderline
115 startAdornment={ 118 startAdornment={
116 <SecurityLabel 119 <SecurityLabel
120 kind={service?.securityLabel ?? SecurityLabelKind.Empty}
117 changed={changed} 121 changed={changed}
118 splitResult={splitResult}
119 position="start" 122 position="start"
120 /> 123 />
121 } 124 }