Port modular app notifications, pargar date display, and closed-store product UX.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,6 +10,24 @@
|
||||
<BasicIcon icon="vuesax-linear:user" size="16" />
|
||||
<span>حساب کاربری</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="notificationEnabled"
|
||||
type="button"
|
||||
class="dhome-btn-ghost dhome-btn-ghost--notify"
|
||||
aria-label="اعلان"
|
||||
@click="goNotifications"
|
||||
>
|
||||
<span class="dhome-notify-wrap">
|
||||
<BasicIcon icon="vuesax-linear:notification-bing" size="16" />
|
||||
<span v-if="unreadCount > 0" class="dhome-notify-badge">
|
||||
{{ unreadCount > 99 ? '99+' : unreadCount }}
|
||||
</span>
|
||||
</span>
|
||||
<span>اعلان</span>
|
||||
</button>
|
||||
<button type="button" class="dhome-btn-ghost" aria-label="بروزرسانی" @click="reloadApp">
|
||||
<BasicIcon icon="vuesax-linear:refresh-2" size="16" />
|
||||
</button>
|
||||
<button
|
||||
v-if="showLogout"
|
||||
type="button"
|
||||
@@ -26,6 +44,8 @@
|
||||
<script lang="ts" setup>
|
||||
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { useAppNotificationBadge } from '@/composables/useAppNotificationBadge'
|
||||
import { canRequestBrowserNotification, requestBrowserNotificationPermission } from '@/utils/browserNotification'
|
||||
import router from '@/router'
|
||||
|
||||
withDefaults(
|
||||
@@ -40,4 +60,43 @@ defineEmits<{
|
||||
}>()
|
||||
|
||||
const userStore = useUserStore()
|
||||
const {
|
||||
enabled: notificationEnabled,
|
||||
unreadCount,
|
||||
clearUnreadLocally,
|
||||
} = useAppNotificationBadge()
|
||||
|
||||
async function goNotifications() {
|
||||
clearUnreadLocally()
|
||||
if (canRequestBrowserNotification()) {
|
||||
await requestBrowserNotificationPermission()
|
||||
}
|
||||
void router.push({ name: 'appNotifications' })
|
||||
}
|
||||
|
||||
function reloadApp() {
|
||||
window.location.reload()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dhome-notify-wrap {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
}
|
||||
.dhome-notify-badge {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
left: -8px;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 4px;
|
||||
border-radius: 999px;
|
||||
background: #dc2626;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user