كيفية إظهار اسم المستخدم بجوار الصورة الرمزية في التنقل عند تسجيل الدخول؟

أهلاً بعودتك يا أوستن!

هل يمكنك تجربة هذا الـ HTML/CSS المخصص، من فضلك؟
يجب أن يعمل بشكل جيد مع جميع شارات الإشعارات مع/بدون تمكين قائمة الإشعارات الجديدة.

أقترح عليك إنشاء مكون سمة. في حال لم تكن تعرف، كل شيء مشروح هنا: Beginner's guide to using Discourse Themes

ملاحظة: إنه معطل في عرض الهاتف المحمول.
ملاحظة: يعتمد الـ CSS على السمة الافتراضية؛ قد تحتاج إلى تعديله. لا تتردد في السؤال.

لم أختبره بشكل مكثف، لكن آمل أن يعمل معك!

رأس

<script type="text/discourse-plugin" version="0.8.13">

api.decorateWidget('header-notifications:after', dec => {
    const { currentUser, site } = dec.widget;

    if (site.mobileView) {
        return;
    }
    
    return dec.h('span.username', currentUser.displayName);
})

</script>
CSS
html:not(.mobile-view) #current-user {
    span.username {
        display: inline-block;
        vertical-align: middle;
        margin-left: 5px;
    }
    
    .icon.btn-flat {
        width: auto;
    }
    
    .user-status-background {
        left: 22px;
    }
    
    .badge-notification {
        &.with-icon.new-pms {
            left: -3px;
            right: auto;
            top: 4px;
        }
    }
    
    .unread-notifications {
        left: 25px;
        right: auto;
    }
    
    .unread-high-priority-notifications,
    .ring {
        left: -3px;
        right: auto;
    }
}
4 إعجابات