Open rafaelramalho19 opened 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!
Anchoring lines is basically this: https://dl.dropboxusercontent.com/s/8ktc1s8zzm5zhr8/x7R0ln4MaI.mp4
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.
As for the copy line/all button, are there any examples elsewhere in the wild that you're a fan of?
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:
I also like this example: https://www.dannyguo.com/blog/how-to-add-copy-to-clipboard-buttons-to-code-blocks-in-hugo/
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:
Web UI/desktop config file:
ProtoSchool:
IPFS Docs:
Keeping the above in mind, weâd need a solution that would enable us to do the following:
This could take the following forms:
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.
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:
$
prefix automatically so we don't visually pollute the codeCons:
#
prefix ?)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.
Nice, do you have any links/relevant info to that reusable pattern library discussion?
@rafaelramalho19 prior discussions see issues linked by @jessicaschilling in https://github.com/ipfs/ipfs-gui/issues/29#issuecomment-610051958
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