mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-03 05:45:55 +09:00
Added following attributes to html element - data-ws-project - data-ws-last-published This should help debugging issues and webstudio discoverability <img width="851" alt="image" src="https://github.com/user-attachments/assets/a4572070-a6da-40ec-88cd-308ab7f7d22f" />
40 lines
993 B
TypeScript
40 lines
993 B
TypeScript
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
|
|
import { Links, Meta, Outlet, useMatches } from "react-router";
|
|
// @todo think about how to make __generated__ typeable
|
|
// @ts-ignore
|
|
import { CustomCode, projectId, lastPublished } from "./__generated__/_index";
|
|
|
|
const Root = () => {
|
|
// Get language from matches
|
|
const matches = useMatches();
|
|
|
|
const lastMatchWithLanguage = matches.findLast((match) => {
|
|
// @ts-ignore
|
|
const language = match?.data?.pageMeta?.language;
|
|
return language != null;
|
|
});
|
|
|
|
// @ts-ignore
|
|
const lang = lastMatchWithLanguage?.data?.pageMeta?.language ?? "en";
|
|
|
|
return (
|
|
<html
|
|
lang={lang}
|
|
data-ws-project={projectId}
|
|
data-ws-last-published={lastPublished}
|
|
>
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<Meta />
|
|
<Links />
|
|
<CustomCode />
|
|
</head>
|
|
<Outlet />
|
|
</html>
|
|
);
|
|
};
|
|
|
|
export default Root;
|