Bug fixes

This commit is contained in:
Sean Edmunds
2025-11-06 16:37:05 -06:00
parent 1103a7401d
commit a2d6dce28c
3 changed files with 57 additions and 57 deletions

View File

@@ -24,7 +24,6 @@ export function DataTable({
}: { }: {
data: any[]; data: any[];
columns: any[]; columns: any[];
subRow?: any;
sorting: SortingState; sorting: SortingState;
setSorting: Dispatch<SetStateAction<SortingState>>; setSorting: Dispatch<SetStateAction<SortingState>>;
filtersEnabled: boolean; filtersEnabled: boolean;

View File

@@ -27,14 +27,14 @@ export function Homepage() {
currentLocation, currentLocation,
setCurrentLocation, setCurrentLocation,
} = useCommonHooks(); } = useCommonHooks();
const dateOptions: Intl.DateTimeFormatOptions = !isMobile const dateOptions: Intl.DateTimeFormatOptions = isMobile
? { ? {}
: {
weekday: 'long', weekday: 'long',
year: 'numeric', year: 'numeric',
month: 'long', month: 'long',
day: 'numeric', day: 'numeric',
} };
: {};
const date = new Date().toLocaleDateString('en-US', dateOptions); const date = new Date().toLocaleDateString('en-US', dateOptions);

View File

@@ -139,6 +139,8 @@ export default function Search({
} }
if (item.key === 'Enter') { if (item.key === 'Enter') {
if (providerLabel === 'Show help') { if (providerLabel === 'Show help') {
setSearchValue('');
closeDropdown();
openProviderModal(); openProviderModal();
} else if (item.target.value.startsWith('/')) { } else if (item.target.value.startsWith('/')) {
mutateAsync({ mutateAsync({
@@ -162,9 +164,9 @@ export default function Search({
open(validUrl, '_self'); open(validUrl, '_self');
} else if (urlPattern.test(item.target.value)) { } else if (urlPattern.test(item.target.value)) {
if (/^(https?:\/\/).*/i.test(item.target.value)) if (/^(https?:\/\/).*/i.test(item.target.value))
window.location = item.target.value; globalThis.location = item.target.value;
else open(`https://${item.target.value}`, '_self'); else open(`https://${item.target.value}`, '_self');
} else if (item.target.value !== '') { } else if (item.target.value.length > 0) {
mutateAsync({ mutateAsync({
method: 'POST', method: 'POST',
endpoint: searchEndpoint, endpoint: searchEndpoint,
@@ -309,19 +311,17 @@ export default function Search({
}; };
}); });
} }
const historyOptions = [ const historyOptions = options
...options .filter((option: any) => {
.filter((option: any) => { return splittedSearch.every((searchWord) =>
return splittedSearch.every((searchWord) => option.value
option.value .toLowerCase()
.toLowerCase() .trim()
.trim() .split(' ')
.split(' ') .some((word: string) => word.includes(searchWord)),
.some((word: string) => word.includes(searchWord)), );
); })
}) .slice(0, 10 * historyMultiplier);
.slice(0, 10 * historyMultiplier),
];
if (historyOptions.length >= 10 * historyMultiplier) { if (historyOptions.length >= 10 * historyMultiplier) {
return [ return [
@@ -343,43 +343,14 @@ export default function Search({
const renderItem: any = (item: any) => { const renderItem: any = (item: any) => {
const Icon = const Icon =
allIcons[ allIcons[
(item.option.icon ?? item.option.prefix === '/g') item.option.icon
? 'FaGoogle' ? item.option.icon
: (providers.find((p: Provider) => p.prefix === item.option.prefix)?.icon ?? '') : item.option.prefix === '/g'
? 'FaGoogle'
: (providers.find((p: Provider) => p.prefix === item.option.prefix)?.icon ??
'')
]; ];
return !searchValue.startsWith('!') ? ( return searchValue.startsWith('!') ? (
item.option.value === 'load' ? (
<Group
pos={'relative'}
m={0}
p={0}
gap={0}
w={'100%'}
h={'2rem'}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
setHistoryMultiplier((prev: number) => prev + 1);
}}
>
<Text
w={'100%'}
c={'var(--mantine-color-accent-0)'}
style={{ textAlign: 'center' }}
>
{item.option.label}
</Text>
</Group>
) : (
<SearchSelectItem
item={item}
handleSearchHistoryItem={handleSearchHistoryItem}
searchEndpoint={searchEndpoint}
setSearchValue={setSearchValue}
Icon={Icon}
/>
)
) : (
<Group <Group
pos={'relative'} pos={'relative'}
m={0} m={0}
@@ -409,6 +380,36 @@ export default function Search({
{item.option.name} {item.option.name}
</Text> </Text>
</Group> </Group>
) : item.option.value === 'load' ? (
<Group
pos={'relative'}
m={0}
p={0}
gap={0}
w={'100%'}
h={'2rem'}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
setHistoryMultiplier((prev: number) => prev + 1);
}}
>
<Text
w={'100%'}
c={'var(--mantine-color-accent-0)'}
style={{ textAlign: 'center' }}
>
{item.option.label}
</Text>
</Group>
) : (
<SearchSelectItem
item={item}
handleSearchHistoryItem={handleSearchHistoryItem}
searchEndpoint={searchEndpoint}
setSearchValue={setSearchValue}
Icon={Icon}
/>
); );
}; };
@@ -490,7 +491,7 @@ export default function Search({
return ( return (
<> <>
{dropdownOpened && <Overlay blur={5} onClick={closeDropdown} />} {dropdownOpened && <Overlay blur={5} onClick={closeDropdown} fixed zIndex={200} />}
<Stack <Stack
style={{ style={{
height: position === 'center' ? '100%' : '100px', height: position === 'center' ? '100%' : '100px',