Skip to content

Commit

Permalink
feat: collpase self thread when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 29, 2022
1 parent 3922db0 commit 2a4e1bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 5 additions & 1 deletion components/status/StatusCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ 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)
const collapseReplyingTo = $computed(() => (!rebloggedBy || collapseRebloggedBy) && status.inReplyToAccountId === status.account.id)
const isDM = $computed(() => status.visibility === 'direct')
</script>
Expand Down Expand Up @@ -98,7 +99,7 @@ const isDM = $computed(() => status.visibility === 'direct')
</div>
<div v-else />
</slot>
<StatusReplyingTo v-if="!directReply" :status="status" :class="faded ? 'text-secondary-light' : ''" py1 />
<StatusReplyingTo v-if="!directReply && !collapseReplyingTo" :status="status" :class="faded ? 'text-secondary-light' : ''" py1 />
</div>
<div flex gap-3 :class="{ 'text-secondary': faded }">
<div relative>
Expand All @@ -122,6 +123,9 @@ const isDM = $computed(() => status.visibility === 'direct')
<AccountHoverWrapper :account="status.account">
<StatusAccountDetails :account="status.account" />
</AccountHoverWrapper>
<div v-if="!directReply && collapseReplyingTo" flex="~" pl-1 items-center justify-center>
<StatusReplyingTo :collapsed="true" :status="status" :class="faded ? 'text-secondary-light' : ''" />
</div>
<div flex-auto />
<div v-if="!isZenMode" text-sm text-secondary flex="~ row nowrap" hover:underline>
<AccountBotIndicator v-if="status.account.bot" mr-2 />
Expand Down
15 changes: 9 additions & 6 deletions components/status/StatusReplyingTo.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import type { Status } from 'masto'
const { status } = defineProps<{
const { status, collapsed = false } = defineProps<{
status: Status
collapsed: boolean
}>()
const isSelf = $computed(() => status.inReplyToAccountId === status.account.id)
Expand All @@ -17,12 +18,14 @@ const account = isSelf ? computed(() => status.account) : useAccountById(status.
:to="getStatusInReplyToRoute(status)"
:title="account ? `Replying to ${getDisplayName(account)}` : 'Replying to someone'"
>
<div i-ri:reply-fill class="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>
<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>
</template>
<span v-else-if="!collapsed" ws-nowrap>{{ $t('status.thread') }}</span>
</template>
<span v-else ws-nowrap>{{ $t('status.thread') }}</span>
<div i-ph:chats-fill text-primary text-lg />
</NuxtLink>
</div>
Expand Down

0 comments on commit 2a4e1bf

Please sign in to comment.