summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/views/widgets/index.ts2
-rw-r--r--src/client/app/common/views/widgets/memo.vue110
2 files changed, 112 insertions, 0 deletions
diff --git a/src/client/app/common/views/widgets/index.ts b/src/client/app/common/views/widgets/index.ts
index 9107d90ce7..7ef4e02092 100644
--- a/src/client/app/common/views/widgets/index.ts
+++ b/src/client/app/common/views/widgets/index.ts
@@ -3,6 +3,7 @@ import Vue from 'vue';
import wVersion from './version.vue';
import wRss from './rss.vue';
import wServer from './server.vue';
+import wMemo from './memo.vue';
import wBroadcast from './broadcast.vue';
import wCalendar from './calendar.vue';
import wPhotoStream from './photo-stream.vue';
@@ -19,5 +20,6 @@ Vue.component('mkw-tips', wTips);
Vue.component('mkw-donation', wDonation);
Vue.component('mkw-broadcast', wBroadcast);
Vue.component('mkw-server', wServer);
+Vue.component('mkw-memo', wMemo);
Vue.component('mkw-rss', wRss);
Vue.component('mkw-version', wVersion);
diff --git a/src/client/app/common/views/widgets/memo.vue b/src/client/app/common/views/widgets/memo.vue
new file mode 100644
index 0000000000..3f599c82a0
--- /dev/null
+++ b/src/client/app/common/views/widgets/memo.vue
@@ -0,0 +1,110 @@
+<template>
+<div class="mkw-memo">
+ <mk-widget-container :show-header="!props.compact">
+ <template slot="header">%fa:R sticky-note%%i18n:@title%</template>
+
+ <div class="mkw-memo--body">
+ <textarea v-model="text" placeholder="%i18n:@memo%" @input="onChange"></textarea>
+ <button @click="saveMemo" :disabled="!changed">%i18n:@save%</button>
+ </div>
+ </mk-widget-container>
+</div>
+</template>
+
+<script lang="ts">
+import define from '../../define-widget';
+
+export default define({
+ name: 'memo',
+ props: () => ({
+ compact: false
+ })
+}).extend({
+ data() {
+ return {
+ text: null,
+ changed: false
+ };
+ },
+
+ created() {
+ this.text = this.$store.state.settings.memo;
+
+ this.$watch('$store.state.settings.memo', text => {
+ this.text = text;
+ });
+ },
+
+ methods: {
+ func() {
+ this.props.compact = !this.props.compact;
+ this.save();
+ },
+
+ onChange() {
+ this.changed = true;
+ },
+
+ saveMemo() {
+ this.$store.dispatch('settings/set', {
+ key: 'memo',
+ value: this.text
+ });
+ this.changed = false;
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+@import '~const.styl'
+
+root(isDark)
+ .mkw-memo--body
+ padding-bottom 28px + 16px
+
+ > textarea
+ display block
+ width 100%
+ max-width 100%
+ min-width 100%
+ padding 16px
+ color isDark ? #fff : #222
+ background isDark ? #282c37 : #fff
+ border none
+ border-bottom solid 1px isDark ? #1c2023 : #eee
+
+ > button
+ display block
+ position absolute
+ bottom 8px
+ right 8px
+ margin 0
+ padding 0 10px
+ height 28px
+ color $theme-color-foreground
+ background $theme-color !important
+ outline none
+ border none
+ border-radius 4px
+ transition background 0.1s ease
+ cursor pointer
+
+ &:hover
+ background lighten($theme-color, 10%) !important
+
+ &:active
+ background darken($theme-color, 10%) !important
+ transition background 0s ease
+
+ &:disabled
+ opacity 0.7
+ cursor default
+
+.mkw-memo[data-darkmode]
+ root(true)
+
+.mkw-memo:not([data-darkmode])
+ root(false)
+
+</style>