renderMain() {
if (!this.state.activeSpaceId) {
// Render Spaces Dashboard Grid View
const spacesCardsHTML = this.state.spaces.map(s => {
const count = s.collections ? s.collections.length : 0;
const notifCount = s.notifications ? s.notifications.length : 0;
const theme = s.theme || 'violet';
return `
${notifCount > 0 ? `${notifCount}` : ''}
${this.escapeHTML(s.name)}
${count} Collections
${this.state.spaces.length > 1 ? `
` : ''}
`;
}).join('');
const dashboardHTML = `
${this.tabs.map((tab, i) => {
const isActive = i === this.activeTabIndex;
const tabName = tab.name || (tab.url ? tab.url.split('/').pop() || 'Request' : 'Untitled');
const displayName = tabName.length > 20 ? tabName.substring(0, 20) + '…' : tabName;
const method = tab.method || 'GET';
const mc = { GET:'var(--m-get)', POST:'var(--m-post)', PUT:'var(--m-put)', DELETE:'var(--m-delete)', PATCH:'var(--m-patch)' }[method] || 'var(--text-3)';
return `
${method}
${this.escapeHTML(displayName)}
`;
}).join('')}