summaryrefslogtreecommitdiff
path: root/src/client/ui
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-10-10 15:19:16 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-10-10 15:19:16 +0900
commitc33e93c66282839c3e721d651720a7573da41b25 (patch)
treee6d0c0f17b679de1345cdf0c68cfbfd7a44fdb96 /src/client/ui
parent:art: (diff)
downloadmisskey-c33e93c66282839c3e721d651720a7573da41b25.tar.gz
misskey-c33e93c66282839c3e721d651720a7573da41b25.tar.bz2
misskey-c33e93c66282839c3e721d651720a7573da41b25.zip
improve ui
Diffstat (limited to 'src/client/ui')
-rw-r--r--src/client/ui/_common_/sidebar.vue68
-rw-r--r--src/client/ui/chat/index.vue3
-rw-r--r--src/client/ui/default.header.vue68
-rw-r--r--src/client/ui/default.sidebar.vue68
4 files changed, 9 insertions, 198 deletions
diff --git a/src/client/ui/_common_/sidebar.vue b/src/client/ui/_common_/sidebar.vue
index 4bb7bbd985..33aea31c39 100644
--- a/src/client/ui/_common_/sidebar.vue
+++ b/src/client/ui/_common_/sidebar.vue
@@ -50,7 +50,7 @@ import { host } from '@client/config';
import { search } from '@client/scripts/search';
import * as os from '@client/os';
import { menuDef } from '@client/menu';
-import { getAccounts, addAccount, login } from '@client/account';
+import { openAccountMenu } from '@client/account';
export default defineComponent({
props: {
@@ -134,76 +134,12 @@ export default defineComponent({
search();
},
- async openAccountMenu(ev) {
- const storedAccounts = await getAccounts().then(accounts => accounts.filter(x => x.id !== this.$i.id));
- const accountsPromise = os.api('users/show', { userIds: storedAccounts.map(x => x.id) });
-
- const accountItemPromises = storedAccounts.map(a => new Promise(res => {
- accountsPromise.then(accounts => {
- const account = accounts.find(x => x.id === a.id);
- if (account == null) return res(null);
- res({
- type: 'user',
- user: account,
- action: () => { this.switchAccount(account); }
- });
- });
- }));
-
- os.popupMenu([...[{
- type: 'link',
- text: this.$ts.profile,
- to: `/@${ this.$i.username }`,
- avatar: this.$i,
- }, null, ...accountItemPromises, {
- icon: 'fas fa-plus',
- text: this.$ts.addAccount,
- action: () => {
- os.popupMenu([{
- text: this.$ts.existingAccount,
- action: () => { this.addAccount(); },
- }, {
- text: this.$ts.createAccount,
- action: () => { this.createAccount(); },
- }], ev.currentTarget || ev.target);
- },
- }]], ev.currentTarget || ev.target, {
- align: 'left'
- });
- },
-
more(ev) {
os.popup(import('@client/components/launch-pad.vue'), {}, {
}, 'closed');
},
- addAccount() {
- os.popup(import('@client/components/signin-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- os.success();
- },
- }, 'closed');
- },
-
- createAccount() {
- os.popup(import('@client/components/signup-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- this.switchAccountWithToken(res.i);
- },
- }, 'closed');
- },
-
- async switchAccount(account: any) {
- const storedAccounts = await getAccounts();
- const token = storedAccounts.find(x => x.id === account.id).token;
- this.switchAccountWithToken(token);
- },
-
- switchAccountWithToken(token: string) {
- login(token);
- },
+ openAccountMenu,
}
});
</script>
diff --git a/src/client/ui/chat/index.vue b/src/client/ui/chat/index.vue
index 4194a9919f..4c068b0d94 100644
--- a/src/client/ui/chat/index.vue
+++ b/src/client/ui/chat/index.vue
@@ -109,6 +109,7 @@ import { search } from '@client/scripts/search';
import copyToClipboard from '@client/scripts/copy-to-clipboard';
import { store } from './store';
import * as symbols from '@client/symbols';
+import { openAccountMenu } from '@client/account';
export default defineComponent({
components: {
@@ -253,6 +254,8 @@ export default defineComponent({
}
}], e);
},
+
+ openAccountMenu,
}
});
</script>
diff --git a/src/client/ui/default.header.vue b/src/client/ui/default.header.vue
index 75c5c0c051..c64b6cf695 100644
--- a/src/client/ui/default.header.vue
+++ b/src/client/ui/default.header.vue
@@ -44,7 +44,7 @@ import { host } from '@client/config';
import { search } from '@client/scripts/search';
import * as os from '@client/os';
import { menuDef } from '@client/menu';
-import { getAccounts, addAccount, login } from '@client/account';
+import { openAccountMenu } from '@client/account';
import MkButton from '@client/components/ui/button.vue';
export default defineComponent({
@@ -100,76 +100,12 @@ export default defineComponent({
search();
},
- async openAccountMenu(ev) {
- const storedAccounts = await getAccounts().then(accounts => accounts.filter(x => x.id !== this.$i.id));
- const accountsPromise = os.api('users/show', { userIds: storedAccounts.map(x => x.id) });
-
- const accountItemPromises = storedAccounts.map(a => new Promise(res => {
- accountsPromise.then(accounts => {
- const account = accounts.find(x => x.id === a.id);
- if (account == null) return res(null);
- res({
- type: 'user',
- user: account,
- action: () => { this.switchAccount(account); }
- });
- });
- }));
-
- os.popupMenu([...[{
- type: 'link',
- text: this.$ts.profile,
- to: `/@${ this.$i.username }`,
- avatar: this.$i,
- }, null, ...accountItemPromises, {
- icon: 'fas fa-plus',
- text: this.$ts.addAccount,
- action: () => {
- os.popupMenu([{
- text: this.$ts.existingAccount,
- action: () => { this.addAccount(); },
- }, {
- text: this.$ts.createAccount,
- action: () => { this.createAccount(); },
- }], ev.currentTarget || ev.target);
- },
- }]], ev.currentTarget || ev.target, {
- align: 'left'
- });
- },
-
more(ev) {
os.popup(import('@client/components/launch-pad.vue'), {}, {
}, 'closed');
},
- addAccount() {
- os.popup(import('@client/components/signin-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- os.success();
- },
- }, 'closed');
- },
-
- createAccount() {
- os.popup(import('@client/components/signup-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- this.switchAccountWithToken(res.i);
- },
- }, 'closed');
- },
-
- async switchAccount(account: any) {
- const storedAccounts = await getAccounts();
- const token = storedAccounts.find(x => x.id === account.id).token;
- this.switchAccountWithToken(token);
- },
-
- switchAccountWithToken(token: string) {
- login(token);
- },
+ openAccountMenu,
}
});
</script>
diff --git a/src/client/ui/default.sidebar.vue b/src/client/ui/default.sidebar.vue
index be907aa2a4..745ad2d602 100644
--- a/src/client/ui/default.sidebar.vue
+++ b/src/client/ui/default.sidebar.vue
@@ -46,7 +46,7 @@ import { host } from '@client/config';
import { search } from '@client/scripts/search';
import * as os from '@client/os';
import { menuDef } from '@client/menu';
-import { getAccounts, addAccount, login } from '@client/account';
+import { openAccountMenu } from '@client/account';
import MkButton from '@client/components/ui/button.vue';
import { StickySidebar } from '@client/scripts/sticky-sidebar';
import MisskeyLogo from '@/../assets/client/misskey.svg';
@@ -120,76 +120,12 @@ export default defineComponent({
search();
},
- async openAccountMenu(ev) {
- const storedAccounts = await getAccounts().then(accounts => accounts.filter(x => x.id !== this.$i.id));
- const accountsPromise = os.api('users/show', { userIds: storedAccounts.map(x => x.id) });
-
- const accountItemPromises = storedAccounts.map(a => new Promise(res => {
- accountsPromise.then(accounts => {
- const account = accounts.find(x => x.id === a.id);
- if (account == null) return res(null);
- res({
- type: 'user',
- user: account,
- action: () => { this.switchAccount(account); }
- });
- });
- }));
-
- os.popupMenu([...[{
- type: 'link',
- text: this.$ts.profile,
- to: `/@${ this.$i.username }`,
- avatar: this.$i,
- }, null, ...accountItemPromises, {
- icon: 'fas fa-plus',
- text: this.$ts.addAccount,
- action: () => {
- os.popupMenu([{
- text: this.$ts.existingAccount,
- action: () => { this.addAccount(); },
- }, {
- text: this.$ts.createAccount,
- action: () => { this.createAccount(); },
- }], ev.currentTarget || ev.target);
- },
- }]], ev.currentTarget || ev.target, {
- align: 'left'
- });
- },
-
more(ev) {
os.popup(import('@client/components/launch-pad.vue'), {}, {
}, 'closed');
},
- addAccount() {
- os.popup(import('@client/components/signin-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- os.success();
- },
- }, 'closed');
- },
-
- createAccount() {
- os.popup(import('@client/components/signup-dialog.vue'), {}, {
- done: res => {
- addAccount(res.id, res.i);
- this.switchAccountWithToken(res.i);
- },
- }, 'closed');
- },
-
- async switchAccount(account: any) {
- const storedAccounts = await getAccounts();
- const token = storedAccounts.find(x => x.id === account.id).token;
- this.switchAccountWithToken(token);
- },
-
- switchAccountWithToken(token: string) {
- login(token);
- },
+ openAccountMenu,
}
});
</script>