Skip to content

feat: Refresh design, use latest ManyJs#4

Merged
stanleyjones merged 4 commits intoliftedinit:mainfrom
stanleyjones:update
Nov 29, 2022
Merged

feat: Refresh design, use latest ManyJs#4
stanleyjones merged 4 commits intoliftedinit:mainfrom
stanleyjones:update

Conversation

@stanleyjones
Copy link
Copy Markdown
Contributor

@stanleyjones stanleyjones commented Nov 21, 2022

Description

Kaylee is starting to be useful again, so this PR resurrects it so we can use it to diagnose network requests.

  • Use latest ManyJS
  • Use new shared UI library
  • Update to latest React, Webpack, etc. (so we know how to update Alberto and Gwen too)
  • Use Lifted logo instead of L1
  • Poll network for attribute information, show status (future)

Related Issue

Nothing yet, but relates to the "Allow frontends to connect to arbitrary backends by URL" story that @tysloan is still getting ready.

Screenshots (if applicable)

OLD KAYLEE

Screenshot 2022-11-21 at 3 57 28 PM

NEW KAYLEE

Screenshot 2022-11-21 at 3 51 08 PM

@stanleyjones stanleyjones self-assigned this Nov 21, 2022
Comment thread .nvmrc
@@ -0,0 +1 @@
18.12.1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use current Node LTS.

Comment thread config-overrides.js
Comment on lines +12 to +13
buffer: require.resolve("buffer"),
stream: require.resolve("stream-browserify"),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest Webpack (5+) no longer includes Node polyfills by default, so we have to add them here. We'll need to do this in Alberto and Gwen eventually.

Comment thread config-overrides.js
config.plugins.push(
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell the browser that we mean Node's Buffer if it's not defined.

Comment thread package.json
Comment on lines +6 to +7
"@liftedinit/many-js": "^0.1.0-alpha.5",
"@liftedinit/ui": "github:liftedinit/lifted-ui",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the latest libraries from Lifted.

Comment thread package.json
"@liftedinit/ui": "github:liftedinit/lifted-ui",
"buffer": "^6.0.3",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React App Rewired allows us to modify Webpack (see config-overrides.js above) without ejecting from Create React App.

</form>
</Section>
<Box bg="white" p={6}>
<Heading>Network</Heading>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for networks. We can eventually use the dropdown here.

Comment on lines +36 to +50
React.useEffect(() => {
async function convertMsg(msg: Msg) {
const cose = await msg?.toCoseMessage(id);
setHex(cose.toCborData().toString("hex"));
}
msg && convertMsg(msg);
}, [id, msg]);

React.useEffect(() => {
function hexToJson(hex: string) {
const cose = Msg.fromCborData(Buffer.from(hex, "hex"));
setJson(cose.toString());
}
hex && hexToJson(hex);
}, [hex]);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can generate a message from the form or paste hex in directly. Either way will be parsed into the JSON view and set the pending request.

</TabPanel>
<TabPanel>
<pre style={{ whiteSpace: "pre-wrap" }}>
{res && Msg.fromCborData(Buffer.from(res, "hex")).toString()}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't like how we're parsing the response into JSON here. I want to do something that's fully recursive so anything that looks like CBOR gets processed and replaced. But this works for now.

Comment thread src/index.tsx
@@ -1,10 +1,14 @@
import React from "react";
import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now React 18 compliant.

Comment thread tsconfig.json
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es2015"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change in this file is targeting es2015 instead of es5. The rest is sorting.

@stanleyjones stanleyjones marked this pull request as ready for review November 22, 2022 20:20
@stanleyjones stanleyjones added the enhancement New feature or request label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants