From da52f980c4e3cca48d0da47903cc8b6b5e12949e Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Tue, 29 May 2018 14:42:29 +0900
Subject: [PATCH] :v:

---
 locales/ja.yml                                |  8 ++
 src/client/app/mobile/script.ts               |  2 +
 .../mobile/views/components/note-detail.vue   |  2 -
 .../app/mobile/views/components/ui.nav.vue    |  7 +-
 .../app/mobile/views/pages/favorites.vue      | 94 +++++++++++++++++++
 5 files changed, 107 insertions(+), 6 deletions(-)
 create mode 100644 src/client/app/mobile/views/pages/favorites.vue

diff --git a/locales/ja.yml b/locales/ja.yml
index d727b01185..366a030c99 100644
--- a/locales/ja.yml
+++ b/locales/ja.yml
@@ -846,6 +846,10 @@ mobile/views/components/ui.nav.vue:
   messaging: "メッセージ"
   search: "検索"
   drive: "ドライブ"
+  favorites: "お気に入り"
+  widgets: "ウィジェット"
+  game: "ゲーム"
+  darkmode: "ダークモード"
   settings: "設定"
   about: "Misskeyについて"
 
@@ -859,8 +863,12 @@ mobile/views/components/users-list.vue:
   known: "知り合い"
   load-more: "もっと"
 
+mobile/views/pages/favorites.vue:
+  title: "お気に入り"
+
 mobile/views/pages/drive.vue:
   drive: "ドライブ"
+  more: "もっと見る"
 
 mobile/views/pages/followers.vue:
   followers-of: "{}のフォロワー"
diff --git a/src/client/app/mobile/script.ts b/src/client/app/mobile/script.ts
index 5418aac090..4c3d8fc3bd 100644
--- a/src/client/app/mobile/script.ts
+++ b/src/client/app/mobile/script.ts
@@ -36,6 +36,7 @@ import MkNote from './views/pages/note.vue';
 import MkSearch from './views/pages/search.vue';
 import MkFollowers from './views/pages/followers.vue';
 import MkFollowing from './views/pages/following.vue';
+import MkFavorites from './views/pages/favorites.vue';
 import MkSettings from './views/pages/settings.vue';
 import MkOthello from './views/pages/othello.vue';
 
@@ -72,6 +73,7 @@ init((launch) => {
 			{ path: '/signup', name: 'signup', component: MkSignup },
 			{ path: '/i/settings', name: 'settings', component: MkSettings },
 			{ path: '/i/notifications', name: 'notifications', component: MkNotifications },
+			{ path: '/i/favorites', name: 'favorites', component: MkFavorites },
 			{ path: '/i/widgets', name: 'widgets', component: MkWidgets },
 			{ path: '/i/messaging', name: 'messaging', component: MkMessaging },
 			{ path: '/i/messaging/:user', component: MkMessagingRoom },
diff --git a/src/client/app/mobile/views/components/note-detail.vue b/src/client/app/mobile/views/components/note-detail.vue
index d4606c0313..211ca27f1c 100644
--- a/src/client/app/mobile/views/components/note-detail.vue
+++ b/src/client/app/mobile/views/components/note-detail.vue
@@ -216,8 +216,6 @@ export default Vue.extend({
 
 root(isDark)
 	overflow hidden
-	margin 0 auto
-	padding 0
 	width 100%
 	text-align left
 	background isDark ? #282C37 : #fff
diff --git a/src/client/app/mobile/views/components/ui.nav.vue b/src/client/app/mobile/views/components/ui.nav.vue
index 033372ffef..dd1b9c8e25 100644
--- a/src/client/app/mobile/views/components/ui.nav.vue
+++ b/src/client/app/mobile/views/components/ui.nav.vue
@@ -18,18 +18,17 @@
 					<li><router-link to="/" :data-active="$route.name == 'index'">%fa:home%%i18n:@home%%fa:angle-right%</router-link></li>
 					<li><router-link to="/i/notifications" :data-active="$route.name == 'notifications'">%fa:R bell%%i18n:@notifications%<template v-if="hasUnreadNotification">%fa:circle%</template>%fa:angle-right%</router-link></li>
 					<li><router-link to="/i/messaging" :data-active="$route.name == 'messaging'">%fa:R comments%%i18n:@messaging%<template v-if="hasUnreadMessagingMessage">%fa:circle%</template>%fa:angle-right%</router-link></li>
-					<li><router-link to="/othello" :data-active="$route.name == 'othello'">%fa:gamepad%ゲーム<template v-if="hasGameInvitation">%fa:circle%</template>%fa:angle-right%</router-link></li>
+					<li><router-link to="/othello" :data-active="$route.name == 'othello'">%fa:gamepad%%i18n:@game%<template v-if="hasGameInvitation">%fa:circle%</template>%fa:angle-right%</router-link></li>
 				</ul>
 				<ul>
 					<li><router-link to="/i/widgets" :data-active="$route.name == 'widgets'">%fa:quidditch%%i18n:@widgets%%fa:angle-right%</router-link></li>
+					<li><router-link to="/i/favorites" :data-active="$route.name == 'favorites'">%fa:star%%i18n:@favorites%%fa:angle-right%</router-link></li>
 					<li><router-link to="/i/drive" :data-active="$route.name == 'drive'">%fa:cloud%%i18n:@drive%%fa:angle-right%</router-link></li>
 				</ul>
 				<ul>
 					<li><a @click="search">%fa:search%%i18n:@search%%fa:angle-right%</a></li>
-				</ul>
-				<ul>
 					<li><router-link to="/i/settings" :data-active="$route.name == 'settings'">%fa:cog%%i18n:@settings%%fa:angle-right%</router-link></li>
-					<li @click="dark"><p><template v-if="$store.state.device.darkmode">%fa:moon%</template><template v-else>%fa:R moon%</template><span>ダークモード</span></p></li>
+					<li @click="dark"><p><template v-if="$store.state.device.darkmode">%fa:moon%</template><template v-else>%fa:R moon%</template><span>%i18n:@darkmode%</span></p></li>
 				</ul>
 			</div>
 			<a :href="aboutUrl"><p class="about">%i18n:@about%</p></a>
diff --git a/src/client/app/mobile/views/pages/favorites.vue b/src/client/app/mobile/views/pages/favorites.vue
new file mode 100644
index 0000000000..c4edd9d970
--- /dev/null
+++ b/src/client/app/mobile/views/pages/favorites.vue
@@ -0,0 +1,94 @@
+<template>
+<mk-ui>
+	<span slot="header">%fa:star%%i18n:@title%</span>
+
+	<main>
+		<template v-for="favorite in favorites">
+			<mk-note-detail class="post" :note="favorite.note" :key="favorite.note.id"/>
+		</template>
+		<a v-if="existMore" @click="more">%i18n:@more%</a>
+	</main>
+</mk-ui>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+import Progress from '../../../common/scripts/loading';
+
+export default Vue.extend({
+	data() {
+		return {
+			fetching: true,
+			favorites: [],
+			existMore: false,
+			moreFetching: false
+		};
+	},
+	created() {
+		this.fetch();
+	},
+	mounted() {
+		document.title = 'Misskey | %i18n:@notifications%';
+	},
+	methods: {
+		fetch() {
+			Progress.start();
+			this.fetching = true;
+
+			(this as any).api('i/favorites', {
+				limit: 11
+			}).then(favorites => {
+				if (favorites.length == 11) {
+					this.existMore = true;
+					favorites.pop();
+				}
+
+				this.favorites = favorites;
+				this.fetching = false;
+
+				Progress.done();
+			});
+		},
+		more() {
+			this.moreFetching = true;
+			(this as any).api('i/favorites', {
+				limit: 11,
+				maxId: this.favorites[this.favorites.length - 1].id
+			}).then(favorites => {
+				if (favorites.length == 11) {
+					this.existMore = true;
+					favorites.pop();
+				} else {
+					this.existMore = false;
+				}
+
+				this.favorites = this.favorites.concat(favorites);
+				this.moreFetching = false;
+			});
+		}
+	}
+});
+</script>
+
+<style lang="stylus" scoped>
+@import '~const.styl'
+
+main
+	width 100%
+	max-width 680px
+	margin 0 auto
+	padding 8px
+
+	> .post
+		margin-bottom 8px
+
+	@media (min-width 500px)
+		padding 16px
+
+		> .post
+			margin-bottom 16px
+
+	@media (min-width 600px)
+		padding 32px
+
+</style>