From a2dfbbc5c278e927ec70f1bba030b0bfb4a8b223 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 11 Dec 2021 21:35:38 -0700 Subject: [PATCH] Close #64, add help docs to Add screen, add option to disable alert SFX --- www/assets/css/app.css | 4 +++ www/assets/js/add.js | 9 ++++- www/assets/js/audio.js | 16 +++++++-- www/assets/js/settings.js | 4 +++ www/pages/add.html | 19 +++++++++++ www/pages/help/add.html | 64 ++++++++++++++++++++++++++++++++++++ www/routes.js | 69 ++++++++++++++++++++++++++++++--------- 7 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 www/pages/help/add.html diff --git a/www/assets/css/app.css b/www/assets/css/app.css index d205ca8..f6d7b71 100644 --- a/www/assets/css/app.css +++ b/www/assets/css/app.css @@ -96,6 +96,10 @@ Framework7 and FontAwesome both have a .fab class transition: 10ms !important; } +.fab-stacked-above { + bottom: calc(calc(calc(var(--f7-fab-margin) + var(--f7-safe-area-bottom)) + var(--f7-fab-size)) + var(--f7-fab-margin)) !important; +} + /* Allow easily changing help text to reflect finger/mouse usage. */ diff --git a/www/assets/js/add.js b/www/assets/js/add.js index 0eadc79..5325958 100644 --- a/www/assets/js/add.js +++ b/www/assets/js/add.js @@ -56,6 +56,13 @@ $(".addpackagebtn").click(function () { } var address = ($("input[name=number]").val() + " " + $("input[name=street]").val()).toUpperCase(); + + var itemtype = $("input[name=itemtype]:checked").val(); + + if ($(this).hasClass("addpackagebtn-custom")) { + itemtype = $(this).data("addtype"); + } + $("#no-history").addClass("display-none"); addPackageByAddress( $("input[name=number]").val().toUpperCase(), @@ -63,7 +70,7 @@ $(".addpackagebtn").click(function () { $("input[name=street]").val().toUpperCase(), $("input[name=citystate]").val().toUpperCase(), $("input[name=zipcode]").val().toUpperCase(), - $("input[name=itemtype]:checked").val(), + itemtype, function (ids) { var packageObj = getPackage(ids.packageID); // Reset item type to default diff --git a/www/assets/js/audio.js b/www/assets/js/audio.js index 500d83c..2e7de82 100644 --- a/www/assets/js/audio.js +++ b/www/assets/js/audio.js @@ -14,11 +14,17 @@ function initSFX() { setStorage("alertvolume", 100); } - var alertNoiseFile = SETTINGS.alertsounds[getStorage("alertsound")].file; var alertVolume = getStorage("alertvolume"); + var noalertsound = false; + var alertNoiseFile = ""; + if (getStorage("alertsound") == "NONE") { + noalertsound = true; + } else { + alertNoiseFile = SETTINGS.alertsounds[getStorage("alertsound")].file; + } sfx = { - "alert": new Audio("assets/audio/" + alertNoiseFile), + "alert": noalertsound ? false : new Audio("assets/audio/" + alertNoiseFile), "ok": new Audio("assets/audio/ok.mp3"), "error": new Audio("assets/audio/error.mp3"), "scan": new Audio("assets/audio/scan.mp3") @@ -33,6 +39,9 @@ function initSFX() { * @returns {undefined} */ function playSound(sound) { + if (sfx[sound] == false) { + return; + } sfx[sound].play(); } @@ -42,6 +51,9 @@ function playSound(sound) { * @param number volume Number in range 0 to 100 */ function setVolume(sound, volume) { + if (sfx[sound] == false) { + return; + } sfx[sound].volume = volume / 100.0; } diff --git a/www/assets/js/settings.js b/www/assets/js/settings.js index e0c9f44..40914eb 100644 --- a/www/assets/js/settings.js +++ b/www/assets/js/settings.js @@ -171,4 +171,8 @@ $('.item-link[data-setting=alertsound] select').on("change", function () { initSFX(); // Play the selected sound playSound("alert"); +}); + +$('.item-link[data-setting=customaddtype] select').on("change", function () { + setStorage("customaddtype", $('.item-link[data-setting=customaddtype] select').val()); }); \ No newline at end of file diff --git a/www/pages/add.html b/www/pages/add.html index 0f5ac3a..01c0fd7 100644 --- a/www/pages/add.html +++ b/www/pages/add.html @@ -21,6 +21,11 @@ more_vert + {{#if show_help}} + + help + + {{/if}} @@ -138,6 +143,20 @@ + {{#if customaddtype}} +
+ + + +
+
+ + +
{{customaddname}}
+
+
+ {{/if}} +
add diff --git a/www/pages/help/add.html b/www/pages/help/add.html new file mode 100644 index 0000000..3435079 --- /dev/null +++ b/www/pages/help/add.html @@ -0,0 +1,64 @@ + +
+
+
+ + + +
+
Add a Package/Item
+
+ Enter the house number, street, city, state, and ZIP code. Then choose an item type and + tapclick the + button. + You'll hear a noise and see a message at the bottom of the screen confirming the item was added. + +
    +
  • The city, state, and ZIP are saved for you so you won't have to enter them every day. +
  • The next time you tapclick + the Number box, it will automatically be erased for you so you can quickly enter the next one. +
  • If you find yourself frequently selecting the same item type, you can add an extra + button that will only + add items as your preferred type. Go to Settings -> Packages and Alerts -> Custom Add Button to set it up. +
+
+ +
Addresses with Letters
+
+ If the house "number" has letters in it, tapclick + the menu button () the top right and select "Address contains letters". + You'll now be able to enter both letters and numbers in the Number box. +
+ +
Remove an Item
+
+ If you made a mistake, you can quickly remove a recently added item. + On small screens, tapclick the recent tab + or swipe to the left. Then simply tapclick the entry you + want to remove. + If you go to a different part of the app, the recent tab will be empty. + If the item you want to remove isn't in the recent tab, back out to the main screen, + go to the List page, and remove it from there. +
+ +
Autocomplete
+
+ You'll notice that as you use PackageHelper, it will suggest street names for you. These suggestions + are based on the address number you enter. For example, if you add a package for 1234 Sample Rd, then + for 987 Other St, the next time you type 1234 it will suggest Sample Rd. If multiple addresses share the same + number, the suggestion list will start with the most frequently used at the top. +
+
+
+
+
\ No newline at end of file diff --git a/www/routes.js b/www/routes.js index 6d46fd3..fec2047 100644 --- a/www/routes.js +++ b/www/routes.js @@ -79,6 +79,9 @@ var routes = [ context: { show_help: show_help, itemtypes: SETTINGS.itemtypes, + customaddtype: inStorage("customaddtype") && getStorage("customaddtype") != "NONE" ? getStorage("customaddtype") : false, + customaddicon: inStorage("customaddtype") && getStorage("customaddtype") != "NONE" ? SETTINGS.itemtypes[getStorage("customaddtype")].icon : false, + customaddname: inStorage("customaddtype") && getStorage("customaddtype") != "NONE" ? SETTINGS.itemtypes[getStorage("customaddtype")].name : false, nottablet: !tablet } }) @@ -435,6 +438,12 @@ var routes = [ { path: '/help', routes: [ + { + path: '/add', + panel: { + url: './pages/help/add.html' + } + }, { path: '/list', panel: { @@ -500,16 +509,16 @@ var routes = [ } settings.push( { - setting: "alerts", - title: "Package Alerts", - text: "Change the alert sound, volume, and distance.", - onclick: "router.navigate('/settings/alerts')", + setting: "packages", + title: "Packages and Alerts", + text: "Change options for the Add screen, proximity alerts, etc.", + onclick: "router.navigate('/settings/packages')", link: true }, { setting: "maps", title: "Map and Navigation", - text: "Change map settings and units.", + text: "Change map theme and settings.", onclick: "router.navigate('/settings/maps')", link: true }, @@ -580,10 +589,16 @@ var routes = [ }, routes: [ { - path: '/alerts', + path: '/packages', name: 'settings', async: function (routeTo, routeFrom, resolve, reject) { - var alertsounds = []; + var alertsounds = [ + { + value: "NONE", + label: "No sound", + selected: getStorage("alertsound") == "NONE" + } + ]; for (var id in SETTINGS.alertsounds) { if (SETTINGS.alertsounds.hasOwnProperty(id)) { alertsounds.push({ @@ -594,7 +609,39 @@ var routes = [ } } + var customitemtypes = [ + { + value: "NONE", + label: "No button", + selected: !inStorage("customaddtype") || getStorage("customaddtype") == "NONE" + } + ]; + for (var id in SETTINGS.itemtypes) { + if (SETTINGS.itemtypes.hasOwnProperty(id)) { + customitemtypes.push({ + value: id, + label: SETTINGS.itemtypes[id].name, + selected: getStorage("customaddtype") == id + }); + } + } + var settings = [ + { + setting: "mapcalibrate", + title: "Map Calibration", + text: "Ask to fix the map if package delivered far from expected location.", + toggle: true, + checked: getStorage("mapcalibrate") !== "false", + onclick: "" + }, + { + setting: "customaddtype", + title: "Custom Add Button", + text: "Have a second button on the Add screen for your favorite item type.", + select: true, + options: customitemtypes + }, { setting: "alertsound", title: "Alert sound", @@ -702,14 +749,6 @@ var routes = [ } ] }, - { - setting: "mapcalibrate", - title: "Map Calibration", - text: "Ask where you are when delivering a package if the map is wrong.", - toggle: true, - checked: getStorage("mapcalibrate") !== "false", - onclick: "" - }, { setting: "mapscale", title: "Map Scale Ruler",