Feat v0.6.17 bugfixes (#52)
Some checks failed
CI/CD / detect-changes (push) Successful in 16s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Failing after 2m54s
CI/CD / test-sqlite (push) Failing after 3m7s
CI/CD / build-and-deploy (push) Has been skipped

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:
2026-04-01 16:36:43 +00:00
committed by xcaliber
parent ff19a1b4d3
commit e7d1b53ebf
12 changed files with 111 additions and 30 deletions

View File

@@ -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);