Highly ambitious ATProtocol AppView service and sdks
at fix-postgres 153 lines 5.7 kB view raw
1import { useEffect, useState } from "react"; 2import { codeToHtml } from "shiki"; 3 4export function FeaturesSection() { 5 const [highlightedCode, setHighlightedCode] = useState<string>(""); 6 const [highlightedGraphQLCode, setHighlightedGraphQLCode] = useState<string>(""); 7 8 const codeExample = `const resp = await client.com.recordcollector.album.getRecords({ 9 where: { artist: { eq: "Nirvana" } }, 10 sortBy: [{ field: "releaseDate", direction: "desc" }] 11});`; 12 13 const graphQLExample = `query MyGalleries { 14 socialGrainGalleries( 15 where: { actorHandle: { eq: "chadtmiller.com" } } 16 ) { 17 title 18 socialGrainFavoritesCount # Reverse: all favorites 19 socialGrainGalleryItems { # Reverse: all items 20 position 21 socialGrainPhoto { # Forward: follow item→photo 22 alt 23 aspectRatio 24 socialGrainPhotoExifs { # Reverse: photo EXIF data 25 fNumber 26 iSO 27 } 28 } 29 } 30 } 31}`; 32 33 useEffect(() => { 34 const generateHighlightedCode = async () => { 35 const html = await codeToHtml(codeExample, { 36 lang: "typescript", 37 theme: "ayu-dark", 38 }); 39 40 const styledCode = html.replace( 41 '<pre class="shiki', 42 '<pre class="shiki !p-2 !m-0 overflow-x-auto !text-[10px]', 43 ); 44 45 setHighlightedCode(styledCode); 46 }; 47 48 generateHighlightedCode(); 49 }, [codeExample]); 50 51 useEffect(() => { 52 const generateGraphQLCode = async () => { 53 const html = await codeToHtml(graphQLExample, { 54 lang: "graphql", 55 theme: "ayu-dark", 56 }); 57 58 const styledCode = html.replace( 59 '<pre class="shiki', 60 '<pre class="shiki !p-2 !m-0 overflow-x-auto !text-[10px]', 61 ); 62 63 setHighlightedGraphQLCode(styledCode); 64 }; 65 66 generateGraphQLCode(); 67 }, [graphQLExample]); 68 69 return ( 70 <div className="mb-12"> 71 <div className="space-y-4"> 72 {/* Feature 1 */} 73 <div className="border-l-2 border-blue-400/30 pl-3"> 74 <div className="flex items-baseline gap-2 mb-1"> 75 <span className="text-xs text-zinc-600 font-medium">01</span> 76 <h3 className="text-sm font-medium text-white">Auto-Indexing Engine</h3> 77 </div> 78 <p className="text-xs text-zinc-500 leading-relaxed"> 79 Automatically discover and index records matching your lexicons. 80 Real-time data sync from the AT Protocol firehose. 81 </p> 82 </div> 83 84 {/* Feature 2 */} 85 <div className="border-l-2 border-blue-400/30 pl-3"> 86 <div className="flex items-baseline gap-2 mb-1"> 87 <span className="text-xs text-zinc-600 font-medium">02</span> 88 <h3 className="text-sm font-medium text-white">Schema Management</h3> 89 </div> 90 <p className="text-xs text-zinc-500 leading-relaxed"> 91 Deploy lexicons that instantly become queryable collections. 92 Built-in validation ensures your schemas work correctly from day one. 93 </p> 94 </div> 95 96 {/* Feature 3 */} 97 <div className="border-l-2 border-blue-400/30 pl-3"> 98 <div className="flex items-baseline gap-2 mb-1"> 99 <span className="text-xs text-zinc-600 font-medium">03</span> 100 <h3 className="text-sm font-medium text-white">Type-Safe APIs</h3> 101 </div> 102 <div className="rounded border border-zinc-800 overflow-hidden mb-2"> 103 {highlightedCode 104 ? <div dangerouslySetInnerHTML={{ __html: highlightedCode }} /> 105 : ( 106 <pre className="p-2 text-[10px] overflow-x-auto bg-zinc-900"> 107 <code className="text-zinc-400">{codeExample}</code> 108 </pre> 109 )} 110 </div> 111 <p className="text-xs text-zinc-500 leading-relaxed"> 112 Generated clients with getRecords(), createRecord(), updateRecord(), and deleteRecord(). 113 Full TypeScript support with filtering, sorting, and pagination. 114 </p> 115 </div> 116 117 {/* Feature 4 */} 118 <div className="border-l-2 border-blue-400/30 pl-3"> 119 <div className="flex items-baseline gap-2 mb-1"> 120 <span className="text-xs text-zinc-600 font-medium">04</span> 121 <h3 className="text-sm font-medium text-white">Lexicon-to-GraphQL Mapping</h3> 122 </div> 123 <div className="rounded border border-zinc-800 overflow-hidden mb-2"> 124 {highlightedGraphQLCode 125 ? <div dangerouslySetInnerHTML={{ __html: highlightedGraphQLCode }} /> 126 : ( 127 <pre className="p-2 text-[10px] overflow-x-auto bg-zinc-900"> 128 <code className="text-zinc-400">{graphQLExample}</code> 129 </pre> 130 )} 131 </div> 132 <p className="text-xs text-zinc-500 leading-relaxed"> 133 Lexicons map directly to GraphQL schema with automatic relationship resolution. 134 Forward joins traverse at-uri references. Reverse joins find all records pointing back. 135 Query deeply nested data structures in a single efficient request. 136 </p> 137 </div> 138 139 {/* Feature 5 */} 140 <div className="border-l-2 border-blue-400/30 pl-3"> 141 <div className="flex items-baseline gap-2 mb-1"> 142 <span className="text-xs text-zinc-600 font-medium">05</span> 143 <h3 className="text-sm font-medium text-white">User Authentication</h3> 144 </div> 145 <p className="text-xs text-zinc-500 leading-relaxed"> 146 Production-ready OAuth 2.0 with PKCE and Device Code flows. 147 Automatic token management, refresh handling, and secure session storage. 148 </p> 149 </div> 150 </div> 151 </div> 152 ); 153}