Skip to content

Commit

Permalink
chore: change memo created time (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack authored Nov 24, 2022
1 parent 1d41d53 commit 50d41c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions web/src/components/ChangeMemoCreatedTsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
9 changes: 8 additions & 1 deletion web/src/components/Memo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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()}`}
Expand Down

0 comments on commit 50d41c4

Please sign in to comment.