diff --git a/app/src/assets/scss/_function.scss b/app/src/assets/scss/_function.scss
index d48df7bf0..0476b225b 100644
--- a/app/src/assets/scss/_function.scss
+++ b/app/src/assets/scss/_function.scss
@@ -151,4 +151,16 @@
padding: 16px;
border-radius: 0 0 4px 0;
}
+
+ &__repo {
+ background-color: var(--b3-theme-background);
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ box-sizing: border-box
+ }
+
+ &__repoheader {
+ padding: 8px 16px;
+ }
}
diff --git a/app/src/util/history.ts b/app/src/util/history.ts
index b7210dda5..7287db27c 100644
--- a/app/src/util/history.ts
+++ b/app/src/util/history.ts
@@ -6,6 +6,7 @@ import {MenuItem} from "../menus/Menu";
import {unicode2Emoji} from "../emoji";
import {escapeHtml} from "./escape";
import {isMobile} from "./functions";
+import {getDisplayName} from "./pathName";
const renderDoc = (notebook: INotebook, element: HTMLElement) => {
if (!notebook || !notebook.id) {
@@ -102,34 +103,40 @@ const renderAssets = (element: HTMLElement) => {
element.firstElementChild.innerHTML = logsHTML;
});
};
+
const renderRepo = (element: HTMLElement) => {
element.setAttribute("data-init", "true");
fetchPost("/api/repo/getRepoIndexLogs", {page: 1}, (response) => {
- if (response.data.histories.length === 0) {
- element.innerHTML = `
${window.siyuan.languages.emptyContent}`;
+ if (response.data.logs.length === 0) {
+ element.lastElementChild.firstElementChild.innerHTML = `${window.siyuan.languages.emptyContent}`;
return;
}
- let logsHTML = "";
- response.data.histories.forEach((item: { items: { path: string, title: string }[], time: string }, index: number) => {
- logsHTML += `
-
+ let repoHTML = "";
+ response.data.logs.forEach((item: { files: { path: string, id: string }[], id: string, time: string }, index: number) => {
+ repoHTML += `
+
${item.time}
`;
- if (item.items.length > 0) {
- logsHTML += ``;
- item.items.forEach((docItem) => {
- logsHTML += `-
- ${escapeHtml(docItem.title)}
+ if (item.files.length > 0) {
+ repoHTML += `
`;
+ item.files.forEach((docItem) => {
+ repoHTML += `-
+ ${getDisplayName(docItem.path)}
-
- ${window.siyuan.languages.rollback}
-
+
`;
});
- logsHTML += "
";
+ repoHTML += "
";
+ }
+ if (index === 0) {
+ // fetchPost("/api/history/getDocHistoryContent", {
+ // historyPath: item.items[0].path
+ // }, (response) => {
+ // element.lastElementChild.innerHTML = response.data.content;
+ // });
}
});
- element.innerHTML = logsHTML;
+ element.lastElementChild.firstElementChild.innerHTML = `${repoHTML}`;
});
};
@@ -199,8 +206,21 @@ export const openHistory = () => {
- ${window.siyuan.languages.emptyContent}
-
-
+
+
+
+
+ - ${window.siyuan.languages.emptyContent}
+
+
+
`,