diff --git a/app/src/history/history.ts b/app/src/history/history.ts index b79b4283e..0b25289d0 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -80,6 +80,65 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string return; } let actionHTML = ""; + /// #if MOBILE + if (type === "getCloudRepoTagSnapshots") { + actionHTML = ` + + + + ${window.siyuan.languages.download} + + + + + + ${window.siyuan.languages.remove} + +`; + } else if (type === "getCloudRepoSnapshots") { + actionHTML = ` + + + + ${window.siyuan.languages.download} + +`; + } else if (type === "getRepoTagSnapshots") { + actionHTML = ` + + + + ${window.siyuan.languages.upload} + + + + + + ${window.siyuan.languages.rollback} + + + + + + ${window.siyuan.languages.remove} + +`; + } else if (type === "getRepoSnapshots") { + actionHTML = ` + + + + ${window.siyuan.languages.tagSnapshot} + + + + + + ${window.siyuan.languages.rollback} + +`; + } + /// #else if (type === "getCloudRepoTagSnapshots") { actionHTML = ` `; @@ -93,8 +152,8 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string actionHTML = ` `; } + /// #endif let repoHTML = ""; - const isPhone = isMobile(); response.data.snapshots.forEach((item: { memo: string, id: string, @@ -104,30 +163,42 @@ const renderRepoItem = (response: IWebSocketData, element: Element, type: string tag: string, typesCount: { type: string, count: number }[] }) => { - repoHTML += `
  • -
    -
    - ${escapeHtml(item.memo)} - ${item.tag} -
    -
    - ${item.id.substring(0, 7)} ${item.hCreated} - ${window.siyuan.languages.fileSize} ${item.hSize} - ${window.siyuan.languages.fileCount} ${item.count}`; - let statHTML = ""; - if (item.typesCount && 0 < item.typesCount.length && !isPhone) { - statHTML += ` - - ${item.typesCount.map((type: { type: string, count: number }) => { - return `${type.type} ${type.count}`; - }).join("  ")}`; + let statHTML = `
    + ${window.siyuan.languages.fileCount} ${item.count}`; + if (item.typesCount) { + item.typesCount.forEach(subItem => { + statHTML += `${subItem.type} ${subItem.count}`; + }) } - repoHTML += `${statHTML} - -
    + statHTML+="
    "; + + const infoHTML = `
    + ${escapeHtml(item.memo)} + + ${item.tag} + + ${item.id.substring(0, 7)} + + ${item.hCreated} + + ${window.siyuan.languages.fileSize} ${item.hSize} + +
    ${statHTML}` + /// #if MOBILE + repoHTML += `
  • +
    + ${infoHTML} +
    + ${actionHTML}
    - ${actionHTML} +
  • `; + /// #else + repoHTML += `
  • +
    ${infoHTML}
    +${actionHTML} +
  • `; + /// #endif }); element.lastElementChild.innerHTML = `${repoHTML}`; }; @@ -186,8 +257,8 @@ const renderRmNotebook = (element: HTMLElement) => { logsHTML += `
  • ${escapeHtml(docItem.title)} - - ${window.siyuan.languages.rollback} + +
  • `; }); @@ -227,7 +298,7 @@ export const openHistory = () => {
    -
    +
    @@ -434,7 +505,7 @@ const bindEvent = (element: Element, dialog?: Dialog) => { iconElement.classList.add("b3-list-item__arrow--open"); let html = ""; response.data.items.forEach((docItem: { title: string, path: string }) => { - html += `
  • + html += `
  • ${escapeHtml(docItem.title)} @@ -470,7 +541,7 @@ const bindEvent = (element: Element, dialog?: Dialog) => { target.parentElement.querySelector(`.b3-list-item[data-id="${idJSON.splice(0, 1)[0].id}"]`)?.classList.remove("b3-list-item--focus"); } } - idJSON.push({id, time: target.querySelector(".ft__smaller").textContent}); + idJSON.push({id, time: target.querySelector('[data-type="hCreated"]').textContent}); } if (idJSON.length === 2) {