Vendor backend and frontend into the monorepo
The submodule collapse was only half applied: .gitmodules was deleted but backend/ and frontend/ were still recorded as gitlinks, so none of their files were tracked. Replace the gitlinks with the real trees. Also untrack .env (it carried placeholder secrets) in favour of a tracked .env.example, drop the committed __pycache__, and narrow the blanket *.png ignore that would have swallowed design assets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
3cb16958ba
commit
1916f7f778
@@ -0,0 +1,105 @@
|
||||
import { Monitor, Moon, Sun } from "lucide-react"
|
||||
|
||||
import { type Theme, useTheme } from "@/components/theme-provider"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import {
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar"
|
||||
|
||||
type LucideIcon = React.FC<React.SVGProps<SVGSVGElement>>
|
||||
|
||||
const ICON_MAP: Record<Theme, LucideIcon> = {
|
||||
system: Monitor,
|
||||
light: Sun,
|
||||
dark: Moon,
|
||||
}
|
||||
|
||||
export const SidebarAppearance = () => {
|
||||
const { isMobile } = useSidebar()
|
||||
const { setTheme, theme } = useTheme()
|
||||
const Icon = ICON_MAP[theme]
|
||||
|
||||
return (
|
||||
<SidebarMenuItem>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<SidebarMenuButton tooltip="Appearance" data-testid="theme-button">
|
||||
<Icon className="size-4 text-muted-foreground" />
|
||||
<span>Appearance</span>
|
||||
<span className="sr-only">Toggle theme</span>
|
||||
</SidebarMenuButton>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
side={isMobile ? "top" : "right"}
|
||||
align="end"
|
||||
className="w-(--radix-dropdown-menu-trigger-width) min-w-56"
|
||||
>
|
||||
<DropdownMenuItem
|
||||
data-testid="light-mode"
|
||||
onClick={() => setTheme("light")}
|
||||
>
|
||||
<Sun className="mr-2 h-4 w-4" />
|
||||
Light
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
data-testid="dark-mode"
|
||||
onClick={() => setTheme("dark")}
|
||||
>
|
||||
<Moon className="mr-2 h-4 w-4" />
|
||||
Dark
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTheme("system")}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
System
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</SidebarMenuItem>
|
||||
)
|
||||
}
|
||||
|
||||
export const Appearance = () => {
|
||||
const { setTheme } = useTheme()
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center">
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button data-testid="theme-button" variant="outline" size="icon">
|
||||
<Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
||||
<Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
||||
<span className="sr-only">Toggle theme</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem
|
||||
data-testid="light-mode"
|
||||
onClick={() => setTheme("light")}
|
||||
>
|
||||
<Sun className="mr-2 h-4 w-4" />
|
||||
Light
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
data-testid="dark-mode"
|
||||
onClick={() => setTheme("dark")}
|
||||
>
|
||||
<Moon className="mr-2 h-4 w-4" />
|
||||
Dark
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => setTheme("system")}>
|
||||
<Monitor className="mr-2 h-4 w-4" />
|
||||
System
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Appearance } from "@/components/Common/Appearance"
|
||||
import { Logo } from "@/components/Common/Logo"
|
||||
import { Footer } from "./Footer"
|
||||
|
||||
interface AuthLayoutProps {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function AuthLayout({ children }: AuthLayoutProps) {
|
||||
return (
|
||||
<div className="grid min-h-svh lg:grid-cols-2">
|
||||
<div className="bg-muted dark:bg-zinc-900 relative hidden lg:flex lg:items-center lg:justify-center">
|
||||
<Logo variant="full" className="h-16" asLink={false} />
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 p-6 md:p-10">
|
||||
<div className="flex justify-end">
|
||||
<Appearance />
|
||||
</div>
|
||||
<div className="flex flex-1 items-center justify-center">
|
||||
<div className="w-full max-w-xs">{children}</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
import {
|
||||
type ColumnDef,
|
||||
flexRender,
|
||||
getCoreRowModel,
|
||||
getPaginationRowModel,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table"
|
||||
import {
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ChevronsLeft,
|
||||
ChevronsRight,
|
||||
} from "lucide-react"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select"
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@/components/ui/table"
|
||||
|
||||
interface DataTableProps<TData, TValue> {
|
||||
columns: ColumnDef<TData, TValue>[]
|
||||
data: TData[]
|
||||
}
|
||||
|
||||
export function DataTable<TData, TValue>({
|
||||
columns,
|
||||
data,
|
||||
}: DataTableProps<TData, TValue>) {
|
||||
const table = useReactTable({
|
||||
data,
|
||||
columns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getPaginationRowModel: getPaginationRowModel(),
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
<TableRow key={headerGroup.id} className="hover:bg-transparent">
|
||||
{headerGroup.headers.map((header) => {
|
||||
return (
|
||||
<TableHead key={header.id}>
|
||||
{header.isPlaceholder
|
||||
? null
|
||||
: flexRender(
|
||||
header.column.columnDef.header,
|
||||
header.getContext(),
|
||||
)}
|
||||
</TableHead>
|
||||
)
|
||||
})}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{table.getRowModel().rows.length ? (
|
||||
table.getRowModel().rows.map((row) => (
|
||||
<TableRow key={row.id}>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id}>
|
||||
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow className="hover:bg-transparent">
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
className="h-32 text-center text-muted-foreground"
|
||||
>
|
||||
No results found.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
{table.getPageCount() > 1 && (
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-t bg-muted/20">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-4">
|
||||
<div className="text-sm text-muted-foreground">
|
||||
Showing{" "}
|
||||
{table.getState().pagination.pageIndex *
|
||||
table.getState().pagination.pageSize +
|
||||
1}{" "}
|
||||
to{" "}
|
||||
{Math.min(
|
||||
(table.getState().pagination.pageIndex + 1) *
|
||||
table.getState().pagination.pageSize,
|
||||
data.length,
|
||||
)}{" "}
|
||||
of{" "}
|
||||
<span className="font-medium text-foreground">{data.length}</span>{" "}
|
||||
entries
|
||||
</div>
|
||||
<div className="flex items-center gap-x-2">
|
||||
<p className="text-sm text-muted-foreground">Rows per page</p>
|
||||
<Select
|
||||
value={`${table.getState().pagination.pageSize}`}
|
||||
onValueChange={(value) => {
|
||||
table.setPageSize(Number(value))
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="h-8 w-[70px]">
|
||||
<SelectValue
|
||||
placeholder={table.getState().pagination.pageSize}
|
||||
/>
|
||||
</SelectTrigger>
|
||||
<SelectContent side="top">
|
||||
{[5, 10, 25, 50].map((pageSize) => (
|
||||
<SelectItem key={pageSize} value={`${pageSize}`}>
|
||||
{pageSize}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-x-6">
|
||||
<div className="flex items-center gap-x-1 text-sm text-muted-foreground">
|
||||
<span>Page</span>
|
||||
<span className="font-medium text-foreground">
|
||||
{table.getState().pagination.pageIndex + 1}
|
||||
</span>
|
||||
<span>of</span>
|
||||
<span className="font-medium text-foreground">
|
||||
{table.getPageCount()}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-x-1">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0"
|
||||
onClick={() => table.setPageIndex(0)}
|
||||
disabled={!table.getCanPreviousPage()}
|
||||
>
|
||||
<span className="sr-only">Go to first page</span>
|
||||
<ChevronsLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0"
|
||||
onClick={() => table.previousPage()}
|
||||
disabled={!table.getCanPreviousPage()}
|
||||
>
|
||||
<span className="sr-only">Go to previous page</span>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0"
|
||||
onClick={() => table.nextPage()}
|
||||
disabled={!table.getCanNextPage()}
|
||||
>
|
||||
<span className="sr-only">Go to next page</span>
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0"
|
||||
onClick={() => table.setPageIndex(table.getPageCount() - 1)}
|
||||
disabled={!table.getCanNextPage()}
|
||||
>
|
||||
<span className="sr-only">Go to last page</span>
|
||||
<ChevronsRight className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Link } from "@tanstack/react-router"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
const ErrorComponent = () => {
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen items-center justify-center flex-col p-4"
|
||||
data-testid="error-component"
|
||||
>
|
||||
<div className="flex items-center z-10">
|
||||
<div className="flex flex-col ml-4 items-center justify-center p-4">
|
||||
<span className="text-6xl md:text-8xl font-bold leading-none mb-4">
|
||||
Error
|
||||
</span>
|
||||
<span className="text-2xl font-bold mb-2">Oops!</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-lg text-muted-foreground mb-4 text-center z-10">
|
||||
Something went wrong. Please try again.
|
||||
</p>
|
||||
<Link to="/">
|
||||
<Button>Go Home</Button>
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ErrorComponent
|
||||
@@ -0,0 +1,44 @@
|
||||
import { FaGithub, FaLinkedinIn } from "react-icons/fa"
|
||||
import { FaXTwitter } from "react-icons/fa6"
|
||||
|
||||
const socialLinks = [
|
||||
{
|
||||
icon: FaGithub,
|
||||
href: "https://github.com/fastapi/fastapi",
|
||||
label: "GitHub",
|
||||
},
|
||||
{ icon: FaXTwitter, href: "https://x.com/fastapi", label: "X" },
|
||||
{
|
||||
icon: FaLinkedinIn,
|
||||
href: "https://linkedin.com/company/fastapi",
|
||||
label: "LinkedIn",
|
||||
},
|
||||
]
|
||||
|
||||
export function Footer() {
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
return (
|
||||
<footer className="border-t py-4 px-6">
|
||||
<div className="flex flex-col items-center justify-between gap-4 sm:flex-row">
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Full Stack FastAPI Template - {currentYear}
|
||||
</p>
|
||||
<div className="flex items-center gap-4">
|
||||
{socialLinks.map(({ icon: Icon, href, label }) => (
|
||||
<a
|
||||
key={label}
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={label}
|
||||
className="text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<Icon className="h-5 w-5" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Link } from "@tanstack/react-router"
|
||||
|
||||
import { useTheme } from "@/components/theme-provider"
|
||||
import { cn } from "@/lib/utils"
|
||||
import icon from "/assets/images/fastapi-icon.svg"
|
||||
import iconLight from "/assets/images/fastapi-icon-light.svg"
|
||||
import logo from "/assets/images/fastapi-logo.svg"
|
||||
import logoLight from "/assets/images/fastapi-logo-light.svg"
|
||||
|
||||
interface LogoProps {
|
||||
variant?: "full" | "icon" | "responsive"
|
||||
className?: string
|
||||
asLink?: boolean
|
||||
}
|
||||
|
||||
export function Logo({
|
||||
variant = "full",
|
||||
className,
|
||||
asLink = true,
|
||||
}: LogoProps) {
|
||||
const { resolvedTheme } = useTheme()
|
||||
const isDark = resolvedTheme === "dark"
|
||||
|
||||
const fullLogo = isDark ? logoLight : logo
|
||||
const iconLogo = isDark ? iconLight : icon
|
||||
|
||||
const content =
|
||||
variant === "responsive" ? (
|
||||
<>
|
||||
<img
|
||||
src={fullLogo}
|
||||
alt="FastAPI"
|
||||
className={cn(
|
||||
"h-6 w-auto group-data-[collapsible=icon]:hidden",
|
||||
className,
|
||||
)}
|
||||
/>
|
||||
<img
|
||||
src={iconLogo}
|
||||
alt="FastAPI"
|
||||
className={cn(
|
||||
"size-5 hidden group-data-[collapsible=icon]:block",
|
||||
className,
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<img
|
||||
src={variant === "full" ? fullLogo : iconLogo}
|
||||
alt="FastAPI"
|
||||
className={cn(variant === "full" ? "h-6 w-auto" : "size-5", className)}
|
||||
/>
|
||||
)
|
||||
|
||||
if (!asLink) {
|
||||
return content
|
||||
}
|
||||
|
||||
return <Link to="/">{content}</Link>
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Link } from "@tanstack/react-router"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
const NotFound = () => {
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen items-center justify-center flex-col p-4"
|
||||
data-testid="not-found"
|
||||
>
|
||||
<div className="flex items-center z-10">
|
||||
<div className="flex flex-col ml-4 items-center justify-center p-4">
|
||||
<span className="text-6xl md:text-8xl font-bold leading-none mb-4">
|
||||
404
|
||||
</span>
|
||||
<span className="text-2xl font-bold mb-2">Oops!</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-lg text-muted-foreground mb-4 text-center z-10">
|
||||
The page you are looking for was not found.
|
||||
</p>
|
||||
<div className="z-10">
|
||||
<Link to="/">
|
||||
<Button className="mt-4">Go Back</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default NotFound
|
||||
Reference in New Issue
Block a user