refactor: cleanup tags ui

This commit is contained in:
zhom
2025-08-15 19:10:16 +04:00
parent f7ccca0075
commit 77f93cc122
3 changed files with 8 additions and 3 deletions
+1
View File
@@ -131,6 +131,7 @@
"SARIF",
"scipy",
"screeninfo",
"selectables",
"serde",
"setuptools",
"shadcn",
+6 -2
View File
@@ -352,6 +352,10 @@ const MultipleSelector = React.forwardRef<
[options, selected],
);
const hasAvailableOptions = React.useMemo(() => {
return Object.values(selectables).some((group) => group.length > 0);
}, [selectables]);
/** Avoid Creatable Selector freezing or lagging when paste a long string. */
const commandFilter = React.useCallback(() => {
if (commandProps?.filter) {
@@ -499,7 +503,7 @@ const MultipleSelector = React.forwardRef<
"flex-1 bg-transparent outline-none placeholder:text-muted-foreground",
{
"w-full": hidePlaceholderWhenSelected,
"px-3 py-2": selected.length === 0,
"px-3 mt-1": selected.length === 0,
"ml-1": selected.length !== 0,
},
inputProps?.className,
@@ -508,7 +512,7 @@ const MultipleSelector = React.forwardRef<
</div>
</div>
<div className="relative">
{open && (
{open && hasAvailableOptions && (
<CommandList className="absolute top-1 z-10 w-full rounded-md border shadow-md outline-none bg-popover text-popover-foreground animate-in">
{isLoading ? (
loadingIndicator
+1 -1
View File
@@ -263,7 +263,7 @@ const TagsCell = React.memo<{
creatable
selectFirstItem={false}
placeholder={effectiveTags.length === 0 ? "Add tags" : ""}
className="bg-transparent"
className="overflow-x-hidden overflow-y-scroll h-7 bg-transparent"
badgeClassName=""
inputProps={{
className: "py-1",