This commit is contained in:
syuilo 2018-02-24 03:03:26 +09:00
parent df8a2aea35
commit cf1f2562d7
4 changed files with 34 additions and 13 deletions

View file

@ -25,7 +25,6 @@ export default function<T extends object>(data: {
};
},
created() {
if (this.widget.data == null) this.widget.data = {};
if (this.props) {
Object.keys(this.props).forEach(prop => {
if (this.widget.data.hasOwnProperty(prop)) {

View file

@ -33,7 +33,7 @@ export default Vue.extend({
&.naked
background transparent !important
border none !important
box-shadow none !important
> header
> .title

View file

@ -1,6 +1,6 @@
<template>
<div class="mkw-activity">
<mk-widget-container>
<mk-widget-container :show-header="!props.compact">
<template slot="header">%fa:chart-bar%アクティビティ</template>
<div :class="$style.body">
<mk-activity :user="os.i"/>
@ -14,6 +14,15 @@ import define from '../../../../common/define-widget';
export default define({
name: 'activity',
props: () => ({
compact: false
})
}).extend({
methods: {
func() {
this.props.compact = !this.props.compact;
}
}
});
</script>

View file

@ -44,7 +44,7 @@
<header>
<span class="handle">%fa:bars%</span>{{ widget.name }}<button class="remove" @click="removeWidget(widget)">%fa:times%</button>
</header>
<div>
<div @click="widgetFunc(widget.id)">
<component :is="`mkw-${widget.name}`" :widget="widget" :ref="widget.id" :is-mobile="true"/>
</div>
</div>
@ -84,28 +84,37 @@ export default Vue.extend({
if ((this as any).os.i.client_settings.mobile_home == null) {
Vue.set((this as any).os.i.client_settings, 'mobile_home', [{
name: 'calendar',
id: 'a'
id: 'a', data: {}
}, {
name: 'activity',
id: 'b'
id: 'b', data: {}
}, {
name: 'rss',
id: 'c'
id: 'c', data: {}
}, {
name: 'photo-stream',
id: 'd'
id: 'd', data: {}
}, {
name: 'donation',
id: 'e'
id: 'e', data: {}
}, {
name: 'nav',
id: 'f'
id: 'f', data: {}
}, {
name: 'version',
id: 'g'
id: 'g', data: {}
}]);
}
this.widgets = (this as any).os.i.client_settings.mobile_home;
this.saveHome();
} else {
this.widgets = (this as any).os.i.client_settings.mobile_home;
}
this.$watch('os.i', i => {
this.widgets = (this as any).os.i.client_settings.mobile_home;
}, {
deep: true
});
},
mounted() {
document.title = 'Misskey';
@ -143,6 +152,10 @@ export default Vue.extend({
document.title = 'Misskey';
}
},
widgetFunc(id) {
const w = this.$refs[id][0];
if (w.func) w.func();
},
onWidgetSort() {
this.saveHome();
},