biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -11,31 +11,29 @@ import {
|
|||
faMusic,
|
||||
faImage,
|
||||
faLink,
|
||||
faPollH
|
||||
faPollH,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { useMediaViewerStore } from 'src/stores/media_viewer'
|
||||
|
||||
library.add(
|
||||
faCircleNotch,
|
||||
faFile,
|
||||
faMusic,
|
||||
faImage,
|
||||
faLink,
|
||||
faPollH
|
||||
)
|
||||
library.add(faCircleNotch, faFile, faMusic, faImage, faLink, faPollH)
|
||||
|
||||
const camelCase = name => name.charAt(0).toUpperCase() + name.slice(1)
|
||||
const camelCase = (name) => name.charAt(0).toUpperCase() + name.slice(1)
|
||||
|
||||
const controlledOrUncontrolledGetters = list => list.reduce((res, name) => {
|
||||
const camelized = camelCase(name)
|
||||
const toggle = `controlledToggle${camelized}`
|
||||
const controlledName = `controlled${camelized}`
|
||||
const uncontrolledName = `uncontrolled${camelized}`
|
||||
res[name] = function () {
|
||||
return ((this.$data[toggle] !== undefined || this.$props[toggle] !== undefined) && this[toggle]) ? this[controlledName] : this[uncontrolledName]
|
||||
}
|
||||
return res
|
||||
}, {})
|
||||
const controlledOrUncontrolledGetters = (list) =>
|
||||
list.reduce((res, name) => {
|
||||
const camelized = camelCase(name)
|
||||
const toggle = `controlledToggle${camelized}`
|
||||
const controlledName = `controlled${camelized}`
|
||||
const uncontrolledName = `uncontrolled${camelized}`
|
||||
res[name] = function () {
|
||||
return (this.$data[toggle] !== undefined ||
|
||||
this.$props[toggle] !== undefined) &&
|
||||
this[toggle]
|
||||
? this[controlledName]
|
||||
: this[uncontrolledName]
|
||||
}
|
||||
return res
|
||||
}, {})
|
||||
|
||||
const controlledOrUncontrolledToggle = (obj, name) => {
|
||||
const camelized = camelCase(name)
|
||||
|
|
@ -63,28 +61,38 @@ const StatusContent = {
|
|||
'controlledToggleShowingTall',
|
||||
'controlledToggleExpandingSubject',
|
||||
'controlledShowingLongSubject',
|
||||
'controlledToggleShowingLongSubject'
|
||||
'controlledToggleShowingLongSubject',
|
||||
],
|
||||
emits: ['parseReady', 'mediaplay', 'mediapause'],
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
uncontrolledShowingTall: this.fullContent || (this.inConversation && this.focused),
|
||||
uncontrolledShowingTall:
|
||||
this.fullContent || (this.inConversation && this.focused),
|
||||
uncontrolledShowingLongSubject: false,
|
||||
// not as computed because it sets the initial state which will be changed later
|
||||
uncontrolledExpandingSubject: !this.$store.getters.mergedConfig.collapseMessageWithSubject
|
||||
uncontrolledExpandingSubject:
|
||||
!this.$store.getters.mergedConfig.collapseMessageWithSubject,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...controlledOrUncontrolledGetters(['showingTall', 'expandingSubject', 'showingLongSubject']),
|
||||
statusCard () {
|
||||
...controlledOrUncontrolledGetters([
|
||||
'showingTall',
|
||||
'expandingSubject',
|
||||
'showingLongSubject',
|
||||
]),
|
||||
statusCard() {
|
||||
if (!this.status.card) return null
|
||||
return this.status.card.url === this.status.quote_url ? null : this.status.card
|
||||
return this.status.card.url === this.status.quote_url
|
||||
? null
|
||||
: this.status.card
|
||||
},
|
||||
hideAttachments () {
|
||||
return (this.mergedConfig.hideAttachments && !this.inConversation) ||
|
||||
hideAttachments() {
|
||||
return (
|
||||
(this.mergedConfig.hideAttachments && !this.inConversation) ||
|
||||
(this.mergedConfig.hideAttachmentsInConv && this.inConversation)
|
||||
)
|
||||
},
|
||||
nsfwClickthrough () {
|
||||
nsfwClickthrough() {
|
||||
if (!this.status.nsfw) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -93,49 +101,54 @@ const StatusContent = {
|
|||
}
|
||||
return true
|
||||
},
|
||||
localCollapseSubjectDefault () {
|
||||
localCollapseSubjectDefault() {
|
||||
return this.mergedConfig.collapseMessageWithSubject
|
||||
},
|
||||
attachmentSize () {
|
||||
attachmentSize() {
|
||||
if (this.compact) {
|
||||
return 'small'
|
||||
} else if ((this.mergedConfig.hideAttachments && !this.inConversation) ||
|
||||
} else if (
|
||||
(this.mergedConfig.hideAttachments && !this.inConversation) ||
|
||||
(this.mergedConfig.hideAttachmentsInConv && this.inConversation) ||
|
||||
(this.status.attachments.length > this.maxThumbnails)) {
|
||||
this.status.attachments.length > this.maxThumbnails
|
||||
) {
|
||||
return 'hide'
|
||||
}
|
||||
return 'normal'
|
||||
},
|
||||
maxThumbnails () {
|
||||
maxThumbnails() {
|
||||
return this.mergedConfig.maxThumbnails
|
||||
},
|
||||
...mapGetters(['mergedConfig']),
|
||||
...mapState({
|
||||
currentUser: state => state.users.currentUser
|
||||
})
|
||||
currentUser: (state) => state.users.currentUser,
|
||||
}),
|
||||
},
|
||||
components: {
|
||||
Attachment,
|
||||
Poll,
|
||||
Gallery,
|
||||
LinkPreview,
|
||||
StatusBody
|
||||
StatusBody,
|
||||
},
|
||||
methods: {
|
||||
toggleShowingTall () {
|
||||
toggleShowingTall() {
|
||||
controlledOrUncontrolledToggle(this, 'showingTall')
|
||||
},
|
||||
toggleExpandingSubject () {
|
||||
toggleExpandingSubject() {
|
||||
controlledOrUncontrolledToggle(this, 'expandingSubject')
|
||||
},
|
||||
toggleShowingLongSubject () {
|
||||
toggleShowingLongSubject() {
|
||||
controlledOrUncontrolledToggle(this, 'showingLongSubject')
|
||||
},
|
||||
setMedia () {
|
||||
const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments
|
||||
setMedia() {
|
||||
const attachments =
|
||||
this.attachmentSize === 'hide'
|
||||
? this.status.attachments
|
||||
: this.galleryAttachments
|
||||
return () => useMediaViewerStore().setMedia(attachments)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default StatusContent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue