debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Sources] style the debuggee domain

Open jasonLaster opened this issue 9 years ago • 8 comments

It would be awesome if we could highlight the debuggee domain.

diff --git a/src/components/PrimaryPanes/SourcesTree.js b/src/components/PrimaryPanes/SourcesTree.js
index 151a774..1fb1f78 100644
--- a/src/components/PrimaryPanes/SourcesTree.js
+++ b/src/components/PrimaryPanes/SourcesTree.js
@@ -21,9 +21,11 @@ import {
   sortEntireTree,
   collapseTree,
   createTree,
-  getDirectories
+  getDirectories,
+  getUrl
 } from "../../utils/sources-tree";

+
 import ManagedTree from "../shared/ManagedTree";

 import actions from "../../actions";
@@ -230,9 +232,16 @@ class SourcesTree extends Component {
           : "paddingRight";
     }

+    const isDebuggeeDomain = getUrl(this.props.debuggeeUrl) ....
+    // we'll likely want to just look at the HOST because we only
+    // want to style the domain and not everything in the domain directory
+
     return (
       <div
-        className={classnames("node", { focused })}
+        className={classnames("node", {
+          focused,
+          debuggee: isDebuggee
+        })}
         style={{ [paddingDir]: `${depth * 15}px` }}
         key={item.path}

jasonLaster avatar Oct 03 '17 17:10 jasonLaster

/claim

svitlana-galianova avatar Oct 03 '17 18:10 svitlana-galianova

Thanks for claiming the issue! :wave:

Here are some link for getting setup, contributing, and development tips. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Oct 03 '17 18:10 claim

Hey @svitlana-galianova how's it going?

jasonLaster avatar Oct 13 '17 18:10 jasonLaster

Hello @jasonLaster I am setting up a testing environment. Had some fun figuring how to make debugger run and make Firefox listen to the right port

svitlana-galianova avatar Oct 14 '17 00:10 svitlana-galianova

@jasonLaster The code has been modified a bit and it's different from the one in the issue description. I have tried different things, but I feel like without understanding which domain is debuggee, I will be stuck in the same place for a while.

Is using "focusedItem" state property a good idea to determine which domain is debuggee or maybe "highlightItems"? From every property I saw in the code, I feel like those two are the most suitable.

svitlana-galianova avatar Oct 19 '17 20:10 svitlana-galianova

Hi @svitlana-galianova!

thanks for reaching out, the debuggee url is here

so you should be able to get it w/ this.props.debuggeeUrl :)

jasonLaster avatar Oct 19 '17 21:10 jasonLaster

Hi @svitlana-galianova !

I like this change... it's a subtle way to see where you are in a larger project. If you don't mind, I think you could make a couple small changes to take advantage of the getURL utility already in the project.

The getURL utility would be added here. The function lives in the utils/sources-tree folder if you want to check it out, but you should only need to call it like the other utils.

By doing that, you should be able to to do something like const isDebugeeDomain = getURL(this.props.debuggeeUrl) here, which will then make your comparison for the class to item.name much simpler.

For the CSS, I would recommend moving it to the Sources.css since this is really more about the tree than the svg. I did the exact same thing yesterday for PR I am working on :)

Does that make sense? Keep up the great work!

tohmjudson avatar Oct 20 '17 15:10 tohmjudson

@tohmjudson Thank you for your suggestion! I have used "debuggeeUrl contains name" logic, so it wasn't that hard and I wasn't parsing it by myself

svitlana-galianova avatar Oct 21 '17 22:10 svitlana-galianova