summaryrefslogtreecommitdiff
path: root/main.ur
diff options
context:
space:
mode:
Diffstat (limited to 'main.ur')
-rw-r--r--main.ur102
1 files changed, 49 insertions, 53 deletions
diff --git a/main.ur b/main.ur
index 42c3dab..54ccb14 100644
--- a/main.ur
+++ b/main.ur
@@ -11,32 +11,29 @@ under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License. *)
-table nextAction : {
- Id : int,
- Nam : string,
- Done : bool,
-} PRIMARY KEY Id
+table nextAction : { Id : int, Nam : string, Done : bool } PRIMARY KEY Id
sequence nextActionId
fun markNextActionStatus id done =
- dml (UPDATE nextAction SET Done = {[done]} WHERE Id = {[id]})
+ dml (UPDATE nextAction SET Done = {[done]} WHERE Id = {[id]})
fun renderNextAction action : transaction xbody =
- c <- Material.Checkbox.make action.Done
- (fn b => rpc (markNextActionStatus action.Id b));
- return (Material.List.SingleLine.item {
- Icon = c,
- Content = cdata action.Nam
- })
+ c <- Material.Checkbox.make
+ action.Done
+ (fn b => rpc (markNextActionStatus action.Id b));
+ return (Material.List.SingleLine.item {Icon = c,
+ Content = cdata action.Nam})
val renderNextActions =
- queryX1' (SELECT * FROM nextAction WHERE nextAction.Done = FALSE) renderNextAction
+ queryX1' (SELECT * FROM nextAction WHERE nextAction.Done = FALSE)
+ renderNextAction
fun newNextAction name =
- id <- nextval nextActionId;
- dml (INSERT INTO nextAction (Id, Nam, Done) VALUES ({[4 + id]}, {[name]}, FALSE));
- renderNextActions
+ id <- nextval nextActionId;
+ dml (INSERT INTO nextAction (Id, Nam, Done)
+ VALUES ({[4 + id]}, {[name]}, FALSE));
+ renderNextActions
style hidden
@@ -45,40 +42,39 @@ style visible
datatype mode = NextActions | NewNextAction
val main =
- actionItems <- bind renderNextActions source;
- mode <- source NextActions;
- floatingActionButton <-
- Material.FloatingActionButton.make "add" (fn _ => set mode NewNextAction);
- return (Material.page {
- Head = <xml>
- (* TODO(bbaren): Write a meta-description tag. *)
- <title>Next actions</title>
-
- (* TODO(bbaren): Support homescreen tiles for Chrome on Android, Safari on
- iOS, and Windows 8. *)
-
- <link rel="stylesheet" href="/ugtd.css" />
- </xml>,
- Body = <xml>
- <div dynClass={
- currentMode <- signal mode;
- return (case currentMode of
- NewNextAction => visible
- | _ => hidden)
- }>
- {Material.AppBar.make "New action"}
- </div>
- <div dynClass={
- currentMode <- signal mode;
- return (case currentMode of
- NextActions => visible
- | _ => hidden)
- }>
- {Material.AppBar.make "Next actions"}
- {Material.List.SingleLine.make <xml>
- <dyn signal={signal actionItems} />
- </xml>}
- {floatingActionButton}
- </div>
- </xml>
- })
+ actionItems <- bind renderNextActions source;
+ mode <- source NextActions;
+ floatingActionButton <- Material.FloatingActionButton.make
+ "add"
+ (fn _ => set mode NewNextAction);
+ let
+ val head = <xml>
+ (* TODO(bbaren): Write a meta-description tag. *)
+ <title>Next actions</title>
+
+ (* TODO(bbaren): Support homescreen tiles for Chrome on Android,
+ Safari on iOS, and Windows 8. *)
+
+ <link rel="stylesheet" href="/ugtd.css" />
+ </xml>
+
+ val body = <xml>
+ <div dynClass={currentMode <- signal mode;
+ return (case currentMode of
+ NewNextAction => visible
+ | _ => hidden)}>
+ {Material.AppBar.make "New action"}
+ </div>
+ <div dynClass={currentMode <- signal mode;
+ return (case currentMode of
+ NextActions => visible
+ | _ => hidden)}>
+ {Material.AppBar.make "Next actions"}
+ {Material.List.SingleLine.make
+ <xml><dyn signal={signal actionItems} /></xml>}
+ {floatingActionButton}
+ </div>
+ </xml>
+ in
+ return (Material.page {Head = head, Body = body})
+ end