pull/2901/head
Tienson Qin 2021-09-28 20:07:37 +08:00
parent 242fc010a0
commit 78cc8fdb46
3 changed files with 36 additions and 24 deletions

View File

@ -4,7 +4,7 @@
"bundledWebRuntime": false,
"webDir": "public",
"server": {
"url": "http://192.168.1.59:3001",
"url": "http://192.168.147.189:3001",
"cleartext": true
}
}

View File

@ -29,13 +29,16 @@
[:h1.title
(tongue :all-files)]
(when-let [current-repo (state/sub :git/current-repo)]
(let [files (db/get-files current-repo)]
(let [files (db/get-files current-repo)
mobile? (util/mobile?)]
[:table.table-auto
[:thead
[:tr
[:th (tongue :file/name)]
[:th (tongue :file/last-modified-at)]
[:th ""]]]
(when-not mobile?
[:th (tongue :file/last-modified-at)])
(when-not mobile?
[:th ""])]]
[:tbody
(for [[file modified-at] files]
(let [file-id file]
@ -46,16 +49,18 @@
(rfe/href :file {:path file-id}))]
[:a {:href href}
file])]
[:td [:span.text-gray-500.text-sm
(if (zero? modified-at)
(tongue :file/no-data)
(date/get-date-time-string
(t/to-default-time-zone (tc/to-date-time modified-at))))]]
(when-not mobile?
[:td [:span.text-gray-500.text-sm
(if (zero? modified-at)
(tongue :file/no-data)
(date/get-date-time-string
(t/to-default-time-zone (tc/to-date-time modified-at))))]])
[:td [:a.text-sm
{:on-click (fn [e]
(export-handler/download-file! file))}
[:span (tongue :download)]]]]))]]))]))
(when-not mobile?
[:td [:a.text-sm
{:on-click (fn [e]
(export-handler/download-file! file))}
[:span (tongue :download)]]])]))]]))]))
(rum/defcs file < rum/reactive
{:did-mount (fn [state]

View File

@ -745,7 +745,8 @@
[state]
(let [current-repo (state/sub :git/current-repo)
*sort-by-item (get state ::sort-by-item)
*desc? (get state ::desc?)]
*desc? (get state ::desc?)
mobile? (util/mobile?)]
(rum/with-context [[t] i18n/*tongue-context*]
[:div.flex-1
[:h1.title (t :all-pages)]
@ -757,9 +758,12 @@
[:thead
[:tr
(sortable-title (t :block/name) :block/name *sort-by-item *desc?)
(sortable-title (t :page/backlinks) :block/backlinks *sort-by-item *desc?)
(sortable-title (t :page/created-at) :block/created-at *sort-by-item *desc?)
(sortable-title (t :page/updated-at) :block/updated-at *sort-by-item *desc?)]]
(when-not mobile?
(sortable-title (t :page/backlinks) :block/backlinks *sort-by-item *desc?))
(when-not mobile?
(sortable-title (t :page/created-at) :block/created-at *sort-by-item *desc?))
(when-not mobile?
(sortable-title (t :page/updated-at) :block/updated-at *sort-by-item *desc?))]]
[:tbody
(for [{:block/keys [name created-at updated-at backlinks] :as page} pages]
[:tr {:key name}
@ -773,10 +777,13 @@
{:page (:block/name page)}))))
:href (rfe/href :page {:name (:block/name page)})}
(block/page-cp {} page)]]
[:td [:span.text-gray-500.text-sm backlinks]]
[:td [:span.text-gray-500.text-sm (if created-at
(date/int->local-time-2 created-at)
"Unknown")]]
[:td [:span.text-gray-500.text-sm (if updated-at
(date/int->local-time-2 updated-at)
"Unknown")]]])]]))])))
(when-not mobile?
[:td [:span.text-gray-500.text-sm backlinks]])
(when-not mobile?
[:td [:span.text-gray-500.text-sm (if created-at
(date/int->local-time-2 created-at)
"Unknown")]])
(when-not mobile?
[:td [:span.text-gray-500.text-sm (if updated-at
(date/int->local-time-2 updated-at)
"Unknown")]])])]]))])))