This commit is contained in:
syuilo 2018-02-22 02:00:30 +09:00
parent 3d4fccef45
commit abf1c30ce6
9 changed files with 108 additions and 18 deletions

View file

@ -35,6 +35,7 @@ init(async (launch) => {
// Register components // Register components
require('./views/components'); require('./views/components');
// Launch the app
const [app, os] = launch(os => ({ const [app, os] = launch(os => ({
chooseDriveFolder, chooseDriveFolder,
chooseDriveFile, chooseDriveFile,
@ -65,19 +66,15 @@ init(async (launch) => {
} }
} }
app.$router.addRoutes([{ // Routing
path: '/', name: 'index', component: MkIndex app.$router.addRoutes([
}, { { path: '/', name: 'index', component: MkIndex },
path: '/i/customize-home', component: MkHomeCustomize { path: '/i/customize-home', component: MkHomeCustomize },
}, { { path: '/i/drive', component: MkDrive },
path: '/i/drive', component: MkDrive { path: '/i/drive/folder/:folder', component: MkDrive },
}, { { path: '/selectdrive', component: MkSelectDrive },
path: '/i/drive/folder/:folder', component: MkDrive { path: '/:user', component: MkUser }
}, { ]);
path: '/selectdrive', component: MkSelectDrive
}, {
path: '/:user', component: MkUser
}]);
}, true); }, true);
function registerNotifications(stream: HomeStreamManager) { function registerNotifications(stream: HomeStreamManager) {

View file

@ -0,0 +1,18 @@
import Chooser from '../views/components/drive-file-chooser.vue';
export default function(opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new Chooser({
propsData: {
title: o.title,
multiple: o.multiple,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', file => {
res(file);
});
document.body.appendChild(w.$el);
});
}

View file

@ -0,0 +1,17 @@
import Chooser from '../views/components/drive-folder-chooser.vue';
export default function(opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new Chooser({
propsData: {
title: o.title,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', folder => {
res(folder);
});
document.body.appendChild(w.$el);
});
}

View file

@ -0,0 +1,5 @@
export default function(opts) {
return new Promise<string>((res, rej) => {
alert('dialog not implemented yet');
});
}

View file

@ -0,0 +1,5 @@
export default function(opts) {
return new Promise<string>((res, rej) => {
alert('input not implemented yet');
});
}

View file

@ -0,0 +1,14 @@
export default opts => {
const app = document.getElementById('app');
app.style.display = 'none';
function recover() {
app.style.display = 'block';
}
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
form
.on('cancel', recover)
.on('post', recover);
};

View file

@ -5,9 +5,22 @@
// Style // Style
import './style.styl'; import './style.styl';
require('./tags');
import init from '../init'; import init from '../init';
import chooseDriveFolder from './api/choose-drive-folder';
import chooseDriveFile from './api/choose-drive-file';
import dialog from './api/dialog';
import input from './api/input';
import post from './api/post';
import notify from './api/notify';
import updateAvatar from './api/update-avatar';
import updateBanner from './api/update-banner';
import MkIndex from './views/pages/index.vue';
import MkUser from './views/pages/user/user.vue';
import MkSelectDrive from './views/pages/selectdrive.vue';
import MkDrive from './views/pages/drive.vue';
/** /**
* init * init
*/ */
@ -15,9 +28,30 @@ init((launch) => {
// Register directives // Register directives
require('./views/directives'); require('./views/directives');
// Register components
require('./views/components');
// http://qiita.com/junya/items/3ff380878f26ca447f85 // http://qiita.com/junya/items/3ff380878f26ca447f85
document.body.setAttribute('ontouchstart', ''); document.body.setAttribute('ontouchstart', '');
// Start routing // Launch the app
//route(mios); const [app, os] = launch(os => ({
chooseDriveFolder,
chooseDriveFile,
dialog,
input,
post,
notify,
updateAvatar: updateAvatar(os),
updateBanner: updateBanner(os)
}));
// Routing
app.$router.addRoutes([
{ path: '/', name: 'index', component: MkIndex },
{ path: '/i/drive', component: MkDrive },
{ path: '/i/drive/folder/:folder', component: MkDrive },
{ path: '/selectdrive', component: MkSelectDrive },
{ path: '/:user', component: MkUser }
]);
}, true); }, true);

View file

@ -4,7 +4,7 @@
<header> <header>
<h1>%i18n:mobile.tags.mk-drive-folder-selector.select-folder%</h1> <h1>%i18n:mobile.tags.mk-drive-folder-selector.select-folder%</h1>
<button class="close" @click="cancel">%fa:times%</button> <button class="close" @click="cancel">%fa:times%</button>
<button v-if="opts.multiple" class="ok" @click="ok">%fa:check%</button> <button class="ok" @click="ok">%fa:check%</button>
</header> </header>
<mk-drive ref="browser" <mk-drive ref="browser"
select-folder select-folder

View file

@ -29,7 +29,7 @@ module.exports = Object.keys(langs).map(lang => {
// Entries // Entries
const entry = { const entry = {
desktop: './src/web/app/desktop/script.ts', desktop: './src/web/app/desktop/script.ts',
//mobile: './src/web/app/mobile/script.ts', mobile: './src/web/app/mobile/script.ts',
//ch: './src/web/app/ch/script.ts', //ch: './src/web/app/ch/script.ts',
//stats: './src/web/app/stats/script.ts', //stats: './src/web/app/stats/script.ts',
//status: './src/web/app/status/script.ts', //status: './src/web/app/status/script.ts',