chore: change memo created time (#556)

This commit is contained in:
boojack 2022-11-24 19:55:52 +08:00 committed by GitHub
parent 1d41d53723
commit 50d41c456b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -69,6 +69,9 @@ const ChangeMemoCreatedTsDialog: React.FC<Props> = (props: Props) => {
</button>
</div>
<div className="dialog-content-container">
<p className="w-full bg-yellow-100 border border-yellow-400 rounded p-2 text-xs leading-4">
THIS IS NOT A NORMAL BEHAVIOR. PLEASE MAKE SURE YOU REALLY NEED IT.
</p>
<label className="form-label input-form-label">
<input type="datetime-local" value={createdAt} max={maxDatetimeValue} onChange={handleDatetimeInputChange} />
</label>

View file

@ -12,6 +12,7 @@ import MemoContent from "./MemoContent";
import MemoResources from "./MemoResources";
import showShareMemoImageDialog from "./ShareMemoImageDialog";
import showPreviewImageDialog from "./PreviewImageDialog";
import showChangeMemoCreatedTsDialog from "./ChangeMemoCreatedTsDialog";
import "../less/memo.less";
dayjs.extend(relativeTime);
@ -171,6 +172,10 @@ const Memo: React.FC<Props> = (props: Props) => {
editorStateService.setEditMemoWithId(memo.id);
};
const handleMemoDisplayTimeClick = () => {
showChangeMemoCreatedTsDialog(memo.id);
};
const handleMemoVisibilityClick = (visibility: Visibility) => {
const currVisibilityQuery = locationService.getState().query?.visibility;
if (currVisibilityQuery === visibility) {
@ -185,7 +190,9 @@ const Memo: React.FC<Props> = (props: Props) => {
{memo.pinned && <div className="corner-container"></div>}
<div className="memo-top-wrapper">
<div className="status-text-container">
<span className="time-text">{displayTimeStr}</span>
<span className="time-text" onDoubleClick={handleMemoDisplayTimeClick}>
{displayTimeStr}
</span>
{memo.visibility !== "PRIVATE" && !isVisitorMode && (
<span
className={`status-text ${memo.visibility.toLocaleLowerCase()}`}