summaryrefslogtreecommitdiff
path: root/app/src/pages/Home.vue
blob: 2fe403069fb8ada6bd8f39735424050e741dcd43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
  <div class="wrap">
    <div class="panels">
      <Panel v-model="from" @connect="connectFrom" />
      <Panel v-model="to" @connect="connectTo" />
    </div>
    <button @click="migrate">
      Migrate!
    </button>

    <h1>FROM</h1>
    <ul v-if="from.folders">
      <Folders :folder="from.folders" />
    </ul>
    <code>
      {{ from.folders }}
    </code>

    <h1>TO</h1>
    <ul v-if="to.folders">
      <Folders :folder="to.folders" />
    </ul>
    <code>
      {{ to.folders }}
    </code>
  </div>
</template>

<script>
import Panel from '../components/Panel.vue';
import Folders from '../components/Folders';

export default {
  components: {
    Panel,
    Folders,
  },

  data () {
    return {};
  },

  computed: {
    from: {
      set (value) {
        this.$store.commit('setFrom', value);
      },
      get () {
        return this.$store.state.from;
      },
    },
    to: {
      set (value) {
        this.$store.commit('setTo', value);
      },
      get () {
        return this.$store.state.to;
      },
    },
  },

  mounted () {
    this.$electron.ipcRenderer.on('imap:listTree:from:reply', (event, folders) => {
      this.from.folders = folders;
    });

    this.$electron.ipcRenderer.on('imap:listTree:to:reply', (event, folders) => {
      this.to.folders = folders;
    });
  },

  methods: {
    connectFrom () {
      this.$electron.ipcRenderer.send('imap:listTree:from', JSON.parse(JSON.stringify(this.from)));
    },

    connectTo () {
      this.$electron.ipcRenderer.send('imap:listTree:to', JSON.parse(JSON.stringify(this.to)));
    },

    async migrate () {

    },
  },
};
</script>

<style lang="scss">
body {
  margin: 0;
  font-size: 1rem;
  font-family: Helvetica, sans-serif;
}

.panels {
  display: flex;
  justify-content: space-between;
}
</style>