diff --git a/src/main/index.js b/src/main/index.js index caff2336..d907383c 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -645,6 +645,27 @@ ipcMain.on('save-preferences', (event, data) => { }) }) +ipcMain.on('change-collapse', (event, value) => { + const preferences = new Preferences(preferencesDBPath) + preferences.update( + { + state: { + collapse: value + } + }) + .catch((err) => { + log.error(err) + }) +}) + +ipcMain.on('get-collapse', (event, _) => { + const preferences = new Preferences(preferencesDBPath) + preferences.load() + .then((conf) => { + event.sender.send('response-get-collapse', conf.state.collapse) + }) +}) + // hashtag ipcMain.on('save-hashtag', (event, tag) => { const hashtags = new Hashtags(hashtagsDB) diff --git a/src/main/preferences.js b/src/main/preferences.js index d8fc14ec..ac3482b0 100644 --- a/src/main/preferences.js +++ b/src/main/preferences.js @@ -10,6 +10,9 @@ const Base = { theme: 'white', fontSize: 14, displayNameStyle: 0 + }, + state: { + collapse: false } } @@ -47,4 +50,11 @@ export default class Preferences { }) }) } + + async update (obj) { + const current = await this.load() + const data = objectAssignDeep({}, current, obj) + const result = await this.save(data) + return result + } } diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index d2b9143d..96ec6858 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -6,7 +6,7 @@ element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)"> -
+
@@ -29,7 +29,8 @@ export default { components: { SideMenu, HeaderMenu, Modals, Contents }, computed: { ...mapState({ - loading: state => state.TimelineSpace.loading + loading: state => state.TimelineSpace.loading, + collapse: state => state.TimelineSpace.SideMenu.collapse }) }, created () { @@ -126,4 +127,19 @@ export default { } } +.page-narrow { + margin-left: 76px; + height: 100%; + box-sizing: border-box; + + .header { + width: calc(100% - 141px); + position: fixed; + top: 0; + left: 141px; + height: 48px; + border-bottom: solid 1px var(--theme-border-color); + } +} + diff --git a/src/renderer/components/TimelineSpace/SideMenu.vue b/src/renderer/components/TimelineSpace/SideMenu.vue index 53c341a0..0d268375 100644 --- a/src/renderer/components/TimelineSpace/SideMenu.vue +++ b/src/renderer/components/TimelineSpace/SideMenu.vue @@ -1,7 +1,10 @@