content.tsx53 lines · main
| 1 | import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock' |
| 2 | |
| 3 | import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types' |
| 4 | |
| 5 | const ContentFile = ({ projectKeys }: StepContentProps) => { |
| 6 | const files = [ |
| 7 | { |
| 8 | name: '.env.local', |
| 9 | language: 'bash', |
| 10 | code: ` |
| 11 | BRIVEN_URL=${projectKeys.apiUrl ?? 'your-project-url'} |
| 12 | BRIVEN_KEY=${projectKeys.publishableKey ?? projectKeys.anonKey ?? 'your-anon-key'} |
| 13 | `, |
| 14 | }, |
| 15 | { |
| 16 | name: 'src/db/briven.js', |
| 17 | language: 'js', |
| 18 | code: ` |
| 19 | import { createClient } from "@supabase/supabase-js"; |
| 20 | |
| 21 | const brivenUrl = import.meta.env.BRIVEN_URL; |
| 22 | const brivenKey = import.meta.env.BRIVEN_KEY; |
| 23 | |
| 24 | export const briven = createClient(brivenUrl, brivenKey); |
| 25 | `, |
| 26 | }, |
| 27 | { |
| 28 | name: 'src/pages/index.astro', |
| 29 | language: 'html', |
| 30 | code: ` |
| 31 | --- |
| 32 | import { briven } from '../db/briven'; |
| 33 | |
| 34 | const { data, error } = await briven.from("todos").select('*'); |
| 35 | --- |
| 36 | |
| 37 | { |
| 38 | ( |
| 39 | <ul> |
| 40 | {data.map((entry) => ( |
| 41 | <li>{entry.name}</li> |
| 42 | ))} |
| 43 | </ul> |
| 44 | ) |
| 45 | } |
| 46 | `, |
| 47 | }, |
| 48 | ] |
| 49 | |
| 50 | return <MultipleCodeBlock files={files} /> |
| 51 | } |
| 52 | |
| 53 | export default ContentFile |