Skip to content

Commit

Permalink
feat: simplify replying to badge when it's the same as reblogger
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 29, 2022
1 parent 2a4e1bf commit 28af2f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion components/status/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ const isFiltered = $computed(() => filterPhrase && (props.context ? filter?.cont
const avatarOnAvatar = $(computedEager(() => useFeatureFlags().experimentalAvatarOnAvatar))
const collapseRebloggedBy = $computed(() => rebloggedBy?.id === status.account.id)
const showRebloggedByAvatarOnAvatar = $computed(() => rebloggedBy && avatarOnAvatar && rebloggedBy.id !== status.account.id)
// Collapse ReplyingTo badge if it is a self-reply (thread)
const collapseReplyingTo = $computed(() => (!rebloggedBy || collapseRebloggedBy) && status.inReplyToAccountId === status.account.id)
// Only show avatar in ReplyingTo badge if it was reblogged by the same account
const simplifyReplyingTo = $computed(() => rebloggedBy && rebloggedBy.id === status.inReplyToAccountId)
const isDM = $computed(() => status.visibility === 'direct')
</script>

Expand Down Expand Up @@ -99,7 +104,7 @@ const isDM = $computed(() => status.visibility === 'direct')
</div>
<div v-else />
</slot>
<StatusReplyingTo v-if="!directReply && !collapseReplyingTo" :status="status" :class="faded ? 'text-secondary-light' : ''" py1 />
<StatusReplyingTo v-if="!directReply && !collapseReplyingTo" :status="status" :simplified="simplifyReplyingTo" :class="faded ? 'text-secondary-light' : ''" py1 />
</div>
<div flex gap-3 :class="{ 'text-secondary': faded }">
<div relative>
Expand Down
7 changes: 4 additions & 3 deletions components/status/StatusReplyingTo.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script setup lang="ts">
import type { Status } from 'masto'
const { status, collapsed = false } = defineProps<{
const { status, collapsed = false, simplified = false } = defineProps<{
status: Status
collapsed: boolean
simplified: boolean
}>()
const isSelf = $computed(() => status.inReplyToAccountId === status.account.id)
Expand All @@ -21,8 +22,8 @@ const account = isSelf ? computed(() => status.account) : useAccountById(status.
<template v-if="account">
<div i-ri:reply-fill :class="collapsed ? '' : 'scale-x-[-1]'" text-secondary-light />
<template v-if="!isSelf">
<AccountInlineInfo v-if="account" :account="account" :link="false" />
<span v-else ws-nowrap>{{ $t('status.someone') }}</span>
<AccountAvatar v-if="simplified" :account="account" :link="false" w-5 h-5 />
<AccountInlineInfo v-else :account="account" :link="false" />
</template>
<span v-else-if="!collapsed" ws-nowrap>{{ $t('status.thread') }}</span>
</template>
Expand Down

0 comments on commit 28af2f2

Please sign in to comment.