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
199d5680
Commit
199d5680
authored
Oct 19, 2024
by
johnnyjoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update inbox messages style
parent
435bd5c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
39 deletions
+51
-39
MemoCommentMessage.tsx
web/src/components/Inbox/MemoCommentMessage.tsx
+49
-37
VersionUpdateMessage.tsx
web/src/components/Inbox/VersionUpdateMessage.tsx
+2
-2
No files found.
web/src/components/Inbox/MemoCommentMessage.tsx
View file @
199d5680
import
{
Tooltip
}
from
"@mui/joy"
;
import
clsx
from
"clsx"
;
import
{
InboxIcon
,
MessageCircleIcon
}
from
"lucide-react"
;
import
{
use
Effect
,
use
State
}
from
"react"
;
import
{
InboxIcon
,
LoaderIcon
,
MessageCircleIcon
}
from
"lucide-react"
;
import
{
useState
}
from
"react"
;
import
toast
from
"react-hot-toast"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
import
useAsyncEffect
from
"@/hooks/useAsyncEffect"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
{
activityNamePrefix
,
memoNamePrefix
,
useInboxStore
,
useMemoStore
,
useUserStore
}
from
"@/store/v1"
;
import
{
Inbox
,
Inbox_Status
}
from
"@/types/proto/api/v1/inbox_service"
;
...
...
@@ -23,27 +24,27 @@ const MemoCommentMessage = ({ inbox }: Props) => {
const
userStore
=
useUserStore
();
const
[
relatedMemo
,
setRelatedMemo
]
=
useState
<
Memo
|
undefined
>
(
undefined
);
const
[
sender
,
setSender
]
=
useState
<
User
|
undefined
>
(
undefined
);
const
[
initialized
,
setInitialized
]
=
useState
<
boolean
>
(
false
);
use
Effect
(
()
=>
{
use
AsyncEffect
(
async
()
=>
{
if
(
!
inbox
.
activityId
)
{
return
;
}
(
async
()
=>
{
const
activity
=
await
activityServiceClient
.
getActivity
({
name
:
`
${
activityNamePrefix
}${
inbox
.
activityId
}
`
,
const
activity
=
await
activityServiceClient
.
getActivity
({
name
:
`
${
activityNamePrefix
}${
inbox
.
activityId
}
`
,
});
if
(
activity
.
payload
?.
memoComment
)
{
const
memoCommentPayload
=
activity
.
payload
.
memoComment
;
const
relatedMemoId
=
memoCommentPayload
.
relatedMemoId
;
const
memo
=
await
memoStore
.
getOrFetchMemoByName
(
`
${
memoNamePrefix
}${
relatedMemoId
}
`
,
{
skipStore
:
true
,
});
if
(
activity
.
payload
?.
memoComment
)
{
const
memoCommentPayload
=
activity
.
payload
.
memoComment
;
const
relatedMemoId
=
memoCommentPayload
.
relatedMemoId
;
const
memo
=
await
memoStore
.
getOrFetchMemoByName
(
`
${
memoNamePrefix
}${
relatedMemoId
}
`
,
{
skipStore
:
true
,
});
setRelatedMemo
(
memo
);
const
sender
=
await
userStore
.
getOrFetchUserByName
(
inbox
.
sender
);
setSender
(
sender
);
}
})();
setRelatedMemo
(
memo
);
const
sender
=
await
userStore
.
getOrFetchUserByName
(
inbox
.
sender
);
setSender
(
sender
);
setInitialized
(
true
);
}
},
[
inbox
.
activityId
]);
const
handleNavigateToMemo
=
async
()
=>
{
...
...
@@ -86,30 +87,41 @@ const MemoCommentMessage = ({ inbox }: Props) => {
</
div
>
<
div
className=
{
clsx
(
"border w-full p-
3 px-4 rounded-lg flex flex-col justify-start items-start gap-2
dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700"
,
"border w-full p-
2 px-3 rounded-lg flex flex-col justify-start items-start gap-1
dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700"
,
inbox
.
status
!==
Inbox_Status
.
UNREAD
&&
"opacity-60"
,
)
}
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
span
className=
"text-xs text-gray-500"
>
{
inbox
.
createTime
?.
toLocaleString
()
}
</
span
>
<
div
>
{
inbox
.
status
===
Inbox_Status
.
UNREAD
&&
(
<
Tooltip
title=
{
t
(
"common.archive"
)
}
placement=
"top"
>
<
InboxIcon
className=
"w-4 h-auto cursor-pointer text-gray-400 hover:text-blue-600"
onClick=
{
()
=>
handleArchiveMessage
()
}
/>
</
Tooltip
>
)
}
{
initialized
?
(
<>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
span
className=
"text-sm text-gray-500"
>
{
inbox
.
createTime
?.
toLocaleString
()
}
</
span
>
<
div
>
{
inbox
.
status
===
Inbox_Status
.
UNREAD
&&
(
<
Tooltip
title=
{
t
(
"common.archive"
)
}
placement=
"top"
>
<
InboxIcon
className=
"w-4 h-auto cursor-pointer text-gray-400 hover:text-blue-600"
onClick=
{
()
=>
handleArchiveMessage
()
}
/>
</
Tooltip
>
)
}
</
div
>
</
div
>
<
p
className=
"text-base leading-tight cursor-pointer text-gray-500 dark:text-gray-400 hover:underline hover:text-blue-600"
onClick=
{
handleNavigateToMemo
}
>
{
t
(
"inbox.memo-comment"
,
{
user
:
sender
?.
nickname
||
sender
?.
username
,
memo
:
`memos/${relatedMemo?.uid}`
,
interpolation
:
{
escapeValue
:
false
},
})
}
</
p
>
</>
)
:
(
<
div
className=
"w-full flex flex-row justify-center items-center my-2"
>
<
LoaderIcon
className=
"animate-spin text-zinc-500"
/>
</
div
>
</
div
>
<
p
className=
"text-base leading-tight cursor-pointer text-gray-500 dark:text-gray-400 hover:underline hover:text-blue-600"
onClick=
{
handleNavigateToMemo
}
>
{
t
(
"inbox.memo-comment"
,
{
user
:
sender
?.
nickname
||
sender
?.
username
,
memo
:
`memos/${relatedMemo?.uid}`
,
interpolation
:
{
escapeValue
:
false
},
})
}
</
p
>
)
}
</
div
>
</
div
>
);
...
...
web/src/components/Inbox/VersionUpdateMessage.tsx
View file @
199d5680
...
...
@@ -71,12 +71,12 @@ const VersionUpdateMessage = ({ inbox }: Props) => {
</div>
<div
className={clsx(
"border w-full p-
3 px-4 rounded-lg flex flex-col justify-start items-start gap-2
dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700",
"border w-full p-
2 px-3 rounded-lg flex flex-col justify-start items-start gap-1
dark:border-zinc-700 hover:bg-gray-100 dark:hover:bg-zinc-700",
inbox.status !== Inbox_Status.UNREAD && "opacity-60",
)}
>
<div className="w-full flex flex-row justify-between items-center">
<span className="text-
xs
text-gray-500">{inbox.createTime?.toLocaleString()}</span>
<span className="text-
sm
text-gray-500">{inbox.createTime?.toLocaleString()}</span>
<div>
{inbox.status === Inbox_Status.UNREAD && (
<Tooltip title={t("common.archive")} placement="top">
...
...
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