String updates
This commit is contained in:
@@ -14,7 +14,7 @@ function Header({
|
||||
closeWeatherModal,
|
||||
openWeatherModal,
|
||||
}: any) {
|
||||
const { isMobile, weather, basicWeather } = useCommonHooks();
|
||||
const { isMobile, weather, basicWeather, personal } = useCommonHooks();
|
||||
const [time, setTime] = useState(new Date());
|
||||
function fixDigits(k: any) {
|
||||
if (k < 10) {
|
||||
@@ -54,7 +54,6 @@ function Header({
|
||||
});
|
||||
}
|
||||
}, [weather, basicWeather]);
|
||||
|
||||
return (
|
||||
<Stack
|
||||
style={{
|
||||
@@ -77,7 +76,11 @@ function Header({
|
||||
classNames={textClasses}
|
||||
fz={isMobile ? 24 : undefined}
|
||||
>
|
||||
{greet}
|
||||
{greet
|
||||
.replace('$firstName', personal?.[0].firstName)
|
||||
.replace('$lastName', personal?.[0].lastName)
|
||||
.replace('$firstName!', personal?.[0].firstName.toUpperCase())
|
||||
.replace('$lastName!', personal?.[0].lastName.toUpperCase())}
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Stack, TextInput } from '@mantine/core';
|
||||
import { useDisclosure } from '@mantine/hooks';
|
||||
import { HelpModal, WeatherModal } from 'components';
|
||||
import { containsProtocol, useCommonHooks, validURL } from 'hooks';
|
||||
import { useCommonHooks } from 'hooks';
|
||||
import { textInputClasses } from 'styles';
|
||||
|
||||
export default function Search({
|
||||
@@ -27,6 +27,15 @@ export default function Search({
|
||||
const handleKeyPress = (item: any) => {
|
||||
let option = '';
|
||||
let subtext = '';
|
||||
const urlPattern = new RegExp(
|
||||
'^(https?:\\/\\/)?' + // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
||||
'(\\#[-a-z\\d_]*)?$',
|
||||
'i',
|
||||
); // fragment locator
|
||||
if (item.target.value.startsWith('/')) {
|
||||
option =
|
||||
item.target.value.substr(1, item.target.value.indexOf(' ') - 1) ||
|
||||
@@ -46,8 +55,9 @@ export default function Search({
|
||||
open(`${providerURL}${subtext}`, '_self');
|
||||
} else if (providerLabel === 'Show weather') {
|
||||
openWeatherModal();
|
||||
} else if (validURL(item.target.value)) {
|
||||
if (containsProtocol(item.target.value)) window.location = item.target.value;
|
||||
} else if (urlPattern.test(item.target.value)) {
|
||||
if (/^(https?:\/\/).*/i.test(item.target.value))
|
||||
window.location = item.target.value;
|
||||
else open(`https://${item.target.value}`, '_self');
|
||||
} else {
|
||||
open(`${providerURL}${subtext}`, '_self');
|
||||
|
||||
@@ -101,7 +101,7 @@ function SettingsButton() {
|
||||
<Button
|
||||
classNames={buttonClasses}
|
||||
className={buttonClasses.wakeButton}
|
||||
disabled={!wolClients?.length}
|
||||
disabled={!wolClients?.length || selectedClient === null}
|
||||
onClick={() => {
|
||||
handleWakeRequest();
|
||||
notify('Wake command sent');
|
||||
|
||||
Reference in New Issue
Block a user