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
39a0e69b
Commit
39a0e69b
authored
Nov 05, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update function name
parent
e60e47f7
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
42 additions
and
51 deletions
+42
-51
inbox_service .go
api/v2/inbox_service .go
+2
-2
resource_name.go
api/v2/resource_name.go
+4
-4
user_service.go
api/v2/user_service.go
+4
-4
ChangeMemberPasswordDialog.tsx
web/src/components/ChangeMemberPasswordDialog.tsx
+11
-8
ChangePasswordDialog.tsx
web/src/components/ChangePasswordDialog.tsx
+1
-2
Header.tsx
web/src/components/Header.tsx
+1
-1
MemoCommentMessage.tsx
web/src/components/Inbox/MemoCommentMessage.tsx
+1
-2
Memo.tsx
web/src/components/Memo.tsx
+1
-2
MemoList.tsx
web/src/components/MemoList.tsx
+1
-1
AccessTokenSection.tsx
web/src/components/Settings/AccessTokenSection.tsx
+1
-1
MyAccountSection.tsx
web/src/components/Settings/MyAccountSection.tsx
+1
-1
ShareMemoDialog.tsx
web/src/components/ShareMemoDialog.tsx
+1
-2
UsageHeatMap.tsx
web/src/components/UsageHeatMap.tsx
+1
-2
UserBanner.tsx
web/src/components/UserBanner.tsx
+1
-1
DatePicker.tsx
web/src/components/kit/DatePicker.tsx
+1
-1
DailyReview.tsx
web/src/pages/DailyReview.tsx
+1
-1
Inboxes.tsx
web/src/pages/Inboxes.tsx
+1
-1
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+1
-2
inbox.ts
web/src/store/v1/inbox.ts
+1
-3
index.ts
web/src/store/v1/index.ts
+4
-4
memo.ts
web/src/store/v1/memo.ts
+1
-3
user.ts
web/src/store/v1/user.ts
+1
-3
No files found.
api/v2/inbox_service .go
View file @
39a0e69b
...
@@ -46,7 +46,7 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
...
@@ -46,7 +46,7 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"update mask is required"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"update mask is required"
)
}
}
inboxID
,
err
:=
GetInboxID
(
request
.
Inbox
.
Name
)
inboxID
,
err
:=
ExtractInboxIDFromName
(
request
.
Inbox
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid inbox name: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid inbox name: %v"
,
err
)
}
}
...
@@ -77,7 +77,7 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
...
@@ -77,7 +77,7 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
}
}
func
(
s
*
APIV2Service
)
DeleteInbox
(
ctx
context
.
Context
,
request
*
apiv2pb
.
DeleteInboxRequest
)
(
*
apiv2pb
.
DeleteInboxResponse
,
error
)
{
func
(
s
*
APIV2Service
)
DeleteInbox
(
ctx
context
.
Context
,
request
*
apiv2pb
.
DeleteInboxRequest
)
(
*
apiv2pb
.
DeleteInboxResponse
,
error
)
{
inboxID
,
err
:=
GetInboxID
(
request
.
Name
)
inboxID
,
err
:=
ExtractInboxIDFromName
(
request
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid inbox name: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid inbox name: %v"
,
err
)
}
}
...
...
api/v2/resource_name.go
View file @
39a0e69b
...
@@ -34,8 +34,8 @@ func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error)
...
@@ -34,8 +34,8 @@ func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error)
return
tokens
,
nil
return
tokens
,
nil
}
}
//
GetUsern
ame returns the username from a resource name.
//
ExtractUsernameFromN
ame returns the username from a resource name.
func
GetUsern
ame
(
name
string
)
(
string
,
error
)
{
func
ExtractUsernameFromN
ame
(
name
string
)
(
string
,
error
)
{
tokens
,
err
:=
GetNameParentTokens
(
name
,
UserNamePrefix
)
tokens
,
err
:=
GetNameParentTokens
(
name
,
UserNamePrefix
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
@@ -43,8 +43,8 @@ func GetUsername(name string) (string, error) {
...
@@ -43,8 +43,8 @@ func GetUsername(name string) (string, error) {
return
tokens
[
0
],
nil
return
tokens
[
0
],
nil
}
}
//
GetInboxID
returns the inbox ID from a resource name.
//
ExtractInboxIDFromName
returns the inbox ID from a resource name.
func
GetInboxID
(
name
string
)
(
int32
,
error
)
{
func
ExtractInboxIDFromName
(
name
string
)
(
int32
,
error
)
{
tokens
,
err
:=
GetNameParentTokens
(
name
,
InboxNamePrefix
)
tokens
,
err
:=
GetNameParentTokens
(
name
,
InboxNamePrefix
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
...
...
api/v2/user_service.go
View file @
39a0e69b
...
@@ -28,7 +28,7 @@ var (
...
@@ -28,7 +28,7 @@ var (
)
)
func
(
s
*
APIV2Service
)
GetUser
(
ctx
context
.
Context
,
request
*
apiv2pb
.
GetUserRequest
)
(
*
apiv2pb
.
GetUserResponse
,
error
)
{
func
(
s
*
APIV2Service
)
GetUser
(
ctx
context
.
Context
,
request
*
apiv2pb
.
GetUserRequest
)
(
*
apiv2pb
.
GetUserResponse
,
error
)
{
username
,
err
:=
GetUsern
ame
(
request
.
Name
)
username
,
err
:=
ExtractUsernameFromN
ame
(
request
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
}
}
...
@@ -58,7 +58,7 @@ func (s *APIV2Service) CreateUser(ctx context.Context, request *apiv2pb.CreateUs
...
@@ -58,7 +58,7 @@ func (s *APIV2Service) CreateUser(ctx context.Context, request *apiv2pb.CreateUs
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
}
username
,
err
:=
GetUsern
ame
(
request
.
User
.
Name
)
username
,
err
:=
ExtractUsernameFromN
ame
(
request
.
User
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
}
}
...
@@ -88,7 +88,7 @@ func (s *APIV2Service) CreateUser(ctx context.Context, request *apiv2pb.CreateUs
...
@@ -88,7 +88,7 @@ func (s *APIV2Service) CreateUser(ctx context.Context, request *apiv2pb.CreateUs
}
}
func
(
s
*
APIV2Service
)
UpdateUser
(
ctx
context
.
Context
,
request
*
apiv2pb
.
UpdateUserRequest
)
(
*
apiv2pb
.
UpdateUserResponse
,
error
)
{
func
(
s
*
APIV2Service
)
UpdateUser
(
ctx
context
.
Context
,
request
*
apiv2pb
.
UpdateUserRequest
)
(
*
apiv2pb
.
UpdateUserResponse
,
error
)
{
username
,
err
:=
GetUsern
ame
(
request
.
User
.
Name
)
username
,
err
:=
ExtractUsernameFromN
ame
(
request
.
User
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
}
}
...
@@ -159,7 +159,7 @@ func (s *APIV2Service) ListUserAccessTokens(ctx context.Context, request *apiv2p
...
@@ -159,7 +159,7 @@ func (s *APIV2Service) ListUserAccessTokens(ctx context.Context, request *apiv2p
}
}
userID
:=
user
.
ID
userID
:=
user
.
ID
username
,
err
:=
GetUsern
ame
(
request
.
Name
)
username
,
err
:=
ExtractUsernameFromN
ame
(
request
.
Name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"name is required"
)
}
}
...
...
web/src/components/ChangeMemberPasswordDialog.tsx
View file @
39a0e69b
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
useUser
Store
}
from
"@/store/module
"
;
import
{
useUser
V1Store
,
UserNamePrefix
}
from
"@/store/v1
"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
...
@@ -10,9 +10,9 @@ interface Props extends DialogProps {
...
@@ -10,9 +10,9 @@ interface Props extends DialogProps {
}
}
const
ChangeMemberPasswordDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
ChangeMemberPasswordDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
user
:
propsUser
,
destroy
}
=
props
;
const
{
user
,
destroy
}
=
props
;
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
userStore
=
useUserStore
();
const
userStore
=
useUser
V1
Store
();
const
[
newPassword
,
setNewPassword
]
=
useState
(
""
);
const
[
newPassword
,
setNewPassword
]
=
useState
(
""
);
const
[
newPasswordAgain
,
setNewPasswordAgain
]
=
useState
(
""
);
const
[
newPasswordAgain
,
setNewPasswordAgain
]
=
useState
(
""
);
...
@@ -47,10 +47,13 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
...
@@ -47,10 +47,13 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
}
}
try
{
try
{
await
userStore
.
patchUser
({
await
userStore
.
updateUser
(
id
:
propsUser
.
id
,
{
password
:
newPassword
,
name
:
`
${
UserNamePrefix
}${
user
.
username
}
`
,
});
password
:
newPassword
,
},
[
"password"
]
);
toast
(
t
(
"message.password-changed"
));
toast
(
t
(
"message.password-changed"
));
handleCloseBtnClick
();
handleCloseBtnClick
();
}
catch
(
error
:
any
)
{
}
catch
(
error
:
any
)
{
...
@@ -63,7 +66,7 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
...
@@ -63,7 +66,7 @@ const ChangeMemberPasswordDialog: React.FC<Props> = (props: Props) => {
<>
<>
<
div
className=
"dialog-header-container !w-64"
>
<
div
className=
"dialog-header-container !w-64"
>
<
p
className=
"title-text"
>
<
p
className=
"title-text"
>
{
t
(
"setting.account-section.change-password"
)
}
(
{
propsU
ser
.
username
}
)
{
t
(
"setting.account-section.change-password"
)
}
(
{
u
ser
.
username
}
)
</
p
>
</
p
>
<
button
className=
"btn close-btn"
onClick=
{
handleCloseBtnClick
}
>
<
button
className=
"btn close-btn"
onClick=
{
handleCloseBtnClick
}
>
<
Icon
.
X
/>
<
Icon
.
X
/>
...
...
web/src/components/ChangePasswordDialog.tsx
View file @
39a0e69b
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
useGlobalStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useGlobalStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
,
UserNamePrefix
}
from
"@/store/v1"
;
import
{
UserNamePrefix
}
from
"@/store/v1/resourceName"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
...
...
web/src/components/Header.tsx
View file @
39a0e69b
...
@@ -3,7 +3,7 @@ import { useEffect } from "react";
...
@@ -3,7 +3,7 @@ import { useEffect } from "react";
import
{
NavLink
,
useLocation
}
from
"react-router-dom"
;
import
{
NavLink
,
useLocation
}
from
"react-router-dom"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useLayoutStore
}
from
"@/store/module"
;
import
{
useLayoutStore
}
from
"@/store/module"
;
import
useInboxStore
from
"@/store/v1/inbox
"
;
import
{
useInboxStore
}
from
"@/store/v1
"
;
import
{
Inbox_Status
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
Inbox_Status
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
resolution
}
from
"@/utils/layout"
;
import
{
resolution
}
from
"@/utils/layout"
;
...
...
web/src/components/Inbox/MemoCommentMessage.tsx
View file @
39a0e69b
...
@@ -4,8 +4,7 @@ import { useEffect, useState } from "react";
...
@@ -4,8 +4,7 @@ import { useEffect, useState } from "react";
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
import
{
activityServiceClient
}
from
"@/grpcweb"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useInboxStore
from
"@/store/v1/inbox"
;
import
{
useInboxStore
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
extractUsernameFromName
}
from
"@/store/v1/resourceName"
;
import
{
Activity
}
from
"@/types/proto/api/v2/activity_service"
;
import
{
Activity
}
from
"@/types/proto/api/v2/activity_service"
;
import
{
Inbox
,
Inbox_Status
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
Inbox
,
Inbox_Status
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
...
...
web/src/components/Memo.tsx
View file @
39a0e69b
...
@@ -8,8 +8,7 @@ import { getRelativeTimeString } from "@/helpers/datetime";
...
@@ -8,8 +8,7 @@ import { getRelativeTimeString } from "@/helpers/datetime";
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
{
useFilterStore
,
useMemoStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useFilterStore
,
useMemoStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
extractUsernameFromName
}
from
"@/store/v1/resourceName"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showChangeMemoCreatedTsDialog
from
"./ChangeMemoCreatedTsDialog"
;
import
showChangeMemoCreatedTsDialog
from
"./ChangeMemoCreatedTsDialog"
;
import
{
showCommonDialog
}
from
"./Dialog/CommonDialog"
;
import
{
showCommonDialog
}
from
"./Dialog/CommonDialog"
;
...
...
web/src/components/MemoList.tsx
View file @
39a0e69b
...
@@ -7,7 +7,7 @@ import { getTimeStampByDate } from "@/helpers/datetime";
...
@@ -7,7 +7,7 @@ import { getTimeStampByDate } from "@/helpers/datetime";
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
TAG_REG
}
from
"@/labs/marked/parser"
;
import
{
TAG_REG
}
from
"@/labs/marked/parser"
;
import
{
useFilterStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
useFilterStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
Empty
from
"./Empty"
;
import
Empty
from
"./Empty"
;
import
Memo
from
"./Memo"
;
import
Memo
from
"./Memo"
;
...
...
web/src/components/Settings/AccessTokenSection.tsx
View file @
39a0e69b
...
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
...
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
UserAccessToken
}
from
"@/types/proto/api/v2/user_service"
;
import
{
UserAccessToken
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
...
...
web/src/components/Settings/MyAccountSection.tsx
View file @
39a0e69b
import
{
Button
}
from
"@mui/joy"
;
import
{
Button
}
from
"@mui/joy"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
import
showChangePasswordDialog
from
"../ChangePasswordDialog"
;
import
showUpdateAccountDialog
from
"../UpdateAccountDialog"
;
import
showUpdateAccountDialog
from
"../UpdateAccountDialog"
;
...
...
web/src/components/ShareMemoDialog.tsx
View file @
39a0e69b
...
@@ -5,8 +5,7 @@ import { toast } from "react-hot-toast";
...
@@ -5,8 +5,7 @@ import { toast } from "react-hot-toast";
import
{
getDateTimeString
}
from
"@/helpers/datetime"
;
import
{
getDateTimeString
}
from
"@/helpers/datetime"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
toImage
from
"@/labs/html2image"
;
import
toImage
from
"@/labs/html2image"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
extractUsernameFromName
}
from
"@/store/v1/resourceName"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
{
generateDialog
}
from
"./Dialog"
;
import
showEmbedMemoDialog
from
"./EmbedMemoDialog"
;
import
showEmbedMemoDialog
from
"./EmbedMemoDialog"
;
...
...
web/src/components/UsageHeatMap.tsx
View file @
39a0e69b
...
@@ -5,8 +5,7 @@ import { getDateStampByDate, getDateString, getTimeStampByDate } from "@/helpers
...
@@ -5,8 +5,7 @@ import { getDateStampByDate, getDateString, getTimeStampByDate } from "@/helpers
import
*
as
utils
from
"@/helpers/utils"
;
import
*
as
utils
from
"@/helpers/utils"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useGlobalStore
}
from
"@/store/module"
;
import
{
useGlobalStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
extractUsernameFromName
}
from
"@/store/v1/resourceName"
;
import
{
useTranslate
,
Translations
}
from
"@/utils/i18n"
;
import
{
useTranslate
,
Translations
}
from
"@/utils/i18n"
;
import
{
useFilterStore
,
useMemoStore
}
from
"../store/module"
;
import
{
useFilterStore
,
useMemoStore
}
from
"../store/module"
;
import
"@/less/usage-heat-map.less"
;
import
"@/less/usage-heat-map.less"
;
...
...
web/src/components/UserBanner.tsx
View file @
39a0e69b
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
{
useGlobalStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useGlobalStore
,
useUserStore
}
from
"@/store/module"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
User_Role
}
from
"@/types/proto/api/v2/user_service"
;
import
{
User_Role
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
import
showAboutSiteDialog
from
"./AboutSiteDialog"
;
...
...
web/src/components/kit/DatePicker.tsx
View file @
39a0e69b
...
@@ -5,7 +5,7 @@ import { getMemoStats } from "@/helpers/api";
...
@@ -5,7 +5,7 @@ import { getMemoStats } from "@/helpers/api";
import
{
DAILY_TIMESTAMP
}
from
"@/helpers/consts"
;
import
{
DAILY_TIMESTAMP
}
from
"@/helpers/consts"
;
import
{
getDateStampByDate
,
isFutureDate
}
from
"@/helpers/datetime"
;
import
{
getDateStampByDate
,
isFutureDate
}
from
"@/helpers/datetime"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
Icon
from
"../Icon"
;
import
Icon
from
"../Icon"
;
import
"@/less/common/date-picker.less"
;
import
"@/less/common/date-picker.less"
;
...
...
web/src/pages/DailyReview.tsx
View file @
39a0e69b
...
@@ -15,7 +15,7 @@ import { DAILY_TIMESTAMP, DEFAULT_MEMO_LIMIT } from "@/helpers/consts";
...
@@ -15,7 +15,7 @@ import { DAILY_TIMESTAMP, DEFAULT_MEMO_LIMIT } from "@/helpers/consts";
import
{
getDateStampByDate
,
getNormalizedDateString
,
getTimeStampByDate
,
getTimeString
}
from
"@/helpers/datetime"
;
import
{
getDateStampByDate
,
getNormalizedDateString
,
getTimeStampByDate
,
getTimeString
}
from
"@/helpers/datetime"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useMemoStore
,
useUserStore
}
from
"@/store/module"
;
import
{
useMemoStore
,
useUserStore
}
from
"@/store/module"
;
import
{
extractUsernameFromName
}
from
"@/store/v1
/resourceName
"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
const
DailyReview
=
()
=>
{
const
DailyReview
=
()
=>
{
...
...
web/src/pages/Inboxes.tsx
View file @
39a0e69b
...
@@ -3,7 +3,7 @@ import Empty from "@/components/Empty";
...
@@ -3,7 +3,7 @@ import Empty from "@/components/Empty";
import
Icon
from
"@/components/Icon"
;
import
Icon
from
"@/components/Icon"
;
import
MemoCommentMessage
from
"@/components/Inbox/MemoCommentMessage"
;
import
MemoCommentMessage
from
"@/components/Inbox/MemoCommentMessage"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
useInboxStore
from
"@/store/v1/inbox
"
;
import
{
useInboxStore
}
from
"@/store/v1
"
;
import
{
Inbox_Type
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
Inbox_Type
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
...
...
web/src/pages/MemoDetail.tsx
View file @
39a0e69b
...
@@ -19,8 +19,7 @@ import { getDateTimeString } from "@/helpers/datetime";
...
@@ -19,8 +19,7 @@ import { getDateTimeString } from "@/helpers/datetime";
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
useNavigateTo
from
"@/hooks/useNavigateTo"
;
import
{
useGlobalStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
useGlobalStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
useUserV1Store
}
from
"@/store/v1"
;
import
{
useUserV1Store
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
extractUsernameFromName
}
from
"@/store/v1/resourceName"
;
import
{
User
,
User_Role
}
from
"@/types/proto/api/v2/user_service"
;
import
{
User
,
User_Role
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
...
...
web/src/store/v1/inbox.ts
View file @
39a0e69b
...
@@ -8,7 +8,7 @@ interface InboxStore {
...
@@ -8,7 +8,7 @@ interface InboxStore {
updateInbox
:
(
inbox
:
Partial
<
Inbox
>
,
updateMask
:
string
[])
=>
Promise
<
Inbox
>
;
updateInbox
:
(
inbox
:
Partial
<
Inbox
>
,
updateMask
:
string
[])
=>
Promise
<
Inbox
>
;
}
}
const
useInboxStore
=
create
<
InboxStore
>
()((
set
,
get
)
=>
({
export
const
useInboxStore
=
create
<
InboxStore
>
()((
set
,
get
)
=>
({
inboxes
:
[],
inboxes
:
[],
fetchInboxes
:
async
()
=>
{
fetchInboxes
:
async
()
=>
{
const
{
inboxes
}
=
await
inboxServiceClient
.
listInboxes
({});
const
{
inboxes
}
=
await
inboxServiceClient
.
listInboxes
({});
...
@@ -28,5 +28,3 @@ const useInboxStore = create<InboxStore>()((set, get) => ({
...
@@ -28,5 +28,3 @@ const useInboxStore = create<InboxStore>()((set, get) => ({
return
updatedInbox
;
return
updatedInbox
;
},
},
}));
}));
export
default
useInboxStore
;
web/src/store/v1/index.ts
View file @
39a0e69b
import
useMemoCacheStore
from
"./memo
"
;
export
*
from
"./user
"
;
import
useUserV1Store
from
"./user
"
;
export
*
from
"./memo
"
;
export
*
from
"./inbox"
;
export
{
useUserV1Store
,
useMemoCacheStore
}
;
export
*
from
"./resourceName"
;
web/src/store/v1/memo.ts
View file @
39a0e69b
...
@@ -3,7 +3,7 @@ import { combine } from "zustand/middleware";
...
@@ -3,7 +3,7 @@ import { combine } from "zustand/middleware";
import
*
as
api
from
"@/helpers/api"
;
import
*
as
api
from
"@/helpers/api"
;
import
{
convertResponseModelMemo
}
from
"../module"
;
import
{
convertResponseModelMemo
}
from
"../module"
;
const
useMemoCacheStore
=
create
(
export
const
useMemoCacheStore
=
create
(
combine
({
memoById
:
new
Map
<
MemoId
,
Memo
>
()
},
(
set
,
get
)
=>
({
combine
({
memoById
:
new
Map
<
MemoId
,
Memo
>
()
},
(
set
,
get
)
=>
({
getState
:
()
=>
get
(),
getState
:
()
=>
get
(),
getOrFetchMemoById
:
async
(
memoId
:
MemoId
)
=>
{
getOrFetchMemoById
:
async
(
memoId
:
MemoId
)
=>
{
...
@@ -39,5 +39,3 @@ const useMemoCacheStore = create(
...
@@ -39,5 +39,3 @@ const useMemoCacheStore = create(
},
},
}))
}))
);
);
export
default
useMemoCacheStore
;
web/src/store/v1/user.ts
View file @
39a0e69b
...
@@ -13,7 +13,7 @@ interface UserV1Store {
...
@@ -13,7 +13,7 @@ interface UserV1Store {
// Request cache is used to prevent multiple requests.
// Request cache is used to prevent multiple requests.
const
requestCache
=
new
Map
<
string
,
Promise
<
any
>>
();
const
requestCache
=
new
Map
<
string
,
Promise
<
any
>>
();
const
useUserV1Store
=
create
<
UserV1Store
>
()((
set
,
get
)
=>
({
export
const
useUserV1Store
=
create
<
UserV1Store
>
()((
set
,
get
)
=>
({
userMapByUsername
:
{},
userMapByUsername
:
{},
getOrFetchUserByUsername
:
async
(
username
:
string
)
=>
{
getOrFetchUserByUsername
:
async
(
username
:
string
)
=>
{
const
userMap
=
get
().
userMapByUsername
;
const
userMap
=
get
().
userMapByUsername
;
...
@@ -58,5 +58,3 @@ const useUserV1Store = create<UserV1Store>()((set, get) => ({
...
@@ -58,5 +58,3 @@ const useUserV1Store = create<UserV1Store>()((set, get) => ({
return
updatedUser
;
return
updatedUser
;
},
},
}));
}));
export
default
useUserV1Store
;
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