From 1d64b7621176e25fedd98553c282c56242d38571 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 14 Feb 2017 22:21:23 +0100 Subject: Add basic configuration module, make it work for title and theme. --- src/main.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index c187ffd6..fb48a64d 100644 --- a/src/main.js +++ b/src/main.js @@ -12,11 +12,10 @@ import UserProfile from './components/user_profile/user_profile.vue' import statusesModule from './modules/statuses.js' import usersModule from './modules/users.js' import apiModule from './modules/api.js' +import configModule from './modules/config.js' import VueTimeago from 'vue-timeago' -import StyleSetter from './services/style_setter/style_setter.js' - Vue.use(Vuex) Vue.use(VueRouter) Vue.use(VueTimeago, { @@ -30,7 +29,8 @@ const store = new Vuex.Store({ modules: { statuses: statusesModule, users: usersModule, - api: apiModule + api: apiModule, + config: configModule } }) @@ -61,4 +61,9 @@ new Vue({ components: { App } }) -StyleSetter.setStyle('/static/css/base16-solarized-light.css') +window.fetch('/static/config.json') + .then((res) => res.json()) + .then(({name, theme}) => { + store.dispatch('setOption', { name: 'name', value: name }) + store.dispatch('setOption', { name: 'theme', value: theme }) + }) -- cgit v1.2.3-70-g09d2 From 370468bd6aadd31b9c254bde87af2f9eaeb06c0b Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 14 Feb 2017 22:42:13 +0100 Subject: Persist users. --- package.json | 3 ++- src/main.js | 9 ++++++++- yarn.lock | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/main.js') diff --git a/package.json b/package.json index 38321134..437ad57f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "vue": "^2.0.1", "vue-router": "^2.0.1", "vue-timeago": "^3.1.2", - "vuex": "^2.0.0" + "vuex": "^2.0.0", + "vuex-persistedstate": "^1.1.0" }, "devDependencies": { "autoprefixer": "^6.4.0", diff --git a/src/main.js b/src/main.js index fb48a64d..84db5c86 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,8 @@ import configModule from './modules/config.js' import VueTimeago from 'vue-timeago' +import createPersistedState from 'vuex-persistedstate' + Vue.use(Vuex) Vue.use(VueRouter) Vue.use(VueTimeago, { @@ -25,13 +27,18 @@ Vue.use(VueTimeago, { } }) +const persistedStateOptions = { + paths: ['users.users'] +} + const store = new Vuex.Store({ modules: { statuses: statusesModule, users: usersModule, api: apiModule, config: configModule - } + }, + plugins: [createPersistedState(persistedStateOptions)] }) const routes = [ diff --git a/yarn.lock b/yarn.lock index 16150613..a1ce6b64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3495,6 +3495,10 @@ lodash.merge@^3.3.2: lodash.keysin "^3.0.0" lodash.toplainobject "^3.0.0" +lodash.merge@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5" + lodash.pairs@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash.pairs/-/lodash.pairs-3.0.1.tgz#bbe08d5786eeeaa09a15c91ebf0dcb7d2be326a9" @@ -4011,6 +4015,10 @@ object-component@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" +object-path@^0.11.2: + version "0.11.3" + resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.11.3.tgz#3e21a42ad07234d815429ae9e15c1c5f38050554" + object.omit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.0.tgz#868597333d54e60662940bb458605dd6ae12fe94" @@ -5734,6 +5742,13 @@ vuex: version "2.0.0" resolved "https://registry.yarnpkg.com/vuex/-/vuex-2.0.0.tgz#26befa44de220f009e432d1027487bff29571cee" +vuex-persistedstate: + version "1.1.0" + resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-1.1.0.tgz#94f2e94a873f39fc716dea3129af45df8d4d6f78" + dependencies: + lodash.merge "^4.6.0" + object-path "^0.11.2" + watchpack@^0.2.1: version "0.2.9" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-0.2.9.tgz#62eaa4ab5e5ba35fdfc018275626e3c0f5e3fb0b" -- cgit v1.2.3-70-g09d2 From ae388d79278157e33d9818f6365d0d2fb1c116b5 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 16 Feb 2017 14:23:59 +0100 Subject: Be strict about putting changes in mutations. --- src/main.js | 3 ++- src/modules/users.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index 84db5c86..20489d42 100644 --- a/src/main.js +++ b/src/main.js @@ -38,7 +38,8 @@ const store = new Vuex.Store({ api: apiModule, config: configModule }, - plugins: [createPersistedState(persistedStateOptions)] + plugins: [createPersistedState(persistedStateOptions)], + strict: process.env.NODE_ENV !== 'production' }) const routes = [ diff --git a/src/modules/users.js b/src/modules/users.js index dd65afe1..ae90abbd 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -33,6 +33,9 @@ export const mutations = { }, addNewUsers (state, users) { each(users, (user) => mergeOrAdd(state.users, user)) + }, + setUserForStatus (state, status) { + status.user = find(state.users, status.user) } } @@ -54,11 +57,11 @@ const users = { // Reconnect users to statuses each(statuses, (status) => { - status.user = find(store.state.users, status.user) + store.commit('setUserForStatus', status) }) // Reconnect users to retweets each(compact(map(statuses, 'retweeted_status')), (status) => { - status.user = find(store.state.users, status.user) + store.commit('setUserForStatus', status) }) }, loginUser (store, userCredentials) { -- cgit v1.2.3-70-g09d2 From a3b2be09b3acab977682cc4cc4cebc7d9229f036 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 16 Feb 2017 16:59:06 +0100 Subject: Add /cyb/ background by sonyam. --- src/App.js | 5 ++++- src/main.js | 3 ++- static/bg.jpg | Bin 0 -> 229574 bytes static/bgalt.jpg | Bin 0 -> 330583 bytes static/config.json | 3 ++- 5 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 static/bg.jpg create mode 100644 static/bgalt.jpg (limited to 'src/main.js') diff --git a/src/App.js b/src/App.js index c326ddfc..736755ea 100644 --- a/src/App.js +++ b/src/App.js @@ -16,7 +16,10 @@ export default { }), computed: { currentUser () { return this.$store.state.users.currentUser }, - style () { return { 'background-image': `url(${this.currentUser.background_image})` } }, + background () { + return this.currentUser.background_image || this.$store.state.config.background + }, + style () { return { 'background-image': `url(${this.background})` } }, sitename () { return this.$store.state.config.name } }, methods: { diff --git a/src/main.js b/src/main.js index 20489d42..68653c37 100644 --- a/src/main.js +++ b/src/main.js @@ -71,7 +71,8 @@ new Vue({ window.fetch('/static/config.json') .then((res) => res.json()) - .then(({name, theme}) => { + .then(({name, theme, background}) => { store.dispatch('setOption', { name: 'name', value: name }) store.dispatch('setOption', { name: 'theme', value: theme }) + store.dispatch('setOption', { name: 'background', value: background }) }) diff --git a/static/bg.jpg b/static/bg.jpg new file mode 100644 index 00000000..60e2311a Binary files /dev/null and b/static/bg.jpg differ diff --git a/static/bgalt.jpg b/static/bgalt.jpg new file mode 100644 index 00000000..fdb666ff Binary files /dev/null and b/static/bgalt.jpg differ diff --git a/static/config.json b/static/config.json index 058c9875..d522e7e2 100644 --- a/static/config.json +++ b/static/config.json @@ -1,4 +1,5 @@ { "name": "Pleroma FE", - "theme": "base16-ashes.css" + "theme": "base16-ashes.css", + "background": "/static/bg.jpg" } -- cgit v1.2.3-70-g09d2 From ce5b3d4c924d6e94b6fbde3c50fdb209e4ec1fab Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 16 Feb 2017 17:44:36 +0100 Subject: Add logo. --- src/App.js | 1 + src/App.scss | 4 ++++ src/App.vue | 2 +- src/main.js | 3 ++- static/config.json | 3 ++- static/logo.png | Bin 0 -> 2411 bytes 6 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 static/logo.png (limited to 'src/main.js') diff --git a/src/App.js b/src/App.js index 736755ea..06634adb 100644 --- a/src/App.js +++ b/src/App.js @@ -19,6 +19,7 @@ export default { background () { return this.currentUser.background_image || this.$store.state.config.background }, + logoStyle () { return { 'background-image': `url(${this.$store.state.config.logo})` } }, style () { return { 'background-image': `url(${this.background})` } }, sitename () { return this.$store.state.config.name } }, diff --git a/src/App.scss b/src/App.scss index c820779a..d39fc749 100644 --- a/src/App.scss +++ b/src/App.scss @@ -63,6 +63,10 @@ nav { align-items: center; flex-basis: 920px; margin: auto; + height: 50px; + background-repeat: no-repeat; + background-position: center; + background-size: contain; } } diff --git a/src/App.vue b/src/App.vue index d2b07d2b..a22307a6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@