Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 16s
CodeQL / Analyze (python) (push) Failing after 3s
i18n sync check / check:sync (push) Failing after 3s
React Doctor / react-doctor (push) Failing after 16s
Branch Build CE / Build-Push Admin Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Admin Manifest (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Web Manifest (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Proxy Manifest (push) Has been cancelled
Branch Build CE / Merge Space Manifest (push) Has been cancelled
Branch Build CE / Prepare AIO Assets (push) Has been cancelled
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge Live Collaboration Manifest (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge API Server Manifest (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (${{ matrix.arch }}) (push) Has been cancelled
Branch Build CE / Merge AIO Manifest (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
139 lines
5.5 KiB
TypeScript
139 lines
5.5 KiB
TypeScript
/**
|
|
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
import type { ReactNode } from "react";
|
|
import { Links, Meta, Outlet, Scripts } from "react-router";
|
|
import type { LinksFunction } from "react-router";
|
|
import { ThemeProvider, useTheme } from "next-themes";
|
|
// plane imports
|
|
import { SITE_DESCRIPTION, SITE_NAME } from "@plane/constants";
|
|
// types
|
|
// assets
|
|
import favicon16 from "@/app/assets/favicon/favicon-16x16.png?url";
|
|
import favicon32 from "@/app/assets/favicon/favicon-32x32.png?url";
|
|
import faviconIco from "@/app/assets/favicon/favicon.ico?url";
|
|
import icon180 from "@/app/assets/icons/icon-180x180.png?url";
|
|
import icon512 from "@/app/assets/icons/icon-512x512.png?url";
|
|
import ogImage from "@/app/assets/og-image.png?url";
|
|
import globalStyles from "@/styles/globals.css?url";
|
|
import type { Route } from "./+types/root";
|
|
// components
|
|
import { LogoSpinner } from "@/components/common/logo-spinner";
|
|
// lib
|
|
import { isStaleAssetError, recoverFromStaleAsset } from "@/lib/stale-asset-error";
|
|
// local
|
|
import { CustomErrorComponent } from "./error";
|
|
// fonts
|
|
import "@fontsource-variable/inter";
|
|
import interVariableWoff2 from "@fontsource-variable/inter/files/inter-latin-wght-normal.woff2?url";
|
|
import "@fontsource/material-symbols-rounded";
|
|
import "@fontsource/ibm-plex-mono";
|
|
|
|
const APP_TITLE = "Plane | Simple, extensible, open-source project management tool.";
|
|
|
|
export const links: LinksFunction = () => [
|
|
{ rel: "icon", type: "image/png", sizes: "32x32", href: favicon32 },
|
|
{ rel: "icon", type: "image/png", sizes: "16x16", href: favicon16 },
|
|
{ rel: "shortcut icon", href: faviconIco },
|
|
{ rel: "manifest", href: "/site.webmanifest.json" },
|
|
{ rel: "apple-touch-icon", href: icon512 },
|
|
{ rel: "apple-touch-icon", sizes: "180x180", href: icon180 },
|
|
{ rel: "apple-touch-icon", sizes: "512x512", href: icon512 },
|
|
{ rel: "manifest", href: "/manifest.json" },
|
|
{ rel: "stylesheet", href: globalStyles },
|
|
{
|
|
rel: "preload",
|
|
href: interVariableWoff2,
|
|
as: "font",
|
|
type: "font/woff2",
|
|
crossOrigin: "anonymous",
|
|
},
|
|
];
|
|
|
|
export function Layout({ children }: { children: ReactNode }) {
|
|
return (
|
|
<html lang="en" suppressHydrationWarning>
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<meta name="theme-color" content="#fff" />
|
|
{/* Meta info for PWA */}
|
|
<meta name="application-name" content="Plane" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
|
<meta name="apple-mobile-web-app-title" content={SITE_NAME} />
|
|
<meta name="format-detection" content="telephone=no" />
|
|
<meta name="mobile-web-app-capable" content="yes" />
|
|
<Meta />
|
|
<Links />
|
|
</head>
|
|
<body suppressHydrationWarning>
|
|
<div id="context-menu-portal" />
|
|
<div id="editor-portal" />
|
|
<ThemeProvider themes={["light", "dark", "light-contrast", "dark-contrast", "custom"]} defaultTheme="system">
|
|
{children}
|
|
</ThemeProvider>
|
|
<Scripts />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
export const meta: Route.MetaFunction = () => [
|
|
{ title: APP_TITLE },
|
|
{ name: "description", content: SITE_DESCRIPTION },
|
|
{ property: "og:title", content: APP_TITLE },
|
|
{
|
|
property: "og:description",
|
|
content: "Open-source project management tool to manage work items, cycles, and product roadmaps easily",
|
|
},
|
|
{ property: "og:url", content: "https://app.plane.so/" },
|
|
{ property: "og:image", content: ogImage },
|
|
{ property: "og:image:width", content: "1200" },
|
|
{ property: "og:image:height", content: "630" },
|
|
{ property: "og:image:alt", content: "Plane - Modern project management" },
|
|
{
|
|
name: "keywords",
|
|
content:
|
|
"software development, plan, ship, software, accelerate, code management, release management, project management, work item tracking, agile, scrum, kanban, collaboration",
|
|
},
|
|
{ name: "twitter:site", content: "@planepowers" },
|
|
{ name: "twitter:card", content: "summary_large_image" },
|
|
{ name: "twitter:image", content: ogImage },
|
|
{ name: "twitter:image:width", content: "1200" },
|
|
{ name: "twitter:image:height", content: "630" },
|
|
{ name: "twitter:image:alt", content: "Plane - Modern project management" },
|
|
];
|
|
|
|
// Root stays shell-thin: in SPA mode React Router server-builds only the root route, so
|
|
// everything imported here is evaluated in Node just to prerender the fallback index.html.
|
|
// Providers, the store layer, and app chrome belong in app/layout.tsx — never import them here.
|
|
export default function Root() {
|
|
return <Outlet />;
|
|
}
|
|
|
|
export function HydrateFallback() {
|
|
const { resolvedTheme } = useTheme();
|
|
|
|
// if we are on the server or the theme is not resolved, return an empty div
|
|
if (typeof window === "undefined" || resolvedTheme === undefined) return <div />;
|
|
|
|
return (
|
|
<div className="relative flex h-screen w-full items-center justify-center bg-canvas">
|
|
<LogoSpinner />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
// A stale chunk failure surfaces here as React Router's own wrapper error
|
|
// (the failed dynamic import itself never reaches a window event) — recover
|
|
// the same way entry.client.tsx does instead of just showing the error page.
|
|
if (import.meta.env.PROD && isStaleAssetError(error)) recoverFromStaleAsset();
|
|
|
|
return <CustomErrorComponent error={error} />;
|
|
}
|