Skip to content

Commit

Permalink
Merge pull request #32 from miurla/fix-legal
Browse files Browse the repository at this point in the history
Add MDX components and layouts for legal pages
  • Loading branch information
miurla authored Apr 18, 2024
2 parents 83d6975 + b8010b9 commit ddac232
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 34 deletions.
12 changes: 0 additions & 12 deletions app/legal/action.ts

This file was deleted.

9 changes: 9 additions & 0 deletions app/legal/privacy/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function MdxLayout({ children }: { children: React.ReactNode }) {
return (
<div className="max-w-3xl mx-auto px-4 py-16">
<div className="prose-sm prose-neutral prose-a:text-accent-foreground/50">
{children}
</div>
</div>
)
}
10 changes: 3 additions & 7 deletions app/legal/privacy/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import MdContents from '@/components/md-contents'
import { readFile } from '../action'
import Privacy from '@/markdown/privacy.mdx'

export default async function PrivacyPage() {
const res = await readFile('./public/legal', 'privacy.md')
const { fileContents } = await res.json()

return <MdContents content={fileContents} />
export default function Page() {
return <Privacy />
}
9 changes: 9 additions & 0 deletions app/legal/terms/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function MdxLayout({ children }: { children: React.ReactNode }) {
return (
<div className="max-w-3xl mx-auto px-4 py-16">
<div className="prose-sm prose-neutral prose-a:text-accent-foreground/50">
{children}
</div>
</div>
)
}
10 changes: 3 additions & 7 deletions app/legal/terms/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import MdContents from '@/components/md-contents'
import { readFile } from '../action'
import Terms from '@/markdown/terms.mdx'

export default async function TermsOfUsePage() {
const res = await readFile('./public/legal', 'terms.md')
const { fileContents } = await res.json()

return <MdContents content={fileContents} />
export default function Page() {
return <Terms />
}
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/agents/inquire.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OpenAI } from 'ai/openai'
import { OpenAI } from '@ai-sdk/openai'
import { Copilot } from '@/components/copilot'
import { createStreamableUI, createStreamableValue } from 'ai/rsc'
import { ExperimentalMessage, experimental_streamObject } from 'ai'
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/query-suggestor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ExperimentalMessage, experimental_streamObject } from 'ai'
import { PartialRelated, relatedSchema } from '@/lib/schema/related'
import { Section } from '@/components/section'
import SearchRelated from '@/components/search-related'
import { OpenAI } from 'ai/openai'
import { OpenAI } from '@ai-sdk/openai'
import type { AgentOptions } from './types'
import { DEFAULT_MODEL } from '../aiModel/utils'

Expand Down
2 changes: 1 addition & 1 deletion lib/agents/researcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'ai'
import { searchSchema } from '@/lib/schema/search'
import { Section } from '@/components/section'
import { OpenAI } from 'ai/openai'
import { OpenAI } from '@ai-sdk/openai'
import { ToolBadge } from '@/components/tool-badge'
import { SearchSkeleton } from '@/components/search-skeleton'
import { SearchResults } from '@/components/search-results'
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/task-manager.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExperimentalMessage, experimental_generateObject } from 'ai'
import { OpenAI } from 'ai/openai'
import { OpenAI } from '@ai-sdk/openai'
import { nextActionSchema } from '../schema/next-action'
import type { AgentOptions } from './types'
import { DEFAULT_MODEL } from '../aiModel/utils'
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { MDXComponents } from 'mdx/types'

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components
}
}
11 changes: 8 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
import createMDX from '@next/mdx'

export default nextConfig;
const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx']
}

const withMDX = createMDX()

export default withMDX(nextConfig)
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"preinstall": "bunx prisma generate"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.2",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/mdx": "^14.2.2",
"@prisma/client": "^5.12.1",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
Expand All @@ -24,14 +28,15 @@
"@supabase/ssr": "^0.1.0",
"@supabase/supabase-js": "^2.42.0",
"@tailwindcss/typography": "^0.5.12",
"@types/mdx": "^2.0.13",
"@vercel/analytics": "^1.2.2",
"ai": "^3.0.14",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"embla-carousel-react": "^8.0.0",
"exa-js": "^1.0.12",
"lucide-react": "^0.363.0",
"next": "v14.2.0-canary.60",
"next": "latest",
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18",
Expand Down

0 comments on commit ddac232

Please sign in to comment.