| @@ -160,6 +160,21 @@ |
| 160 | [:dim-label {:label (s/last-preview buffer)}] | 160 | [:dim-label {:label (s/last-preview buffer)}] |
| 161 | [:button {:label "Open" :kind :primary :on-click #(s/open-channel! name)}]])) | 161 | [:button {:label "Open" :kind :primary :on-click #(s/open-channel! name)}]])) |
| 162 | | 162 | |
| | 163 | +(def ^:private sidebar-width 320) |
| | 164 | + |
| | 165 | +(defn- control-entry-width |
| | 166 | + "How wide the join and search boxes ask to be. |
| | 167 | + |
| | 168 | + A fixed 380 is right on a window that holds the list alone, and too wide for |
| | 169 | + the list as a split view's left column: the row it sits on is only |
| | 170 | + `sidebar-width` across, and an entry that asks for more than remains pushes |
| | 171 | + the button beside it onto a row of its own — Join under the box rather than |
| | 172 | + next to it. Beside the entry go the button and the gap, and around the row |
| | 173 | + the card's and the page's padding, so the column's share is what is left of |
| | 174 | + the sidebar after those." |
| | 175 | + [] |
| | 176 | + (if (s/wide?) (- sidebar-width 130) 380)) |
| | 177 | + |
| 163 | (defn chats-screen [] | 178 | (defn chats-screen [] |
| 164 | (let [buffers (s/channel-list)] | 179 | (let [buffers (s/channel-list)] |
| 165 | [:page {:max-width 620} | 180 | [:page {:max-width 620} |
| @@ -179,7 +194,7 @@ |
| 179 | ;; Both kinds of conversation through one box: `#room` joins a | 194 | ;; Both kinds of conversation through one box: `#room` joins a |
| 180 | ;; channel, `@nick` opens a message to a person. | 195 | ;; channel, `@nick` opens a message to a person. |
| 181 | [:entry {:text @s/join-input | 196 | [:entry {:text @s/join-input |
| 182 | - :width-request 380 | 197 | + :width-request (control-entry-width) |
| 183 | :placeholder "#channel or @nick" | 198 | :placeholder "#channel or @nick" |
| 184 | :on-change #(reset! s/join-input %) | 199 | :on-change #(reset! s/join-input %) |
| 185 | :on-activate #(do (s/join! @s/join-input) (reset! s/join-input ""))}] | 200 | :on-activate #(do (s/join! @s/join-input) (reset! s/join-input ""))}] |
| @@ -191,7 +206,7 @@ |
| 191 | ;; one that stopped working. | 206 | ;; one that stopped working. |
| 192 | [:hbox {:spacing 8} | 207 | [:hbox {:spacing 8} |
| 193 | [:entry {:text @s/search | 208 | [:entry {:text @s/search |
| 194 | - :width-request 380 | 209 | + :width-request (control-entry-width) |
| 195 | :placeholder "Search channels" | 210 | :placeholder "Search channels" |
| 196 | :on-change #(reset! s/search %)}] | 211 | :on-change #(reset! s/search %)}] |
| 197 | (when (seq @s/search) | 212 | (when (seq @s/search) |
| @@ -840,8 +855,6 @@ |
| 840 | (when (and (empty? dirs) (empty? files)) | 855 | (when (and (empty? dirs) (empty? files)) |
| 841 | [:dim-label {:label "No pictures here that this app can read."}])]]]])) | 856 | [:dim-label {:label "No pictures here that this app can read."}])]]]])) |
| 842 | | 857 | |
| 843 | -(def ^:private sidebar-width 320) | | |
| 844 | - | | |
| 845 | ;; What the people panel asks for, and what the conversation beside it has to | 858 | ;; What the people panel asks for, and what the conversation beside it has to |
| 846 | ;; be told to leave. A column with `:fill-height` and no width takes the whole | 859 | ;; be told to leave. A column with `:fill-height` and no width takes the whole |
| 847 | ;; row — so the panel is only ever on screen if the message list is given a | 860 | ;; row — so the panel is only ever on screen if the message list is given a |