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
2a4fc7dc
Unverified
Commit
2a4fc7dc
authored
Oct 21, 2022
by
boojack
Committed by
GitHub
Oct 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update memo display time (#327)
* chore: update memo display time * chore: update
parent
b68d6e26
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
59 additions
and
73 deletions
+59
-73
user_setting.go
api/user_setting.go
+16
-16
memo.go
store/memo.go
+8
-8
ArchivedMemo.tsx
web/src/components/ArchivedMemo.tsx
+2
-7
DailyMemo.tsx
web/src/components/DailyMemo.tsx
+3
-12
DailyReviewDialog.tsx
web/src/components/DailyReviewDialog.tsx
+3
-3
MemoCardDialog.tsx
web/src/components/MemoCardDialog.tsx
+7
-7
MemoList.tsx
web/src/components/MemoList.tsx
+3
-3
PreferencesSection.tsx
web/src/components/Settings/PreferencesSection.tsx
+7
-7
ShareMemoImageDialog.tsx
web/src/components/ShareMemoImageDialog.tsx
+1
-1
UsageHeatMap.tsx
web/src/components/UsageHeatMap.tsx
+1
-1
consts.ts
web/src/helpers/consts.ts
+1
-1
en.json
web/src/locales/en.json
+1
-1
zh.json
web/src/locales/zh.json
+2
-2
Explore.tsx
web/src/pages/Explore.tsx
+1
-1
MemoDetail.tsx
web/src/pages/MemoDetail.tsx
+1
-1
userService.ts
web/src/services/userService.ts
+1
-1
setting.d.ts
web/src/types/modules/setting.d.ts
+1
-1
No files found.
api/user_setting.go
View file @
2a4fc7dc
...
@@ -16,8 +16,8 @@ const (
...
@@ -16,8 +16,8 @@ const (
UserSettingEditorFontStyleKey
UserSettingKey
=
"editorFontStyle"
UserSettingEditorFontStyleKey
UserSettingKey
=
"editorFontStyle"
// UserSettingEditorFontStyleKey is the key type for mobile editor style.
// UserSettingEditorFontStyleKey is the key type for mobile editor style.
UserSettingMobileEditorStyleKey
UserSettingKey
=
"mobileEditorStyle"
UserSettingMobileEditorStyleKey
UserSettingKey
=
"mobileEditorStyle"
// UserSettingMemo
SortOptionKey is the key type for memo sort
option.
// UserSettingMemo
DisplayTsOptionKey is the key type for memo display ts
option.
UserSettingMemo
Sort
OptionKey
UserSettingKey
=
"memoSortOption"
UserSettingMemo
DisplayTs
OptionKey
UserSettingKey
=
"memoSortOption"
)
)
// String returns the string format of UserSettingKey type.
// String returns the string format of UserSettingKey type.
...
@@ -31,18 +31,18 @@ func (key UserSettingKey) String() string {
...
@@ -31,18 +31,18 @@ func (key UserSettingKey) String() string {
return
"editorFontFamily"
return
"editorFontFamily"
case
UserSettingMobileEditorStyleKey
:
case
UserSettingMobileEditorStyleKey
:
return
"mobileEditorStyle"
return
"mobileEditorStyle"
case
UserSettingMemo
Sort
OptionKey
:
case
UserSettingMemo
DisplayTs
OptionKey
:
return
"memo
Sort
Option"
return
"memo
DisplayTs
Option"
}
}
return
""
return
""
}
}
var
(
var
(
UserSettingLocaleValue
=
[]
string
{
"en"
,
"zh"
,
"vi"
}
UserSettingLocaleValue
=
[]
string
{
"en"
,
"zh"
,
"vi"
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Privite
,
Protected
,
Public
}
UserSettingMemoVisibilityValue
=
[]
Visibility
{
Privite
,
Protected
,
Public
}
UserSettingEditorFontStyleValue
=
[]
string
{
"normal"
,
"mono"
}
UserSettingEditorFontStyleValue
=
[]
string
{
"normal"
,
"mono"
}
UserSettingMobileEditorStyleValue
=
[]
string
{
"normal"
,
"float"
}
UserSettingMobileEditorStyleValue
=
[]
string
{
"normal"
,
"float"
}
UserSettingMemo
Sort
OptionKeyValue
=
[]
string
{
"created_ts"
,
"updated_ts"
}
UserSettingMemo
DisplayTs
OptionKeyValue
=
[]
string
{
"created_ts"
,
"updated_ts"
}
)
)
type
UserSetting
struct
{
type
UserSetting
struct
{
...
@@ -127,22 +127,22 @@ func (upsert UserSettingUpsert) Validate() error {
...
@@ -127,22 +127,22 @@ func (upsert UserSettingUpsert) Validate() error {
if
invalid
{
if
invalid
{
return
fmt
.
Errorf
(
"invalid user setting mobile editor style value"
)
return
fmt
.
Errorf
(
"invalid user setting mobile editor style value"
)
}
}
}
else
if
upsert
.
Key
==
UserSettingMemo
Sort
OptionKey
{
}
else
if
upsert
.
Key
==
UserSettingMemo
DisplayTs
OptionKey
{
memo
Sort
Option
:=
"created_ts"
memo
DisplayTs
Option
:=
"created_ts"
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
memo
Sort
Option
)
err
:=
json
.
Unmarshal
([]
byte
(
upsert
.
Value
),
&
memo
DisplayTs
Option
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to unmarshal user setting memo
sort
option"
)
return
fmt
.
Errorf
(
"failed to unmarshal user setting memo
display ts
option"
)
}
}
invalid
:=
true
invalid
:=
true
for
_
,
value
:=
range
UserSettingMemo
Sort
OptionKeyValue
{
for
_
,
value
:=
range
UserSettingMemo
DisplayTs
OptionKeyValue
{
if
memo
Sort
Option
==
value
{
if
memo
DisplayTs
Option
==
value
{
invalid
=
false
invalid
=
false
break
break
}
}
}
}
if
invalid
{
if
invalid
{
return
fmt
.
Errorf
(
"invalid user setting memo
sort
option value"
)
return
fmt
.
Errorf
(
"invalid user setting memo
display ts
option value"
)
}
}
}
else
{
}
else
{
return
fmt
.
Errorf
(
"invalid user setting key"
)
return
fmt
.
Errorf
(
"invalid user setting key"
)
...
...
store/memo.go
View file @
2a4fc7dc
...
@@ -64,22 +64,22 @@ func (s *Store) ComposeMemo(ctx context.Context, memo *api.Memo) (*api.Memo, err
...
@@ -64,22 +64,22 @@ func (s *Store) ComposeMemo(ctx context.Context, memo *api.Memo) (*api.Memo, err
return
nil
,
err
return
nil
,
err
}
}
memo
SortOptionKey
:=
api
.
UserSettingMemoSort
OptionKey
memo
DisplayTsOptionKey
:=
api
.
UserSettingMemoDisplayTs
OptionKey
memo
SortOption
,
err
:=
s
.
FindUserSetting
(
ctx
,
&
api
.
UserSettingFind
{
memo
DisplayTsOptionSetting
,
err
:=
s
.
FindUserSetting
(
ctx
,
&
api
.
UserSettingFind
{
UserID
:
memo
.
CreatorID
,
UserID
:
memo
.
CreatorID
,
Key
:
&
memo
Sort
OptionKey
,
Key
:
&
memo
DisplayTs
OptionKey
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
memo
Sort
OptionValue
:=
"created_ts"
memo
DisplayTs
OptionValue
:=
"created_ts"
if
memo
SortOption
!=
nil
{
if
memo
DisplayTsOptionSetting
!=
nil
{
err
=
json
.
Unmarshal
([]
byte
(
memo
SortOption
.
Value
),
&
memoSort
OptionValue
)
err
=
json
.
Unmarshal
([]
byte
(
memo
DisplayTsOptionSetting
.
Value
),
&
memoDisplayTs
OptionValue
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to unmarshal user setting memo
sort
option value"
)
return
nil
,
fmt
.
Errorf
(
"failed to unmarshal user setting memo
display ts
option value"
)
}
}
}
}
if
memo
Sort
OptionValue
==
"updated_ts"
{
if
memo
DisplayTs
OptionValue
==
"updated_ts"
{
memo
.
DisplayTs
=
memo
.
UpdatedTs
memo
.
DisplayTs
=
memo
.
UpdatedTs
}
}
...
...
web/src/components/ArchivedMemo.tsx
View file @
2a4fc7dc
...
@@ -12,12 +12,7 @@ interface Props {
...
@@ -12,12 +12,7 @@ interface Props {
}
}
const
ArchivedMemo
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
ArchivedMemo
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
memo
:
propsMemo
}
=
props
;
const
{
memo
}
=
props
;
const
memo
=
{
...
propsMemo
,
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
createdTs
),
archivedAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
updatedTs
??
Date
.
now
()),
};
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
const
[
showConfirmDeleteBtn
,
toggleConfirmDeleteBtn
]
=
useToggle
(
false
);
...
@@ -60,7 +55,7 @@ const ArchivedMemo: React.FC<Props> = (props: Props) => {
...
@@ -60,7 +55,7 @@ const ArchivedMemo: React.FC<Props> = (props: Props) => {
<
div
className=
{
`memo-wrapper archived-memo ${"memos-" + memo.id}`
}
onMouseLeave=
{
handleMouseLeaveMemoWrapper
}
>
<
div
className=
{
`memo-wrapper archived-memo ${"memos-" + memo.id}`
}
onMouseLeave=
{
handleMouseLeaveMemoWrapper
}
>
<
div
className=
"memo-top-wrapper"
>
<
div
className=
"memo-top-wrapper"
>
<
span
className=
"time-text"
>
<
span
className=
"time-text"
>
{
t
(
"common.archived-at"
)
}
{
memo
.
archivedAtStr
}
{
t
(
"common.archived-at"
)
}
{
utils
.
getDateTimeString
(
memo
.
updatedTs
)
}
</
span
>
</
span
>
<
div
className=
"btns-container"
>
<
div
className=
"btns-container"
>
<
span
className=
"btn restore-btn"
onClick=
{
handleRestoreMemoClick
}
>
<
span
className=
"btn restore-btn"
onClick=
{
handleRestoreMemoClick
}
>
...
...
web/src/components/DailyMemo.tsx
View file @
2a4fc7dc
...
@@ -3,22 +3,13 @@ import MemoContent, { DisplayConfig } from "./MemoContent";
...
@@ -3,22 +3,13 @@ import MemoContent, { DisplayConfig } from "./MemoContent";
import
MemoResources
from
"./MemoResources"
;
import
MemoResources
from
"./MemoResources"
;
import
"../less/daily-memo.less"
;
import
"../less/daily-memo.less"
;
interface
DailyMemo
extends
Memo
{
createdAtStr
:
string
;
timeStr
:
string
;
}
interface
Props
{
interface
Props
{
memo
:
Memo
;
memo
:
Memo
;
}
}
const
DailyMemo
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
DailyMemo
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
memo
:
propsMemo
}
=
props
;
const
{
memo
}
=
props
;
const
memo
:
DailyMemo
=
{
const
displayTimeStr
=
utils
.
getTimeString
(
memo
.
displayTs
);
...
propsMemo
,
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
createdTs
),
timeStr
:
utils
.
getTimeString
(
propsMemo
.
createdTs
),
};
const
displayConfig
:
DisplayConfig
=
{
const
displayConfig
:
DisplayConfig
=
{
enableExpand
:
false
,
enableExpand
:
false
,
};
};
...
@@ -26,7 +17,7 @@ const DailyMemo: React.FC<Props> = (props: Props) => {
...
@@ -26,7 +17,7 @@ const DailyMemo: React.FC<Props> = (props: Props) => {
return
(
return
(
<
div
className=
"daily-memo-wrapper"
>
<
div
className=
"daily-memo-wrapper"
>
<
div
className=
"time-wrapper"
>
<
div
className=
"time-wrapper"
>
<
span
className=
"normal-text"
>
{
memo
.
t
imeStr
}
</
span
>
<
span
className=
"normal-text"
>
{
displayT
imeStr
}
</
span
>
</
div
>
</
div
>
<
div
className=
"memo-container"
>
<
div
className=
"memo-container"
>
<
MemoContent
content=
{
memo
.
content
}
displayConfig=
{
displayConfig
}
/>
<
MemoContent
content=
{
memo
.
content
}
displayConfig=
{
displayConfig
}
/>
...
...
web/src/components/DailyReviewDialog.tsx
View file @
2a4fc7dc
...
@@ -30,10 +30,10 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
...
@@ -30,10 +30,10 @@ const DailyReviewDialog: React.FC<Props> = (props: Props) => {
.
filter
(
.
filter
(
(
m
)
=>
(
m
)
=>
m
.
rowStatus
===
"NORMAL"
&&
m
.
rowStatus
===
"NORMAL"
&&
utils
.
getTimeStampByDate
(
m
.
created
Ts
)
>=
currentDateStamp
&&
utils
.
getTimeStampByDate
(
m
.
display
Ts
)
>=
currentDateStamp
&&
utils
.
getTimeStampByDate
(
m
.
created
Ts
)
<
currentDateStamp
+
DAILY_TIMESTAMP
utils
.
getTimeStampByDate
(
m
.
display
Ts
)
<
currentDateStamp
+
DAILY_TIMESTAMP
)
)
.
sort
((
a
,
b
)
=>
utils
.
getTimeStampByDate
(
a
.
createdTs
)
-
utils
.
getTimeStampByDate
(
b
.
created
Ts
));
.
sort
((
a
,
b
)
=>
utils
.
getTimeStampByDate
(
a
.
displayTs
)
-
utils
.
getTimeStampByDate
(
b
.
display
Ts
));
const
handleShareBtnClick
=
()
=>
{
const
handleShareBtnClick
=
()
=>
{
if
(
!
memosElRef
.
current
)
{
if
(
!
memosElRef
.
current
)
{
...
...
web/src/components/MemoCardDialog.tsx
View file @
2a4fc7dc
...
@@ -58,8 +58,8 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -58,8 +58,8 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
if
(
memoTemp
)
{
if
(
memoTemp
)
{
linkMemos
.
push
({
linkMemos
.
push
({
...
memoTemp
,
...
memoTemp
,
createdAtStr
:
utils
.
getDateTimeString
(
memoTemp
.
created
Ts
),
createdAtStr
:
utils
.
getDateTimeString
(
memoTemp
.
display
Ts
),
dateStr
:
utils
.
getDateString
(
memoTemp
.
created
Ts
),
dateStr
:
utils
.
getDateString
(
memoTemp
.
display
Ts
),
});
});
}
}
}
}
...
@@ -70,11 +70,11 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -70,11 +70,11 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
setLinkedMemos
(
setLinkedMemos
(
linkedMemos
linkedMemos
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
&&
m
.
id
!==
memo
.
id
)
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
&&
m
.
id
!==
memo
.
id
)
.
sort
((
a
,
b
)
=>
utils
.
getTimeStampByDate
(
b
.
createdTs
)
-
utils
.
getTimeStampByDate
(
a
.
created
Ts
))
.
sort
((
a
,
b
)
=>
utils
.
getTimeStampByDate
(
b
.
displayTs
)
-
utils
.
getTimeStampByDate
(
a
.
display
Ts
))
.
map
((
m
)
=>
({
.
map
((
m
)
=>
({
...
m
,
...
m
,
createdAtStr
:
utils
.
getDateTimeString
(
m
.
created
Ts
),
createdAtStr
:
utils
.
getDateTimeString
(
m
.
display
Ts
),
dateStr
:
utils
.
getDateString
(
m
.
created
Ts
),
dateStr
:
utils
.
getDateString
(
m
.
display
Ts
),
}))
}))
);
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -104,7 +104,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -104,7 +104,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
if
(
memoTemp
)
{
if
(
memoTemp
)
{
const
nextMemo
=
{
const
nextMemo
=
{
...
memoTemp
,
...
memoTemp
,
createdAtStr
:
utils
.
getDateTimeString
(
memoTemp
.
created
Ts
),
createdAtStr
:
utils
.
getDateTimeString
(
memoTemp
.
display
Ts
),
};
};
setLinkMemos
([]);
setLinkMemos
([]);
setLinkedMemos
([]);
setLinkedMemos
([]);
...
@@ -169,7 +169,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
...
@@ -169,7 +169,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
<
div
className=
"memo-card-container"
>
<
div
className=
"memo-card-container"
>
<
div
className=
"header-container"
>
<
div
className=
"header-container"
>
<
p
className=
"time-text"
onClick=
{
handleMemoCreatedAtClick
}
>
<
p
className=
"time-text"
onClick=
{
handleMemoCreatedAtClick
}
>
{
utils
.
getDateTimeString
(
memo
.
created
Ts
)
}
{
utils
.
getDateTimeString
(
memo
.
display
Ts
)
}
</
p
>
</
p
>
<
div
className=
"btns-container"
>
<
div
className=
"btns-container"
>
{
!
isVisitorMode
&&
(
{
!
isVisitorMode
&&
(
...
...
web/src/components/MemoList.tsx
View file @
2a4fc7dc
...
@@ -12,7 +12,7 @@ import "../less/memo-list.less";
...
@@ -12,7 +12,7 @@ import "../less/memo-list.less";
const
MemoList
=
()
=>
{
const
MemoList
=
()
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
query
=
useAppSelector
((
state
)
=>
state
.
location
.
query
);
const
memo
SortOption
=
useAppSelector
((
state
)
=>
state
.
user
.
user
?.
setting
.
memoSort
Option
);
const
memo
DisplayTsOption
=
useAppSelector
((
state
)
=>
state
.
user
.
user
?.
setting
.
memoDisplayTs
Option
);
const
{
memos
,
isFetching
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
{
memos
,
isFetching
}
=
useAppSelector
((
state
)
=>
state
.
memo
);
const
{
tag
:
tagQuery
,
duration
,
type
:
memoType
,
text
:
textQuery
,
shortcutId
}
=
query
??
{};
const
{
tag
:
tagQuery
,
duration
,
type
:
memoType
,
text
:
textQuery
,
shortcutId
}
=
query
??
{};
...
@@ -50,7 +50,7 @@ const MemoList = () => {
...
@@ -50,7 +50,7 @@ const MemoList = () => {
if
(
if
(
duration
&&
duration
&&
duration
.
from
<
duration
.
to
&&
duration
.
from
<
duration
.
to
&&
(
utils
.
getTimeStampByDate
(
memo
.
createdTs
)
<
duration
.
from
||
utils
.
getTimeStampByDate
(
memo
.
created
Ts
)
>
duration.to)
(
utils
.
getTimeStampByDate
(
memo
.
displayTs
)
<
duration
.
from
||
utils
.
getTimeStampByDate
(
memo
.
display
Ts
)
>
duration.to)
)
{
)
{
shouldShow
=
false
;
shouldShow
=
false
;
}
}
...
@@ -88,7 +88,7 @@ const MemoList = () => {
...
@@ -88,7 +88,7 @@ const MemoList = () => {
console
.
error
(
error
);
console
.
error
(
error
);
toastHelper
.
error
(
error
.
response
.
data
.
message
);
toastHelper
.
error
(
error
.
response
.
data
.
message
);
});
});
}
, [memo
Sort
Option]);
}
, [memo
DisplayTs
Option]);
useEffect(() =
>
{
useEffect(() =
>
{
const
pageWrapper
=
document
.
body
.
querySelector
(
".page-wrapper"
);
const
pageWrapper
=
document
.
body
.
querySelector
(
".page-wrapper"
);
...
...
web/src/components/Settings/PreferencesSection.tsx
View file @
2a4fc7dc
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
globalService
,
userService
}
from
"../../services"
;
import
{
globalService
,
userService
}
from
"../../services"
;
import
{
useAppSelector
}
from
"../../store"
;
import
{
useAppSelector
}
from
"../../store"
;
import
{
VISIBILITY_SELECTOR_ITEMS
,
MEMO_
SORT
_OPTION_SELECTOR_ITEMS
}
from
"../../helpers/consts"
;
import
{
VISIBILITY_SELECTOR_ITEMS
,
MEMO_
DISPLAY_TS
_OPTION_SELECTOR_ITEMS
}
from
"../../helpers/consts"
;
import
Selector
from
"../common/Selector"
;
import
Selector
from
"../common/Selector"
;
import
"../../less/settings/preferences-section.less"
;
import
"../../less/settings/preferences-section.less"
;
...
@@ -52,7 +52,7 @@ const PreferencesSection = () => {
...
@@ -52,7 +52,7 @@ const PreferencesSection = () => {
};
};
});
});
const
memo
SortOptionSelectorItems
=
MEMO_SORT
_OPTION_SELECTOR_ITEMS
.
map
((
item
)
=>
{
const
memo
DisplayTsOptionSelectorItems
=
MEMO_DISPLAY_TS
_OPTION_SELECTOR_ITEMS
.
map
((
item
)
=>
{
return
{
return
{
value
:
item
.
value
,
value
:
item
.
value
,
text
:
t
(
`setting.preference-section.
${
item
.
value
}
`
),
text
:
t
(
`setting.preference-section.
${
item
.
value
}
`
),
...
@@ -76,8 +76,8 @@ const PreferencesSection = () => {
...
@@ -76,8 +76,8 @@ const PreferencesSection = () => {
await
userService
.
upsertUserSetting
(
"mobileEditorStyle"
,
value
);
await
userService
.
upsertUserSetting
(
"mobileEditorStyle"
,
value
);
};
};
const
handleMemo
Sort
OptionChanged
=
async
(
value
:
string
)
=>
{
const
handleMemo
DisplayTs
OptionChanged
=
async
(
value
:
string
)
=>
{
await
userService
.
upsertUserSetting
(
"memo
Sort
Option"
,
value
);
await
userService
.
upsertUserSetting
(
"memo
DisplayTs
Option"
,
value
);
};
};
return
(
return
(
...
@@ -119,9 +119,9 @@ const PreferencesSection = () => {
...
@@ -119,9 +119,9 @@ const PreferencesSection = () => {
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.default-memo-sort-option"
)
}
</
span
>
<
span
className=
"normal-text"
>
{
t
(
"setting.preference-section.default-memo-sort-option"
)
}
</
span
>
<
Selector
<
Selector
className=
"ml-2 w-32"
className=
"ml-2 w-32"
value=
{
setting
.
memo
Sort
Option
}
value=
{
setting
.
memo
DisplayTs
Option
}
dataSource=
{
memo
Sort
OptionSelectorItems
}
dataSource=
{
memo
DisplayTs
OptionSelectorItems
}
handleValueChanged=
{
handleMemo
Sort
OptionChanged
}
handleValueChanged=
{
handleMemo
DisplayTs
OptionChanged
}
/>
/>
</
label
>
</
label
>
</
div
>
</
div
>
...
...
web/src/components/ShareMemoImageDialog.tsx
View file @
2a4fc7dc
...
@@ -20,7 +20,7 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
...
@@ -20,7 +20,7 @@ const ShareMemoImageDialog: React.FC<Props> = (props: Props) => {
const
[
shortcutImgUrl
,
setShortcutImgUrl
]
=
useState
(
""
);
const
[
shortcutImgUrl
,
setShortcutImgUrl
]
=
useState
(
""
);
const
memo
=
{
const
memo
=
{
...
propsMemo
,
...
propsMemo
,
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
created
Ts
),
createdAtStr
:
utils
.
getDateTimeString
(
propsMemo
.
display
Ts
),
};
};
const
memoElRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
memoElRef
=
useRef
<
HTMLDivElement
>
(
null
);
...
...
web/src/components/UsageHeatMap.tsx
View file @
2a4fc7dc
...
@@ -41,7 +41,7 @@ const UsageHeatMap = () => {
...
@@ -41,7 +41,7 @@ const UsageHeatMap = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
const
newStat
:
DailyUsageStat
[]
=
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimestemp
);
const
newStat
:
DailyUsageStat
[]
=
getInitialUsageStat
(
usedDaysAmount
,
beginDayTimestemp
);
for
(
const
m
of
memos
)
{
for
(
const
m
of
memos
)
{
const
index
=
(
utils
.
getDateStampByDate
(
m
.
created
Ts
)
-
beginDayTimestemp
)
/
(
1000
*
3600
*
24
)
-
1
;
const
index
=
(
utils
.
getDateStampByDate
(
m
.
display
Ts
)
-
beginDayTimestemp
)
/
(
1000
*
3600
*
24
)
-
1
;
if
(
index
>=
0
)
{
if
(
index
>=
0
)
{
newStat
[
index
].
count
+=
1
;
newStat
[
index
].
count
+=
1
;
}
}
...
...
web/src/helpers/consts.ts
View file @
2a4fc7dc
...
@@ -13,7 +13,7 @@ export const VISIBILITY_SELECTOR_ITEMS = [
...
@@ -13,7 +13,7 @@ export const VISIBILITY_SELECTOR_ITEMS = [
{
text
:
"PRIVATE"
,
value
:
"PRIVATE"
},
{
text
:
"PRIVATE"
,
value
:
"PRIVATE"
},
];
];
export
const
MEMO_
SORT
_OPTION_SELECTOR_ITEMS
=
[
export
const
MEMO_
DISPLAY_TS
_OPTION_SELECTOR_ITEMS
=
[
{
text
:
"created_ts"
,
value
:
"created_ts"
},
{
text
:
"created_ts"
,
value
:
"created_ts"
},
{
text
:
"created_ts"
,
value
:
"updated_ts"
},
{
text
:
"created_ts"
,
value
:
"updated_ts"
},
];
];
...
...
web/src/locales/en.json
View file @
2a4fc7dc
...
@@ -130,7 +130,7 @@
...
@@ -130,7 +130,7 @@
"default-memo-visibility"
:
"Default memo visibility"
,
"default-memo-visibility"
:
"Default memo visibility"
,
"editor-font-style"
:
"Editor font style"
,
"editor-font-style"
:
"Editor font style"
,
"mobile-editor-style"
:
"Mobile editor style"
,
"mobile-editor-style"
:
"Mobile editor style"
,
"default-memo-sort-option"
:
"
Sort by created time
/updated time"
,
"default-memo-sort-option"
:
"
Display by created
/updated time"
,
"created_ts"
:
"Created Time"
,
"created_ts"
:
"Created Time"
,
"updated_ts"
:
"Updated Time"
"updated_ts"
:
"Updated Time"
},
},
...
...
web/src/locales/zh.json
View file @
2a4fc7dc
...
@@ -130,7 +130,7 @@
...
@@ -130,7 +130,7 @@
"default-memo-visibility"
:
"默认 Memo 可见性"
,
"default-memo-visibility"
:
"默认 Memo 可见性"
,
"editor-font-style"
:
"编辑器字体样式"
,
"editor-font-style"
:
"编辑器字体样式"
,
"mobile-editor-style"
:
"移动端编辑器样式"
,
"mobile-editor-style"
:
"移动端编辑器样式"
,
"default-memo-sort-option"
:
"按创建时间/更新时间
排序
"
,
"default-memo-sort-option"
:
"按创建时间/更新时间
显示
"
,
"created_ts"
:
"创建时间"
,
"created_ts"
:
"创建时间"
,
"updated_ts"
:
"更新时间"
"updated_ts"
:
"更新时间"
},
},
...
@@ -163,4 +163,4 @@
...
@@ -163,4 +163,4 @@
"copied"
:
"已复制"
,
"copied"
:
"已复制"
,
"succeed-copy-content"
:
"复制内容到剪贴板成功。"
"succeed-copy-content"
:
"复制内容到剪贴板成功。"
}
}
}
}
\ No newline at end of file
web/src/pages/Explore.tsx
View file @
2a4fc7dc
...
@@ -55,7 +55,7 @@ const Explore = () => {
...
@@ -55,7 +55,7 @@ const Explore = () => {
<
main
className=
"memos-wrapper"
>
<
main
className=
"memos-wrapper"
>
{
state
.
memos
.
length
>
0
?
(
{
state
.
memos
.
length
>
0
?
(
state
.
memos
.
map
((
memo
)
=>
{
state
.
memos
.
map
((
memo
)
=>
{
const
createdAtStr
=
dayjs
(
memo
.
created
Ts
).
locale
(
i18n
.
language
).
format
(
"YYYY/MM/DD HH:mm:ss"
);
const
createdAtStr
=
dayjs
(
memo
.
display
Ts
).
locale
(
i18n
.
language
).
format
(
"YYYY/MM/DD HH:mm:ss"
);
return
(
return
(
<
div
className=
"memo-container"
key=
{
memo
.
id
}
>
<
div
className=
"memo-container"
key=
{
memo
.
id
}
>
<
div
className=
"memo-header"
>
<
div
className=
"memo-header"
>
...
...
web/src/pages/MemoDetail.tsx
View file @
2a4fc7dc
...
@@ -99,7 +99,7 @@ const MemoDetail = () => {
...
@@ -99,7 +99,7 @@ const MemoDetail = () => {
<
div
className=
"memo-container"
>
<
div
className=
"memo-container"
>
<
div
className=
"memo-header"
>
<
div
className=
"memo-header"
>
<
div
className=
"status-container"
>
<
div
className=
"status-container"
>
<
span
className=
"time-text"
>
{
dayjs
(
state
.
memo
.
created
Ts
).
locale
(
i18n
.
language
).
format
(
"YYYY/MM/DD HH:mm:ss"
)
}
</
span
>
<
span
className=
"time-text"
>
{
dayjs
(
state
.
memo
.
display
Ts
).
locale
(
i18n
.
language
).
format
(
"YYYY/MM/DD HH:mm:ss"
)
}
</
span
>
{
user
?.
id
===
state
.
memo
.
creatorId
?
(
{
user
?.
id
===
state
.
memo
.
creatorId
?
(
<
Dropdown
<
Dropdown
className=
"visibility-selector"
className=
"visibility-selector"
...
...
web/src/services/userService.ts
View file @
2a4fc7dc
...
@@ -8,7 +8,7 @@ const defauleSetting: Setting = {
...
@@ -8,7 +8,7 @@ const defauleSetting: Setting = {
memoVisibility
:
"PRIVATE"
,
memoVisibility
:
"PRIVATE"
,
editorFontStyle
:
"normal"
,
editorFontStyle
:
"normal"
,
mobileEditorStyle
:
"normal"
,
mobileEditorStyle
:
"normal"
,
memo
Sort
Option
:
"created_ts"
,
memo
DisplayTs
Option
:
"created_ts"
,
};
};
export
const
convertResponseModelUser
=
(
user
:
User
):
User
=>
{
export
const
convertResponseModelUser
=
(
user
:
User
):
User
=>
{
...
...
web/src/types/modules/setting.d.ts
View file @
2a4fc7dc
...
@@ -3,7 +3,7 @@ interface Setting {
...
@@ -3,7 +3,7 @@ interface Setting {
memoVisibility
:
Visibility
;
memoVisibility
:
Visibility
;
editorFontStyle
:
"normal"
|
"mono"
;
editorFontStyle
:
"normal"
|
"mono"
;
mobileEditorStyle
:
"normal"
|
"float"
;
mobileEditorStyle
:
"normal"
|
"float"
;
memo
Sort
Option
:
"created_ts"
|
"updated_ts"
;
memo
DisplayTs
Option
:
"created_ts"
|
"updated_ts"
;
}
}
interface
UserLocaleSetting
{
interface
UserLocaleSetting
{
...
...
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