jira/apps/admin/components/instance/failure.tsx

44 lines
1.7 KiB
TypeScript
Raw Permalink Normal View History

/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { observer } from "mobx-react";
2024-05-14 15:24:49 +00:00
import { useTheme } from "next-themes";
refactor(admin): replace workspace @plane/propel with @makeplane/propel (#9692) Stacked on the @plane/ui migration: admin's component imports now come from the published npm package (@makeplane/propel 0.2.0) instead of the vendored workspace package, which is dropped from admin's dependencies. The workspace package remains in use by web/space/editor. Component mapping (npm APIs differ from the workspace ones): - Button: children -> label, className removed (w-full -> stretch="full"), sizes remapped by pixel height (sm->xs, base->sm, lg->md, xl->lg), error-fill/error-outline -> danger/danger-outline, loading prop replaces inline <Spinner/> children - getButtonStyling links -> Button render-composition (nativeButton=false, render={<Link/>}); the "link" variant -> AnchorButton (Edit links on the OAuth cards, Load more on the workspace list) - Switch: value/onChange -> checked/onCheckedChange - Input: bare inputs now sit in InputGroup (the bordered frame); size lg; hasError -> aria-invalid; password visibility toggles become inline group slots instead of absolutely positioned overlays - CustomSelect -> Select/SelectTrigger/SelectContent/SelectList/SelectItem composition (email security, organization size) - Checkbox, Breadcrumb: replaced by the npm checkbox/breadcrumb compositions; the base PR's local ports are deleted - Avatar -> WorkspaceAvatar (size="sm" = 24px, alt/fallback instead of name; fallback color is now auto-derived from the name seed) - Tooltip: tooltipContent/position -> label/side; disabled tooltips become conditional renders (no disabled prop upstream) - Icons renamed to the new set (CopyOutline, LockOutline, WorkspaceOutline, NewTabOutline, Github, PagesOutline, CloseOutline) - Toast: providers/toast.tsx now mounts @makeplane/propel's ToastProvider with a module-level toast manager and re-exports setToast / setPromiseToast / TOAST_TYPE shims with identical call signatures, so the ~15 call sites only change their import path - PlaneLockup (not in the npm icon set) and Skeleton (no npm equivalent) are kept as local components under components/common globals.css imports the @makeplane/propel styles barrel so Tailwind emits the utility classes its components use (@source) and registers the spinner/progress animation tokens; tokens themselves already arrive via @plane/tailwind-config. Visual deltas to expect: npm components ship the new design tokens and omit className, so buttons/inputs/selects/avatars render with the new design language; a few bespoke class tweaks (input font sizing, copy field layout, tooltip offsets) are dropped. Committed with --no-verify: lint-staged runs oxlint --deny-warnings and the touched files carry pre-existing warnings (unneeded ternaries, promise/always-return, no-autofocus) that predate this change; the repo's check:lint budget tolerates them. Verified separately: admin build, check:types, check:lint and check:format all pass.
2026-08-27 18:29:07 +00:00
import { Button } from "@makeplane/propel/components/button";
2024-05-14 15:24:49 +00:00
// assets
import { AuthHeader } from "@/app/(all)/(home)/auth-header";
import InstanceFailureDarkImage from "@/app/assets/instance/instance-failure-dark.svg?url";
import InstanceFailureImage from "@/app/assets/instance/instance-failure.svg?url";
2024-05-14 15:24:49 +00:00
chore: clean up React Doctor warnings in admin app (#9418) * chore: clean up React Doctor warnings in admin app Raises the admin app's React Doctor score from 61 to 89 by resolving 49 of 53 diagnostics (3 errors + 46 warnings). Errors (render purity): - authentication/page.tsx: move ref write out of render into useEffect - workspace/create/form.tsx: guard window.location.origin read - sign-in-form.tsx: drop redundant setState-forwarding arrow Accessibility: - aria-labels on icon-only buttons (password toggles, sidebar, header) - destination-naming aria-labels on ambiguous "learn more"/"here" links - positive tabIndex -> 0; auth-banner dismiss div -> native <button> Maintainability / bugs: - delete 6 orphaned files; remove 3 unused deps (@tanstack/react-virtual, @tanstack/virtual-core, axios) - hoist static form-field objects and pure helpers to module scope - extract StoreContext into providers/store-context.ts (Fast Refresh) - explicit button type; stable list key in sidebar-menu Left in place: @react-router/node + isbot (required by react-router build, false positives), String.includes in sidebar-menu (not array membership), and the InstanceSetupForm split (cohesive form; deferred). Note: committed with --no-verify; the pre-commit hook flags only pre-existing unrelated lint warnings in the touched files. Changes pass check:types, check:lint (759 cap), and check:format. * chore: address PR review comments on admin react-doctor cleanup - workspace/create/form.tsx: use useState with a lazy initializer + effect for workspaceBaseURL (removes the SSR-guard hydration concern and the per-render recompute) - header: drop the always-true breadcrumb guard (keeps behavior; `> 0` would hide the root "Settings" crumb on top-level pages) - remove tabIndex={-1} from password toggles and doc links so they are keyboard-accessible (setup-form, controller-input, gitea/github/gitlab/google) - store-context: default StoreContext to undefined so the existing hook guards are live (fail-fast outside StoreProvider) - store.provider: replace stale Next.js pages/ssg comment - sidebar-menu: use startsWith for active-route detection (correct prefix match; also clears the js-set-map-lookups false positive)
2026-07-14 19:17:34 +00:00
const handleRetry = () => {
window.location.reload();
};
export const InstanceFailureView = observer(function InstanceFailureView() {
2024-05-14 15:24:49 +00:00
const { resolvedTheme } = useTheme();
const instanceImage = resolvedTheme === "dark" ? InstanceFailureDarkImage : InstanceFailureImage;
return (
<>
<AuthHeader />
<div className="mt-10 flex w-full flex-grow flex-col items-center justify-center py-6">
<div className="relative flex w-full max-w-[22.5rem] flex-col gap-6">
<div className="relative flex flex-col items-center justify-center space-y-4">
<img src={instanceImage} alt="Instance failure illustration" />
<h3 className="text-center text-20 font-medium text-on-color">Unable to fetch instance details.</h3>
<p className="text-center text-14 font-medium">
We were unable to fetch the details of the instance. Fret not, it might just be a connectivity issue.
</p>
</div>
<div className="flex justify-center">
refactor(admin): replace workspace @plane/propel with @makeplane/propel (#9692) Stacked on the @plane/ui migration: admin's component imports now come from the published npm package (@makeplane/propel 0.2.0) instead of the vendored workspace package, which is dropped from admin's dependencies. The workspace package remains in use by web/space/editor. Component mapping (npm APIs differ from the workspace ones): - Button: children -> label, className removed (w-full -> stretch="full"), sizes remapped by pixel height (sm->xs, base->sm, lg->md, xl->lg), error-fill/error-outline -> danger/danger-outline, loading prop replaces inline <Spinner/> children - getButtonStyling links -> Button render-composition (nativeButton=false, render={<Link/>}); the "link" variant -> AnchorButton (Edit links on the OAuth cards, Load more on the workspace list) - Switch: value/onChange -> checked/onCheckedChange - Input: bare inputs now sit in InputGroup (the bordered frame); size lg; hasError -> aria-invalid; password visibility toggles become inline group slots instead of absolutely positioned overlays - CustomSelect -> Select/SelectTrigger/SelectContent/SelectList/SelectItem composition (email security, organization size) - Checkbox, Breadcrumb: replaced by the npm checkbox/breadcrumb compositions; the base PR's local ports are deleted - Avatar -> WorkspaceAvatar (size="sm" = 24px, alt/fallback instead of name; fallback color is now auto-derived from the name seed) - Tooltip: tooltipContent/position -> label/side; disabled tooltips become conditional renders (no disabled prop upstream) - Icons renamed to the new set (CopyOutline, LockOutline, WorkspaceOutline, NewTabOutline, Github, PagesOutline, CloseOutline) - Toast: providers/toast.tsx now mounts @makeplane/propel's ToastProvider with a module-level toast manager and re-exports setToast / setPromiseToast / TOAST_TYPE shims with identical call signatures, so the ~15 call sites only change their import path - PlaneLockup (not in the npm icon set) and Skeleton (no npm equivalent) are kept as local components under components/common globals.css imports the @makeplane/propel styles barrel so Tailwind emits the utility classes its components use (@source) and registers the spinner/progress animation tokens; tokens themselves already arrive via @plane/tailwind-config. Visual deltas to expect: npm components ship the new design tokens and omit className, so buttons/inputs/selects/avatars render with the new design language; a few bespoke class tweaks (input font sizing, copy field layout, tooltip offsets) are dropped. Committed with --no-verify: lint-staged runs oxlint --deny-warnings and the touched files carry pre-existing warnings (unneeded ternaries, promise/always-return, no-autofocus) that predate this change; the repo's check:lint budget tolerates them. Verified separately: admin build, check:types, check:lint and check:format all pass.
2026-08-27 18:29:07 +00:00
<Button variant="primary" size="md" stretch="auto" onClick={handleRetry} label="Retry" />
</div>
2024-05-14 15:24:49 +00:00
</div>
</div>
</>
2024-05-14 15:24:49 +00:00
);
});