everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
1 lines • 3.62 kB
Source Map (JSON)
{"version":3,"file":"router-error.mjs","names":[],"sources":["../../src/ui/router-error.tsx"],"sourcesContent":["/**\n * Generic router error boundary component — shared by the client and SSR\n * router factories. Dependency-free by design: the framework cannot import\n * the app's UI kit, so primitives are plain markup + semantic tokens.\n */\n\nexport function RouterError({\n error,\n reset,\n messages,\n}: {\n error: Error;\n reset?: () => void;\n messages?: { title: string; body: string; home: string; retry: string };\n}) {\n return (\n <div\n className=\"flex min-h-96 flex-1 items-center justify-center bg-background px-4 py-16\"\n role=\"alert\"\n data-testid=\"router-error\"\n >\n <div className=\"flex max-w-md flex-col items-center gap-6 text-center\">\n <div className=\"flex size-14 items-center justify-center rounded-full bg-destructive-muted text-destructive-muted-foreground\">\n <svg className=\"size-7\" viewBox=\"0 0 256 256\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm-8-80V80a8 8 0 0 1 16 0v56a8 8 0 0 1-16 0Zm20 36a12 12 0 1 1-12-12 12 12 0 0 1 12 12Z\" />\n </svg>\n </div>\n <div className=\"flex flex-col gap-3\">\n <h1 className=\"text-3xl font-semibold text-foreground\">\n {messages?.title ?? \"This page didn’t load\"}\n </h1>\n <p className=\"text-base text-muted-foreground\">\n {messages?.body ?? \"Something went wrong on our side. Try again, or head back home.\"}\n </p>\n </div>\n <div className=\"flex flex-wrap justify-center gap-3\">\n <a\n href=\"/\"\n data-testid=\"router-error-home\"\n className=\"inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground\"\n >\n {messages?.home ?? \"Back home\"}\n </a>\n <button\n type=\"button\"\n onClick={() => (reset ? reset() : window.location.reload())}\n data-testid=\"router-error-retry\"\n className=\"inline-flex h-9 items-center justify-center rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground\"\n >\n {messages?.retry ?? \"Try again\"}\n </button>\n </div>\n <details className=\"w-full text-left text-sm text-muted-foreground\">\n <summary className=\"cursor-pointer text-center\">Error details</summary>\n <pre className=\"mt-3 overflow-x-auto whitespace-pre-wrap rounded-lg bg-muted p-4 font-mono text-xs\">\n {error.message}\n </pre>\n </details>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,YAAY,EAC1B,OACA,OACA,YAKC;CACD,OACE,oBAAC,OAAD;EACE,WAAU;EACV,MAAK;EACL,eAAY;YAEZ,qBAAC,OAAD;GAAK,WAAU;aAAf;IACE,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,OAAD;MAAK,WAAU;MAAS,SAAQ;MAAc,MAAK;MAAe,eAAY;gBAC5E,oBAAC,QAAD,EAAM,GAAE,iMAAkM;KACvM;IACF;IACL,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,MAAD;MAAI,WAAU;gBACX,UAAU,SAAS;KAClB,IACJ,oBAAC,KAAD;MAAG,WAAU;gBACV,UAAU,QAAQ;KAClB,EACA;;IACL,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,KAAD;MACE,MAAK;MACL,eAAY;MACZ,WAAU;gBAET,UAAU,QAAQ;KAClB,IACH,oBAAC,UAAD;MACE,MAAK;MACL,eAAgB,QAAQ,MAAM,IAAI,OAAO,SAAS,OAAO;MACzD,eAAY;MACZ,WAAU;gBAET,UAAU,SAAS;KACd,EACL;;IACL,qBAAC,WAAD;KAAS,WAAU;eAAnB,CACE,oBAAC,WAAD;MAAS,WAAU;gBAA6B;KAAsB,IACtE,oBAAC,OAAD;MAAK,WAAU;gBACZ,MAAM;KACJ,EACE;;GACN;;CACF;AAET"}