Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: change memo created time (#556)

boojack50d41c456b41
diff --git a/web/src/components/ChangeMemoCreatedTsDialog.tsx b/web/src/components/ChangeMemoCreatedTsDialog.tsx
index b3fc7bafc..8cf300395 100644
--- a/web/src/components/ChangeMemoCreatedTsDialog.tsx
+++ b/web/src/components/ChangeMemoCreatedTsDialog.tsx
@@ -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>
diff --git a/web/src/components/Memo.tsx b/web/src/components/Memo.tsx
index 25f05bc10..3ab5e69d1 100644
--- a/web/src/components/Memo.tsx
+++ b/web/src/components/Memo.tsx
@@ -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()}`}