Compare commits

...

4 Commits

Author SHA1 Message Date
07e873bb36 Arreglo de idiomas en producción 2025-12-01 19:52:19 +01:00
8b5678da5a Cambio de estilo 2025-12-01 19:51:53 +01:00
43a6b24ccb . 2025-12-01 19:51:25 +01:00
5ac9aa0d3a Cambio de estilo 2025-12-01 19:46:55 +01:00
14 changed files with 96 additions and 106 deletions

View File

@ -8,7 +8,7 @@
"build": "tsc && vite build",
"build:rodax": "tsc && vite build --mode rodax",
"build:acana": "tsc && vite build --mode acana",
"preview": "vite preview --host",
"preview": "vite preview --host --debug --mode production",
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
"check:deps": "pnpm exec depcheck",
"lint": "biome lint --fix",

View File

@ -21,32 +21,32 @@ export function PageHeader({
className,
}: PageHeaderProps) {
return (
<div className={cn("pt-6 pb-6 lg:flex lg:items-center lg:justify-between", className)}>
<div className={cn("pt-6 pb-4 lg:flex lg:items-center lg:justify-between", className)}>
{/* Lado izquierdo */}
<div className='min-w-0 flex-1'>
<div className='flex items-start gap-4'>
<div className="min-w-0 flex-1">
<div className="flex items-start gap-4">
{backIcon && (
<Button
variant='ghost'
size='icon'
className='cursor-pointer'
className="cursor-pointer"
onClick={() => window.history.back()}
size="icon"
variant="ghost"
>
<ChevronLeftIcon className='size-5' />
<ChevronLeftIcon className="size-5" />
</Button>
)}
<div>
<h2 className='h-8 text-xl font-semibold text-foreground sm:truncate sm:tracking-tight'>
<h2 className="h-8 text-xl font-semibold text-foreground sm:truncate sm:tracking-tight">
{title}
</h2>
{description && <p className='text-sm text-muted-foreground'>{description}</p>}
{description && <p className="text-sm text-primary">{description}</p>}
</div>
</div>
</div>
{/* Lado derecho parametrizable */}
<div className='mt-4 flex lg:mt-0 lg:ml-4'>{rightSlot}</div>
<div className="mt-4 flex lg:mt-0 lg:ml-4">{rightSlot}</div>
</div>
);
}

View File

@ -1,4 +1,5 @@
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";
import { CustomersProvider } from "../context";
export const CustomersLayout = ({ children }: PropsWithChildren) => {

View File

@ -3,13 +3,12 @@
"version": "0.0.0",
"private": true,
"type": "module",
"sideEffects": false,
"scripts": {
"typecheck": "tsc -p tsconfig.json --noEmit",
"clean": "rimraf .turbo node_modules dist"
},
"exports": {
".": "./src/index.ts"
".": "./src/i18n.ts"
},
"dependencies": {
"i18next": "25.6.0",

View File

@ -1,10 +1,20 @@
import i18next, { type i18n } from "i18next";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { initReactI18next } from "react-i18next";
let hasInit = false;
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
detection: { order: ["navigator"] },
debug: true,
fallbackLng: "es",
interpolation: { escapeValue: false },
});
export const initI18Next = () => {
export { i18n };
/*export const initI18Next = () => {
if (hasInit) return i18next;
i18next
@ -12,14 +22,14 @@ export const initI18Next = () => {
.use(initReactI18next)
.init({
detection: { order: ["navigator"] },
debug: false,
debug: true,
fallbackLng: "es",
interpolation: { escapeValue: false },
});
hasInit = true;
return i18next;
};
};*/
/**
* Registra dinámicamente traducciones de un módulo.
@ -33,25 +43,16 @@ export const registerTranslations = (
locale: string,
resources: Record<string, unknown>
): void => {
if (!hasInit) {
/*if (!hasInit) {
throw new Error("i18n not initialized. Call initI18Next() first.");
}
}*/
const ns = moduleName;
const alreadyExists = i18next.hasResourceBundle(locale, ns);
const alreadyExists = i18n.hasResourceBundle(locale, ns);
if (!alreadyExists) {
i18next.addResourceBundle(locale, ns, resources, true, true);
console.log("cargando => ", moduleName, locale);
i18n.addResourceBundle(locale, ns, resources, true, true);
}
};
/**
* Acceso al `t()` global por si se necesita en librerías de backend.
*/
export const t = (...args: Parameters<i18n["t"]>) => {
if (!hasInit) {
throw new Error("i18n not initialized. Call initI18Next() first.");
}
return i18next.t(...args);
};

View File

@ -1 +0,0 @@
export * from "./i18n";

View File

@ -23,6 +23,7 @@
},
"devDependencies": {
"@biomejs/biome": "^2.3.1",
"@repo/i18next": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@tailwindcss/postcss": "^4.1.5",
"@turbo/gen": "^2.5.2",

View File

@ -9,7 +9,6 @@ export const AppContent = ({
return (
<div
className={cn("app-content flex flex-1 flex-col gap-4 p-4 pt-6 min-h-screen", className)}
style={{ backgroundColor: "#fdfdfd" }}
{...props}
>
{children}

View File

@ -1,5 +1,5 @@
import { cn } from "@repo/shadcn-ui/lib/utils";
import { PropsWithChildren } from "react";
import type { PropsWithChildren } from "react";
export const AppHeader = ({
className,
@ -7,7 +7,14 @@ export const AppHeader = ({
...props
}: PropsWithChildren<{ className?: string }>) => {
return (
<div className={cn("app-header gap-4 px-4 pt-0 border-b bg-background", className)} {...props}>
<div
className={cn(
"md:rounded-tl-xl md:rounded-tr-xl",
"app-header gap-4 px-4 pt-0 border-b border-sidebar/25 bg-background",
className
)}
{...props}
>
{children}
</div>
);

View File

@ -15,7 +15,7 @@ export const AppLayout = () => {
>
<AppSidebar variant="inset" />
{/* Aquí está el MAIN */}
<SidebarInset className="app-main">
<SidebarInset className="app-main bg-white">
<Outlet />
</SidebarInset>
</SidebarProvider>

View File

@ -6,11 +6,9 @@ import {
SidebarRail,
} from "@repo/shadcn-ui/components";
import {
AudioWaveform,
BarChartIcon,
CameraIcon,
ClipboardListIcon,
Command,
DatabaseIcon,
FileCheckIcon,
FileCodeIcon,
@ -20,7 +18,6 @@ import {
Frame,
GalleryVerticalEnd,
HelpCircleIcon,
HomeIcon,
LayoutDashboardIcon,
ListIcon,
MapIcon,
@ -161,24 +158,14 @@ const data2 = {
logo: GalleryVerticalEnd,
plan: "Enterprise",
},
{
name: "Acme Corp.",
logo: AudioWaveform,
plan: "Startup",
},
{
name: "Evil Corp.",
logo: Command,
plan: "Free",
},
],
navMain: [
{
/*{
title: "Inicio",
url: "/",
icon: HomeIcon,
isActive: true,
},
},*/
{
title: "Clientes",
icon: UsersIcon,
@ -188,10 +175,10 @@ const data2 = {
title: "Listado de clientes",
url: "/customers",
},
{
/*{
title: "Añadir un cliente",
url: "/customers/create",
},
},*/
],
},
{
@ -202,10 +189,10 @@ const data2 = {
title: "Listado de proformas",
url: "/proformas",
},
{
/*{
title: "Enviar a Veri*Factu",
url: "#",
},
},*/
],
},
{

View File

@ -1,5 +1,3 @@
import { ChevronRightIcon, type LucideIcon, PlusCircleIcon } from "lucide-react";
import {
Collapsible,
CollapsibleContent,
@ -13,6 +11,7 @@ import {
SidebarMenuSubButton,
SidebarMenuSubItem,
} from "@repo/shadcn-ui/components";
import { ChevronRightIcon, type LucideIcon, PlusCircleIcon } from "lucide-react";
import { useNavigate } from "react-router";
type NavMainItem = {
@ -26,21 +25,17 @@ type NavMainItem = {
}[];
};
export function NavMain({
items,
}: {
items: NavMainItem[];
}) {
export function NavMain({ items }: { items: NavMainItem[] }) {
const navigate = useNavigate();
return (
<SidebarGroup>
<SidebarGroupContent className='flex flex-col gap-2'>
<SidebarGroupContent className="flex flex-col gap-2">
<SidebarMenu>
<SidebarMenuItem className='flex items-center gap-2'>
<SidebarMenuItem className="flex items-center gap-2">
<SidebarMenuButton
tooltip='Quick Create'
className='min-w-8 bg-primary text-primary-foreground duration-200 ease-linear hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground'
className="hidden min-w-8 bg-primary text-primary-foreground duration-200 ease-linear hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground"
tooltip="Quick Create"
>
<PlusCircleIcon />
<span>Quick Create</span>
@ -49,13 +44,13 @@ export function NavMain({
</SidebarMenu>
<SidebarMenu>
{items.map((item) => (
<Collapsible key={item.title} asChild defaultOpen={true} className='group/collapsible'>
<SidebarMenuItem className='mb-6'>
<Collapsible asChild className="group/collapsible" defaultOpen={true} key={item.title}>
<SidebarMenuItem className="mb-6">
<CollapsibleTrigger asChild>
<SidebarMenuButton tooltip={item.title}>
{item.icon && <item.icon />}
<span className='font-semibold'>{item.title}</span>
<ChevronRightIcon className='ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90' />
<span className="font-semibold">{item.title}</span>
<ChevronRightIcon className="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
</SidebarMenuButton>
</CollapsibleTrigger>
<CollapsibleContent>

View File

@ -1,5 +1,6 @@
import { useTranslation } from "@repo/rdx-ui/locales/i18n.ts";
import { JSX } from "react";
import type { JSX } from "react";
import { LoadingIndicator } from "./loading-indicator.tsx";
export type LoadingOverlayProps = {
@ -31,7 +32,7 @@ export const LoadingOverlay = ({ title, subtitle, ...props }: LoadingOverlayProp
}
{...props}
>
<LoadingIndicator look='dark' title={loadingTitle} subtitle={loadingSubtitle} />
<LoadingIndicator look="dark" subtitle={loadingSubtitle} title={loadingTitle} />
</div>
);
};

View File

@ -117,38 +117,38 @@
--font-serif: "Noto Serif", ui-serif, serif;
--font-mono: "Noto Sans Mono", ui-monospace, monospace;
--background: oklch(1 0 0);
--foreground: oklch(13.636% 0.02685 282.25);
--card: oklch(1 0 0);
--card-foreground: oklch(0.2035 0.0139 285.1021);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.2035 0.0139 285.1021);
--primary: oklch(0.623 0.214 259.815);
--primary-foreground: oklch(1 0 0);
--secondary: oklch(0.9574 0.0011 197.1383);
--secondary-foreground: oklch(0.2069 0.0098 285.5081);
--muted: oklch(0.9674 0.0013 286.3752);
--muted-foreground: oklch(0.5466 0.0216 285.664);
--accent: oklch(0.9299 0.0334 272.7879);
--accent-foreground: oklch(0.3729 0.0306 259.7328);
--destructive: oklch(0.583 0.2387 28.4765);
--destructive-foreground: oklch(1 0 0);
--border: oklch(0.9273 0.0067 286.2663);
--input: oklch(0.9173 0.0067 286.2663);
--ring: oklch(0.6187 0.2067 259.2316);
--chart-1: oklch(0.6471 0.2173 36.8511);
--chart-2: oklch(37.973% 0.0506 187.591);
--chart-3: oklch(0.4247 0.0852 230.5827);
--chart-4: oklch(0.829 0.1712 81.0381);
--chart-5: oklch(0.7724 0.1728 65.367);
--sidebar: oklch(0.957 0.007 272.5840410480741);
--sidebar-foreground: oklch(0.2035 0.0139 285.1021);
--sidebar-primary: oklch(0.623 0.214 259.815);
--sidebar-primary-foreground: oklch(1 0 0);
--sidebar-accent: oklch(0.9674 0.0013 286.3752);
--sidebar-accent-foreground: oklch(0.2069 0.0098 285.5081);
--sidebar-border: oklch(0.9173 0.0067 286.2663);
--sidebar-ring: oklch(0.623 0.214 259.815);
--background: #eef4ff;
--foreground: #1e293b;
--card: #ffffff;
--card-foreground: #1e293b;
--popover: #ffffff;
--popover-foreground: #1e293b;
--primary: #3478d1;
--primary-foreground: #ffffff;
--secondary: #e8f1fb;
--secondary-foreground: #1e293b;
--muted: #e8f1fb;
--muted-foreground: #6b7d93;
--accent: #6b7d93;
--accent-foreground: #ffffff;
--destructive: #ef4444;
--destructive-foreground: #ffffff;
--border: #d1dce8;
--input: #d1dce8;
--ring: #3478d1;
--chart-1: #3478d1;
--chart-2: #6b7d93;
--chart-3: #5ba3e0;
--chart-4: #4a90c9;
--chart-5: #8ba3bd;
--sidebar: #3478d1;
--sidebar-foreground: #ffffff;
--sidebar-primary: #ffffff;
--sidebar-primary-foreground: #3478d1;
--sidebar-accent: #4a8fe0;
--sidebar-accent-foreground: #ffffff;
--sidebar-border: #4a8fe0;
--sidebar-ring: #ffffff;
--radius: 0.4rem;
--shadow-2xs: 1px 1px 6px 0px hsl(0 0% 0% / 0.05);
--shadow-xs: 1px 1px 6px 0px hsl(0 0% 0% / 0.05);