From 7f0b9d933db747d29d033491047fca7ef0d59b97 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Mar 2018 18:55:02 +0900 Subject: [PATCH] wip --- src/api/models/othello-game.ts | 6 +++++- src/web/app/mobile/api/input.ts | 5 ++++- src/web/app/mobile/script.ts | 3 +++ src/web/app/mobile/views/components/ui.nav.vue | 1 + src/web/app/mobile/views/pages/othello.vue | 16 ++++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/web/app/mobile/views/pages/othello.vue diff --git a/src/api/models/othello-game.ts b/src/api/models/othello-game.ts index d75baf356..73a5c94b2 100644 --- a/src/api/models/othello-game.ts +++ b/src/api/models/othello-game.ts @@ -43,7 +43,11 @@ export const pack = ( // Populate user _game.black_user = await packUser(_game.black_user_id, meId); _game.white_user = await packUser(_game.white_user_id, meId); - _game.winner = await packUser(_game.winner_id, meId); + if (_game.winner_id) { + _game.winner = await packUser(_game.winner_id, meId); + } else { + _game.winner = null; + } resolve(_game); }); diff --git a/src/web/app/mobile/api/input.ts b/src/web/app/mobile/api/input.ts index fcff68cfb..38d0fb61e 100644 --- a/src/web/app/mobile/api/input.ts +++ b/src/web/app/mobile/api/input.ts @@ -1,5 +1,8 @@ export default function(opts) { return new Promise((res, rej) => { - alert('input not implemented yet'); + const x = window.prompt(opts.title); + if (x) { + res(x); + } }); } diff --git a/src/web/app/mobile/script.ts b/src/web/app/mobile/script.ts index eeadfd92b..27c18c5ae 100644 --- a/src/web/app/mobile/script.ts +++ b/src/web/app/mobile/script.ts @@ -4,6 +4,7 @@ // Style import './style.styl'; +import '../../element.scss'; import init from '../init'; @@ -28,6 +29,7 @@ import MkFollowers from './views/pages/followers.vue'; import MkFollowing from './views/pages/following.vue'; import MkSettings from './views/pages/settings.vue'; import MkProfileSetting from './views/pages/profile-setting.vue'; +import MkOthello from './views/pages/othello.vue'; /** * init @@ -67,6 +69,7 @@ init((launch) => { { path: '/i/drive/file/:file', component: MkDrive }, { path: '/selectdrive', component: MkSelectDrive }, { path: '/search', component: MkSearch }, + { path: '/game/othello', component: MkOthello }, { path: '/:user', component: MkUser }, { path: '/:user/followers', component: MkFollowers }, { path: '/:user/following', component: MkFollowing }, diff --git a/src/web/app/mobile/views/components/ui.nav.vue b/src/web/app/mobile/views/components/ui.nav.vue index 62ea83526..a58225a17 100644 --- a/src/web/app/mobile/views/components/ui.nav.vue +++ b/src/web/app/mobile/views/components/ui.nav.vue @@ -18,6 +18,7 @@
  • %fa:home%%i18n:mobile.tags.mk-ui-nav.home%%fa:angle-right%
  • %fa:R bell%%i18n:mobile.tags.mk-ui-nav.notifications%%fa:angle-right%
  • %fa:R comments%%i18n:mobile.tags.mk-ui-nav.messaging%%fa:angle-right%
  • +
  • %fa:gamepad%ゲーム%fa:angle-right%