Skip to content

Commit

Permalink
Removed legacy config, allow to include segments in produciton, updat…
Browse files Browse the repository at this point in the history
…ed docs website
  • Loading branch information
AlemTuzlak committed Nov 12, 2024
1 parent c8491f9 commit 5ebde1a
Show file tree
Hide file tree
Showing 35 changed files with 13,297 additions and 27,673 deletions.
119 changes: 0 additions & 119 deletions docs/.eslintrc.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion docs/app/components/ClientHint.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useRevalidator } from '@remix-run/react'

import { useEffect } from 'react'
import { useRevalidator } from 'react-router'

const clientHints = {
theme: {
Expand Down
3 changes: 2 additions & 1 deletion docs/app/components/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useFetcher } from '@remix-run/react'

import { MoonIcon, SunIcon } from 'lucide-react'
import { useRef } from 'react'
import { useFetcher } from 'react-router'

import { useTheme } from '~/hooks/useTheme'

Expand Down
7 changes: 4 additions & 3 deletions docs/app/components/layout/Documentation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useRouteLoaderData } from '@remix-run/react'

import { Fragment, useMemo, useRef } from 'react'
import { getMDXComponent, getMDXExport } from 'mdx-bundler/client'
import clsx from 'clsx'
Expand All @@ -12,6 +12,7 @@ import Editor from '~/components/plugins/Editor'
import Heading from '~/components/plugins/Heading'
import { useTableOfContents } from '~/hooks/useTableOfContents'
import { BackgroundGradient } from '../ui/background-gradient'
import { Link, useRouteLoaderData } from 'react-router'

export function Documentation({
route = 'routes/docs.$tag.$slug',
Expand Down Expand Up @@ -117,7 +118,7 @@ export function Documentation({
</dt>
<dd className="mt-1">
<Link
unstable_viewTransition
viewTransition
className="text-base font-semibold text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300"
to={`/docs/${tag}/${prev.slug}`}
prefetch="intent"
Expand All @@ -138,7 +139,7 @@ export function Documentation({
className="text-base font-semibold text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300"
to={`/docs/${tag}/${next.slug}`}
prefetch="intent"
unstable_viewTransition
viewTransition
>
{next.alternateTitle ?? next.title}
{/* */}&nbsp;<span aria-hidden="true"></span>
Expand Down
4 changes: 2 additions & 2 deletions docs/app/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useLocation,
useNavigate,
useRouteLoaderData,
} from '@remix-run/react'
} from 'react-router'
import { ChevronDownIcon, RatioIcon, SearchIcon, XIcon } from 'lucide-react'
import { Disclosure, Menu, Transition } from '@headlessui/react'
import { useTransition, animated } from 'react-spring'
Expand Down Expand Up @@ -308,7 +308,7 @@ export default function Header({
aria-label="Home page"
to="/"
reloadDocument
unstable_viewTransition
viewTransition
className="md:flex"
>
<RatioIcon className="mr-2 h-7 w-7 self-center text-center md:hidden" />
Expand Down
4 changes: 2 additions & 2 deletions docs/app/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fragment, useEffect, useRef, useState } from 'react'
import type { ReactNode } from 'react'
import { NavLink, useLocation } from '@remix-run/react'
import { NavLink, useLocation } from 'react-router'
import clsx from 'clsx'

import { useIsomorphicLayoutEffect } from '~/hooks/useIsomorphicLayoutEffect'
Expand Down Expand Up @@ -125,7 +125,7 @@ function DocList({ meta, tag }: { meta: MetadataMetaType; tag: string }) {
/>
</svg>
Quick search...
{actionKey ? (
<span className="ml-auto flex-none pl-3 text-xs font-semibold">
{actionKey[0]}K
Expand Down
2 changes: 1 addition & 1 deletion docs/app/components/ui/navbar-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { motion } from 'framer-motion'
import { Link } from '@remix-run/react'
import { Link } from 'react-router'
import { cn } from '~/utils/cn'

const transition = {
Expand Down
4 changes: 2 additions & 2 deletions docs/app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RemixBrowser } from '@remix-run/react'
import { HydratedRouter } from 'react-router/dom'
import { startTransition, StrictMode } from 'react'
import { hydrateRoot } from 'react-dom/client'
import { configureGlobalCache } from 'remix-client-cache'
Expand All @@ -9,7 +9,7 @@ startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
<HydratedRouter />
</StrictMode>
)
})
9 changes: 4 additions & 5 deletions docs/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable indent */
import { PassThrough } from 'node:stream'
import type { AppLoadContext, EntryContext } from '@remix-run/node'
import { createReadableStreamFromReadable } from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
import { type AppLoadContext, type EntryContext, ServerRouter } from "react-router"
import { createReadableStreamFromReadable } from '@react-router/node'
import * as isbotModule from 'isbot'
import { renderToPipeableStream } from 'react-dom/server'
import 'dotenv/config'
Expand Down Expand Up @@ -61,7 +60,7 @@ function handleBotRequest(
return new Promise((resolve, reject) => {
let shellRendered = false
const { abort, pipe } = renderToPipeableStream(
<RemixServer
<ServerRouter
context={remixContext}
url={request.url}
abortDelay={ABORT_DELAY}
Expand Down Expand Up @@ -111,7 +110,7 @@ function handleBrowserRequest(
return new Promise((resolve, reject) => {
let shellRendered = false
const { abort, pipe } = renderToPipeableStream(
<RemixServer
<ServerRouter
context={remixContext}
url={request.url}
abortDelay={ABORT_DELAY}
Expand Down
2 changes: 1 addition & 1 deletion docs/app/hooks/useRequestInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invariant } from '@epic-web/invariant'
import { useRouteLoaderData } from '@remix-run/react'
import { useRouteLoaderData } from 'react-router'

import { type loader as rootLoader } from '~/root.tsx'

Expand Down
2 changes: 1 addition & 1 deletion docs/app/hooks/useTheme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetchers } from '@remix-run/react'
import { useFetchers } from 'react-router'
import { z } from 'zod'

import { useHints } from './useHints'
Expand Down
14 changes: 3 additions & 11 deletions docs/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from '@remix-run/react'
import { json } from '@remix-run/node'
import type { LoaderFunctionArgs, MetaFunction } from '@remix-run/node'

import { ClientHints, getHints } from './components/ClientHint'
import { useTheme } from './hooks/useTheme'
import { getTheme } from './utils/server/theme.server'
Expand All @@ -17,11 +8,12 @@ import './styles/code.css'
import './styles/documentation.css'
import './styles/fonts.css'
import './styles/tailwind.css'
import { Links, LoaderFunctionArgs, Meta, MetaFunction, Outlet, Scripts, ScrollRestoration } from 'react-router'

export const loader = async ({ request }: LoaderFunctionArgs) => {
const versions = (await getVersions()) ?? []

return json({
return ({
requestInfo: {
hints: getHints(request),
userPrefs: { theme: getTheme(request) },
Expand Down
3 changes: 3 additions & 0 deletions docs/app/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { flatRoutes } from "@react-router/fs-routes"

export const routes = flatRoutes()
6 changes: 3 additions & 3 deletions docs/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MetaFunction } from '@remix-run/node'
import { Link } from '@remix-run/react'

import { Link } from 'react-router'
import { FeaturesSection } from '~/components/FeaturesSection'
import { Button } from '~/components/ui/Button'
import { LampContainer } from '~/components/ui/Lamp'
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function Index() {
as={Link}
to="/docs/main"
className="text-white"
unstable_viewTransition
viewTransition
>
Get Started
</Button>
Expand Down
4 changes: 2 additions & 2 deletions docs/app/routes/docs.$tag.$slug.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type LoaderFunctionArgs, json } from '@remix-run/node'

import { LoaderFunctionArgs } from 'react-router'
import { Documentation } from '~/components/layout/Documentation'
import {
getPostContent,
Expand All @@ -15,7 +15,7 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
const { code, frontmatter } = await mdxToHtml(postContent)
const [prev, next] = await getPreviousAndNextRoutes(tag, slug)

return json({
return ({
frontmatter,
code,
next,
Expand Down
6 changes: 3 additions & 3 deletions docs/app/routes/docs.$tag._index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { json, redirect } from '@remix-run/node'
import type { LoaderFunctionArgs } from '@remix-run/node'

import { LoaderFunctionArgs, redirect } from 'react-router'

import { Documentation } from '~/components/layout/Documentation'
import {
Expand All @@ -23,7 +23,7 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
const { code, frontmatter } = await mdxToHtml(postContent)
const next = await getFirstPost(tag)

return json({
return ({
frontmatter,
code,
next,
Expand Down
9 changes: 4 additions & 5 deletions docs/app/routes/docs.$tag.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { json } from '@remix-run/node'
import type { LoaderFunctionArgs } from '@remix-run/node'
import type { ClientLoaderFunctionArgs } from '@remix-run/react'
import { Outlet } from '@remix-run/react'

import type { ClientLoaderFunctionArgs, LoaderFunctionArgs } from 'react-router'
import { Outlet } from 'react-router'
import { cacheClientLoader, useCachedLoaderData } from 'remix-client-cache'

import { Sidebar } from '~/components/layout/Sidebar'
Expand All @@ -20,7 +19,7 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
metadata = (await getParsedMetadata(params.tag)) ?? metadata
}

return json({
return ({
metadata,
tag: params.tag,
})
Expand Down
2 changes: 1 addition & 1 deletion docs/app/routes/healthcheck.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LoaderFunctionArgs } from '@remix-run/node'
import type { LoaderFunctionArgs } from '@react-router/node'

export async function loader({ request }: LoaderFunctionArgs) {
try {
Expand Down
5 changes: 3 additions & 2 deletions docs/app/routes/updateTheme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { json, type ActionFunctionArgs, redirect } from '@remix-run/node'


import { ActionFunctionArgs, data, redirect } from 'react-router'
import { ThemeFormSchema } from '~/hooks/useTheme'
import { setTheme } from '~/utils/server/theme.server'

Expand All @@ -15,5 +16,5 @@ export async function action({ request }: ActionFunctionArgs) {
return redirect(redirectTo, responseInit)
}

return json({ success: true }, responseInit)
return data({ success: true }, responseInit)
}
2 changes: 1 addition & 1 deletion docs/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference types="@remix-run/node" />
/// <reference types="@react-router/node" />
/// <reference types="vite/client" />
Loading

0 comments on commit 5ebde1a

Please sign in to comment.