Skip to content

Commit

Permalink
core: main-frontend: Create initial structure
Browse files Browse the repository at this point in the history
Setup is:
- Vue 2
- Typescript
- Vuetify
- Vuex
- Router (with history mode)
- PWA support
- SASS (with dart-sass)
- Eslint (with Airbnb pattern) and:
    - Max line length of 120
    - No camelcase check
    - No lines between class members
- Font as dependency (for offline usage)
- Port 8080
  • Loading branch information
rafaellehmkuhl committed Jun 18, 2021
1 parent fe47c67 commit 2b6cfe1
Show file tree
Hide file tree
Showing 24 changed files with 9,875 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/companion_os/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead
23 changes: 23 additions & 0 deletions core/companion_os/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist


# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions core/companion_os/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CompanionOS

Main frontend for managing Companion
5 changes: 5 additions & 0 deletions core/companion_os/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
};
42 changes: 42 additions & 0 deletions core/companion_os/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "companion-os",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@mdi/font": "^5.9.55",
"core-js": "^3.6.5",
"register-service-worker": "^1.7.1",
"roboto-fontface": "*",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuetify": "^2.4.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-pwa": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-airbnb": "^5.0.2",
"@vue/eslint-config-typescript": "^7.0.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"typescript": "~4.1.5",
"vue-cli-plugin-vuetify": "~2.4.1",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.7.0"
}
}
Binary file added core/companion_os/public/favicon.ico
Binary file not shown.
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 core/companion_os/public/img/icons/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions core/companion_os/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
73 changes: 73 additions & 0 deletions core/companion_os/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template>
<v-app>
<v-card
flat
>
<v-app-bar
color="#08c"
rounded="0"
>
<v-app-bar-nav-icon
color="white"
@click="drawer = true"
></v-app-bar-nav-icon>

<v-spacer></v-spacer>

</v-app-bar>
</v-card>

<v-navigation-drawer
v-model="drawer"
absolute
temporary
>
<v-list
nav
dense
>
<v-list-item-group
active-class="deep-blue--text text--accent-4"
>
<v-card elevation="0" class="d-flex justify-center">
<v-img
alt="Blue Robotics Logo"
class="shrink mr-2"
contain
src="./assets/logo.svg"
width="60"
/>
</v-card>

<v-card elevation="0" height="30" class="pa-4">
<v-divider></v-divider>
</v-card>

<v-list-item to="/">
<v-list-item-icon>
<v-icon>mdi-home</v-icon>
</v-list-item-icon>
<v-list-item-title>Main</v-list-item-title>
</v-list-item>

</v-list-item-group>
</v-list>
</v-navigation-drawer>

<v-main>
<router-view/>
</v-main>
</v-app>
</template>

<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
name: 'App',
data: () => ({
drawer: false,
}),
});
</script>
1 change: 1 addition & 0 deletions core/companion_os/src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions core/companion_os/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import vuetify from './plugins/vuetify';

Vue.config.productionTip = false;

new Vue({
router,
store,
vuetify,
render: (h) => h(App),
}).$mount('#app');
11 changes: 11 additions & 0 deletions core/companion_os/src/plugins/vuetify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import '@mdi/font/css/materialdesignicons.css';
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';

Vue.use(Vuetify);

export default new Vuetify({
icons: {
iconfont: 'mdi',
},
});
21 changes: 21 additions & 0 deletions core/companion_os/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Vue from 'vue';
import VueRouter, { RouteConfig } from 'vue-router';
import Main from '../views/MainView.vue';

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
{
path: '/',
name: 'Main',
component: Main,
},
];

const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes,
});

export default router;
15 changes: 15 additions & 0 deletions core/companion_os/src/store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
modules: {
},
});
4 changes: 4 additions & 0 deletions core/companion_os/src/types/shims-general.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const value: string;
export default value;
}
13 changes: 13 additions & 0 deletions core/companion_os/src/types/shims-tsx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Vue, { VNode } from 'vue';

declare global {
namespace JSX {
// tslint:disable no-empty-interface
interface Element extends VNode {}
// tslint:disable no-empty-interface
interface ElementClass extends Vue {}
interface IntrinsicElements {
[elem: string]: any
}
}
}
5 changes: 5 additions & 0 deletions core/companion_os/src/types/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.vue' {
import Vue from 'vue';

export default Vue;
}
5 changes: 5 additions & 0 deletions core/companion_os/src/types/shims-vuetify.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'vuetify/lib/framework' {
import Vuetify from 'vuetify';

export default Vuetify;
}
11 changes: 11 additions & 0 deletions core/companion_os/src/views/MainView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<v-container>Main</v-container>
</template>

<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
name: 'Main',
});
</script>
39 changes: 39 additions & 0 deletions core/companion_os/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": false,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}
19 changes: 19 additions & 0 deletions core/companion_os/vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
transpileDependencies: [
'vuetify',
],
pwa: {
name: 'CompanionOS',
themeColor: '#08c',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'white',
manifestOptions: {
background_color: '#FFFFFF',
},
iconPaths: {
favicon32: 'img/icons/favicon-32x32.png',
favicon16: 'img/icons/favicon-16x16.png',
appleTouchIcon: 'img/icons/apple-touch-icon.png',
},
},
};
Loading

0 comments on commit 2b6cfe1

Please sign in to comment.