Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: lang switcher in api docs
Brad Barbin8fee217173da
diff --git a/apps/carbon/app/routes/x+/api+/_layout.tsx b/apps/carbon/app/routes/x+/api+/_layout.tsxindex 9a4b49505b..ead3b29204 100644--- a/apps/carbon/app/routes/x+/api+/_layout.tsx+++ b/apps/carbon/app/routes/x+/api+/_layout.tsx@@ -1,7 +1,9 @@+import { Button } from "@carbon/react";import type { MetaFunction } from "@remix-run/node";-import { Outlet } from "@remix-run/react";+import { Outlet, useLocation, useNavigate } from "@remix-run/react";import { GroupedContentSidebar } from "~/components/Layout";import swaggerDocsSchema from "~/lib/swagger-docs-schema";+import type { ValidLang } from "~/modules/api";import { useSelectedLang } from "~/modules/api";import DocsStyle from "~/styles/docs.css?url";import type { RouteGroup } from "~/types";@@ -24,9 +26,47 @@ export function links() {export default function ApiDocsRoute() {const groups = useApiDocsMenu();+ const selectedLang = useSelectedLang();+ const navigate = useNavigate();+ const { pathname } = useLocation();++ const onChangeLanguage = (newLang: ValidLang) => {+ if (newLang === selectedLang) return;+ let newPath = "";+ switch (selectedLang) {+ case "bash":+ newPath = pathname.replace("/bash/", `/${newLang}/`);+ navigate(newPath);+ break;+ case "js":+ newPath = pathname.replace("/js/", `/${newLang}/`);+ navigate(newPath);+ break;+ default:+ throw new Error(`Invalid language: ${selectedLang}`);+ }+ };return (- <div className="grid grid-cols-[auto_1fr] w-full h-full">+ <div className="relative grid grid-cols-[auto_1fr] w-full h-full">+ <div className="flex absolute top-4 right-4 z-50 gap-2">+ <Button+ variant={selectedLang === "js" ? "primary" : "secondary"}+ onClick={() => {+ onChangeLanguage("js");+ }}+ >+ JS+ </Button>+ <Button+ variant={selectedLang === "bash" ? "primary" : "secondary"}+ onClick={() => {+ onChangeLanguage("bash");+ }}+ >+ Bash+ </Button>+ </div><GroupedContentSidebar groups={groups} width={270} /><div className="Docs Docs--api-page w-full h-full overflow-y-auto"><div className="Docs--inner-wrapper pt-4">diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 89a5d55d1a..add459f186 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -22950,14 +22950,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["id"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["id"]diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 89a5d55d1a..add459f186 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -22950,14 +22950,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["supplierCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["id"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["supplierCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["id"]