Feat v0.6.17 bugfixes (#52)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #52.
This commit is contained in:
@@ -288,7 +288,7 @@
|
||||
.admin-user-name { font-weight: 600; font-size: 13px; }
|
||||
.admin-user-handle { font-size: 11px; color: var(--text-3); margin-top: 1px; }
|
||||
.admin-user-time { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
|
||||
.admin-actions-cell { white-space: nowrap; text-align: right; }
|
||||
.admin-actions-cell { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
|
||||
|
||||
/* ── Provider Cards ──────────────────────── */
|
||||
.provider-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
|
||||
|
||||
@@ -274,8 +274,9 @@
|
||||
.sw-dropdown__value { flex: 1; text-align: left; }
|
||||
.sw-dropdown__chevron { color: var(--text-3); font-size: 0.7em; }
|
||||
.sw-dropdown__list {
|
||||
position: absolute; top: calc(100% + 4px); left: 0; right: 0;
|
||||
z-index: 6000; max-height: 240px; overflow-y: auto;
|
||||
position: absolute; top: calc(100% + 4px); left: 0;
|
||||
min-width: max-content;
|
||||
z-index: 6000; max-height: 240px; overflow-y: auto; overflow-x: hidden;
|
||||
background: var(--bg-surface); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); box-shadow: var(--shadow-lg);
|
||||
animation: sw-fade-in 0.1s ease;
|
||||
|
||||
@@ -193,7 +193,24 @@ export async function boot() {
|
||||
events.connect(BASE + '/ws');
|
||||
}
|
||||
|
||||
// 10. Signal ready
|
||||
// 10. Mount imperative hosts (Toast, DialogStack) if not already present.
|
||||
// Core surfaces mount these via AppShell; extension surfaces need SDK to do it.
|
||||
try {
|
||||
const hostId = 'sw-imperative-hosts';
|
||||
if (!document.getElementById(hostId)) {
|
||||
const mount = document.createElement('div');
|
||||
mount.id = hostId;
|
||||
document.body.appendChild(mount);
|
||||
const { ToastContainer } = await import('../primitives/toast.js');
|
||||
const { DialogStack } = await import('../shell/dialog-stack.js');
|
||||
const { render } = preact;
|
||||
render(html`<${ToastContainer} /><${DialogStack} />`, mount);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[sw] Imperative host mount failed:', e.message);
|
||||
}
|
||||
|
||||
// 11. Signal ready
|
||||
events.emit('sdk.ready', {}, { localOnly: true });
|
||||
document.dispatchEvent(new CustomEvent('sw:ready', { detail: { sw } }));
|
||||
console.log(`[sw] SDK v${sw._sdk} ready`);
|
||||
|
||||
@@ -27,7 +27,7 @@ function _currentSurface() {
|
||||
|
||||
export function UserMenu({ placement = 'down-right', onAction, extraItems }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [extSurfaces, setExtSurfaces] = useState([]);
|
||||
const [allSurfaces, setAllSurfaces] = useState([]);
|
||||
const btnRef = useRef(null);
|
||||
|
||||
const sw = window.sw;
|
||||
@@ -35,17 +35,19 @@ export function UserMenu({ placement = 'down-right', onAction, extraItems }) {
|
||||
const authenticated = sw?.auth?.isAuthenticated;
|
||||
|
||||
// Fetch installed surfaces once on mount.
|
||||
// Filter out core surfaces that have dedicated menu entries below.
|
||||
const CORE_IDS = new Set(['admin', 'settings', 'team-admin', 'workflow', 'workflow-landing', 'docs']);
|
||||
const CORE_IDS = new Set(['admin', 'settings', 'team-admin', 'workflow', 'workflow-landing', 'docs', 'welcome']);
|
||||
|
||||
useEffect(() => {
|
||||
if (!sw?.api?.surfaces?.list) return;
|
||||
sw.api.surfaces.list().then(data => {
|
||||
const raw = Array.isArray(data) ? data : data?.data || [];
|
||||
setExtSurfaces(raw.filter(s => !CORE_IDS.has(s.id)));
|
||||
setAllSurfaces(raw);
|
||||
}).catch(() => {});
|
||||
}, [authenticated]);
|
||||
|
||||
const extSurfaces = allSurfaces.filter(s => !CORE_IDS.has(s.id));
|
||||
const enabledIds = new Set(allSurfaces.map(s => s.id));
|
||||
|
||||
const items = useMemo(() => {
|
||||
const current = _currentSurface();
|
||||
const list = [];
|
||||
@@ -68,13 +70,13 @@ export function UserMenu({ placement = 'down-right', onAction, extraItems }) {
|
||||
}
|
||||
|
||||
// ── Standard items ─────────────────────
|
||||
// Docs — skip if current surface IS docs
|
||||
if (current !== 'docs') {
|
||||
// Docs — only if enabled and not current
|
||||
if (current !== 'docs' && enabledIds.has('docs')) {
|
||||
list.push({ label: 'Docs', action: 'docs', icon: '\ud83d\udcd6' });
|
||||
}
|
||||
|
||||
// Settings — skip if current surface IS settings
|
||||
if (current !== 'settings') {
|
||||
// Settings — only if enabled and not current
|
||||
if (current !== 'settings' && enabledIds.has('settings')) {
|
||||
list.push({ label: 'Settings', action: 'settings', icon: '\u2699\ufe0f' });
|
||||
}
|
||||
|
||||
@@ -85,7 +87,7 @@ export function UserMenu({ placement = 'down-right', onAction, extraItems }) {
|
||||
|
||||
// Team Admin — requires admin role on at least one team
|
||||
const hasTeamAdmin = sw?.auth?.teams?.some(t => t.my_role === 'admin');
|
||||
if (authenticated && hasTeamAdmin && current !== 'team-admin') {
|
||||
if (authenticated && hasTeamAdmin && current !== 'team-admin' && enabledIds.has('team-admin')) {
|
||||
list.push({ label: 'Team Admin', action: 'team-admin', icon: '\ud83d\udc65' });
|
||||
}
|
||||
|
||||
@@ -98,7 +100,7 @@ export function UserMenu({ placement = 'down-right', onAction, extraItems }) {
|
||||
list.push({ label: 'Sign Out', action: 'sign-out' });
|
||||
|
||||
return list;
|
||||
}, [user, authenticated, extraItems, extSurfaces]);
|
||||
}, [user, authenticated, extraItems, extSurfaces, enabledIds]);
|
||||
|
||||
function handleSelect(action) {
|
||||
setOpen(false);
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function TeamsSection() {
|
||||
sw.api.admin.users.list(),
|
||||
]);
|
||||
setMembers(m || []);
|
||||
const uList = u || [];
|
||||
const uList = Array.isArray(u) ? u : (u && u.data) || [];
|
||||
setAllUsers(uList);
|
||||
} catch (e) { sw.toast(e.message, 'error'); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user