mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
remove comments and fix scrolling
This commit is contained in:
parent
900cd46e54
commit
ebd6a2b27b
1 changed files with 12 additions and 23 deletions
|
@ -38,14 +38,6 @@ const cl = classNameFactory("vc-search-modal-");
|
||||||
// TODO make guilds work
|
// TODO make guilds work
|
||||||
// FIXME fix the no results display
|
// FIXME fix the no results display
|
||||||
|
|
||||||
// TODO add all channel types
|
|
||||||
|
|
||||||
// TODO filter for input type
|
|
||||||
// TODO setting for max amount of selected items
|
|
||||||
|
|
||||||
// FIXME remove scrolling up onclick
|
|
||||||
// FIXME move selected items to the top of the list.
|
|
||||||
|
|
||||||
const SearchBarModule = findByPropsLazy("SearchBar", "Checkbox", "AvatarSizes");
|
const SearchBarModule = findByPropsLazy("SearchBar", "Checkbox", "AvatarSizes");
|
||||||
const SearchBarWrapper = findByPropsLazy("SearchBar", "Item");
|
const SearchBarWrapper = findByPropsLazy("SearchBar", "Item");
|
||||||
const TextTypes = findByPropsLazy("APPLICATION", "GROUP_DM", "GUILD");
|
const TextTypes = findByPropsLazy("APPLICATION", "GROUP_DM", "GUILD");
|
||||||
|
@ -79,6 +71,7 @@ interface UnspecificRowProps {
|
||||||
"aria-posinset": number,
|
"aria-posinset": number,
|
||||||
"aria-setsize": number
|
"aria-setsize": number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SpecificRowProps extends UnspecificRowProps {
|
interface SpecificRowProps extends UnspecificRowProps {
|
||||||
icon: React.JSX.Element,
|
icon: React.JSX.Element,
|
||||||
label: string,
|
label: string,
|
||||||
|
@ -90,7 +83,7 @@ interface UserIconProps {
|
||||||
size?: number;
|
size?: number;
|
||||||
animate?: boolean;
|
animate?: boolean;
|
||||||
"aria-hidden"?: boolean;
|
"aria-hidden"?: boolean;
|
||||||
[key: string]: any; // To allow any additional props
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchTypesToResultTypes = (type: string | string[]) => {
|
const searchTypesToResultTypes = (type: string | string[]) => {
|
||||||
|
@ -203,7 +196,7 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
return (
|
return (
|
||||||
<SearchBarModule.Clickable
|
<SearchBarModule.Clickable
|
||||||
className={cl("destination-row")}
|
className={cl("destination-row")}
|
||||||
onClick={handlePress}
|
onClick={e => { handlePress(); e.preventDefault(); e.stopPropagation(); }}
|
||||||
aria-selected={isSelected}
|
aria-selected={isSelected}
|
||||||
{...interactionProps}
|
{...interactionProps}
|
||||||
{...rest}
|
{...rest}
|
||||||
|
@ -329,9 +322,10 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row {...otherProps}
|
<Row {...otherProps}
|
||||||
icon={<GroupDMAvatars aria-hidden={true} size={SearchBarModule.AvatarSizes.SIZE_32} channel={channel}/>}
|
icon={<GroupDMAvatars aria-hidden={true} size={SearchBarModule.AvatarSizes.SIZE_32}
|
||||||
label={label}
|
channel={channel}/>}
|
||||||
subLabel={subLabelValue ?? ""}
|
label={label}
|
||||||
|
subLabel={subLabelValue ?? ""}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -536,10 +530,10 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
|
|
||||||
const destinations = removeDuplicates(
|
const destinations = removeDuplicates(
|
||||||
[...(pinnedDestinations.length > 0 ? pinnedDestinations.map(e => getItem(e)) : []),
|
[...(pinnedDestinations.length > 0 ? pinnedDestinations.map(e => getItem(e)) : []),
|
||||||
...recentDestinations
|
...recentDestinations
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return processItems(destinations).slice(0, 15);
|
return processItems(destinations);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -639,11 +633,6 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
});
|
});
|
||||||
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
/* if (currentSelected.length >= 5) { TODO add this later
|
|
||||||
$(""); // Handle the case when max selection is reached
|
|
||||||
return currentSelected;
|
|
||||||
} */
|
|
||||||
|
|
||||||
refCounter.current += 1;
|
refCounter.current += 1;
|
||||||
return [e, ...currentSelected];
|
return [e, ...currentSelected];
|
||||||
}
|
}
|
||||||
|
@ -682,7 +671,7 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
size={SearchBarModule.SearchBar.Sizes.MEDIUM}
|
size={SearchBarModule.SearchBar.Sizes.MEDIUM}
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
query={searchText}
|
query={searchText}
|
||||||
onChange={v => {
|
onChange={(v: string) => {
|
||||||
setSearchText(v);
|
setSearchText(v);
|
||||||
updateSearchText(v);
|
updateSearchText(v);
|
||||||
}}
|
}}
|
||||||
|
@ -690,7 +679,7 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
setSearchText("");
|
setSearchText("");
|
||||||
updateSearchText("");
|
updateSearchText("");
|
||||||
}}
|
}}
|
||||||
setFocus={true}
|
autoFocus={true}
|
||||||
/>
|
/>
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
{
|
{
|
||||||
|
@ -715,7 +704,7 @@ export default function SearchModal({ modalProps, onSubmit, input, searchType =
|
||||||
modalProps.onClose();
|
modalProps.onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Confirm
|
{"Add" + (selected.length > 1 ? " (" + selected.length + ")" : "")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
color={Button.Colors.TRANSPARENT}
|
color={Button.Colors.TRANSPARENT}
|
||||||
|
|
Loading…
Add table
Reference in a new issue