Skip to content

Commit

Permalink
chore: renamed value to search
Browse files Browse the repository at this point in the history
  • Loading branch information
MehadND committed May 7, 2024
1 parent 91ffd46 commit 6009450
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions web/src/components/HomeSidebar/TagsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const TagsSection = () => {
setTags(root.subTags as Tag[]);
}, [tagStore.getState().tags]);

const [value, setValue] = useState<string | null>();
const [search, setSearch] = useState<string | null>();

const handleDeleteTag = async (tagValue: string) => {
showCommonDialog({
Expand All @@ -94,7 +94,7 @@ const TagsSection = () => {
</div>
<div className="w-full flex items-center justify-between">
<Autocomplete
key={value}
key={search}
options={tags.map((tag) => tag.text)}
autoHighlight
renderOption={(props, option) => (
Expand All @@ -108,23 +108,23 @@ const TagsSection = () => {
</AutocompleteOption>
)}
className="w-full"
value={value || null}
onChange={(event, newValue) => {
setValue(newValue);
filterStore.setTagFilter(newValue || "");
value={search || null}
onChange={(event, searchValue) => {
setSearch(searchValue);
filterStore.setTagFilter(searchValue || "");
}}
/>
{value && (
{search && (
<Dropdown>
<MenuButton variant="plain">
<Icon.MoreVertical />
</MenuButton>
<Menu size="sm" placement="bottom">
<MenuItem onClick={() => showRenameTagDialog({ tag: value })}>
<MenuItem onClick={() => showRenameTagDialog({ tag: search })}>
<Icon.Edit3 className="w-4 h-auto" />
{t("common.rename")}
</MenuItem>
<MenuItem color="danger" onClick={() => handleDeleteTag(value)}>
<MenuItem color="danger" onClick={() => handleDeleteTag(search)}>
<Icon.Trash className="w-4 h-auto" />
{t("common.delete")}
</MenuItem>
Expand Down

0 comments on commit 6009450

Please sign in to comment.