Skip to content

Commit

Permalink
Merge pull request #1040 from fuma-nama/dev
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
fuma-nama authored Nov 8, 2024
2 parents dd7185b + a6a7b70 commit 1e748aa
Show file tree
Hide file tree
Showing 83 changed files with 2,215 additions and 1,845 deletions.
2 changes: 1 addition & 1 deletion apps/docs/app/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ function Features(): React.ReactElement {
icon={SearchIcon}
subheading="Search Integration"
heading="Enhance your search experience."
description="Integrate with Algolia Search in your docs easily."
description="Integrate with Orama Search and Algolia Search in your docs easily."
>
<Link
href="/docs/headless/search/algolia"
Expand Down
10 changes: 9 additions & 1 deletion apps/docs/app/(home)/sponsors/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
*/
export const organizationUsers = ['marclave', 'rishi-raj-jain', 'handotdev'];

export const sponsors = [
export const organizationSponsors = [
{
url: 'https://orama.com',
label: 'Orama Search',
tier: 'golden',
github: 'oramasearch',
logo: (
<svg
className="h-full py-1"
Expand Down Expand Up @@ -283,6 +284,7 @@ export const sponsors = [
url: 'https://mintlify.com',
label: 'Mintlify',
tier: 'golden',
github: 'mintlify',
logo: (
<svg
viewBox="0 0 103 24"
Expand Down Expand Up @@ -320,6 +322,7 @@ export const sponsors = [
url: 'https://inkeep.com',
tier: 'golden',
label: 'Inkeep',
github: 'inkeep',
logo: (
<svg
viewBox="0 0 99 24"
Expand Down Expand Up @@ -373,11 +376,13 @@ export const sponsors = [
></path>
</svg>
),
github: 'vercel',
tier: 'golden-one-time',
label: 'Vercel',
},
{
url: 'https://unkey.com',
github: 'unkeyed',
label: 'Unkey',
logo: (
<svg
Expand All @@ -396,6 +401,7 @@ export const sponsors = [
{
url: 'https://github.com/scalar/scalar',
label: 'Scalar',
github: 'scalar',
logo: (
<>
<svg
Expand All @@ -415,6 +421,7 @@ export const sponsors = [
},
{
url: 'https://supastarter.dev',
github: 'supastarter',
logo: (
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -441,6 +448,7 @@ export const sponsors = [
{
url: 'https://launchfa.st',
label: 'launchfast',
github: 'launchfast',
logo: (
<>
<svg
Expand Down
44 changes: 37 additions & 7 deletions apps/docs/app/(home)/sponsors/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { Fragment, type ReactNode } from 'react';
import Image from 'next/image';
import { organizationUsers, sponsors } from '@/app/(home)/sponsors/data';
import {
organizationUsers,
organizationSponsors,
} from '@/app/(home)/sponsors/data';
import { buttonVariants } from '@/components/ui/button';
import { cn } from '@/utils/cn';
import { getUserSponsors } from '@/utils/get-sponsors';
import { getSponsors } from '@/utils/get-sponsors';

export default async function Page(): Promise<ReactNode> {
const sponsors = await getSponsors('fuma-nama', [
...organizationUsers,
...organizationSponsors.map((sponsor) => sponsor.github),
]);

return (
<main className="container flex flex-col items-center py-16 text-center">
<div
Expand Down Expand Up @@ -178,7 +186,29 @@ export default async function Page(): Promise<ReactNode> {
</svg>
<h2 className="mt-12 font-mono text-xs">Organization Sponsors</h2>
<div className="mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
{sponsors.map((sponsor) => (
{[
...organizationSponsors,
...sponsors
.filter((sponsor) => sponsor.__typename === 'Organization')
.map((sponsor) => ({
label: sponsor.name,
logo: (
<>
<Image
alt="avatar"
src={sponsor.avatarUrl}
unoptimized
width="30"
height="30"
className="rounded-lg"
/>
{sponsor.name}
</>
),
url: sponsor.websiteUrl ?? `https://github.com/${sponsor.login}`,
tier: '',
})),
].map((sponsor) => (
<a
key={sponsor.label}
href={sponsor.url}
Expand Down Expand Up @@ -209,8 +239,9 @@ export default async function Page(): Promise<ReactNode> {

<h2 className="mt-12 font-mono text-xs">Individual Sponsors</h2>
<div className="mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
{(await getUserSponsors('fuma-nama', organizationUsers)).map(
(sponsor) => (
{sponsors
.filter((sponsor) => sponsor.__typename === 'User')
.map((sponsor) => (
<a
key={sponsor.name}
href={sponsor.websiteUrl ?? `https://github.com/${sponsor.login}`}
Expand All @@ -228,8 +259,7 @@ export default async function Page(): Promise<ReactNode> {
/>
{sponsor.name}
</a>
),
)}
))}
</div>
</main>
);
Expand Down
40 changes: 14 additions & 26 deletions apps/docs/app/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
import type { ReactNode } from 'react';
import { MessageCircle } from 'lucide-react';
import { Slot } from '@radix-ui/react-slot';
import { baseOptions, linkItems, logo } from '@/app/layout.config';
import { baseOptions, linkItems } from '@/app/layout.config';
import 'fumadocs-twoslash/twoslash.css';
import { source } from '@/app/source';
import { Trigger } from '@/components/ai/search-ai';
Expand All @@ -12,25 +12,6 @@ import { buttonVariants } from '@/components/ui/button';
const docsOptions: DocsLayoutProps = {
...baseOptions,
tree: source.pageTree,
nav: {
...baseOptions.nav,
title: logo,
children: (
<Trigger
className={cn(
buttonVariants({
variant: 'secondary',
size: 'xs',
className:
'md:flex-1 px-2 ms-2 gap-1.5 text-fd-muted-foreground rounded-full',
}),
)}
>
<MessageCircle className="size-3" />
Ask AI
</Trigger>
),
},
links: [linkItems[linkItems.length - 1]],
sidebar: {
tabs: {
Expand All @@ -42,7 +23,7 @@ const docsOptions: DocsLayoutProps = {
...option,
icon: (
<Slot
className="mb-auto bg-gradient-to-t from-fd-background/80 p-1 [&_svg]:size-5"
className="bg-gradient-to-t from-fd-background/80 p-1 [&_svg]:size-5"
style={{
color: `hsl(var(--${meta.file.dirname}-color))`,
backgroundColor: `hsl(var(--${meta.file.dirname}-color)/.3)`,
Expand All @@ -57,11 +38,7 @@ const docsOptions: DocsLayoutProps = {
},
};

export default function Layout({
children,
}: {
children: ReactNode;
}): React.ReactElement {
export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout {...docsOptions}>
<span
Expand Down Expand Up @@ -158,6 +135,17 @@ export default function Layout({
</svg>
</span>
{children}
<Trigger
className={cn(
buttonVariants({
variant: 'secondary',
}),
'fixed bottom-0 left-1/2 h-fit -translate-x-1/2 gap-1.5 rounded-b-none rounded-t-2xl bg-secondary/50 pb-1 text-fd-muted-foreground shadow-lg backdrop-blur-lg',
)}
>
<MessageCircle className="size-4" />
Ask AI
</Trigger>
</DocsLayout>
);
}
2 changes: 1 addition & 1 deletion apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function RootLayout({
children,
}: {
children: React.ReactNode;
}): React.ReactElement {
}) {
return (
<html
lang="en"
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/components/ai/search-ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const context =
const endpoint = process.env.NEXT_PUBLIC_ORAMA_ENDPOINT;
const apiKey = process.env.NEXT_PUBLIC_ORAMA_API_KEY;

export async function createClient(): Promise<AnswerSession> {
export async function createClient(): Promise<AnswerSession<boolean>> {
const { OramaClient } = await import('@oramacloud/client');
if (!endpoint || !apiKey) throw new Error('Failed to find api keys');

Expand Down Expand Up @@ -73,7 +73,7 @@ export async function createClient(): Promise<AnswerSession> {
return instance;
}

let session: AnswerSession | undefined;
let session: AnswerSession<boolean> | undefined;

export function AIDialog(): React.ReactElement {
const [message, setMessage] = useState('');
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const buttonVariants = cva(
outline:
'border bg-gradient-to-t from-fd-primary/10 shadow-inner shadow-fd-primary/10 hover:bg-fd-accent/50 hover:text-fd-accent-foreground',
secondary:
'border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-secondary/80',
'border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent',
ghost: 'hover:bg-fd-accent hover:text-fd-accent-foreground',
link: 'text-fd-primary underline-offset-4 hover:underline',
},
Expand Down
16 changes: 8 additions & 8 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start": "next start"
},
"dependencies": {
"@oramacloud/client": "^1.3.19",
"@oramacloud/client": "^1.3.20",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-slot": "^1.1.0",
Expand All @@ -29,8 +29,8 @@
"geist": "^1.3.1",
"hast-util-to-jsx-runtime": "^2.3.2",
"katex": "^0.16.11",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"lucide-react": "^0.455.0",
"next": "15.0.3",
"phenomenon": "^1.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand All @@ -48,19 +48,19 @@
},
"devDependencies": {
"@fumadocs/cli": "workspace:*",
"@next/bundle-analyzer": "15.0.2",
"@next/env": "15.0.2",
"@next/eslint-plugin-next": "15.0.2",
"@next/bundle-analyzer": "15.0.3",
"@next/env": "15.0.3",
"@next/eslint-plugin-next": "15.0.3",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "22.8.6",
"@types/node": "22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
"eslint-config-custom": "workspace:*",
"fast-glob": "^3.3.1",
"gray-matter": "^4.0.3",
"next-validate-link": "^1.0.1",
"next-validate-link": "^1.4.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"tailwindcss-animate": "^1.0.7",
Expand Down
Binary file removed apps/docs/public/icon.png
Binary file not shown.
13 changes: 8 additions & 5 deletions apps/docs/utils/get-sponsors.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
interface UserSponsor {
interface SponsorEntity {
__typename: 'User' | 'Organization';
login: string;
name: string;
avatarUrl: string;
websiteUrl?: string;
}

export async function getUserSponsors(
export async function getSponsors(
login: string,
excluded: string[],
): Promise<UserSponsor[]> {
): Promise<SponsorEntity[]> {
const query = `query {
user(login:${JSON.stringify(login)}) {
... on Sponsorable {
sponsors(first: 100) {
nodes {
__typename
... on User { login, name, avatarUrl, websiteUrl }
... on Organization { login, name, avatarUrl, websiteUrl }
}
}
}
Expand All @@ -40,13 +43,13 @@ export async function getUserSponsors(
data: {
user: {
sponsors: {
nodes: (UserSponsor | Record<string, never>)[];
nodes: (SponsorEntity | Record<string, never>)[];
};
};
};
};

return data.user.sponsors.nodes.filter(
(sponsor) => 'name' in sponsor && !excluded.includes(sponsor.login),
) as UserSponsor[];
) as SponsorEntity[];
}
4 changes: 2 additions & 2 deletions examples/content-collections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"@fumadocs/content-collections": "workspace:*",
"fumadocs-core": "workspace:*",
"fumadocs-ui": "workspace:*",
"next": "^15.0.2",
"next": "^15.0.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@content-collections/core": "^0.7.2",
"@content-collections/core": "^0.7.3",
"@content-collections/mdx": "^0.2.0",
"@content-collections/next": "^0.2.3",
"@types/mdx": "^2.0.13",
Expand Down
6 changes: 3 additions & 3 deletions examples/i18n/app/[lang]/docs/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { source } from '@/lib/source';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { baseOptions } from '@/app/layout.config';

export default function Layout({
export default async function Layout({
params,
children,
}: {
params: { lang: string };
params: Promise<{ lang: string }>;
children: ReactNode;
}) {
return (
<DocsLayout {...baseOptions} tree={source.pageTree[params.lang]}>
<DocsLayout {...baseOptions} tree={source.pageTree[(await params).lang]}>
{children}
</DocsLayout>
);
Expand Down
Loading

0 comments on commit 1e748aa

Please sign in to comment.