Skip to content

Commit

Permalink
Inital Commit for Open Nomie
Browse files Browse the repository at this point in the history
  • Loading branch information
brandoncorbin committed Jul 20, 2019
0 parents commit 4c42c7d
Show file tree
Hide file tree
Showing 116 changed files with 22,998 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
node_modules
public/bundle.*
package-lock.json
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Open Nomie - Private & Encrypted Mood & Life Tracker

![](https://shareking.s3.amazonaws.com/Screen-Shot-2019-07-07-14-12-15.02.png)

I started [building Nomie in 2014](https://nomie.app/blog/original-nomie-blog-post) and over the next handful of years I release 3 major versions in 3 different JS technologies (VanilaJS -> Ionic -> ReactNative). The Nomie user base grew to ~100,000 users spread over multiple versions and multiple platforms.

In March 2019 I decided to remove the apps from Google Play and the App Store and step away from the "native app world" has it's too exhausting.

While the native apps will continue to run for those who installed it before, I wanted to take the best parts of Nomie 1, 2 and 3 and release it as an open source solution that could be run in the browser. This project is that result.

## [Svelte](https://svlete.dev)

This rewrite/port uses SvelteJS https://svlete.dev - a great tool for building fast / reactive single page apps (like Vue, React) without the framework.

## [Blockstack](https://blockstack.org)

Since this version runs in the browser, it's using Blockstack for auth and storage. Blockstack is all about decentralized apps, and giving users full control over their data and keeps everything (trackers, boards, every single log) encrypted, only to be decrypted with your blockstack profile.

## Running it Locally

```
git clone [email protected]:nomie-app/nomie.git
cd nomie
npm install
npm run dev
```

## Structure Overview

- **/src**
- **/src/components** - simple single ui components to build the user interfact
- **/src/containers** - complicated components
- **/src/modules** - models and commonly used functions
- **/src/routes** - nomie app's primary routes
- **/src/scss** - global SCSS styling, variables, bootstrap
- **/src/store** - application state management
- **/src/utils** - common utility functions

## Meet the Nouns

- **Tracker** - primarily represented by a button on the "track board". Trackers are represented by their hashtag in notes - for example: #sleep(160000).
- **Board** - a board is specific group of trackers.
- **Board Tabs** - how you switch boards on the track tab
- **Log** - a record event. A lot contains a note, a note can contain unlimited numbers of tags; e.g: #mood(4) #pizza #beer(12). Logs can contain a lat and long. Tracker Objects and their values are parsed out of the logs in real time.

## Data Storage

Blockstack.org is a "Decentralized computing network and app ecosystem" - basically, it offers a means to auth a user, and get/put files that are encrypted. This means Nomie works with flat files that require a network lookup. I've decided to create a "log book" for each month. Even heavy users will have a monthly book less than 100k, so that seemed reasonable. Plus doing it every day would require way too many network lookups when generating stats, and each year would be too big for and risky.

/v01/data/books/2019-01

- v01 - a way to make upgrading easier without affecting users existing data stores
- data - generic
- books - holder of books
- 2019-01 - json array of logs

/v01/data/trackers.json - trackers
/v01/data/boards.json - users board configuration

# Coding Rules

- **Keep it readable** - focus on writing code that new people can easily understand and follow. If the code can't do it, then do it with comments. There's no such thing as too much commenting.
- **Keep it under 300 lines** - the goal is to keep files under 300 lines of code. Note: Sometimes that's not feasible.
- **Keep it flexible** - think in components. If you're doing something more than once, it most likely should be a component.
- **Keep cleaning, organizing and testing** - this project didn't start very clean, or ready for unit testing, this should be an on going objective.
- **Use what's there** - Twitter bootstrap ([and all it's classes](https://getbootstrap.com/)) are available, reuse what already exists before writing new - especially css.
22 changes: 22 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Todo

- [] - come up with some way to pull in content
- [] - TESTING!
- [] - add goals
- [] - make logs FULLY editable
- [x] - do onboarding slides
- [x] - make export work with events
- [x] - make /public/global.css pull from scss
- [x] - complete tracker editor
- [x] - start stats
- [x] - get search working
- [x] - Make location lookup work
- [x] - timer input
- [] - Edit / Create boards
- [x] - keypad input
- [x] - slider input
- [x] - board support
- [-] - Tracker Editor
- [x] - Get date picker for desktop
- [x] - Setup starter packs - make them easy for others to contirbute
- [x] - think about adding page view data to a store - to maintain the state as a users clicks around
8 changes: 8 additions & 0 deletions build-tools/bust-cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const fs = require('fs');
// Read Public and Package file
let public = fs.readFileSync('./public/index.html', 'UTF-8');
let packageJSON = JSON.parse(fs.readFileSync('./package.json', 'UTF-8'));
// Replace app version with app version
public = public.replace(/APP_VERSION/g, packageJSON.version.substr(0, 10)); // substr to limit any fuckery

fs.writeFileSync('./public/index.html', public, 'UTF-8');
7 changes: 7 additions & 0 deletions build-tools/patch-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let packageJson = require('../package.json');
let semver = require('semver');
let fs = require('fs');
packageJson.version = semver.inc(packageJson.version, 'patch');
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2), 'UTF-8');

console.log(`Nomie Version is now set to: ${packageJson.version}`);
7 changes: 7 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build]
command = "npm run build"
publish = "public"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
53 changes: 53 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "nomie-dap",
"version": "4.0.51",
"scripts": {
"build": "node build-tools/bust-cache.js && rollup -c",
"autobuild": "rollup -c -w",
"scss": "node-sass ./src/scss/main.scss --output=./public --watch=./src/scss/**/*.scss --include-path",
"watch:scss": "nodemon -e scss -x \"npm run scss\"",
"dev": "concurrently \"run-p start:dev autobuild\" \"npm run scss\"",
"dev-original": "run-p start:dev autobuild",
"start": "sirv public --single",
"start:dev": "sirv public --cors --single --dev",
"patch": "node build-tools/patch-version.js",
"test:unit": "jest src/**/*.spec.js"
},
"devDependencies": {
"@kazzkiq/svelte-preprocess-scss": "^0.1.3",
"@sveltejs/gestures": "0.0.1",
"bootstrap": "^4.3.1",
"concurrently": "^4.1.1",
"jest": "^24.8.0",
"mini-css-extract-plugin": "^0.7.0",
"node-sass": "^4.12.0",
"nomie-uom": "^1.0.2",
"npm-run-all": "^4.1.5",
"pre-commit": "^1.2.2",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^4.0.4",
"sass-loader": "^7.1.0",
"semver": "^6.2.0",
"sirv-cli": "^0.4.4",
"style-loader": "^0.23.1",
"svelte": "^3.0.0",
"svelte-preprocess-css-global": "0.0.1",
"svelte-routing": "^1.2.0"
},
"dependencies": {
"d3-scale": "^3.0.0",
"dayjs": "^1.8.14",
"md5": "^2.2.1",
"svelte-awesome": "^1.4.1",
"svelte-loader": "^2.13.4",
"svelte-spinner": "^2.0.1"
},
"license": "MIT"
}
2 changes: 2 additions & 0 deletions public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*
Access-Control-Allow-Origin: https://browser.blockstack.org
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions public/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
body {
color: #333;
margin: 0;
padding: 8px;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
a {
color: rgb(0,100,200);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:visited {
color: rgb(0,80,160);
}
label {
display: block;
}
input, button, select, textarea {
font-family: inherit;
font-size: inherit;
padding: 0.4em;
margin: 0 0 0.5em 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
}
input:disabled {
color: #ccc;
}
input[type="range"] {
height: 0;
}
button {
color: #333;
background-color: #f4f4f4;
outline: none;
}
button:active {
background-color: #ddd;
}
button:focus {
border-color: #666;
} */
Binary file added public/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/logos/Blockstack-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nomie-splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nomie-white-type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/pin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/screens/blockstack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/screens/board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/screens/capture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/screens/homescreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/screens/stats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>Nomie Dap</title>
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=contain" />

<meta name="apple-mobile-web-app-title" content="Nomie 4" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="apple-touch-startup-image" href="/images/nomie-splash.png" />
<link rel="apple-touch-icon" href="/images/icon.png" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="icon" sizes="192x192" href="/images/icon.png" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<!-- Browserstack for decentralied / encrypted storage -->
<script
src="https://unpkg.com/[email protected]/dist/blockstack.js"
integrity="sha384-+qYCYoUGzsMLAzHm80c4DyhbWgHBBb2N0RFqsg7Lws5ljtBtj/IwpgxZkiR7j7lp"
crossorigin="anonymous"
></script>
<!-- Leaflet for Map -->
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""
/>
<script
src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="
crossorigin=""
></script>
<!-- GeoCoding -->

<!-- Load Esri Leaflet from CDN -->
<script
src="https://unpkg.com/[email protected]/dist/esri-leaflet.js"
integrity="sha512-tyPum7h2h36X52O2gz+Pe8z/3l+Y9S1yEUscbVs5r5aEY5dFmP1WWRY/WLLElnFHa+k1JBQZSCDGwEAnm2IxAQ=="
crossorigin=""
></script>

<!-- Load Esri Leaflet Geocoder from CDN -->
<link
rel="stylesheet"
href="https://unpkg.com/[email protected]/dist/esri-leaflet-geocoder.css"
integrity="sha512-v5YmWLm8KqAAmg5808pETiccEohtt8rPVMGQ1jA6jqkWVydV5Cuz3nJ9fQ7ittSxvuqsvI9RSGfVoKPaAJZ/AQ=="
crossorigin=""
/>
<script
src="https://unpkg.com/[email protected]/dist/esri-leaflet-geocoder.js"
integrity="sha512-uK5jVwR81KVTGe8KpJa1QIN4n60TsSV8+DPbL5wWlYQvb0/nYNgSOg9dZG6ViQhwx/gaMszuWllTemL+K+IXjg=="
crossorigin=""
></script>

<!-- ZMDI for icons -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css"
/>
<!-- main is from scss/main.scss -->
<link rel="stylesheet" href="/main.css?v=APP_VERSION" />
<!-- bundle is all the styles from the app and components-->
<link rel="stylesheet" href="/bundle.css?v=APP_VERSION" />
</head>

<body>
<script src="/bundle.js?v=APP_VERSION"></script>
</body>
</html>
Loading

0 comments on commit 4c42c7d

Please sign in to comment.