2026-09-26 22:20:00 +08:00
|
|
|
<!--
|
|
|
|
|
Copyright 2024-2026 ReplyPier
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from 'vue'
|
2026-10-22 17:44:36 +08:00
|
|
|
import { navIconSvg } from '@/components/layout/navIcons'
|
2026-09-26 22:20:00 +08:00
|
|
|
|
|
|
|
|
// The channel's delivery receipt for a message we sent. 'failed' has its own
|
|
|
|
|
// "Not delivered" notice, so it shows no tick.
|
|
|
|
|
type ChannelStatus = 'sent' | 'delivered' | 'read'
|
|
|
|
|
|
|
|
|
|
const TICKS: Record<ChannelStatus, { icon: string; label: string }> = {
|
2026-10-22 17:44:36 +08:00
|
|
|
sent: { icon: 'check', label: '已发送' },
|
|
|
|
|
delivered: { icon: 'checks', label: '已送达' },
|
|
|
|
|
read: { icon: 'checks', label: '已读' },
|
2026-09-26 22:20:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
status?: string | null
|
|
|
|
|
// On an accent-filled bubble no blue holds contrast in either theme, so
|
2026-10-22 17:44:36 +08:00
|
|
|
// the tick inherits the bubble's own foreground instead.
|
2026-09-26 22:20:00 +08:00
|
|
|
onAccent?: boolean
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const tick = computed(() =>
|
|
|
|
|
props.status && props.status in TICKS ? TICKS[props.status as ChannelStatus] : null
|
|
|
|
|
)
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<span
|
|
|
|
|
v-if="tick"
|
|
|
|
|
class="status-ticks"
|
|
|
|
|
:class="[`status-ticks--${status}`, { 'status-ticks--on-accent': onAccent }]"
|
|
|
|
|
:title="tick.label"
|
|
|
|
|
:aria-label="tick.label"
|
|
|
|
|
role="img"
|
|
|
|
|
>
|
2026-10-22 17:44:36 +08:00
|
|
|
<span class="tick-icon" v-html="navIconSvg(tick.icon, 13)"></span>
|
|
|
|
|
<span class="tick-label">{{ tick.label }}</span>
|
2026-09-26 22:20:00 +08:00
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.status-ticks {
|
|
|
|
|
display: inline-flex;
|
2026-10-22 17:44:36 +08:00
|
|
|
align-items: center;
|
|
|
|
|
gap: 3px;
|
|
|
|
|
color: var(--celadon);
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
line-height: 1;
|
|
|
|
|
white-space: nowrap;
|
2026-09-26 22:20:00 +08:00
|
|
|
}
|
|
|
|
|
|
2026-10-22 17:44:36 +08:00
|
|
|
.tick-icon {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tick-icon :deep(svg) {
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A sent message is not a success yet — keep it quiet until it lands. */
|
|
|
|
|
.status-ticks--sent {
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-ticks--on-accent {
|
|
|
|
|
color: color-mix(in srgb, var(--bubble-human-fg) 78%, transparent);
|
2026-09-26 22:20:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-ticks--on-accent.status-ticks--read {
|
2026-10-22 17:44:36 +08:00
|
|
|
color: var(--bubble-human-fg);
|
2026-09-26 22:20:00 +08:00
|
|
|
}
|
|
|
|
|
</style>
|