mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: visibility click filter (#463)
* feat: visibility click filter * update Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
@ -195,6 +195,15 @@ const Memo: React.FC<Props> = (props: Props) => {
|
||||
editorStateService.setEditMemoWithId(memo.id);
|
||||
};
|
||||
|
||||
const handleMemoVisibilityClick = (visibility: Visibility) => {
|
||||
const currVisibilityQuery = locationService.getState().query?.visibility;
|
||||
if (currVisibilityQuery === visibility) {
|
||||
locationService.setMemoVisibilityQuery(undefined);
|
||||
} else {
|
||||
locationService.setMemoVisibilityQuery(visibility);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`memo-wrapper ${"memos-" + memo.id} ${memo.pinned ? "pinned" : ""}`} ref={memoContainerRef}>
|
||||
{memo.pinned && <div className="corner-container"></div>}
|
||||
@ -204,7 +213,12 @@ const Memo: React.FC<Props> = (props: Props) => {
|
||||
{displayTimeStr}
|
||||
</span>
|
||||
{memo.visibility !== "PRIVATE" && !isVisitorMode && (
|
||||
<span className={`status-text ${memo.visibility.toLocaleLowerCase()}`}>{memo.visibility}</span>
|
||||
<span
|
||||
className={`status-text ${memo.visibility.toLocaleLowerCase()}`}
|
||||
onClick={() => handleMemoVisibilityClick(memo.visibility)}
|
||||
>
|
||||
{memo.visibility}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{!isVisitorMode && (
|
||||
|
Reference in New Issue
Block a user