Testing new features
This commit is contained in:
@@ -70,6 +70,10 @@ export default function Search({
|
|||||||
open(`${url}${item.option.searchTerm}`, '_self');
|
open(`${url}${item.option.searchTerm}`, '_self');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleAppSearchItem = (item: any) => {
|
||||||
|
open(`https://${item.option.url}`, '_self');
|
||||||
|
};
|
||||||
|
|
||||||
const handleKeyPress = (item: any) => {
|
const handleKeyPress = (item: any) => {
|
||||||
let option = '';
|
let option = '';
|
||||||
let subtext = '';
|
let subtext = '';
|
||||||
@@ -134,7 +138,9 @@ export default function Search({
|
|||||||
setListIndex(0);
|
setListIndex(0);
|
||||||
openDropdown();
|
openDropdown();
|
||||||
setPlaceholderValue(
|
setPlaceholderValue(
|
||||||
searchHistory.length > 0 ? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}` : '',
|
searchHistory.length > 0
|
||||||
|
? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!providerLabel.startsWith('Invalid')) {
|
if (!providerLabel.startsWith('Invalid')) {
|
||||||
@@ -156,7 +162,9 @@ export default function Search({
|
|||||||
}
|
}
|
||||||
} else if (item.code === 'ArrowRight' || item.code === 'Tab') {
|
} else if (item.code === 'ArrowRight' || item.code === 'Tab') {
|
||||||
setSearchValue(
|
setSearchValue(
|
||||||
searchHistory.length > 0 ? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}` : '',
|
searchHistory.length > 0
|
||||||
|
? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
setValue(searchHistory.length > 0 ? searchHistory[listIndex].id : 0);
|
setValue(searchHistory.length > 0 ? searchHistory[listIndex].id : 0);
|
||||||
}
|
}
|
||||||
@@ -232,6 +240,15 @@ export default function Search({
|
|||||||
|
|
||||||
const optionsFilter: OptionsFilter = ({ options, search }) => {
|
const optionsFilter: OptionsFilter = ({ options, search }) => {
|
||||||
const splittedSearch = search.toLowerCase().trim().split(' ');
|
const splittedSearch = search.toLowerCase().trim().split(' ');
|
||||||
|
if (splittedSearch[0] === '!') {
|
||||||
|
return apps.map((app: any) => {
|
||||||
|
return {
|
||||||
|
label: app.name,
|
||||||
|
value: app.baseUrl,
|
||||||
|
...app,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
return options
|
return options
|
||||||
.filter((option: any) => {
|
.filter((option: any) => {
|
||||||
const words = option.value.toLowerCase().trim().split(' ');
|
const words = option.value.toLowerCase().trim().split(' ');
|
||||||
@@ -244,6 +261,7 @@ export default function Search({
|
|||||||
|
|
||||||
function RenderOption(item: any) {
|
function RenderOption(item: any) {
|
||||||
const [showFillButton, setShowFillButton] = useState(false);
|
const [showFillButton, setShowFillButton] = useState(false);
|
||||||
|
if (item.option.searchTerm) {
|
||||||
const m = new Date(item.option.dateTimeStamp);
|
const m = new Date(item.option.dateTimeStamp);
|
||||||
const dateString = `${m.getUTCFullYear()}/${`0${m.getUTCMonth() + 1}`.slice(-2)}/${`0${m.getUTCDate()}`.slice(-2)} ${`0${m.getUTCHours()}`.slice(-2)}:${`0${m.getUTCMinutes()}`.slice(-2)}:${`0${m.getUTCSeconds()}`.slice(-2)}`;
|
const dateString = `${m.getUTCFullYear()}/${`0${m.getUTCMonth() + 1}`.slice(-2)}/${`0${m.getUTCDate()}`.slice(-2)} ${`0${m.getUTCHours()}`.slice(-2)}:${`0${m.getUTCMinutes()}`.slice(-2)}:${`0${m.getUTCSeconds()}`.slice(-2)}`;
|
||||||
return (
|
return (
|
||||||
@@ -312,6 +330,44 @@ export default function Search({
|
|||||||
</Group>
|
</Group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return (
|
||||||
|
<Group
|
||||||
|
w={'100%'}
|
||||||
|
onClick={() => {
|
||||||
|
handleAppSearchItem(item);
|
||||||
|
}}
|
||||||
|
onMouseEnter={() => {
|
||||||
|
setShowFillButton(true);
|
||||||
|
}}
|
||||||
|
onMouseLeave={() => {
|
||||||
|
setShowFillButton(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Group w={'15%'}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
backgroundColor: `${theme.primaryColor}33`,
|
||||||
|
fontWeight: 600,
|
||||||
|
borderRadius: '15px',
|
||||||
|
padding: '5px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.option.label}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
<Group justify='space-between' w={'80%'}>
|
||||||
|
<Text c={theme.primaryColor}>{item.option.searchTerm}</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
color: `${theme.primaryColor}55`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{item.option.value}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (providers && providersIsFetched) {
|
if (providers && providersIsFetched) {
|
||||||
@@ -337,7 +393,9 @@ export default function Search({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (dropdownOpened) {
|
if (dropdownOpened) {
|
||||||
setPlaceholderValue(
|
setPlaceholderValue(
|
||||||
searchHistory.length > 0 ? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}` : '',
|
searchHistory.length > 0
|
||||||
|
? `${searchHistory[listIndex].prefix} ${searchHistory[listIndex].searchTerm}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [listIndex, dropdownOpened]);
|
}, [listIndex, dropdownOpened]);
|
||||||
@@ -412,6 +470,7 @@ export default function Search({
|
|||||||
/>
|
/>
|
||||||
<HelpModal
|
<HelpModal
|
||||||
providerModalOpened={providerModalOpened}
|
providerModalOpened={providerModalOpened}
|
||||||
|
applicationData={applicationData}
|
||||||
providerData={providerData}
|
providerData={providerData}
|
||||||
closeProviderModal={closeProviderModal}
|
closeProviderModal={closeProviderModal}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user