bildpunkt / surfbird

A Microblogging client built on Electron and Vue
MIT License
331 stars 56 forks source link

[WIP] Rewrite #47

Closed pixeldesu closed 6 years ago

pixeldesu commented 7 years ago

This is a complete rewrite from scratch using Vue 2 and other tools to improve general experience. Besides adding in new features, the goal of this branch is to reach a somewhat state that can be compared to the old Surfbird release.

Roadmap:

pixeldesu commented 7 years ago

Next big goal to do before everything else:

Bounty: @p01arst0rm gives me 7 cookies. (+1 bonus if compile works fine on first try)

pixeldesu commented 7 years ago

Next goals:

possible code:

const COLUMN_TYPES = [
  'home',
  'mentions',
  'messages',
  'activity',
  'search',
  // ...
]

const COLUMNS = {
  home: {
    initialData: function() {
      /* code here */
    },
    data: function () {
      /* code here */
    }
    // ...
  }
  // ...
}
pixeldesu commented 7 years ago

I'll probably work on a lot of contextual stuff (dialogs and all that) next, and after that I'll reset the boilerplate to Milestone Minimize (SimulatedGREG/electron-vue#171) once that is stable enough and tested.

Seems to have a lot of improvements that will be of use later. (and I'm too lazy to merge in stuff by hand.)

pixeldesu commented 7 years ago

Another thing I just want to note down before I forget it:

Service specific actions

Just a rough idea and subject to change

As it's obvious, services have different actions, and even if Surfbird is a Twitter client at heart, other service columns should have their respective actions tied to them.

Structure (inside client script):

const ACTIONS = [
  {
    name: "Retweet"
    icon: "put batch-icon unicode here"
    active_color: "#ff0000"
    function: "retweet"
  },
 // ...
]

// just for convenience and ease-of-work, we put the entire
// post/tweet object in here to work with.
function retweet (tweet) {
  this.api.post('statuses/retweet', {id: tweet.id_str}, function() {
    // do something in return
  })
}

Inside templates, we can basically loop through our ACTIONS definiton to create the action-sets for posts. We can then use a super-function sendAction(payload) to our state and let the state handle API stuff with the client.

Like this for example:

const actions = [
  // ...
  sendAction ({ commit, state }, payload) {
    commit(types.SEND_ACTION, { payload })
  }
  // ...
]

const mutations = [
  // ...
  [types.SEND_ACTION] (state, { payload }) {
    let activeAccount = state.all[payload.id]
    activeAccount.client[payload.action](payload.data, function (data) {
      // we get something in return from our action, let's work with that
    })
  })
  // ...
]

Oh hey...I basically sketched this out completely, now I just need to implement it sometime!

SimulatedGREG commented 7 years ago

Milestone Minimize has landed in the electron-vue master branch. I've had quite a few people test during development and am fairly confident most issues have been found and resolved. Probably expecting a few more to come in the next week or so, but make sure to check out the new and updated documentation.

https://simulatedgreg.gitbooks.io/electron-vue/content/en/

pixeldesu commented 7 years ago

@SimulatedGREG Thanks for the heads-up on this!

pixeldesu commented 7 years ago

I need to make the entire thing a bit more stateful, or at least easier to manage with statefulness.

I need to split off storages from columns and then link them just by storage/column IDs.

pixeldesu commented 6 years ago

Persistance:

I want to persist the Vuex state using vuex-persistedstate. But for that to work I need a reducer and some initializations on startup.

The reducer needs to get rid of a columns postStorage as I don't want to save tweets locally. Another thing that needs to be cleared is a accounts client, as it includes functions that won't be accessible after the state is put into localStorage.

pixeldesu commented 6 years ago

Okay, doing something else now.

As this has been the main branch for well over half a year now, I'll just merge back into master. I'll also create issues for subsequent sections of this checklist, so participation in the project is easier.