Skip to content

feat(candid): better UI for composite types#374

Merged
chenyan-dfinity merged 34 commits intomasterfrom
idl-ui
Mar 3, 2020
Merged

feat(candid): better UI for composite types#374
chenyan-dfinity merged 34 commits intomasterfrom
idl-ui

Conversation

@chenyan-dfinity
Copy link
Contributor

@chenyan-dfinity chenyan-dfinity commented Feb 12, 2020

It looks like this:
Screen Shot 2020-03-02 at 3 02 43 PM

@nomeata
Copy link
Contributor

nomeata commented Feb 18, 2020

Minor UX issue:
When I use a canister ID that does not exist or has no frontend included, then the error Error: An error happened while retrieving asset "candid.js". is only visible in the console, not on the page itself.

@chenyan-dfinity chenyan-dfinity marked this pull request as ready for review February 26, 2020 19:04
@chenyan-dfinity chenyan-dfinity requested a review from a team as a code owner February 26, 2020 19:04
})().catch(err => {
left.className += ' error';
left.innerText = err.name + ': ' + err.message;
left.innerText = err.stack;
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no err body here?

Copy link
Contributor Author

@chenyan-dfinity chenyan-dfinity Mar 3, 2020

Choose a reason for hiding this comment

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

stack includes everything. The error message and the call stack.


import * as IDL from './idl';
export { IDL };
import * as UI from './idl-ui';
Copy link
Contributor

Choose a reason for hiding this comment

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

This will break Node and TypeScript.

border: 1px solid #E5E5E5;
color: #545454;
font-family: sans-serif;
font-family: monospace;
Copy link
Contributor

Choose a reason for hiding this comment

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

no idea about this whole css section from me.

cc @hansl if you can take a look.

public visitType<T>(t: Type<T>, data: D): R {
throw new Error('Not implemented');
}
public visitPrimitive<T>(t: PrimitiveType<T>, data: D): R {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems a bit too manual? Any way to generate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hard work is done here. You don't need to implement all the visit functions, e.g. you can implement only the visitPrimitive function, because all the primitive types call visitPrimitive by default. See example from idl-ui.ts.

@hansl
Copy link
Contributor

hansl commented Mar 3, 2020

LGTM, we can get this in the release. You tested it manually?

@chenyan-dfinity
Copy link
Contributor Author

Yep, works locally.

@chenyan-dfinity chenyan-dfinity merged commit 31fab2f into master Mar 3, 2020
@chenyan-dfinity chenyan-dfinity deleted the idl-ui branch March 3, 2020 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants