add route

This commit is contained in:
2025-11-19 22:12:18 -03:00
parent f99350f507
commit 5b1ba9e9c7
25 changed files with 162 additions and 334 deletions

View File

@@ -17,7 +17,6 @@ import { WorkspaceSwitcher } from '@/components/workspace-switcher'
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarRail
} from '@repo/ui/components/ui/sidebar'
@@ -83,7 +82,7 @@ export function AppSidebar() {
<SidebarHeader>
<WorkspaceSwitcher />
</SidebarHeader>
<SidebarContent>
<SidebarContent className="group-data-[state=expanded]:p-2">
<NavMain data={data} />
</SidebarContent>
</Sidebar>

View File

@@ -22,7 +22,7 @@ import {
} from '@repo/ui/components/ui/sidebar'
import { initials } from '@repo/ui/lib/utils'
type Workspace = {
export type Workspace = {
id: string
name: string
cnpj: string
@@ -30,7 +30,7 @@ type Workspace = {
type WorkspaceContextProps = {
workspaces: Workspace[]
activeWorkspace: Workspace | null
activeWorkspace: Workspace
setActiveWorkspace: React.Dispatch<React.SetStateAction<Workspace | null>>
}
@@ -54,8 +54,8 @@ export function WorkspaceProvider({
children: React.ReactNode
}) {
const { orgid } = useParams()
const [activeWorkspace, setActiveWorkspace] = useState<Workspace | null>(
() => workspaces.find((ws) => ws.id === orgid) ?? null
const [activeWorkspace, setActiveWorkspace] = useState<Workspace | any>(
() => workspaces.find((ws) => ws.id === orgid) || {}
)
return (
@@ -79,7 +79,7 @@ export function WorkspaceSwitcher() {
}
return (
<SidebarMenu>
<SidebarMenu className="group-data-[state=expanded]:p-2">
<SidebarMenuItem>
<DropdownMenu>
<DropdownMenuTrigger asChild>

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { redirect } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Suspense } from 'react'
import { Await } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import Fuse from 'fuse.js'
import { AwardIcon, BanIcon, LaptopIcon } from 'lucide-react'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { useNavigate } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { flatten } from 'flat'
import {

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Link } from 'react-router'

View File

@@ -1,10 +1,7 @@
export function meta({}) {
return [
{ title: 'Visão geral' }
// { name: 'description', content: 'Welcome to React Router!' }
]
return [{ title: 'Visão geral' }]
}
export default function Page() {
export default function Route() {
return <>index org</>
}

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Suspense } from 'react'
import { Await } from 'react-router'
@@ -48,6 +48,7 @@ export default function Route({ loaderData: { data } }) {
{({ hits, page, hitsPerPage, totalHits }) => {
return (
<DataTable
sort={[{ id: 'created_at', desc: true }]}
columns={columns}
data={hits as Order[]}
pageIndex={page - 1}

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Suspense } from 'react'
import { Await } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { zodResolver } from '@hookform/resolvers/zod'
import { PatternFormat } from 'react-number-format'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { Suspense } from 'react'
import { Await, useOutletContext } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import {
Link,

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { PlusIcon } from 'lucide-react'
import { Suspense } from 'react'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { isValidCPF } from '@brazilian-utils/brazilian-utils'
import { zodResolver } from '@hookform/resolvers/zod'

View File

@@ -1,6 +1,4 @@
import type { Route } from './+types'
import { useLoaderData } from 'react-router'
import type { Route } from './+types/route'
import { type Webhook } from './columns'
@@ -12,9 +10,7 @@ export async function loader(): Promise<Webhook[]> {
return []
}
export default function Page() {
const data = useLoaderData() as Webhook[]
export default function Route() {
return (
<>
<div className="space-y-0.5 mb-8">

View File

@@ -1,11 +1,12 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import * as cookie from 'cookie'
import { Outlet, type ShouldRevalidateFunctionArgs } from 'react-router'
import { AppSidebar } from '@/components/app-sidebar'
import { WorkspaceProvider } from '@/components/workspace-switcher'
import {
WorkspaceProvider,
type Workspace
} from '@/components/workspace-switcher'
import { userContext } from '@repo/auth/context'
import { authMiddleware } from '@repo/auth/middleware/auth'
import { ModeToggle, ThemedImage } from '@repo/ui/components/dark-mode'
@@ -18,6 +19,8 @@ import {
import { Toaster } from '@repo/ui/components/ui/sonner'
import { request as req } from '@repo/util/request'
import { AppSidebar } from '@/components/app-sidebar'
export const middleware: Route.MiddlewareFunction[] = [authMiddleware]
export async function loader({ params, context, request }: Route.ActionArgs) {
@@ -61,7 +64,7 @@ export default function Route({ loaderData }: Route.ComponentProps) {
const { user, orgs, sidebar_state } = loaderData
return (
<WorkspaceProvider workspaces={orgs}>
<WorkspaceProvider workspaces={orgs as Workspace[]}>
<SidebarProvider defaultOpen={sidebar_state === 'true'} className="flex">
<AppSidebar />

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { redirect } from 'react-router'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import { redirect } from 'react-router'
import type { OAuth2Strategy } from 'remix-auth-oauth2'

View File

@@ -1,4 +1,4 @@
import type { Route } from './+types'
import type { Route } from './+types/route'
import type { User } from '@repo/auth/auth'
import { userContext } from '@repo/auth/context'