SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { renderUserAvatar } from '../components/avatar-image.js';
|
||||
// Minimal public preview sidebar, shown only to visitors without a session.
|
||||
export function mountPublicChannelSidebar(screen, { owner = '', channel = '', subscribers = null, avatar = null, navigate }) {
|
||||
screen.querySelector('.shine-public-sidebar')?.remove();
|
||||
const panel = document.createElement('aside');
|
||||
panel.className = 'shine-public-sidebar';
|
||||
const identity = document.createElement('div');
|
||||
identity.className = 'shine-public-sidebar__identity';
|
||||
const face = document.createElement('span');
|
||||
face.className = 'shine-public-sidebar__face';
|
||||
face.replaceChildren(renderUserAvatar({ login: owner || 'unknown', size: 'sm' }));
|
||||
const details = document.createElement('div');
|
||||
const author = document.createElement('strong');
|
||||
author.textContent = owner || t('remaining.public_channel.author');
|
||||
details.append(author);
|
||||
identity.append(face, details);
|
||||
const name = document.createElement('h2');
|
||||
name.textContent = channel || t('remaining.public_channel.channel');
|
||||
const count = document.createElement('p');
|
||||
count.textContent = subscribers == null ? '' : t('remaining.public_channel.subscribers', { count: Math.max(0, Number(subscribers) || 0) });
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = 'primary-btn';
|
||||
button.textContent = t('remaining.public_channel.open_in_shine');
|
||||
button.addEventListener('click', () => {
|
||||
window.sessionStorage.setItem('shine-public-return-path', window.location.pathname);
|
||||
navigate('login-view');
|
||||
});
|
||||
panel.append(identity, name, count, button);
|
||||
screen.append(panel);
|
||||
}
|
||||
Reference in New Issue
Block a user