Skip to content

Commit

Permalink
Begin scaffolding out the "campaign workspace" UI
Browse files Browse the repository at this point in the history
Refs #69

Taking notes is great, but you also probably want to be able to
organize for the current session. The workspace is where you can
layout specific notes and other entities for reference as part of
session planning.
  • Loading branch information
dhleong committed Oct 5, 2019
1 parent 04105d3 commit 948bc7f
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 2 deletions.
13 changes: 13 additions & 0 deletions save-syntax.edn
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,17 @@
:n/1
:n/2
:f/3]}

; what's currently on the workspace?
; The Workspace consists of a single "primary" column and a single
; "secondary" column. Things in the "secondary" column are associated
; with an entry in the "primary" column for quick reference. On mobile,
; they may be accessible via a side-swipe; on desktop or tablet, they
; are placed adjacent to the primary column
:workspace [[:primary/1 :secondary/1 :secondary/2]

; each item in the workspace is wrapped in a vector; the
; first entry is the primary column item, and anything else
; goes in the secondary column
[:primary/2 :secondary/1]]
}
7 changes: 6 additions & 1 deletion src/cljs/wish/sheets/dnd5e/campaign.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
[abilities-display info])]
])

(defn entity-card [e]
; TODO
[:div (str e)])

(defn view
[section]
[base/campaign-page section
:char-card char-card])
:char-card char-card
:entity-card entity-card])
5 changes: 4 additions & 1 deletion src/cljs/wish/views/campaign/base.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
:doc "base"}
wish.views.campaign.base
(:require [wish.views.campaign.chars-carousel :refer [chars-carousel]]
[wish.views.campaign.workspace :refer [workspace]]
[wish.views.error-boundary :refer [error-boundary]]))

(defn campaign-page
[_section & {:keys [char-card]}]
[_section & {:keys [char-card entity-card]}]
[error-boundary
[:div.campaign
[chars-carousel char-card]
[workspace
:entity-card entity-card]

[:div.info
"This is the campaign page."
Expand Down
14 changes: 14 additions & 0 deletions src/cljs/wish/views/campaign/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
wish.views.campaign.subs
(:require [re-frame.core :refer [reg-sub]]))

(defn- reg-meta-sub
[id getter]
(reg-sub
id
:<- [:sheet-meta]
(fn [sheet _]
(getter sheet))))

(reg-meta-sub :meta/workspace :workspace)

;;
;; Campaign members
;;

(reg-sub
::add-char-candidates
:<- [:meta/players]
Expand Down
25 changes: 25 additions & 0 deletions src/cljs/wish/views/campaign/workspace.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(ns ^{:author "Daniel Leong"
:doc "Campaign workspace"}
wish.views.campaign.workspace
(:require [wish.util :refer [<sub >evt]]
[wish.util.nav :as nav :refer [sheet-url]]
[wish.views.error-boundary :refer [error-boundary]]
[wish.views.widgets :refer [icon link link>evt]]
[wish.views.campaign.events :as events]
[wish.views.campaign.subs :as subs]))

(defn- id-for [item]
(or (when (keyword? item)
item)
(:id item)))

(defn workspace-item [entity-card item]
; TODO
[:div (str item)])

(defn workspace [& {:keys [entity-card]}]
(let [workspace (<sub [:meta/workspace])]
[:div.workspace
(for [[item & secondary] workspace]
^{:key (id-for item)}
[workspace-item entity-card item])]))

0 comments on commit 948bc7f

Please sign in to comment.