Dappos is a Ethereum based Dapp POS register.
There was no POS app for Ethereum to our knowledge, so we made one! βπ»
Always make PR towards the DEV branch. Always add an emoji after each commit βπ». Make small commits often.
npm run dev
ES6 StandardJS linting enabled
Vue.js + Quasar framework
Path aliasses available at: quasar.conf.js
.
Path | Alias |
---|---|
src/css/themes/common.variables.styl | import @import '~styl/variables' |
src/router | import ... from '@router/...' |
src/store | import ... from '@store/...' |
src/helpers | import ... from '@helpers/...' |
src/config | import ... from '@config/...' |
Write functional attributes first, semantic ones and classes last:
<button @click="add()" class="_add"> ... </button>
New line per attribute when the line feels to long:
<button
@click="dispatch('cart/openMore', item)"
class="_more _button _extras"
>
...
</button>
Stylus with minimal syntax. We don't use BEM. π±
- Ommit traditional syntax
: ;
- Scoped styles per component
- Do not use element selectors, only classes!
- Top level div class is the component name
- Keep other class names unique to the Vue component short and start with underscore Eg.
_link
(this way it's easy to see which classes are local) - Global classes have no underscore (eg.
reset-button
in example below) - JS selectors start with
js-
(eg.js-info-cart
in example below) - Only very frequently used classes like
btn
andlink
can start witho-
(a little bit of BEM after all π) - No fixed width and margin on most outer div! (Setting the width on a component should be done in the parent component when importing it. This keeps our components re-usable.)
- Mobile first
- Rem/em preffered over pixels
<template>
<div class="info-cart">
<button class="_link reset-button">
<div class="_count js-info-cart">...</div>
</button>
</div>
</template>
<style lang="stylus" scoped>
@import '~styl/variables'
// top level div class is component name
.info-cart
width 100%
// scoped private class
._link
color goldenrod
</style>
Please see src/css/themes/common.variables.styl
.
Several general helpers are available in src/css/themes/helpers
:
Breakpoints
Screen breakpoints have variables set in helpers/breakpoints.styl
. Media queries have a shorthand:
._layout
padding .5rem
media-sm padding 1rem
Basically this says the padding is .5rem
(mobile first) and 1rem
for anything bigger than 'small screens'. It will wrap padding 1rem
in a media query for min-width < $breakpoint-sm
which is set to 767px.
Margin Padding
Classes for margin
and padding
have shorthands like px
for padding-left
and -right
(x axis) and are followed by a size like md
for 'medium':
._class
px md
Combine margin/padding
py/my
orpx/mx
: padding and margin on x or y axispt/pr/pb/pl
ormt/mr/mb/ml
: per directionpa/ma
: all directions
With sizes:
xxs
16px * .1xs
16px * .25sm
16px * .5md
16pxlg
16px * 1.5xl
16px * 2.3xxl
16px * 3xxxl
16px * 5
External plugins etc. to be installed with npm
and added as a plugin. Please read about the plugin documentation here.
We are using the plugins: Vuex easy access and Vuex easy firestore. Please read up on the documentation!
TLDR;
- Never set state directly! Always use the (auto-generated) setters
- Usage of getters and setters in Vue components:
get(path) set(path, val)
path
syntax is:module/prop.subprop
- Always set default mutations per module:
...defaultMutations(initialState(), easyAccessConf)
- Usage of setters in vuex module:
dispatch('module/set/prop.subprop', val)
- Usage of setters for firestore modules ('settings' and 'menulist'):
dispatch('settings/set', newSettings)
dispatch('user/menulist/set' item)
- To overwriting a setter add an action:
actions: {
'prop.subprop': ({commit}, val) => {
// do some stuff
commit('prop.subprop', val)
},
}
The inner process of how the app initialises:
- Vuex store and router are instanciated (
store/index
androuter/index
) - Other plugins are instanciated (
plugins/
please see the documentation) - Firebase gets initialised (
plugins/firebase
) - Authentication is checked (
plugins/boot
) after which:
- Firestore DB channels are opened
- Web3 checks for a wallet
- Vue, the app & DOM get created
The order of the plugins can be checked in quasar.conf.js
.