Commit 090f8e08 authored by Yuanle Song's avatar Yuanle Song
Browse files

tweak UI

- update about page layout.
  use slide in page instead of a fixed position overlay.
  this works well on both desktop and mobile.
- minor updates on about page text content.
- update about page font-family.
- on main UI, put title button on the rhs.
parent cd17d028
Loading
Loading
Loading
Loading
+59 −21
Original line number Diff line number Diff line
@@ -102,19 +102,41 @@
      #help-overlay-content {
	  width: 100%;
	  padding: 20px;
	  font-family: sans;
      }
      #help-overlay-content h4 {
	  margin: 0;
      }
      #close-help-overlay {
	  position: relative;
	  left: 350px;
      }
      .button-group {
	  width: 100%;
	  display: flex;
	  justify-content: center;
      }

      /* title with buttons on the right. see ./test-rhs-link-on-title-row.html */
      .title {
	  display: flex;
	  /* border: 1px black solid; */
      }
      .title h3 {
	  margin: 8px 16px;
	  font-size: 1em;
      }
      .title-button-group {
	  flex-grow: 1;
	  display: flex;
	  justify-content: flex-end;
	  margin: 8px 1em;
      }
      .title-button-group a, .title-button-group button {
	  padding: 0 5px;
      }
      #help-title {
	  text-align: center;
      }
      #copyright {
	  text-align: center;
      }
@media only screen and (max-device-width: 480px) {
      #container {
	  width: 300px;
@@ -156,14 +178,11 @@
	  height: 50px;
      }
      #help-overlay-container {
	  width: 300px;
	  width: 100%;
	  margin: 0px auto;
      }
      #help-overlay-content {
	  padding: 10px;
      }
      #close-help-overlay {
	  position: relative;
	  left: 100px;
	  padding: 5px;
      }
}
    </style>
@@ -172,14 +191,23 @@
  <body>
    <div id="container">
      <div id="stack">
	<p>Stack <a title="clear stack" id="clear-stack" href="#">Clear Stack</a> <a title="expand stack" id="expand-stack" href="#">Expand Stack</a></p>
	<div class="title">
	  <h3>Stack</h3>
	  <div class="title-button-group">
	    <a title="clear stack" id="clear-stack" href="#">Clear Stack</a>
	    <a title="expand stack" id="expand-stack" href="#">Expand Stack</a>
	  </div>
	</div>
	<div id="stack-content"></div>
      </div>
      <div id="keyboard">
	<p>Keyboard
	<div class="title">
	  <h3>Keyboard</h3>
	  <div class="title-button-group">
	    <a title="reset RPN calculator" id="reset" href="#">Reset All</a>
	    <a title="help (?)" id="help-link" href="#">Help</a>
	</p>
	  </div>
	</div>
	<div class="keyboard">
	  <table>
	    <tr>
@@ -229,24 +257,30 @@
	</div>
      </div>
      <div id="trail">
	<p>Trail <a title="clear trail" id="clear-trail" href="#">Clear Trail</a> <a title="expand trail" id="expand-trail" href="#">Expand Trail</a></p>
	<div class="title">
	  <h3>Trail</h3>
	  <div class="title-button-group">
	    <a title="clear trail" id="clear-trail" href="#">Clear Trail</a>
	    <a title="expand trail" id="expand-trail" href="#">Expand Trail</a>
	  </div>
	</div>
	<div id="trail-content"></div>
      </div>
    </div>
    <div id="help-overlay-container" class="overlay">
      <div id="help-overlay-content">
	<h3>HELP <a id="close-help-overlay" class="close-help-overlay" href="#">Close</a></h3>
	<h4>About RPN calculator</h4>
	<p>RPN calculator is a web implementation of a <a href="#TODO">reverse polish notation calculator</a>. You push numbers to stack first, then push operator keys which will pop number from stack and run the computation. For example, you may press num1, return, num2, num3, return, plus, and you will see result 24 in top of stack. Number is pushed to stack using return key.</p>
	<h3 id="help-title" style="text-align: center">RPN calculator v1.0.0</h3>
	<h4>About</h4>
	<p>RPN calculator is a web implementation of a <a href="#TODO">reverse polish notation calculator</a>. You push numbers to stack first, then press operator keys which will pop number from stack and run the calculation. For example, you may press num1, return, num2, num3, return, plus, and you will see result 24 in top of stack. Number is pushed to stack using return key.</p>
	<p>Supported operators are: +, -, *, /, square-root, power, sum-all. Utility features include delete number, duplicate number, swap top 2 number on stack, undo, clear stack. Hover over button to see what that button does and the hotkey for that button.</p>
	<p>This program should work on desktop and mobile browser. Tested in chrome and firefox.</p>
	<h4>Credit</h4>
	<p>This project is inspired by <a href="#TODO">emacs calc mode</a>. It tries to mimic the behavior when possible.</p>
	<h4>Debug Features</h4>
	<p>This website use service worker to make it work offline. If the local cache does not work for some reason, you may <a title="refresh page" id="refresh-page" href="#">force refresh page</a> to get latest version. You may also <a title="purge service worker cache" id="purge-service-worker-cache" href="#">purge all service worker cache</a>.</p>
	<p>RPN calculator v1.0.0, Copyright (C) 2017  Yuanle Song &lt;sylecn@gmail.com&gt;</p>
	<p id="copyright">Copyright (C) 2017  Yuanle Song &lt;sylecn@gmail.com&gt;</p>
	<div class="button-group">
	  <button class="close-help-overlay">Close</button>
	  <button class="close-help-overlay">Return to Calculator</button>
	</div>
      </div>
    </div>
@@ -259,6 +293,7 @@
      (function () {
	  const testing = false;
	  const uiTesting = false;
	  const aboutPageTesting = false;
	  const enableServiceWorker = false;

	  // service worker
@@ -784,6 +819,9 @@
		  }
	      }
	  });
	  if (aboutPageTesting) {
	      showHelpOverlay();
	  }
      }());
    </script>
  </body>
+34 −21
Original line number Diff line number Diff line
@@ -72,6 +72,23 @@ Time-stamp: <2017-01-28>
    not modify the number.

* later                                                               :entry:
** 2017-01-28 try convert it to native app using phonegap.
I like HTML5 offline website better than phonegap app.
I prefer either native app or real website.

** 2017-01-27 deploy on https://rpn.emacsos.com/
- I considered https://www.emacsos.com/rpn-calculator.html, but I don't want
  to mess up with sw.js scope issue.

  maybe use calc-sw.js? I still don't like that.

- just use a standalone domain.
- add link on www.emacsos.com.
- write a blog post about it. techs used in the project. and source repo.

** 2017-01-28 add more content in about page.
- fill in link for #TODO link in about page.
- add LICENSE info and source code repo address in about overlay.
** 2017-01-27 how to capture backspace key in javascript? what about TAB key?
** 2017-01-27 the whole FSM can be made persistent across sessions.
not only trail.
@@ -92,14 +109,25 @@ the parent DOM.

* current                                                             :entry:
** 
** 2017-01-28 add more content in about page.
- fill in link for #TODO link in about page.
- add LICENSE info and source code repo address in about overlay.
** 2017-01-27 add some visual feedback when clicking a button. like in material design.
** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow.
should set a max-width on #number-display.

overflow: auto
doesn't work with <td> in firefox.
* done                                                                :entry:
** 2017-01-28 UI tweaks
- DONE about page, HELP should be centered. change "Close" to "Return to calc".
  put back button on the rhs.
- DONE about page, add font-family config.
- DONE div title should put buttons across the row.  // now links/buttons are
  put on the rhs.

  see ./test-rhs-link-on-title-row.html
- 
** 2017-01-28 UI tweaks
- DONE "refresh page" is for debugging purpose, hide it somewhere.
- div title should put buttons across the row.
  I think there is a flex property for this.
- add about dialog. could put "refresh page" in this page. hidden by default.
- DONE add about dialog. could put "refresh page" in this page. hidden by default.
  - test it in mobile mode.

  - make scroll work on desktop and mobile when window height is small.
@@ -122,21 +150,6 @@ the parent DOM.

  - move "Help" to center. move "close" button to right.

** 2017-01-27 deploy on https://rpn.emacsos.com/
- I considered https://www.emacsos.com/rpn-calculator.html, but I don't want
  to mess up with sw.js scope issue.

  maybe use calc-sw.js? I still don't like that.

- just use a standalone domain.

** 2017-01-27 add some visual feedback when clicking a button. like in material design.
** 2017-01-27 UI problem: when input a very large number, #number-display and keyboard will grow.
should set a max-width on #number-display.

overflow: auto
doesn't work with <td> in firefox.
* done                                                                :entry:
** 2017-01-27 add an about dialog.
add "about" button beside "Reset All".

+53 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>rhs link on title row</title>
    <style type="text/css">
      body {}
      .container {
	  width: 95vw;
	  max-width: 700px;
	  margin: 10px auto;
	  height: 100px;
	  border: 1px black solid;
      }
      .title {
	  display: flex;
      }
      .title h3 {
	  border: 1px blue dotted;
	  margin: 0 1em;
      }
      .title-button-group {
	  border: 1px blue dotted;
	  flex-grow: 1;
	  display: flex;
	  justify-content: flex-end;
	  margin: 0 1em 0 0;
      }
      .title-button {
	  padding: 5px;
      }
      p {
	  padding: 5px;
      }
    </style>
  </head>

  <body>
    <div class="container">
      <div class="title">
	<h3>Some Title</h3>
	<div class="title-button-group">
	  <a class="title-button" href="#">button1</a>
	  <a class="title-button" href="#">button2</a>
	</div>
      </div>
      <p>Here is content</p>
    </div>
  </body>

</html>