Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: improve diff viewing (#7936)

01zulfi944fcf05679a
diff --git a/apps/web/src/components/diff-viewer/index.tsx b/apps/web/src/components/diff-viewer/index.tsx
index 7090e4526..013e738e0 100644
--- a/apps/web/src/components/diff-viewer/index.tsx
+++ b/apps/web/src/components/diff-viewer/index.tsx
@@ -162,6 +162,15 @@ function DiffViewer(props: DiffViewerProps) {
<Copy size={18} />
<Text ml={1}>{strings.saveACopy()}</Text>
</Button>
+ <Button
+ variant="errorSecondary"
+ onClick={() => {
+ const { openSession } = useEditorStore.getState();
+ openSession(session.note.id, { force: true });
+ }}
+ >
+ {strings.close()}
+ </Button>
</>
) : null}
</Flex>
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index f691dc1bc..505d72398 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -182,7 +182,6 @@ export function EditorActionBar() {
activeSession &&
activeSession.type !== "new" &&
activeSession.type !== "locked" &&
- activeSession.type !== "diff" &&
activeSession.type !== "conflicted" &&
!isFocusMode,
onClick: () => useEditorStore.getState().toggleProperties(),
diff --git a/apps/web/src/components/properties/index.tsx b/apps/web/src/components/properties/index.tsx
index 0eae85181..32a09ccc7 100644
--- a/apps/web/src/components/properties/index.tsx
+++ b/apps/web/src/components/properties/index.tsx
@@ -117,7 +117,12 @@ function EditorProperties(props: EditorPropertiesProps) {
const toggleProperties = useEditorStore((store) => store.toggleProperties);
const isFocusMode = useAppStore((store) => store.isFocusMode);
const session = useEditorStore((store) =>
- store.getSession(props.sessionId, ["default", "readonly", "deleted"])
+ store.getSession(props.sessionId, [
+ "default",
+ "readonly",
+ "deleted",
+ "diff"
+ ])
);
if (isFocusMode || !session) return null;
return (
@@ -162,7 +167,8 @@ function EditorProperties(props: EditorPropertiesProps) {
>
<Section title="Properties">
<Flex sx={{ flexDirection: "column", gap: 1, px: 2, pt: 1 }}>
- {session.type === "deleted" ? null : (
+ {session.type === "deleted" ||
+ session.type === "diff" ? null : (
<>
{tools.map((tool) => (
<Toggle
@@ -207,18 +213,25 @@ function EditorProperties(props: EditorPropertiesProps) {
</Text>
</Flex>
))}
- {session.type === "deleted" ? null : (
+ {session.type === "deleted" ||
+ session.type === "diff" ? null : (
<Colors noteId={session.note.id} color={session.color} />
)}
</Flex>
</Section>
{session.type === "deleted" ? null : (
<>
- <InternalLinks noteId={session.note.id} />
- <Notebooks noteId={session.note.id} />
- <Reminders noteId={session.note.id} />
- <Attachments noteId={session.note.id} />
- <SessionHistory noteId={session.note.id} />
+ {session.type === "diff" ? (
+ <SessionHistory noteId={session.note.id} />
+ ) : (
+ <>
+ <InternalLinks noteId={session.note.id} />
+ <Notebooks noteId={session.note.id} />
+ <Reminders noteId={session.note.id} />
+ <Attachments noteId={session.note.id} />
+ <SessionHistory noteId={session.note.id} />
+ </>
+ )}
</>
)}
</Flex>