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
0dfcb1a7
Commit
0dfcb1a7
authored
Mar 12, 2025
by
Johnny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: total memo count
parent
3349311b
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
318 additions
and
285 deletions
+318
-285
user_service.proto
proto/api/v1/user_service.proto
+2
-0
user_service.pb.go
proto/gen/api/v1/user_service.pb.go
+292
-281
apidocs.swagger.yaml
proto/gen/apidocs.swagger.yaml
+3
-0
user_service_stats.go
server/router/api/v1/user_service_stats.go
+2
-0
HomeSidebar.tsx
web/src/components/HomeSidebar/HomeSidebar.tsx
+8
-3
user.ts
web/src/store/v2/user.ts
+11
-1
No files found.
proto/api/v1/user_service.proto
View file @
0dfcb1a7
...
...
@@ -214,6 +214,8 @@ message UserStats {
// The pinned memos of the user.
repeated
string
pinned_memos
=
5
;
int32
total_memo_count
=
6
;
message
MemoTypeStats
{
int32
link_count
=
1
;
int32
code_count
=
2
;
...
...
proto/gen/api/v1/user_service.pb.go
View file @
0dfcb1a7
This diff is collapsed.
Click to expand it.
proto/gen/apidocs.swagger.yaml
View file @
0dfcb1a7
...
...
@@ -3277,6 +3277,9 @@ definitions:
items
:
type
:
string
description
:
The pinned memos of the user.
totalMemoCount
:
type
:
integer
format
:
int32
v1Visibility
:
type
:
string
enum
:
...
...
server/router/api/v1/user_service_stats.go
View file @
0dfcb1a7
...
...
@@ -87,6 +87,7 @@ func (s *APIV1Service) ListAllUserStats(ctx context.Context, _ *v1pb.ListAllUser
if
memo
.
Payload
.
Property
.
GetHasIncompleteTasks
()
{
userStats
.
MemoTypeStats
.
UndoCount
++
}
userStats
.
TotalMemoCount
++
}
userStatsList
:=
[]
*
v1pb
.
UserStats
{}
for
_
,
userStats
:=
range
userStatsMap
{
...
...
@@ -142,6 +143,7 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt
MemoDisplayTimestamps
:
[]
*
timestamppb
.
Timestamp
{},
MemoTypeStats
:
&
v1pb
.
UserStats_MemoTypeStats
{},
TagCount
:
map
[
string
]
int32
{},
TotalMemoCount
:
int32
(
len
(
memos
)),
}
for
_
,
memo
:=
range
memos
{
displayTs
:=
memo
.
CreatedTs
...
...
web/src/components/HomeSidebar/HomeSidebar.tsx
View file @
0dfcb1a7
...
...
@@ -79,15 +79,20 @@ const HomeSidebar = observer((props: Props) => {
key=
{
navLink
.
id
}
className=
{
({
isActive
})
=>
cn
(
"w-full px-2 rounded-xl border flex flex-row items-center text-sm text-zinc-600 dark:text-gray-400 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-700 dark:hover:bg-zinc-800"
,
"w-full px-2 rounded-xl border flex flex-row items-center
justify-between
text-sm text-zinc-600 dark:text-gray-400 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-700 dark:hover:bg-zinc-800"
,
isActive
?
"bg-white drop-shadow-sm dark:bg-zinc-800 border-gray-200 dark:border-zinc-700"
:
"border-transparent"
,
)
}
to=
{
navLink
.
path
}
viewTransition
>
{
navLink
.
icon
}
<
span
className=
"ml-2 truncate leading-8"
>
{
navLink
.
title
}
</
span
>
<
div
className=
"flex flex-row items-center"
>
{
navLink
.
icon
}
<
span
className=
"ml-2 truncate leading-8"
>
{
navLink
.
title
}
</
span
>
</
div
>
{
navLink
.
path
===
Routes
.
ROOT
&&
currentUser
&&
userStore
.
state
.
currentUserStats
&&
(
<
span
className=
"font-mono text-xs opacity-80"
>
{
userStore
.
state
.
currentUserStats
.
totalMemoCount
}
</
span
>
)
}
</
NavLink
>
))
}
</
div
>
...
...
web/src/store/v2/user.ts
View file @
0dfcb1a7
...
...
@@ -26,6 +26,13 @@ class LocalState {
return
tagCount
;
}
get
currentUserStats
()
{
if
(
!
this
.
currentUser
)
{
return
undefined
;
}
return
this
.
userStatsByName
[
this
.
currentUser
];
}
constructor
()
{
makeAutoObservable
(
this
);
}
...
...
@@ -171,7 +178,10 @@ const userStore = (() => {
userStatsByName
[
user
]
=
userStats
;
}
state
.
setPartial
({
userStatsByName
,
userStatsByName
:
{
...
state
.
userStatsByName
,
...
userStatsByName
,
},
});
};
...
...
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