Highly ambitious ATProtocol AppView service and sdks

just show lexicons page for unauthenticated/non-slice owners for now

+37 -31
+7
frontend/src/features/slices/overview/handlers.tsx
··· 27 27 return new Response("Slice not found", { status: 404 }); 28 28 } 29 29 30 + // Redirect unauthenticated users to lexicons tab 31 + if (!context.sliceContext?.hasAccess) { 32 + const lexiconUrl = new URL(req.url); 33 + lexiconUrl.pathname = `/profile/${sliceParams.handle}/slice/${sliceParams.sliceId}/lexicon`; 34 + return Response.redirect(lexiconUrl, 302); 35 + } 36 + 30 37 return renderHTML( 31 38 <SliceOverview 32 39 slice={context.sliceContext!.slice!}
+30 -31
frontend/src/features/slices/shared/fragments/SliceTabs.tsx
··· 13 13 sliceId: string, 14 14 hasSliceAccess?: boolean 15 15 ): SliceTab[] { 16 + // For unauthenticated users, only show lexicons tab 17 + if (!hasSliceAccess) { 18 + return [ 19 + { 20 + id: "lexicon", 21 + name: "Lexicons", 22 + href: buildSliceUrlFromView(slice, sliceId, "lexicon"), 23 + }, 24 + ]; 25 + } 26 + 27 + // For authenticated slice owners, show all tabs 16 28 const tabs = [ 17 29 { 18 30 id: "overview", ··· 24 36 name: "Lexicons", 25 37 href: buildSliceUrlFromView(slice, sliceId, "lexicon"), 26 38 }, 27 - ]; 28 - 29 - // Add sync tab only if user owns the slice 30 - if (hasSliceAccess) { 31 - tabs.push({ 39 + { 32 40 id: "sync", 33 41 name: "Sync", 34 42 href: buildSliceUrlFromView(slice, sliceId, "sync"), 35 - }); 36 - } 37 - 38 - tabs.push( 43 + }, 39 44 { 40 45 id: "records", 41 46 name: "Records", ··· 45 50 id: "codegen", 46 51 name: "Code Gen", 47 52 href: buildSliceUrlFromView(slice, sliceId, "codegen"), 53 + }, 54 + { 55 + id: "oauth", 56 + name: "OAuth Clients", 57 + href: buildSliceUrlFromView(slice, sliceId, "oauth"), 58 + }, 59 + { 60 + id: "waitlist", 61 + name: "Waitlist", 62 + href: buildSliceUrlFromView(slice, sliceId, "waitlist"), 63 + }, 64 + { 65 + id: "settings", 66 + name: "Settings", 67 + href: buildSliceUrlFromView(slice, sliceId, "settings"), 48 68 } 49 - ); 50 - 51 - // Add oauth, waitlist and settings tabs only if user owns the slice 52 - if (hasSliceAccess) { 53 - tabs.push( 54 - { 55 - id: "oauth", 56 - name: "OAuth Clients", 57 - href: buildSliceUrlFromView(slice, sliceId, "oauth"), 58 - }, 59 - { 60 - id: "waitlist", 61 - name: "Waitlist", 62 - href: buildSliceUrlFromView(slice, sliceId, "waitlist"), 63 - }, 64 - { 65 - id: "settings", 66 - name: "Settings", 67 - href: buildSliceUrlFromView(slice, sliceId, "settings"), 68 - } 69 - ); 70 - } 69 + ]; 71 70 72 71 return tabs; 73 72 }