Skip to content

Commit 9bf6778

Browse files
fix(home, subscriptions): remove subscriptions, lite code, ghost blog switch 🐛
1 parent 8b0ae6c commit 9bf6778

File tree

12 files changed

+16
-486
lines changed

12 files changed

+16
-486
lines changed

src/config/defaults/development.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ module.exports = {
1818
home: 'home',
1919
auth: 'auth',
2020
users: 'users',
21-
subscriptions: 'subscriptions',
2221
tasks: 'tasks',
2322
},
2423
},
@@ -133,7 +132,6 @@ module.exports = {
133132
],
134133
},
135134
home: {
136-
subscriptions: true, // disbale / enable
137135
temporalBackground: 'https://blog.weareopensource.me/content/images/size/w1600/2020/11', // one by hour 00.jpg, 01.jpg; 02.jpg ... set to null default background would be in @/assets/images/background.jpg
138136
abouts: [
139137
{
@@ -219,6 +217,7 @@ module.exports = {
219217
// actually dev for Ghost Blog
220218
title: 'Blog',
221219
url: 'https://blog.weareopensource.me',
220+
subscribe: 'https://blog.weareopensource.me/#subscribe',
222221
key: '0415f48774e7c49c713204f787',
223222
},
224223
contact: {

src/modules/_app/app.router.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import config from '@/config';
99
import home from '@/modules/home/router/home.router';
1010
import auth from '@/modules/auth/router/auth.router';
1111
import users from '@/modules/users/router/users.router';
12-
import subscriptions from '@/modules/subscriptions/router/subscriptions.router';
1312
import secure from '@/modules/secure/router/secure.router';
1413
import tasks from '@/modules/tasks/router/tasks.router';
1514

16-
const routes = [].concat(home, auth, users, subscriptions, secure, tasks);
15+
const routes = [].concat(home, auth, users, secure, tasks);
1716

1817
/**
1918
* Router configuration

src/modules/_app/app.store.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Vuex from 'vuex';
66
import core from '@/modules/_core/stores/core.store';
77
import auth from '@/modules/auth/stores/auth.store';
88
import users from '@/modules/users/stores/users.store';
9-
import subscriptions from '@/modules/subscriptions/stores/subscriptions.store';
109
import home from '@/modules/home/stores/home.store';
1110
import tasks from '@/modules/tasks/stores/tasks.store';
1211

@@ -25,7 +24,6 @@ export default new Vuex.Store({
2524
core,
2625
auth,
2726
users,
28-
subscriptions,
2927
home,
3028
tasks,
3129
},

src/modules/home/components/home.banner.component.vue

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
- Call example
33
<homeBannerComponent
44
v-bind:ratio="1"
5-
v-bind:subscribe="true"
65
v-bind:app="app"
76
></homeBannerComponent>
87
- Data Example
98
app: {
109
title: 'WAOS Dev',
1110
logo: 'logo.png', // null to use title by default
1211
subtitle: 'welcome to demo.',
13-
description: 'Vue - Boilerplate Front : Vuetify, Axios, Jest, Cypress (Alpha) '
12+
description: 'Vue - Boilerplate Front : Vuetify, Axios, Jest, Cypress (Alpha)'
13+
home: {
14+
blog: {
15+
subscribe: '...'
16+
}
17+
}
1418
},
1519
-->
1620
<template>
@@ -85,23 +89,17 @@
8589
xl="5"
8690
style="bottom: 5%; position: absolute; opacity: 75%;"
8791
data-aos="fade-up"
88-
v-if="config.home.subscriptions && subscribe"
92+
v-if="config.home.blog && config.home.blog.subscribe"
8993
>
90-
<v-text-field
91-
v-model="email"
92-
:flat="config.vuetify.theme.flat"
93-
:rules="[rules.email]"
94-
:append-icon="'fa-envelope'"
95-
@click:append="createSubscription"
96-
@keydown.enter="createSubscription"
94+
<v-btn
95+
:href="config.home.blog.subscribe"
96+
target="_blank"
97+
class="px-10"
9798
height="55"
98-
name="Mail"
99-
placeholder="Stay informed by email."
100-
class="centered-input"
101-
solo
99+
elevation="0"
102100
rounded
103101
light
104-
></v-text-field>
102+
><span style="color:gray;">Stay informed by email<v-icon class="pl-8">fa-paper-plane</v-icon></span></v-btn>
105103
</v-col>
106104
</v-row>
107105
</v-container>
@@ -112,16 +110,12 @@
112110
</template>
113111

114112
<script>
115-
/**
116-
* Module dependencies.
117-
*/
118-
import { mapGetters } from 'vuex';
119113
/**
120114
* Export default
121115
*/
122116
export default {
123117
name: 'homeBannerComponent',
124-
props: ['ratio', 'subscribe', 'app', 'statusMargin', 'banner'],
118+
props: ['ratio', 'app', 'statusMargin', 'banner'],
125119
data() {
126120
return {
127121
valid: false,
@@ -131,29 +125,10 @@ export default {
131125
},
132126
};
133127
},
134-
computed: {
135-
...mapGetters(['homeSubscription']),
136-
email: {
137-
get() {
138-
return this.homeSubscription.email;
139-
},
140-
set(email) {
141-
this.save = true;
142-
this.$store.commit('subscription_update', { email });
143-
},
144-
},
145-
},
146128
methods: {
147129
generateTemporalBackground() {
148130
return `${this.config.home.temporalBackground}/${`0${new Date().getHours()}`.slice(-2)}.jpg`;
149131
},
150-
createSubscription() {
151-
if (this.rules.email(this.homeSubscription.email)) {
152-
this.$store
153-
.dispatch('createSubscription', this.homeSubscription)
154-
.catch((err) => console.log(err));
155-
}
156-
},
157132
},
158133
};
159134
</script>

src/modules/home/stores/home.store.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
import Vue from 'vue';
55
import _ from 'lodash';
66
import config from '@/config';
7-
import model from '@/lib/middlewares/model';
87
import tools from '@/lib/helpers/tools';
98
import GhostContentAPI from '@tryghost/content-api';
109

1110
const api = `${config.api.protocol}://${config.api.host}:${config.api.port}/${config.api.base}`;
12-
const whitelists = ['email', 'news'];
1311

1412
/**
1513
* Getters: get state
@@ -18,7 +16,6 @@ const getters = {
1816
team: (state) => state.team,
1917
contents: (state) => state.contents,
2018
news: (state) => state.news,
21-
homeSubscription: (state) => state.subscription,
2219
contact: (state) => state.contact,
2320
statistics: (state) => state.statistics,
2421
};
@@ -84,19 +81,6 @@ const actions = {
8481
commit('error', err);
8582
}
8683
},
87-
createSubscription: async ({ commit }, params) => {
88-
try {
89-
const obj = model.clean(params, whitelists);
90-
obj.news = true;
91-
const res = await Vue.prototype.axios.post(
92-
`${api}/${config.api.endPoints.subscriptions}/`,
93-
obj,
94-
);
95-
commit('subscription_set', res.data.data);
96-
} catch (err) {
97-
commit('error', err);
98-
}
99-
},
10084
getStatistics: async ({ commit }) => {
10185
try {
10286
const tasks = await Vue.prototype.axios.get(`${api}/${config.api.endPoints.tasks}/stats`);
@@ -135,13 +119,6 @@ const mutations = {
135119
state.news = data;
136120
},
137121
// mail
138-
subscription_set(state, data) {
139-
state.subscription = data;
140-
},
141-
subscription_update(state, data) {
142-
_.merge(state.subscription, data);
143-
},
144-
// mail
145122
contact_set(state, data) {
146123
state.contact = data;
147124
},
@@ -172,7 +149,6 @@ const state = {
172149
team: [],
173150
contents: [],
174151
news: [],
175-
subscription: {},
176152
contact: {},
177153
statistics: config.home.stats.data,
178154
};

src/modules/home/views/home.view.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<div>
33
<homeBannerComponent
44
v-bind:ratio="1"
5-
v-bind:subscribe="true"
65
v-bind:app="config.app"
76
v-bind:statusMargin="450"
87
></homeBannerComponent>

src/modules/home/views/pages.view.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<div>
33
<homeBannerComponent
44
v-bind:ratio="3"
5-
v-bind:subscribe="false"
65
v-bind:app="{ subtitle: this.$route.meta.title || this._.startCase(this.$route.params.name) }"
76
v-bind:banner="(contents.length == 1 && contents[0].banner) ? contents[0].banner : null"
87
></homeBannerComponent>

src/modules/home/views/team.view.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<div>
33
<homeBannerComponent
44
v-bind:ratio="3"
5-
v-bind:subscribe="false"
65
v-bind:app="{ subtitle: this.$route.meta.title }"
76
></homeBannerComponent>
87
<v-container fluid>

src/modules/subscriptions/router/subscriptions.router.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/modules/subscriptions/stores/subscriptions.store.js

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)