@@ -258,6 +258,7 @@ function buildUpdateFixture(fixture: CliOptions["fixture"], nowMs: number): Upda
258258const repoRoot = path . resolve ( path . dirname ( fileURLToPath ( import . meta. url ) ) , ".." ) ;
259259const uiRoot = path . join ( repoRoot , "ui" ) ;
260260const boardFixturePath = "/__fixtures/board/" ;
261+ const noticesFixturePath = "/__fixtures/notices/" ;
261262const boardFixtureHtml = `<!doctype html>
262263<html lang="en">
263264 <head>
@@ -300,6 +301,34 @@ const boardFixtureHtml = `<!doctype html>
300301 <script type="module" src="/src/test-helpers/board-fixture.ts"></script>
301302 </body>
302303</html>` ;
304+ const noticesFixtureHtml = `<!doctype html>
305+ <html lang="en">
306+ <head>
307+ <meta charset="UTF-8" />
308+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
309+ <meta name="color-scheme" content="dark light" />
310+ <title>OpenClaw Notice Inventory</title>
311+ <script>
312+ const requestedTheme = new URLSearchParams(location.search).get("theme");
313+ const mediaQuery = matchMedia("(prefers-color-scheme: light)");
314+ const applyTheme = () => {
315+ const mode = requestedTheme || (mediaQuery.matches ? "light" : "dark");
316+ document.documentElement.dataset.theme = mode;
317+ document.documentElement.dataset.themeMode = mode;
318+ document.documentElement.className = "wa-" + mode;
319+ document.documentElement.style.colorScheme = mode;
320+ };
321+ applyTheme();
322+ mediaQuery.addEventListener("change", applyTheme);
323+ </script>
324+ <link rel="stylesheet" href="/src/styles.css" />
325+ <style>body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }</style>
326+ </head>
327+ <body>
328+ <div id="app"></div>
329+ <script type="module" src="/src/test-helpers/notices-fixture.ts"></script>
330+ </body>
331+ </html>` ;
303332
304333function mockFileHash ( value : string ) : string {
305334 return createHash ( "sha256" ) . update ( value , "utf8" ) . digest ( "hex" ) ;
@@ -3205,6 +3234,24 @@ function createBoardFixturePlugin(): Plugin {
32053234 } ;
32063235}
32073236
3237+ function createNoticesFixturePlugin ( ) : Plugin {
3238+ return {
3239+ name : "openclaw-control-ui-notices-fixture" ,
3240+ configureServer ( server ) {
3241+ server . middlewares . use ( noticesFixturePath , ( _req , res , next ) => {
3242+ void server
3243+ . transformIndexHtml ( noticesFixturePath , noticesFixtureHtml )
3244+ . then ( ( html ) => {
3245+ res . statusCode = 200 ;
3246+ res . setHeader ( "content-type" , "text/html; charset=utf-8" ) ;
3247+ res . end ( html ) ;
3248+ } )
3249+ . catch ( ( error : unknown ) => next ( error as Error ) ) ;
3250+ } ) ;
3251+ } ,
3252+ } ;
3253+ }
3254+
32083255function hostForUrl ( boundAddress : string , requestedHost : string ) : string {
32093256 const host = boundAddress === "0.0.0.0" || boundAddress === "::" ? requestedHost : boundAddress ;
32103257 const reachableHost = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host ;
@@ -3259,7 +3306,11 @@ const server = await createServer({
32593306 : { } ) ,
32603307 include : [ "lit/directives/repeat.js" ] ,
32613308 } ,
3262- plugins : [ createMockGatewayPlugin ( scenario ) , createBoardFixturePlugin ( ) ] ,
3309+ plugins : [
3310+ createMockGatewayPlugin ( scenario ) ,
3311+ createBoardFixturePlugin ( ) ,
3312+ createNoticesFixturePlugin ( ) ,
3313+ ] ,
32633314 publicDir : path . join ( uiRoot , "public" ) ,
32643315 resolve : {
32653316 alias : [
@@ -3282,5 +3333,8 @@ console.log(`[control-ui-mock] ${resolveServerUrl(server, options.host)}`);
32823333console . log (
32833334 `[control-ui-mock] board fixture: ${ resolveServerUrl ( server , options . host , boardFixturePath ) } ` ,
32843335) ;
3336+ console . log (
3337+ `[control-ui-mock] notices fixture: ${ resolveServerUrl ( server , options . host , noticesFixturePath ) } ` ,
3338+ ) ;
32853339await waitForShutdown ( ) ;
32863340await server . close ( ) ;
0 commit comments