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
9a8a1d01
Commit
9a8a1d01
authored
Mar 02, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add comments icon
parent
7e23ceb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
MemoActionMenu.tsx
web/src/components/MemoActionMenu.tsx
+3
-1
MemoView.tsx
web/src/components/MemoView.tsx
+16
-4
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+2
-1
No files found.
web/src/components/MemoActionMenu.tsx
View file @
9a8a1d01
import
{
Divider
,
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
classNames
from
"classnames"
;
import
copy
from
"copy-to-clipboard"
;
import
toast
from
"react-hot-toast"
;
import
Icon
from
"@/components/Icon"
;
...
...
@@ -12,6 +13,7 @@ import showShareMemoDialog from "./ShareMemoDialog";
interface
Props
{
memo
:
Memo
;
className
?:
string
;
hiddenActions
?:
(
"edit"
|
"archive"
|
"delete"
|
"share"
|
"pin"
)[];
onArchived
?:
()
=>
void
;
onDeleted
?:
()
=>
void
;
...
...
@@ -94,7 +96,7 @@ const MemoActionMenu = (props: Props) => {
return
(
<
Dropdown
>
<
MenuButton
slots=
{
{
root
:
"div"
}
}
>
<
span
className=
"h-7 w-7 flex justify-center items-center rounded-full hover:opacity-70"
>
<
span
className=
{
classNames
(
"flex justify-center items-center rounded-full hover:opacity-70"
,
props
.
className
)
}
>
<
Icon
.
MoreVertical
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
</
span
>
</
MenuButton
>
...
...
web/src/components/MemoView.tsx
View file @
9a8a1d01
...
...
@@ -42,7 +42,8 @@ const MemoView: React.FC<Props> = (props: Props) => {
const
[
displayTime
,
setDisplayTime
]
=
useState
<
string
>
(
getRelativeTimeString
(
getTimeStampByDate
(
memo
.
displayTime
)));
const
[
creator
,
setCreator
]
=
useState
(
userStore
.
getUserByUsername
(
extractUsernameFromName
(
memo
.
creator
)));
const
memoContainerRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
referenceRelations
=
memo
.
relations
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
REFERENCE
);
const
referencedMemos
=
memo
.
relations
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
REFERENCE
);
const
commentAmount
=
memo
.
relations
.
filter
((
relation
)
=>
relation
.
type
===
MemoRelation_Type
.
COMMENT
).
length
;
const
readonly
=
memo
.
creator
!==
user
?.
name
;
useEffect
(()
=>
{
...
...
@@ -124,8 +125,8 @@ const MemoView: React.FC<Props> = (props: Props) => {
</>
)
}
</
div
>
<
div
className=
"flex flex-row justify-end items-center select-none"
>
<
div
className=
"w-auto invisible group-hover:visible flex flex-row justify-between items-center"
>
<
div
className=
"flex flex-row justify-end items-center select-none
gap-1
"
>
<
div
className=
"w-auto invisible group-hover:visible flex flex-row justify-between items-center
gap-1
"
>
{
props
.
showVisibility
&&
memo
.
visibility
!==
Visibility
.
PRIVATE
&&
(
<
Tooltip
title=
{
t
(
`memo.visibility.${convertVisibilityToString(memo.visibility).toLowerCase()}`
as
any
)
}
placement=
"top"
>
<
span
className=
"h-7 w-7 flex justify-center items-center hover:opacity-70"
>
...
...
@@ -135,6 +136,17 @@ const MemoView: React.FC<Props> = (props: Props) => {
)
}
{
currentUser
&&
<
ReactionSelector
className=
"border-none"
memo=
{
memo
}
/>
}
</
div
>
<
Link
className=
{
classNames
(
"flex flex-row justify-start items-center hover:opacity-70"
,
commentAmount
===
0
&&
"invisible group-hover:visible"
,
)
}
to=
{
`/m/${memo.name}`
}
unstable_viewTransition
>
<
Icon
.
MessageCircleMore
className=
"w-4 h-4 mx-auto text-gray-500 dark:text-gray-400"
/>
{
commentAmount
>
0
&&
<
span
className=
"text-xs text-gray-500 dark:text-gray-400"
>
{
commentAmount
}
</
span
>
}
</
Link
>
{
!
readonly
&&
<
MemoActionMenu
memo=
{
memo
}
hiddenActions=
{
props
.
showPinned
?
[]
:
[
"pin"
]
}
/>
}
</
div
>
</
div
>
...
...
@@ -146,7 +158,7 @@ const MemoView: React.FC<Props> = (props: Props) => {
onClick=
{
handleMemoContentClick
}
/>
<
MemoResourceListView
resources=
{
memo
.
resources
}
/>
<
MemoRelationListView
memo=
{
memo
}
relations=
{
reference
Relation
s
}
/>
<
MemoRelationListView
memo=
{
memo
}
relations=
{
reference
dMemo
s
}
/>
<
MemoReactionistView
memo=
{
memo
}
reactions=
{
memo
.
reactions
}
/>
</
div
>
);
...
...
web/src/pages/MemoDetail.tsx
View file @
9a8a1d01
...
...
@@ -155,7 +155,7 @@ const MemoDetail = () => {
<
MemoContent
key=
{
`${memo.id}-${memo.updateTime}`
}
memoId=
{
memo
.
id
}
content=
{
memo
.
content
}
readonly=
{
readonly
}
/>
<
MemoResourceListView
resources=
{
memo
.
resources
}
/>
<
MemoRelationListView
memo=
{
memo
}
relations=
{
referenceRelations
}
/>
<
div
className=
"w-full mt-3 flex flex-row justify-between items-center gap-2"
>
<
div
className=
"w-full mt-3
select-none
flex flex-row justify-between items-center gap-2"
>
<
div
className=
"flex flex-row justify-start items-center"
>
{
!
readonly
&&
(
<
Select
...
...
@@ -197,6 +197,7 @@ const MemoDetail = () => {
</
Tooltip
>
{
!
readonly
&&
(
<
MemoActionMenu
className=
"ml-1"
memo=
{
memo
}
hiddenActions=
{
[
"pin"
,
"edit"
,
"share"
]
}
onArchived=
{
handleMemoArchived
}
...
...
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