Skip to content

Commit

Permalink
moved boilerplate out of web3 folder
Browse files Browse the repository at this point in the history
  • Loading branch information
clr14003 committed May 1, 2020
1 parent f00d1d7 commit 130f428
Show file tree
Hide file tree
Showing 27 changed files with 9,262 additions and 1 deletion.
2 changes: 2 additions & 0 deletions final/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 1%
last 2 versions
7 changes: 7 additions & 0 deletions final/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VUE_APP_API_KEY="AIzaSyAr-XHArmxpdfTvB4lpSxyDhqOdQVlA4PQ"
VUE_APP_AUTH_DOMAIN="dmd-4470-26236.firebaseapp.com"
VUE_APP_DATABASE_URL="https://dmd-4470-26236.firebaseio.com"
VUE_APP_PROJECT_ID="dmd-4470-26236"
VUE_APP_STORAGE_BUCKET="dmd-4470-26236.appspot.com"
VUE_APP_MESSAGE_SENDER_ID="842034760665"
VUE_APP_APP_ID="1:842034760665:web:edcba8e2b27d82a18967c8"
21 changes: 21 additions & 0 deletions final/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

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

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

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
19 changes: 19 additions & 0 deletions final/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# web-three-twitter-boilerplate

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions final/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
24 changes: 24 additions & 0 deletions final/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "web-three-twitter-boilerplate",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.6.4",
"firebase": "^7.13.1",
"firebaseui": "^4.5.0",
"vue": "^2.6.11",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.3",
"@vue/cli-service": "^4.2.3",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.10"
}
}
5 changes: 5 additions & 0 deletions final/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}
Binary file added final/public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions final/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>web-three-twitter-boilerplate</title>
</head>
<body>
<noscript>
<strong>We're sorry but web-three-twitter-boilerplate 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>
94 changes: 94 additions & 0 deletions final/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about"><img class="navImg" src="./assets/prof-link-placeholder.png"></router-link> |
<router-link to="/login" v-if="!authenticated">Log in</router-link>
<a href="#" v-if="authenticated" @click="$store.dispatch('signOut')"><img class="navImg" src="./assets/logout-placeholder.png"></a>
<div id="navSidebar">
<img id ="logo" src="./assets/logo-placeholder.png">
<div id="profPreview">
<img id="profPreviewPic" src="./assets/prof-pic-placeholder.png">
<div>
<span>Profile Name</span>
</div>
</div>


</div>



</div><router-view/>
</div>

</template>

<script src="https://www.gstatic.com/firebasejs/7.14.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.2/firebase-firestore.js"></script>
<script>
export default {
name: 'app',
computed: {
authenticated(){
return this.$store.getters.isAuthenticated;
}
},
mounted() {
// console.log(this.authenticated);
}
}
</script>

<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
display: flex;
justify-content: flex-start;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
filter: brightness(120%);
}
}
img.navImg {
height: 30px;
}
}
#profPreview {
display: flex;
width: 100%;
img {
width: 30%;
}
div {
padding-left: 5%;
line-height: 200%;
}
}
#logo {
height: 170px;
width: 170px;
}
#navSidebar {
width: 100%;
}
</style>
Binary file added final/src/assets/logo-placeholder.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 final/src/assets/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 final/src/assets/logout-placeholder.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 final/src/assets/prof-link-placeholder.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 final/src/assets/prof-pic-placeholder.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 final/src/assets/settings-link-placeholder.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 final/src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>

<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
39 changes: 39 additions & 0 deletions final/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import firebase from '@/plugins/firebase-init'
import ui from '@/plugins/firebaseui-init'

Vue.config.productionTip = false;

/**
*
* Makes available:
* - window.firebase
* - window.db
*/
Vue.use(firebase);

/**
* Prebuilt Authentication UI
* Makes available:
* - window.ui
* - this.$ui (in the vue instance)
*/
Vue.use(ui);


new Vue({
router,
store,
render: h => h(App),
created () {
window.firebase.auth().onAuthStateChanged((user) => {
if(user){
store.commit('user', user);
}
});
}
}).$mount('#app')
26 changes: 26 additions & 0 deletions final/src/plugins/firebase-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as firebase from "firebase/app";

import "firebase/auth";
import "firebase/firestore";

firebase.initializeApp({
apiKey: process.env.VUE_APP_API_KEY,
authDomain: process.env.VUE_APP_AUTH_DOMAIN,
databaseURL: process.env.VUE_APP_DATABASE_URL,
projectId: process.env.VUE_APP_PROJECT_ID,
storageBucket: process.env.VUE_APP_STORAGE_BUCKET,
messagingSenderId: process.env.VUE_APP_MESSAGING_SENDER_ID,
appId: process.env.VUE_APP_APP_ID,
measurementId: process.env.VUE_APP_MEASUREMENT_ID,
});

export default {
install(vue, opts){
// Attach necessary Firebase APIs here
// @url https://firebase.google.com/docs/web/setup
window.db = firebase.firestore();
window.firebase = firebase;
}
}

export { firebase };
13 changes: 13 additions & 0 deletions final/src/plugins/firebaseui-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { firebase } from './firebase-init';
import * as firebaseui from "firebaseui";

let ui = new firebaseui.auth.AuthUI(firebase.auth());

export default {
install(vue, opts){
window.ui = ui;
vue.prototype.$ui = ui;
}
}

export { ui }
47 changes: 47 additions & 0 deletions final/src/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import Vue from 'vue'
import Router from 'vue-router'
import store from './store';


/**
* Don't forget to import your views here:
*/
import Home from './views/Home.vue'
import About from './views/About.vue'
import Login from './views/Login.vue'


Vue.use(Router)

const router = new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/login',
name: 'login',
component: Login
},
{
path: '/',
name: 'home',
component: Home
},

{
path: '/about',
name: 'about',
component: About
}
]
});

/**
* Authentication Check
*/
router.beforeEach((to, from, next) => {
if (to.name !== 'login' && !store.getters.isAuthenticated) next({ name: 'login' })
else next()
})

export default router;
Loading

0 comments on commit 130f428

Please sign in to comment.