diff --git a/experiments/modern/src/App.js b/experiments/modern/src/App.js
index 5c57440d..c81c3217 100644
--- a/experiments/modern/src/App.js
+++ b/experiments/modern/src/App.js
@@ -1,9 +1,26 @@
import React from "react";
import JSZip from "jszip";
import "./App.css";
-import { xml2js } from "xml-js";
import * as Utils from "./utils";
+const IGNORE_IDS = new Set([
+ // The maki script shows/hides these depending on which corner you are in
+ "main2",
+ "main3",
+ "main4",
+ "Title2",
+ "Title3",
+ "Title4",
+ "mask2",
+ "mask3",
+ "mask4",
+ // These need the maki script to get sized
+ "volumethumb",
+ "seekfull",
+ "seek1",
+ "Repeat",
+]);
+
const SkinContext = React.createContext(null);
async function getSkin() {
@@ -37,7 +54,11 @@ async function getSkin() {
}
}
}
- return images;
+
+ const player = await Utils.readXml(zip, "xml/player-normal.xml");
+ // Gross hack returing a tuple here. We're just doing some crazy stuff to get
+ // some data returned in the laziest way possible
+ return [player, images];
}
function Layout({
@@ -127,6 +148,38 @@ function ToggleButton(props) {
return ;
}
+const NODE_NAME_TO_COMPONENT = {
+ layout: Layout,
+ layer: Layer,
+ button: Button,
+ togglebutton: ToggleButton,
+};
+
+// Given a skin XML node, pick which component to use, and render it.
+function XmlNode({ node }) {
+ const attributes = node.attributes;
+ if (attributes && IGNORE_IDS.has(attributes.id)) {
+ return null;
+ }
+ if (node.name == null) {
+ // This is likely a comment
+ return null;
+ }
+ const Component = NODE_NAME_TO_COMPONENT[node.name];
+ if (Component == null) {
+ console.warn("Unknown node type", node.name);
+ return null;
+ }
+ const childNodes = node.children || [];
+ return (
+
| {key} | -
- {JSON.stringify(image, null, 2)}
- |
- {imgElement} | -