mirror of
https://github.com/makeplane/plane.git
synced 2026-09-03 04:29:57 +02:00
* refactor: migrate web icons to @makeplane/propel Replace confirmed icon symbols across apps/web with their audited @makeplane/propel/icons targets. Unresolved symbols and the State, Priority and Brand icons stay on their existing imports. Lucide size props become explicit width/height, including the two relation icons and the inbox status icon that forward a size variable. Two aliased imports resolve to targets the file already imported, so the aliases are dropped rather than importing the same symbol twice. Widen the member dropdown chain and the AI menu from LucideIcon to ComponentType<SVGProps<SVGSVGElement>> so both Lucide and Propel icons satisfy them; both only ever render the icon with a className. CycleGroupIcon is deliberately not migrated: it dispatches a different glyph and color per cycle status, which CyclesOutline cannot express. apps/web already declared @makeplane/propel, so no dependency change was needed. * fix: address icon migration review on web Restore the six user-facing strings the identifier rename overwrote. The migration replaced every occurrence of a source symbol name, including ones inside string literals and JSX text, so the GitHub empty state read "StarOutline us on GitHub", the exporter column key, header and button label became "DownloadOutline", the project card action title became "SettingsOutline" and a tooltip became "PinOutline". Drop 122 strokeWidth props and 10 text-2 classes. Propel glyphs paint with fill="currentColor", so strokeWidth never changed weight, and text-2 was a bad conversion of stroke-2, which is a stroke width rather than a colour and has no meaning on a fill path. Use StarFilled for the two favorited sidebar stars. Lucide's Star with fill-yellow-500 was a solid star, and StarOutline is a ring path, so filling it does not reproduce that shape.
157 lines
5.6 KiB
TypeScript
157 lines
5.6 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
// plane imports
|
|
import { isRouteErrorResponse } from "react-router";
|
|
import { Banner } from "@plane/propel/banner";
|
|
import { Button } from "@plane/propel/button";
|
|
import { Card, ECardVariant } from "@plane/propel/card";
|
|
import { InfoFilled } from "@makeplane/propel/icons";
|
|
|
|
interface ErrorActionsProps {
|
|
onGoHome: () => void;
|
|
onReload?: () => void;
|
|
}
|
|
|
|
function ErrorActions({ onGoHome, onReload }: ErrorActionsProps) {
|
|
return (
|
|
<div className="flex gap-3 pt-2">
|
|
<Button variant="primary" size="lg" onClick={onGoHome}>
|
|
Go to home
|
|
</Button>
|
|
{onReload && (
|
|
<Button variant="secondary" size="lg" onClick={onReload}>
|
|
Reload page
|
|
</Button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface DevErrorComponentProps {
|
|
error: unknown;
|
|
onGoHome: () => void;
|
|
onReload: () => void;
|
|
}
|
|
|
|
export function DevErrorComponent({ error, onGoHome, onReload }: DevErrorComponentProps) {
|
|
if (isRouteErrorResponse(error)) {
|
|
return (
|
|
<div className="flex min-h-screen items-start justify-center bg-surface-2 p-6 transition-none">
|
|
<div className="mt-12 w-full max-w-4xl space-y-4 transition-none">
|
|
<Banner
|
|
variant="error"
|
|
icon={<InfoFilled className="size-5" />}
|
|
title="Route Error Response"
|
|
animationDuration={0}
|
|
/>
|
|
|
|
<Card variant={ECardVariant.WITH_SHADOW} className="!p-6 transition-none">
|
|
<div className="space-y-4">
|
|
<div>
|
|
<h2 className="mb-2 text-20 font-semibold text-danger-primary">
|
|
{error.status} {error.statusText}
|
|
</h2>
|
|
<div className="bg-subtle-1 h-px w-full" />
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<h3 className="text-13 font-medium tracking-wide text-tertiary uppercase">Error Data</h3>
|
|
<div className="rounded-md bg-layer-1 p-4">
|
|
<p className="font-code text-13 text-secondary">{error.data}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<ErrorActions onGoHome={onGoHome} onReload={onReload} />
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (error instanceof Error) {
|
|
return (
|
|
<div className="flex min-h-screen items-start justify-center bg-surface-2 p-6 transition-none">
|
|
<div className="mt-12 w-full max-w-4xl space-y-4 transition-none">
|
|
<Banner
|
|
variant="error"
|
|
icon={<InfoFilled className="size-5" />}
|
|
title="Runtime Error"
|
|
animationDuration={0}
|
|
/>
|
|
<Card variant={ECardVariant.WITH_SHADOW} className="!p-6 transition-none">
|
|
<div className="space-y-4">
|
|
<div>
|
|
<h2 className="mb-2 text-20 font-semibold text-danger-primary">Error</h2>
|
|
<div className="bg-subtle-1 h-px w-full" />
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<h3 className="text-13 font-medium tracking-wide text-tertiary uppercase">Message</h3>
|
|
<div className="rounded-md bg-layer-1 p-4">
|
|
<p className="text-13 font-medium text-primary">{error.message}</p>
|
|
</div>
|
|
</div>
|
|
|
|
{error.stack && (
|
|
<div className="space-y-2">
|
|
<h3 className="text-13 font-medium tracking-wide text-tertiary uppercase">Stack Trace</h3>
|
|
<div className="max-h-96 overflow-auto rounded-md border border-subtle bg-layer-1">
|
|
<pre className="p-4 font-code text-11 break-words whitespace-pre-wrap text-secondary">
|
|
{error.stack}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
<ErrorActions onGoHome={onGoHome} onReload={onReload} />
|
|
</div>
|
|
</Card>
|
|
|
|
<Card variant={ECardVariant.WITHOUT_SHADOW} className="bg-layer-1 !p-4 transition-none">
|
|
<div className="flex items-start gap-3">
|
|
<InfoFilled className="mt-0.5 size-5 flex-shrink-0 text-tertiary" />
|
|
<div className="space-y-1">
|
|
<p className="text-13 font-medium text-secondary">Development Mode</p>
|
|
<p className="text-11 text-tertiary">
|
|
This detailed error view is only visible in development. In production, users will see a friendly
|
|
error page.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex min-h-screen items-start justify-center bg-surface-2 p-6 transition-none">
|
|
<div className="mt-12 w-full max-w-4xl space-y-4 transition-none">
|
|
<Banner variant="error" icon={<InfoFilled className="size-5" />} title="Unknown Error" animationDuration={0} />
|
|
|
|
<Card variant={ECardVariant.WITH_SHADOW} className="!p-6">
|
|
<div className="space-y-4">
|
|
<div>
|
|
<h2 className="mb-2 text-20 font-semibold text-primary">Unknown Error</h2>
|
|
<div className="bg-subtle-1 h-px w-full" />
|
|
</div>
|
|
|
|
<div className="rounded-md bg-layer-1 p-4">
|
|
<p className="text-13 text-secondary">
|
|
An unknown error occurred. Please try refreshing the page or contact support if the problem persists.
|
|
</p>
|
|
</div>
|
|
|
|
<ErrorActions onGoHome={onGoHome} onReload={onReload} />
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|