Skip to content

Commit 33c3bf0

Browse files
authored
Merge pull request #8919 from streetwriters/web/show-monograph-view-count
web: show monograph's view count
2 parents cc58446 + 2fc3cc3 commit 33c3bf0

File tree

9 files changed

+413
-330
lines changed

9 files changed

+413
-330
lines changed

apps/web/src/components/editor/action-bar.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type ToolButton = {
9191
hidden?: boolean;
9292
hideOnMobile?: boolean;
9393
toggled?: boolean;
94-
onClick: () => void;
94+
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
9595
};
9696

9797
export function EditorActionBar() {
@@ -147,11 +147,15 @@ export function EditorActionBar() {
147147
enabled:
148148
activeSession &&
149149
(activeSession.type === "default" || activeSession.type === "readonly"),
150-
onClick: () =>
151-
activeSession &&
152-
(activeSession.type === "default" ||
153-
activeSession.type === "readonly") &&
154-
showPublishView(activeSession.note, "top")
150+
onClick: (e) => {
151+
if (
152+
!activeSession ||
153+
(activeSession.type !== "default" &&
154+
activeSession.type !== "readonly")
155+
)
156+
return;
157+
showPublishView(activeSession.note, e.target as HTMLElement);
158+
}
155159
},
156160
{
157161
title: strings.toc(),

apps/web/src/components/note/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ import {
9696
} from "../icons";
9797
import { Context } from "../list-container/types";
9898
import ListItem from "../list-item";
99-
import { showPublishView } from "../publish-view";
99+
import { PublishDialog } from "../publish-view";
100100
import TimeAgo from "../time-ago";
101101

102102
type NoteProps = NoteResolvedData & {
@@ -480,7 +480,7 @@ export const noteMenuItems: (
480480
title: strings.update(),
481481
icon: Update.path,
482482
onClick: () => {
483-
showPublishView(note, "bottom");
483+
PublishDialog.show({ note });
484484
}
485485
},
486486
{
@@ -499,7 +499,7 @@ export const noteMenuItems: (
499499
]
500500
}
501501
: undefined,
502-
onClick: () => showPublishView(note, "bottom")
502+
onClick: () => PublishDialog.show({ note })
503503
},
504504
{
505505
type: "button",

0 commit comments

Comments
 (0)