diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-04-20 23:22:59 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 23:22:59 +0900 |
| commit | 11349561d697b11df7bcaa3d57ed3498eb4dd3c5 (patch) | |
| tree | 8dfe96ed7c9b695872b7d416383920355621d3c3 /src/client/components/note.vue | |
| parent | Tweak style (diff) | |
| download | sharkey-11349561d697b11df7bcaa3d57ed3498eb4dd3c5.tar.gz sharkey-11349561d697b11df7bcaa3d57ed3498eb4dd3c5.tar.bz2 sharkey-11349561d697b11df7bcaa3d57ed3498eb4dd3c5.zip | |
Use FontAwesome as web font instead of vue component (#7469)
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update yarn.lock
* wip
* wip
Diffstat (limited to 'src/client/components/note.vue')
| -rw-r--r-- | src/client/components/note.vue | 97 |
1 files changed, 43 insertions, 54 deletions
diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 0e153033ca..504d07c0eb 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -9,12 +9,12 @@ v-size="{ max: [500, 450, 350, 300] }" > <XSub :note="appearNote.reply" class="reply-to" v-if="appearNote.reply"/> - <div class="info" v-if="pinned"><Fa :icon="faThumbtack"/> {{ $ts.pinnedNote }}</div> - <div class="info" v-if="appearNote._prId_"><Fa :icon="faBullhorn"/> {{ $ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ $ts.hideThisNote }} <Fa :icon="faTimes"/></button></div> - <div class="info" v-if="appearNote._featuredId_"><Fa :icon="faBolt"/> {{ $ts.featured }}</div> + <div class="info" v-if="pinned"><i class="fas fa-thumbtack"></i> {{ $ts.pinnedNote }}</div> + <div class="info" v-if="appearNote._prId_"><i class="fas fa-bullhorn"></i> {{ $ts.promotion }}<button class="_textButton hide" @click="readPromo()">{{ $ts.hideThisNote }} <i class="fas fa-times"></i></button></div> + <div class="info" v-if="appearNote._featuredId_"><i class="fas fa-bolt"></i> {{ $ts.featured }}</div> <div class="renote" v-if="isRenote"> <MkAvatar class="avatar" :user="note.user"/> - <Fa :icon="faRetweet"/> + <i class="fas fa-retweet"></i> <I18n :src="$ts.renotedBy" tag="span"> <template #user> <MkA class="name" :to="userPage(note.user)" v-user-preview="note.userId"> @@ -24,15 +24,15 @@ </I18n> <div class="info"> <button class="_button time" @click="showRenoteMenu()" ref="renoteTime"> - <Fa class="dropdownIcon" v-if="isMyRenote" :icon="faEllipsisH"/> + <i v-if="isMyRenote" class="fas fa-ellipsis-h dropdownIcon"></i> <MkTime :time="note.createdAt"/> </button> <span class="visibility" v-if="note.visibility !== 'public'"> - <Fa v-if="note.visibility === 'home'" :icon="faHome"/> - <Fa v-if="note.visibility === 'followers'" :icon="faUnlock"/> - <Fa v-if="note.visibility === 'specified'" :icon="faEnvelope"/> + <i v-if="note.visibility === 'home'" class="fas fa-home"></i> + <i v-else-if="note.visibility === 'followers'" class="fas fa-unlock"></i> + <i v-else-if="note.visibility === 'specified'" class="fas fa-envelope"></i> </span> - <span class="localOnly" v-if="note.localOnly"><Fa :icon="faBiohazard"/></span> + <span class="localOnly" v-if="note.localOnly"><i class="fas fa-biohazard"></i></span> </div> </div> <article class="article" @contextmenu.stop="onContextmenu"> @@ -48,7 +48,7 @@ <div class="content" :class="{ collapsed }" v-show="appearNote.cw == null || showContent"> <div class="text"> <span v-if="appearNote.isHidden" style="opacity: 0.5">({{ $ts.private }})</span> - <MkA class="reply" v-if="appearNote.replyId" :to="`/notes/${appearNote.replyId}`"><Fa :icon="faReply"/></MkA> + <MkA class="reply" v-if="appearNote.replyId" :to="`/notes/${appearNote.replyId}`"><i class="fas fa-reply"></i></MkA> <Mfm v-if="appearNote.text" :text="appearNote.text" :author="appearNote.user" :i="$i" :custom-emojis="appearNote.emojis"/> <a class="rp" v-if="appearNote.renote != null">RN:</a> </div> @@ -62,29 +62,29 @@ <span>{{ $ts.showMore }}</span> </button> </div> - <MkA v-if="appearNote.channel && !inChannel" class="channel" :to="`/channels/${appearNote.channel.id}`"><Fa :icon="faSatelliteDish"/> {{ appearNote.channel.name }}</MkA> + <MkA v-if="appearNote.channel && !inChannel" class="channel" :to="`/channels/${appearNote.channel.id}`"><i class="fas fa-satellite-dish"></i> {{ appearNote.channel.name }}</MkA> </div> <footer class="footer"> <XReactionsViewer :note="appearNote" ref="reactionsViewer"/> <button @click="reply()" class="button _button"> - <template v-if="appearNote.reply"><Fa :icon="faReplyAll"/></template> - <template v-else><Fa :icon="faReply"/></template> + <template v-if="appearNote.reply"><i class="fas fa-reply-all"></i></template> + <template v-else><i class="fas fa-reply"></i></template> <p class="count" v-if="appearNote.repliesCount > 0">{{ appearNote.repliesCount }}</p> </button> <button v-if="canRenote" @click="renote()" class="button _button" ref="renoteButton"> - <Fa :icon="faRetweet"/><p class="count" v-if="appearNote.renoteCount > 0">{{ appearNote.renoteCount }}</p> + <i class="fas fa-retweet"></i><p class="count" v-if="appearNote.renoteCount > 0">{{ appearNote.renoteCount }}</p> </button> <button v-else class="button _button"> - <Fa :icon="faBan"/> + <i class="fas fa-ban"></i> </button> <button v-if="appearNote.myReaction == null" class="button _button" @click="react()" ref="reactButton"> - <Fa :icon="faPlus"/> + <i class="fas fa-plus"></i> </button> <button v-if="appearNote.myReaction != null" class="button _button reacted" @click="undoReact(appearNote)" ref="reactButton"> - <Fa :icon="faMinus"/> + <i class="fas fa-minus"></i> </button> <button class="button _button" @click="menu()" ref="menuButton"> - <Fa :icon="faEllipsisH"/> + <i class="fas fa-ellipsis-h"></i> </button> </footer> </div> @@ -103,8 +103,6 @@ <script lang="ts"> import { defineAsyncComponent, defineComponent, markRaw } from 'vue'; -import { faSatelliteDish, faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight, faInfoCircle, faBiohazard, faPlug, faExclamationCircle, faPaperclip, faShareAlt } from '@fortawesome/free-solid-svg-icons'; -import { faCopy, faTrashAlt, faEdit, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; import * as mfm from 'mfm-js'; import { sum } from '../../prelude/array'; import XSub from './note.sub.vue'; @@ -125,14 +123,6 @@ import { noteActions, noteViewInterruptors } from '@client/store'; import { reactionPicker } from '@client/scripts/reaction-picker'; import { extractUrlFromMfm } from '@/misc/extract-url-from-mfm'; -function markRawAll(...xs) { - for (const x of xs) { - markRaw(x); - } -} - -markRawAll(faEdit, faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faBiohazard, faPlug, faSatelliteDish); - export default defineComponent({ components: { XSub, @@ -174,7 +164,6 @@ export default defineComponent({ collapsed: false, isDeleted: false, muted: false, - faEdit, faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faBiohazard, faPlug, faSatelliteDish }; }, @@ -442,7 +431,7 @@ export default defineComponent({ this.blur(); os.modalMenu([{ text: this.$ts.renote, - icon: faRetweet, + icon: 'fas fa-retweet', action: () => { os.api('notes/create', { renoteId: this.appearNote.id @@ -450,7 +439,7 @@ export default defineComponent({ } }, { text: this.$ts.quote, - icon: faQuoteRight, + icon: 'fas fa-quote-right', action: () => { os.post({ renote: this.appearNote, @@ -586,62 +575,62 @@ export default defineComponent({ }); menu = [{ - icon: faCopy, + icon: 'fas fa-copy', text: this.$ts.copyContent, action: this.copyContent }, { - icon: faLink, + icon: 'fas fa-link', text: this.$ts.copyLink, action: this.copyLink }, (this.appearNote.url || this.appearNote.uri) ? { - icon: faExternalLinkSquareAlt, + icon: 'fas fa-external-link-square-alt', text: this.$ts.showOnRemote, action: () => { window.open(this.appearNote.url || this.appearNote.uri, '_blank'); } } : undefined, { - icon: faShareAlt, + icon: 'fas fa-share-alt', text: this.$ts.share, action: this.share }, null, statePromise.then(state => state.isFavorited ? { - icon: faStar, + icon: 'fas fa-star', text: this.$ts.unfavorite, action: () => this.toggleFavorite(false) } : { - icon: faStar, + icon: 'fas fa-star', text: this.$ts.favorite, action: () => this.toggleFavorite(true) }), { - icon: faPaperclip, + icon: 'fas fa-paperclip', text: this.$ts.clip, action: () => this.clip() }, (this.appearNote.userId != this.$i.id) ? statePromise.then(state => state.isWatching ? { - icon: faEyeSlash, + icon: 'fas fa-eye-slash', text: this.$ts.unwatch, action: () => this.toggleWatch(false) } : { - icon: faEye, + icon: 'fas fa-eye', text: this.$ts.watch, action: () => this.toggleWatch(true) }) : undefined, this.appearNote.userId == this.$i.id ? (this.$i.pinnedNoteIds || []).includes(this.appearNote.id) ? { - icon: faThumbtack, + icon: 'fas fa-thumbtack', text: this.$ts.unpin, action: () => this.togglePin(false) } : { - icon: faThumbtack, + icon: 'fas fa-thumbtack', text: this.$ts.pin, action: () => this.togglePin(true) } : undefined, ...(this.$i.isModerator || this.$i.isAdmin ? [ null, { - icon: faBullhorn, + icon: 'fas fa-bullhorn', text: this.$ts.promote, action: this.promote }] @@ -650,7 +639,7 @@ export default defineComponent({ ...(this.appearNote.userId != this.$i.id ? [ null, { - icon: faExclamationCircle, + icon: 'fas fa-exclamation-circle', text: this.$ts.reportAbuse, action: () => { const u = `${url}/notes/${this.appearNote.id}`; @@ -665,12 +654,12 @@ export default defineComponent({ ...(this.appearNote.userId == this.$i.id || this.$i.isModerator || this.$i.isAdmin ? [ null, this.appearNote.userId == this.$i.id ? { - icon: faEdit, + icon: 'fas fa-edit', text: this.$ts.deleteAndEdit, action: this.delEdit } : undefined, { - icon: faTrashAlt, + icon: 'fas fa-trash-alt', text: this.$ts.delete, danger: true, action: this.del @@ -680,15 +669,15 @@ export default defineComponent({ .filter(x => x !== undefined); } else { menu = [{ - icon: faCopy, + icon: 'fas fa-copy', text: this.$ts.copyContent, action: this.copyContent }, { - icon: faLink, + icon: 'fas fa-link', text: this.$ts.copyLink, action: this.copyLink }, (this.appearNote.url || this.appearNote.uri) ? { - icon: faExternalLinkSquareAlt, + icon: 'fas fa-external-link-square-alt', text: this.$ts.showOnRemote, action: () => { window.open(this.appearNote.url || this.appearNote.uri, '_blank'); @@ -699,7 +688,7 @@ export default defineComponent({ if (noteActions.length > 0) { menu = menu.concat([null, ...noteActions.map(action => ({ - icon: faPlug, + icon: 'fas fa-plug', text: action.title, action: () => { action.handler(this.appearNote); @@ -738,7 +727,7 @@ export default defineComponent({ if (!this.isMyRenote) return; os.modalMenu([{ text: this.$ts.unrenote, - icon: faTrashAlt, + icon: 'fas fa-trash-alt', danger: true, action: () => { os.api('notes/delete', { @@ -781,7 +770,7 @@ export default defineComponent({ async clip() { const clips = await os.api('clips/list'); os.modalMenu([{ - icon: faPlus, + icon: 'fas fa-plus', text: this.$ts.createNew, action: async () => { const { canceled, result } = await os.form(this.$ts.createNewClip, { @@ -909,7 +898,7 @@ export default defineComponent({ white-space: pre; color: #d28a3f; - > [data-icon] { + > i { margin-right: 4px; } @@ -945,7 +934,7 @@ export default defineComponent({ border-radius: 6px; } - > [data-icon] { + > i { margin-right: 4px; } |