From 5ab176d4860fa72a45f499ebfe85f40124c91c88 Mon Sep 17 00:00:00 2001 From: Oksamies Date: Fri, 24 May 2024 15:57:58 +0300 Subject: [PATCH] Add usage of DynamiHTML in remix --- apps/cyberstorm-remix/app/root.tsx | 32 ++++++++++++++++++- .../cyberstorm/utils/utils.ts | 28 ++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 apps/cyberstorm-remix/cyberstorm/utils/utils.ts diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index acbf54a01..100a066ce 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -23,6 +23,7 @@ import { LinkingProvider } from "@thunderstore/cyberstorm"; import { DapperTs } from "@thunderstore/dapper-ts"; import { CurrentUser } from "@thunderstore/dapper/types"; import { getDapper } from "cyberstorm/dapper/sessionUtils"; +import { replaceDjangoUnicode } from "cyberstorm/utils/utils"; import { captureRemixErrorBoundaryError, withSentry } from "@sentry/remix"; @@ -62,6 +63,12 @@ export async function loader() { }, }, currentUser: await dapper.getCurrentUser(), + // dynamicHeaders: await dapper.getDynamicHTML("cyberstorm_content_left"), + dynamicBodyBeginning: await dapper.getDynamicHTML( + "cyberstorm_body_beginning" + ), + // dynamicLeftColumn: await dapper.getDynamicHTML("cyberstorm_header"), + // dynamicRightColumn: await dapper.getDynamicHTML("cyberstorm_content_right"), }; } @@ -77,6 +84,12 @@ export async function clientLoader() { }, }, currentUser: await dapper.getCurrentUser(), + // dynamicHeader: await dapper.getDynamicHTML("cyberstorm_content_left"), + dynamicBodyBeginning: await dapper.getDynamicHTML( + "cyberstorm_body_beginning" + ), + // dynamicLeftColumn: await dapper.getDynamicHTML("cyberstorm_header"), + // dynamicRightColumn: await dapper.getDynamicHTML("cyberstorm_content_right"), }; } @@ -95,7 +108,16 @@ function Root() { }; sessionId: string | null; currentUser: CurrentUser; + // dynamicHeader: string[]; + dynamicBodyBeginning: string[]; + // dynamicLeftColumn: string[]; + // dynamicRightColumn: string[]; } = JSON.parse(JSON.stringify(loaderOutput)); + console.log( + parsedLoaderOutput.dynamicBodyBeginning.map((dhtml) => + replaceDjangoUnicode(dhtml) + ) + ); return ( @@ -104,6 +126,7 @@ function Root() { + {/* {parsedLoaderOutput.dynamicHeader} */} @@ -116,7 +139,14 @@ function Root() { /> {/* REMIX TODO: This Ads script seem to break hydration for styles in the head. */} - {/*