ipfs / ipfs-gui

Creating standards and patterns for IPFS that are simple, accessible, reusable, and beautiful
105 stars 17 forks source link

Quick actions in shell component #89

Open rafaelramalho19 opened 4 years ago

rafaelramalho19 commented 4 years ago

We can add some quick actions to the shell component to further improve the UX.

My suggestiond would be:

More info on: https://github.com/ipfs-shipyard/ipfs-webui/pull/1487

jessicaschilling commented 4 years ago

@rafaelramalho19 I'm not quite sure what you mean by "anchor line" ... it sounds cool ;) but can you explain in a little more detail?

It sounds like we might just need an unobtrusive button with "two sides": copy whole shell contents, or copy line (or maybe copy selection; the user can triple-click to select whole line).

The next step is probably to assess Desktop and WebUI to see all the different locations where this button might potentially appear, so we can build a visual asset that fits well in as many of those locations as possible. If you get the time to do this before I do (have some other items on my plate right now), that would be awesome, or we can queue this up to work on later.

Also -- external contribution would be very welcome on this one!

rafaelramalho19 commented 4 years ago

Anchoring lines is basically this: https://dl.dropboxusercontent.com/s/8ktc1s8zzm5zhr8/x7R0ln4MaI.mp4

jessicaschilling commented 4 years ago

Aha! Got it. We've got an established visual pattern in the docs already that we might be able to bring over and have make sense: see https://docs-beta.ipfs.io/ and hover over any H2.

jessicaschilling commented 4 years ago

As for the copy line/all button, are there any examples elsewhere in the wild that you're a fan of?

rafaelramalho19 commented 4 years ago

I actually don't know examples of copy line, it was just a wild idea đŸ€·

The copy code exists in a lot of websites, one example is the one from github refined:

image

I also like this example: https://www.dannyguo.com/blog/how-to-add-copy-to-clipboard-buttons-to-code-blocks-in-hugo/

jessicaschilling commented 4 years ago

Adding some more examples of where we'd use this in the IPFS ecosystem, since a proposed fix would need to solve for all of these scenarios - we'd want this to be a reusable pattern at least visually, if not in code.

Web UI with daemon not started or CORS enabled: image

Web UI/desktop config file: image

ProtoSchool: image

IPFS Docs: image

Keeping the above in mind, we’d need a solution that would enable us to do the following:

This could take the following forms:

  1. An on-hover “copy line” option that appears, probably in the left margin
  2. A “copy all” option that appears (either persistently or on hover), probably in upper right of code block

However, we wouldn’t want both of these to appear in every instance — for example, having both “copy all” and “copy line” appear for a single-line code excerpt is overkill. And having “copy line” for a CLI feedback illustration (like “initializing daemon
”) doesn’t make any sense.

So that leaves us with either building in a bunch of logic to try to detect what does and doesn’t get what kind of copy option, or having to hand-code in what we specifically want to be copy-able. These both feel awkward. Thoughts welcome.

rafaelramalho19 commented 4 years ago

Maybe we should the current approach from:

<Shell className='mw6'>
  <code className='db'><b className='no-select'>$ </b>ipfs daemon</code>
  <code className='db'>Initializing daemon...</code>
  <code className='db'>API server listening on /ip4/127.0.0.1/tcp/5001</code>
</Shell>

to something like:

<Shell className='mw6'>
  <ShellCode>ipfs daemon</ShellCode>
  <ShellInfo>Initializing daemon...</ShellInfo>
  <ShellCode>API server listening on /ip4/127.0.0.1/tcp/5001</ShellCode>
</Shell>

Pros:

Cons:

jessicaschilling commented 4 years ago

I like the logic 😊 Would welcome @lidel’s comments too.

Maybe the shell component could be the first item in a reusable IPFS pattern library ... we started on that in the past but it didn’t gather momentum.

rafaelramalho19 commented 4 years ago

Nice, do you have any links/relevant info to that reusable pattern library discussion?

lidel commented 4 years ago

@rafaelramalho19 prior discussions see issues linked by @jessicaschilling in https://github.com/ipfs/ipfs-gui/issues/29#issuecomment-610051958