mirror of https://github.com/logseq/logseq
Page wip
parent
9957f3f49d
commit
5e0a39437e
|
@ -352,7 +352,8 @@
|
|||
name]])
|
||||
tags)))
|
||||
element (keyword (str "h" level))
|
||||
level-str (str (apply str (repeat level "*")) " ")
|
||||
level-str [:a {:href (str "/page/" uuid)}
|
||||
(str (apply str (repeat level "*")) " ")]
|
||||
heading-part (->elem element
|
||||
{:id anchor
|
||||
:uuid (str uuid)}
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
hiccup (hiccup/->hiccup headings {:id page-id})]
|
||||
[:div.flex-1
|
||||
[:h1.mb-2.font-medium.text-2xl {:style {:color "#161E2E"}}
|
||||
(str "* " title)]
|
||||
[:a {:href (str "/page/" (:heading/uuid (first headings)))}
|
||||
"* "]
|
||||
|
||||
title]
|
||||
(content/content page-id :org
|
||||
{:hiccup hiccup})]))
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
(ns frontend.components.page
|
||||
(:require [rum.core :as rum]
|
||||
[frontend.util :as util]
|
||||
[frontend.handler :as handler]
|
||||
[frontend.state :as state]
|
||||
[clojure.string :as string]
|
||||
[frontend.db :as db]
|
||||
[frontend.components.sidebar :as sidebar]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.ui :as ui]
|
||||
[frontend.format.org-mode :as org]
|
||||
[frontend.format :as format]
|
||||
[frontend.components.content :as content]
|
||||
[frontend.config :as config]
|
||||
[goog.crypt.base64 :as b64]))
|
||||
|
||||
(defn- get-page-name
|
||||
[state]
|
||||
(let [route-match (first (:rum/args state))]
|
||||
(get-in route-match [:parameters :path :name])))
|
||||
|
||||
;; A page is just a logical heading
|
||||
|
||||
(rum/defcs page
|
||||
[state]
|
||||
(let [page-name (get-page-name state)
|
||||
id (uuid page-name)]
|
||||
(prn id)
|
||||
(sidebar/sidebar
|
||||
[:div "page"]
|
||||
;; (let [headings (db/get-file-by-concat-headings path)
|
||||
;; headings (db/with-dummy-heading headings)
|
||||
;; hiccup (hiccup/->hiccup headings {:id encoded-path})]
|
||||
;; (content/content encoded-path format {:hiccup hiccup}))
|
||||
)))
|
|
@ -57,6 +57,7 @@
|
|||
:heading/tags {:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many
|
||||
:db/isComponent true}
|
||||
;; :heading/parent {:db/valueType :db.type/ref}
|
||||
|
||||
;; tag
|
||||
:tag/name {:db/unique :db.unique/identity}
|
||||
|
@ -111,23 +112,9 @@
|
|||
:meta :heading/meta
|
||||
:content :heading/content
|
||||
:page :heading/page
|
||||
;; :parent :heading/parent
|
||||
})
|
||||
|
||||
;; (def schema
|
||||
;; [{:db/ident {:db/unique :db.unique/identity}}
|
||||
|
||||
;; ;; {:db/ident :heading/title
|
||||
;; ;; :db/valueType :db.type/string
|
||||
;; ;; :db/cardinality :db.cardinality/one}
|
||||
|
||||
;; ;; {:db/ident :heading/parent-title
|
||||
;; ;; :db/valueType :db.type/string
|
||||
;; ;; :db/cardinality :db.cardinality/one}
|
||||
|
||||
;; ;; TODO: timestamps, meta
|
||||
;; ;; scheduled, deadline
|
||||
;; ])
|
||||
|
||||
(defn- safe-headings
|
||||
[headings]
|
||||
(mapv (fn [heading]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
[frontend.components.sidebar :as sidebar]
|
||||
[frontend.components.repo :as repo]
|
||||
[frontend.components.file :as file]
|
||||
[frontend.components.page :as page]
|
||||
[frontend.components.agenda :as agenda]
|
||||
[clojure.string :as string]))
|
||||
|
||||
|
@ -19,6 +20,10 @@
|
|||
{:name :file
|
||||
:view file/file}]
|
||||
|
||||
["/page/:name"
|
||||
{:name :page
|
||||
:view page/page}]
|
||||
|
||||
["/agenda"
|
||||
{:name :agenda
|
||||
:view agenda/agenda}]
|
||||
|
|
Loading…
Reference in New Issue