Refactoring

This commit is contained in:
syuilo 2020-11-03 20:36:12 +09:00
parent 7353d729d7
commit 3c59c6fc9b
69 changed files with 157 additions and 285 deletions

View File

@ -22,10 +22,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('error'),
icon: faExclamationTriangle
}]
title: this.$t('error'),
icon: faExclamationTriangle
},
faExclamationTriangle
};

View File

@ -87,10 +87,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('aboutMisskey'),
icon: null
}]
title: this.$t('aboutMisskey'),
icon: null
},
version,
faInfoCircle

View File

@ -37,10 +37,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('about'),
icon: faInfoCircle
}]
title: this.$t('about'),
icon: faInfoCircle
},
version,
serverInfo: null,

View File

@ -31,10 +31,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('announcements'),
icon: faBroadcastTower
}]
title: this.$t('announcements'),
icon: faBroadcastTower
},
pagination: {
endpoint: 'announcements',

View File

@ -41,10 +41,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: 'API console',
icon: faTerminal
}]
title: 'API console',
icon: faTerminal
},
endpoint: '',

View File

@ -51,10 +51,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('installedApps'),
icon: faPlug,
}],
title: this.$t('installedApps'),
icon: faPlug,
},
pagination: {
endpoint: 'i/apps',

View File

@ -46,15 +46,11 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.channelId ? {
header: [{
title: this.$t('_channel.edit'),
icon: faSatelliteDish,
}],
title: this.$t('_channel.edit'),
icon: faSatelliteDish,
} : {
header: [{
title: this.$t('_channel.create'),
icon: faSatelliteDish,
}],
title: this.$t('_channel.create'),
icon: faSatelliteDish,
}),
channel: null,
name: null,

View File

@ -54,10 +54,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.channel ? {
header: [{
title: this.channel.name,
icon: faSatelliteDish,
}],
title: this.channel.name,
icon: faSatelliteDish,
} : null),
channel: null,
showBanner: true,

View File

@ -43,10 +43,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('channel'),
icon: faSatelliteDish
}]
title: this.$t('channel'),
icon: faSatelliteDish
},
tab: 'featured',
featuredPagination: {

View File

@ -43,10 +43,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.title,
icon: faFileAlt
}],
title: this.title,
icon: faFileAlt
},
faFileAlt,
title: '',

View File

@ -21,10 +21,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('help'),
icon: faQuestionCircle
}],
title: this.$t('help'),
icon: faQuestionCircle
},
docs: [],
faQuestionCircle

View File

@ -18,10 +18,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: computed(() => this.folder ? this.folder.name : this.$t('drive')),
icon: faCloud,
}],
title: computed(() => this.folder ? this.folder.name : this.$t('drive')),
icon: faCloud,
action: {
icon: faEllipsisH,
handler: this.menu

View File

@ -93,10 +93,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('explore'),
icon: faHashtag
}],
title: this.$t('explore'),
icon: faHashtag
},
pinnedUsers: { endpoint: 'pinned-users' },
popularUsers: { endpoint: 'users', limit: 10, noPaging: true, params: {

View File

@ -19,10 +19,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('favorites'),
icon: faStar
}]
title: this.$t('favorites'),
icon: faStar
},
pagination: {
endpoint: 'i/favorites',

View File

@ -18,10 +18,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('featured'),
icon: faFireAlt
}],
title: this.$t('featured'),
icon: faFireAlt
},
pagination: {
endpoint: 'notes/featured',

View File

@ -44,10 +44,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('followRequests'),
icon: faUserClock,
}],
title: this.$t('followRequests'),
icon: faUserClock,
},
pagination: {
endpoint: 'following/requests/list',

View File

@ -84,10 +84,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('abuseReports'),
icon: faExclamationCircle
}],
title: this.$t('abuseReports'),
icon: faExclamationCircle
},
searchUsername: '',
searchHost: '',

View File

@ -45,10 +45,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('announcements'),
icon: faBroadcastTower
}]
title: this.$t('announcements'),
icon: faBroadcastTower
},
announcements: [],
faBroadcastTower, faSave, faTrashAlt, faPlus

View File

@ -68,10 +68,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('customEmojis'),
icon: faLaugh
}],
title: this.$t('customEmojis'),
icon: faLaugh,
action: {
icon: faPlus,
handler: this.add

View File

@ -79,10 +79,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('federation'),
icon: faGlobe
}],
title: this.$t('federation'),
icon: faGlobe
},
host: '',
state: 'federating',

View File

@ -84,10 +84,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('files'),
icon: faCloud
}],
title: this.$t('files'),
icon: faCloud
},
q: null,
origin: 'local',

View File

@ -86,7 +86,7 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
tabs: [{
id: 'index',
title: null,
tooltip: this.$t('instance'),

View File

@ -49,10 +49,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('serverLogs'),
icon: faStream
}]
title: this.$t('serverLogs'),
icon: faStream
},
logs: [],
logLevel: 'all',

View File

@ -31,10 +31,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('jobQueue'),
icon: faExchangeAlt,
}],
title: this.$t('jobQueue'),
icon: faExchangeAlt,
},
connection: os.stream.useSharedConnection('queueStats'),
faExchangeAlt, faTrashAlt

View File

@ -38,10 +38,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('relays'),
icon: faProjectDiagram,
}],
title: this.$t('relays'),
icon: faProjectDiagram,
},
relays: [],
inbox: '',

View File

@ -257,10 +257,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('instance'),
icon: faCog,
}],
title: this.$t('instance'),
icon: faCog,
},
url,
proxyAccount: null,

View File

@ -101,10 +101,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('users'),
icon: faUsers
}],
title: this.$t('users'),
icon: faUsers,
action: {
icon: faSearch,
handler: this.searchUser

View File

@ -18,10 +18,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('mentions'),
icon: faAt
}],
title: this.$t('mentions'),
icon: faAt
},
pagination: {
endpoint: 'notes/mentions',

View File

@ -18,10 +18,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('directNotes'),
icon: faEnvelope
}],
title: this.$t('directNotes'),
icon: faEnvelope
},
pagination: {
endpoint: 'notes/mentions',

View File

@ -53,10 +53,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('messaging'),
icon: faComments
}]
title: this.$t('messaging'),
icon: faComments
},
fetching: true,
moreFetching: false,

View File

@ -62,19 +62,15 @@ const Component = defineComponent({
data() {
return {
INFO: computed(() => !this.fetching ? this.user ? {
header: [{
userName: this.user,
avatar: this.user,
}],
userName: this.user,
avatar: this.user,
action: {
icon: faEllipsisH,
handler: this.menu,
},
} : {
header: [{
title: this.group.name,
icon: faUsers
}],
title: this.group.name,
icon: faUsers,
action: {
icon: faEllipsisH,
handler: this.menu,

View File

@ -29,10 +29,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('manageAntennas'),
icon: faSatellite
}],
title: this.$t('manageAntennas'),
icon: faSatellite,
action: {
icon: faPlus,
handler: this.create

View File

@ -48,10 +48,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.group ? {
header: [{
title: this.group.name,
icon: faUsers,
}],
title: this.group.name,
icon: faUsers,
} : null),
group: null,
users: [],

View File

@ -63,10 +63,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('groups'),
icon: faUsers
}],
title: this.$t('groups'),
icon: faUsers
},
tab: 'owned',
ownedPagination: {

View File

@ -26,10 +26,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('manageLists'),
icon: faListUl
}],
title: this.$t('manageLists'),
icon: faListUl,
action: {
icon: faPlus,
handler: this.create

View File

@ -47,10 +47,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.list ? {
header: [{
title: this.list.name,
icon: faListUl,
}],
title: this.list.name,
icon: faListUl,
} : null),
list: null,
users: [],

View File

@ -16,10 +16,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('notFound'),
icon: faExclamationTriangle
}]
title: this.$t('notFound'),
icon: faExclamationTriangle
},
}
},

View File

@ -51,10 +51,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.note ? {
header: [{
title: this.$t('note'),
avatar: this.note.user,
}],
title: this.$t('note'),
avatar: this.note.user,
} : null),
note: null,
hasPrev: false,

View File

@ -21,10 +21,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('notifications'),
icon: faBell
}]
title: this.$t('notifications'),
icon: faBell
},
};
},

View File

@ -57,10 +57,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.page ? {
header: [{
title: computed(() => this.page.title || this.page.name),
avatar: this.page.user,
}],
title: computed(() => this.page.title || this.page.name),
avatar: this.page.user,
} : null),
page: null,
faHeartS, faHeartR

View File

@ -35,10 +35,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('pages'),
icon: faStickyNote
}],
title: this.$t('pages'),
icon: faStickyNote,
action: {
icon: faPlus,
handler: this.create

View File

@ -27,10 +27,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('_reversi.reversi'),
icon: faGamepad
}]
title: this.$t('_reversi.reversi'),
icon: faGamepad
},
game: null,
connection: null,

View File

@ -76,10 +76,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('_reversi.reversi'),
icon: faGamepad
}]
title: this.$t('_reversi.reversi'),
icon: faGamepad
},
games: [],
gamesFetching: true,

View File

@ -82,10 +82,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.user ? {
header: [{
title: this.$t('room'),
avatar: this.user,
}],
title: this.$t('room'),
avatar: this.user,
} : null),
user: null,
objectSelected: false,

View File

@ -44,10 +44,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('scratchpad'),
icon: faTerminal,
}],
title: this.$t('scratchpad'),
icon: faTerminal,
},
code: '',
logs: [],

View File

@ -20,10 +20,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('searchWith', { q: this.$route.query.q }),
icon: faSearch
}],
title: this.$t('searchWith', { q: this.$route.query.q }),
icon: faSearch
},
pagination: {
endpoint: 'notes/search',

View File

@ -28,10 +28,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: 'API',
icon: faKey
}]
title: 'API',
icon: faKey
},
isDesktop: window.innerWidth >= 1100,
};

View File

@ -107,10 +107,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('general'),
icon: faCogs
}]
title: this.$t('general'),
icon: faCogs
},
langs,
lang: localStorage.getItem('lang'),

View File

@ -55,10 +55,8 @@ export default defineComponent({
setup(props, context) {
const INFO = ref({
header: [{
title: i18n.global.t('settings'),
icon: faCog
}]
title: i18n.global.t('settings'),
icon: faCog
});
const narrow = ref(false);
const view = ref(null);

View File

@ -41,10 +41,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('integration'),
icon: faShareAlt
}]
title: this.$t('integration'),
icon: faShareAlt
},
apiUrl,
twitterForm: null,

View File

@ -49,10 +49,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('muteAndBlock'),
icon: faBan
}]
title: this.$t('muteAndBlock'),
icon: faBan
},
tab: 'mute',
mutingPagination: {

View File

@ -40,10 +40,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('notifications'),
icon: faBell
}]
title: this.$t('notifications'),
icon: faBell
},
faCog
}

View File

@ -42,10 +42,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('other'),
icon: faEllipsisH
}]
title: this.$t('other'),
icon: faEllipsisH
},
debug
}

View File

@ -38,10 +38,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('privacy'),
icon: faLockOpen
}]
title: this.$t('privacy'),
icon: faLockOpen
},
isLocked: false,
autoAcceptFollowed: false,

View File

@ -81,10 +81,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('profile'),
icon: faUser
}]
title: this.$t('profile'),
icon: faUser
},
host,
name: null,

View File

@ -37,10 +37,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('reaction'),
icon: faLaugh
}]
title: this.$t('reaction'),
icon: faLaugh
},
reactions: this.$store.state.settings.reactions.join(''),
changed: false,

View File

@ -46,10 +46,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: 'RegEdit',
icon: faCode
}]
title: 'RegEdit',
icon: faCode
},
settings: JSON5.stringify(this.$store.state.settings, null, '\t'),

View File

@ -31,10 +31,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('security'),
icon: faLock
}]
title: this.$t('security'),
icon: faLock
},
faLock, faSyncAlt
}

View File

@ -43,10 +43,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('sidebar'),
icon: faListUl
}]
title: this.$t('sidebar'),
icon: faListUl
},
menuDef: sidebarDef,
items: '',

View File

@ -105,10 +105,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('theme'),
icon: faPalette
}]
title: this.$t('theme'),
icon: faPalette
},
builtinThemes,
installThemeCode: null,

View File

@ -48,10 +48,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('wordMute'),
icon: faCommentSlash
}]
title: this.$t('wordMute'),
icon: faCommentSlash
},
tab: 'soft',
softMutedWords: '',

View File

@ -27,10 +27,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('share'),
icon: faShareAlt
}],
title: this.$t('share'),
icon: faShareAlt
},
title: null,
text: null,

View File

@ -25,10 +25,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.tag,
icon: faHashtag
}],
title: this.tag,
icon: faHashtag
},
pagination: {
endpoint: 'notes/search-by-tag',

View File

@ -152,10 +152,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: 'TEST',
icon: faExclamationTriangle
}]
title: 'TEST',
icon: faExclamationTriangle
},
dialogTitle: 'Hello',
dialogBody: 'World!',

View File

@ -121,10 +121,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: this.$t('themeEditor'),
icon: faPalette,
}],
title: this.$t('themeEditor'),
icon: faPalette,
},
theme: [] as ThemeViewModel,
name: '',

View File

@ -50,7 +50,7 @@ export default defineComponent({
queue: 0,
width: 0,
INFO: computed(() => {
const header = [{
const tabs = [{
id: 'home',
title: null,
tooltip: this.$t('_timelines.home'),
@ -60,7 +60,7 @@ export default defineComponent({
}];
if (!this.$store.state.instance.meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin) {
header.push({
tabs.push({
id: 'local',
title: null,
tooltip: this.$t('_timelines.local'),
@ -69,7 +69,7 @@ export default defineComponent({
selected: computed(() => this.src === 'local')
});
header.push({
tabs.push({
id: 'social',
title: null,
tooltip: this.$t('_timelines.social'),
@ -80,7 +80,7 @@ export default defineComponent({
}
if (!this.$store.state.instance.meta.disableGlobalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin) {
header.push({
tabs.push({
id: 'global',
title: null,
tooltip: this.$t('_timelines.global'),
@ -90,7 +90,7 @@ export default defineComponent({
});
}
header.push({
tabs.push({
id: 'other',
title: null,
icon: faEllipsisH,
@ -99,7 +99,7 @@ export default defineComponent({
});
return {
header,
tabs,
action: {
icon: faPencilAlt,
handler: () => os.post()

View File

@ -160,10 +160,8 @@ export default defineComponent({
data() {
return {
INFO: computed(() => this.user ? {
header: [{
userName: this.user,
avatar: this.user,
}],
userName: this.user,
avatar: this.user,
action: {
icon: faEllipsisH,
handler: this.menu

View File

@ -20,10 +20,8 @@ export default defineComponent({
data() {
return {
INFO: {
header: [{
title: instanceName || 'Misskey',
icon: null
}]
title: instanceName || 'Misskey',
icon: null
},
}
},

View File

@ -5,12 +5,20 @@
</transition>
<template v-if="info">
<div class="titleContainer">
<div class="title" v-for="header in info.header" :key="header.id" :class="{ _button: header.onClick, selected: header.selected }" @click="header.onClick" v-tooltip="header.tooltip">
<Fa v-if="header.icon" :icon="header.icon" :key="header.icon" class="icon"/>
<MkAvatar v-else-if="header.avatar" class="avatar" :user="header.avatar" :disable-preview="true"/>
<span v-if="header.title" class="text">{{ header.title }}</span>
<MkUserName v-else-if="header.userName" :user="header.userName" :nowrap="false" class="text"/>
</div>
<template v-if="info.tabs">
<div class="title" v-for="tab in info.tabs" :key="tab.id" :class="{ _button: tab.onClick, selected: tab.selected }" @click="tab.onClick" v-tooltip="tab.tooltip">
<Fa v-if="tab.icon" :icon="tab.icon" :key="tab.icon" class="icon"/>
<span v-if="tab.title" class="text">{{ tab.title }}</span>
</div>
</template>
<template v-else>
<div class="title">
<Fa v-if="info.icon" :icon="info.icon" :key="info.icon" class="icon"/>
<MkAvatar v-else-if="info.avatar" class="avatar" :user="info.avatar" :disable-preview="true"/>
<span v-if="info.title" class="text">{{ info.title }}</span>
<MkUserName v-else-if="info.userName" :user="info.userName" :nowrap="false" class="text"/>
</div>
</template>
</div>
<button class="_button action" v-if="info.action" @click="info.action.handler"><Fa :icon="info.action.icon" :key="info.action.icon"/></button>
</template>