Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
0df3171b
Commit
0df3171b
authored
Jul 01, 2025
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove command
parent
0cabdbe0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
136 deletions
+27
-136
AddMemoRelationPopover.tsx
...onents/MemoEditor/ActionButton/AddMemoRelationPopover.tsx
+27
-25
command.tsx
web/src/components/ui/command.tsx
+0
-111
No files found.
web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx
View file @
0df3171b
...
...
@@ -6,7 +6,7 @@ import useDebounce from "react-use/lib/useDebounce";
import
{
Badge
}
from
"@/components/ui/badge"
;
import
{
Button
}
from
"@/components/ui/button"
;
import
{
Checkbox
}
from
"@/components/ui/checkbox"
;
import
{
Command
,
CommandInput
,
CommandItem
,
CommandList
,
CommandEmpty
}
from
"@/components/ui/command
"
;
import
{
Input
}
from
"@/components/ui/input
"
;
import
{
Popover
,
PopoverContent
,
PopoverTrigger
}
from
"@/components/ui/popover"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
DEFAULT_LIST_MEMOS_PAGE_SIZE
}
from
"@/helpers/consts"
;
...
...
@@ -157,34 +157,36 @@ const AddMemoRelationPopover = (props: Props) => {
)
}
{
/* Search and selection interface */
}
<
Command
className=
"w-full"
>
<
Command
Input
<
div
className=
"w-full"
>
<
Input
placeholder=
{
t
(
"reference.search-placeholder"
)
}
value=
{
searchText
}
on
ValueChange=
{
setSearchText
}
className=
"h-9"
on
Change=
{
(
e
)
=>
setSearchText
(
e
.
target
.
value
)
}
className=
"h-9
mb-2
"
/>
<
CommandList
className=
"max-h-[200px]"
>
<
CommandEmpty
>
{
isFetching
?
"Loading..."
:
t
(
"reference.no-memos-found"
)
}
</
CommandEmpty
>
{
filteredMemos
.
map
((
memo
)
=>
(
<
CommandItem
key=
{
memo
.
name
}
value=
{
memo
.
name
}
onSelect=
{
()
=>
{
setSelectedMemos
((
prev
)
=>
[...
prev
,
memo
]);
}
}
className=
"cursor-pointer"
>
<
div
className=
"w-full flex flex-col justify-start items-start"
>
<
p
className=
"text-xs text-gray-400 select-none"
>
{
memo
.
displayTime
?.
toLocaleString
()
}
</
p
>
<
p
className=
"mt-0.5 text-sm leading-5 line-clamp-2"
>
{
searchText
?
getHighlightedContent
(
memo
.
content
)
:
memo
.
snippet
}
</
p
>
<
div
className=
"max-h-[200px] overflow-y-auto"
>
{
filteredMemos
.
length
===
0
?
(
<
div
className=
"py-6 text-center text-sm text-gray-500"
>
{
isFetching
?
"Loading..."
:
t
(
"reference.no-memos-found"
)
}
</
div
>
)
:
(
filteredMemos
.
map
((
memo
)
=>
(
<
div
key=
{
memo
.
name
}
className=
"relative flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground"
onClick=
{
()
=>
{
setSelectedMemos
((
prev
)
=>
[...
prev
,
memo
]);
}
}
>
<
div
className=
"w-full flex flex-col justify-start items-start"
>
<
p
className=
"text-xs text-gray-400 select-none"
>
{
memo
.
displayTime
?.
toLocaleString
()
}
</
p
>
<
p
className=
"mt-0.5 text-sm leading-5 line-clamp-2"
>
{
searchText
?
getHighlightedContent
(
memo
.
content
)
:
memo
.
snippet
}
</
p
>
</
div
>
</
div
>
</
CommandItem
>
)
)
}
</
CommandList
>
</
Command
>
))
)
}
</
div
>
</
div
>
<
div
className=
"mt-2 w-full flex flex-row justify-end items-center gap-2"
>
<
div
className=
"flex items-center space-x-2"
>
...
...
web/src/components/ui/command.tsx
deleted
100644 → 0
View file @
0cabdbe0
import
{
Command
as
CommandPrimitive
}
from
"cmdk"
;
import
{
SearchIcon
}
from
"lucide-react"
;
import
*
as
React
from
"react"
;
import
{
Dialog
,
DialogContent
,
DialogDescription
,
DialogHeader
,
DialogTitle
}
from
"@/components/ui/dialog"
;
import
{
cn
}
from
"@/lib/utils"
;
function
Command
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
>
)
{
return
(
<
CommandPrimitive
data
-
slot=
"command"
className=
{
cn
(
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md"
,
className
)
}
{
...
props
}
/>
);
}
function
CommandDialog
({
title
=
"Command Palette"
,
description
=
"Search for a command to run..."
,
children
,
className
,
showCloseButton
=
true
,
...
props
}:
React
.
ComponentProps
<
typeof
Dialog
>
&
{
title
?:
string
;
description
?:
string
;
className
?:
string
;
showCloseButton
?:
boolean
;
})
{
return
(
<
Dialog
{
...
props
}
>
<
DialogHeader
className=
"sr-only"
>
<
DialogTitle
>
{
title
}
</
DialogTitle
>
<
DialogDescription
>
{
description
}
</
DialogDescription
>
</
DialogHeader
>
<
DialogContent
className=
{
cn
(
"overflow-hidden p-0"
,
className
)
}
showCloseButton=
{
showCloseButton
}
>
<
Command
className=
"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"
>
{
children
}
</
Command
>
</
DialogContent
>
</
Dialog
>
);
}
function
CommandInput
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
Input
>
)
{
return
(
<
div
data
-
slot=
"command-input-wrapper"
className=
"flex h-9 items-center gap-2 border-b px-3"
>
<
SearchIcon
className=
"size-4 shrink-0 opacity-50"
/>
<
CommandPrimitive
.
Input
data
-
slot=
"command-input"
className=
{
cn
(
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50"
,
className
,
)
}
{
...
props
}
/>
</
div
>
);
}
function
CommandList
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
List
>
)
{
return
(
<
CommandPrimitive
.
List
data
-
slot=
"command-list"
className=
{
cn
(
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto"
,
className
)
}
{
...
props
}
/>
);
}
function
CommandEmpty
({
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
Empty
>
)
{
return
<
CommandPrimitive
.
Empty
data
-
slot=
"command-empty"
className=
"py-6 text-center text-sm"
{
...
props
}
/>;
}
function
CommandGroup
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
Group
>
)
{
return
(
<
CommandPrimitive
.
Group
data
-
slot=
"command-group"
className=
{
cn
(
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium"
,
className
,
)
}
{
...
props
}
/>
);
}
function
CommandSeparator
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
Separator
>
)
{
return
<
CommandPrimitive
.
Separator
data
-
slot=
"command-separator"
className=
{
cn
(
"bg-border -mx-1 h-px"
,
className
)
}
{
...
props
}
/>;
}
function
CommandItem
({
className
,
...
props
}:
React
.
ComponentProps
<
typeof
CommandPrimitive
.
Item
>
)
{
return
(
<
CommandPrimitive
.
Item
data
-
slot=
"command-item"
className=
{
cn
(
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
,
className
,
)
}
{
...
props
}
/>
);
}
function
CommandShortcut
({
className
,
...
props
}:
React
.
ComponentProps
<
"span"
>
)
{
return
(
<
span
data
-
slot=
"command-shortcut"
className=
{
cn
(
"text-muted-foreground ml-auto text-xs tracking-widest"
,
className
)
}
{
...
props
}
/>
);
}
export
{
Command
,
CommandDialog
,
CommandInput
,
CommandList
,
CommandEmpty
,
CommandGroup
,
CommandItem
,
CommandShortcut
,
CommandSeparator
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment