Skip to content

Commit 839b56d

Browse files
authored
Merge pull request #10 from CourageWolf/main
Reconfigured auto-highlight feature onhover of component map
2 parents 3970662 + 044d06e commit 839b56d

File tree

3 files changed

+270
-22
lines changed

3 files changed

+270
-22
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import { onHover, onHoverExit } from '../actions/actions';
1818
import { useStoreContext } from '../store';
1919

2020
const root = hierarchy({
21-
name: 'root',
21+
name: "root",
2222
children: [
23-
{ name: 'child #1' },
23+
{ name: "child #1" },
2424
{
25-
name: 'child #2',
25+
name: "child #2",
2626
children: [
27-
{ name: 'grandchild #1' },
28-
{ name: 'grandchild #2' },
29-
{ name: 'grandchild #3' },
27+
{ name: "grandchild #1" },
28+
{ name: "grandchild #2" },
29+
{ name: "grandchild #3" },
3030
],
3131
},
3232
],
@@ -61,9 +61,9 @@ export default function ComponentMap({
6161
const data: {} = snapshots[lastNode];
6262

6363
// importing custom hooks for the selection tabs.
64-
const [layout, setLayout] = useState('cartesian');
65-
const [orientation, setOrientation] = useState('horizontal');
66-
const [linkType, setLinkType] = useState('diagonal');
64+
const [layout, setLayout] = useState("cartesian");
65+
const [orientation, setOrientation] = useState("horizontal");
66+
const [linkType, setLinkType] = useState("diagonal");
6767
const [stepPercent, setStepPercent] = useState(10);
6868

6969
// Declared this variable and assigned it to the useForceUpdate function that forces a state to change causing that component to re-render and display on the map
@@ -79,7 +79,7 @@ export default function ComponentMap({
7979

8080
// This sets the starting position for the root node on the maps display. the polar layout sets the root node to the relative center of the display box based on the size of the browser window.
8181
// the else conditional statements determines the root nodes location either in the left middle or top middle of the browser window relative to the size of the browser.
82-
if (layout === 'polar') {
82+
if (layout === "polar") {
8383
origin = {
8484
x: innerWidth / 2,
8585
y: innerHeight / 2,
@@ -88,7 +88,7 @@ export default function ComponentMap({
8888
sizeHeight = Math.min(innerWidth, innerHeight) / 2;
8989
} else {
9090
origin = { x: 0, y: 0 };
91-
if (orientation === 'vertical') {
91+
if (orientation === "vertical") {
9292
sizeWidth = innerWidth;
9393
sizeHeight = innerHeight;
9494
} else {
@@ -176,11 +176,11 @@ export default function ComponentMap({
176176

177177
let top: number;
178178
let left: number;
179-
if (layout === 'polar') {
179+
if (layout === "polar") {
180180
const [radialX, radialY] = pointRadial(node.x, node.y);
181181
top = radialY;
182182
left = radialX;
183-
} else if (orientation === 'vertical') {
183+
} else if (orientation === "vertical") {
184184
top = node.y;
185185
left = node.x;
186186
} else {
@@ -226,10 +226,10 @@ export default function ComponentMap({
226226
width={width}
227227
y={-height / 2}
228228
x={-width / 2}
229-
fill={node.children ? '#161521' : '#62d6fb'}
230-
stroke={node.children ? '#62d6fb' : '#161521'}
229+
fill={node.children ? "#161521" : "#62d6fb"}
230+
stroke={node.children ? "#62d6fb" : "#161521"}
231231
strokeWidth={1}
232-
strokeDasharray={node.children ? '0' : '2,2'}
232+
strokeDasharray={node.children ? "0" : "2,2"}
233233
strokeOpacity="1"
234234
rx={node.children ? 4 : 10}
235235
onClick={() => {
@@ -240,6 +240,8 @@ export default function ComponentMap({
240240
//test feature
241241
onMouseOver={handleMouseOver}
242242
onMouseOut={hideTooltip}
243+
onMouseEnter={() => dispatch(onHover(node.data.rtid))}
244+
onMouseLeave={() => dispatch(onHoverExit(node.data.rtid))}
243245
/>
244246
)}
245247
{/* Display text inside of each component node */}
@@ -248,13 +250,13 @@ export default function ComponentMap({
248250
fontSize={10}
249251
fontFamily="Roboto"
250252
textAnchor="middle"
251-
style={{ pointerEvents: 'none' }}
253+
style={{ pointerEvents: "none" }}
252254
fill={
253255
node.depth === 0
254-
? '#161521'
256+
? "#161521"
255257
: node.children
256-
? 'white'
257-
: '#161521'
258+
? "white"
259+
: "#161521"
258260
}
259261
>
260262
{node.data.name}

src/app/components/StateRoute.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ const StateRoute = (props: StateRouteProps) => {
162162
>
163163
Tree
164164
</NavLink>
165-
166165
{isRecoil && (
167166
<NavLink
168167
className="router-link"
@@ -172,7 +171,6 @@ const StateRoute = (props: StateRouteProps) => {
172171
AtomsRecoil
173172
</NavLink>
174173
)}
175-
176174
</div>
177175
<Switch>
178176
<Route path="/map" render={renderComponentMap} />

ter main

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
2+
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
3+
4+
Commands marked with * may be preceded by a number, _N.
5+
Notes in parentheses indicate the behavior if _N is given.
6+
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
7+
8+
h H Display this help.
9+
q :q Q :Q ZZ Exit.
10+
---------------------------------------------------------------------------
11+
12+
MMOOVVIINNGG
13+
14+
e ^E j ^N CR * Forward one line (or _N lines).
15+
y ^Y k ^K ^P * Backward one line (or _N lines).
16+
f ^F ^V SPACE * Forward one window (or _N lines).
17+
b ^B ESC-v * Backward one window (or _N lines).
18+
z * Forward one window (and set window to _N).
19+
w * Backward one window (and set window to _N).
20+
ESC-SPACE * Forward one window, but don't stop at end-of-file.
21+
d ^D * Forward one half-window (and set half-window to _N).
22+
u ^U * Backward one half-window (and set half-window to _N).
23+
ESC-) RightArrow * Right one half screen width (or _N positions).
24+
ESC-( LeftArrow * Left one half screen width (or _N positions).
25+
ESC-} ^RightArrow Right to last column displayed.
26+
ESC-{ ^LeftArrow Left to first column.
27+
F Forward forever; like "tail -f".
28+
ESC-F Like F but stop when search pattern is found.
29+
r ^R ^L Repaint screen.
30+
R Repaint screen, discarding buffered input.
31+
---------------------------------------------------
32+
Default "window" is the screen height.
33+
Default "half-window" is half of the screen height.
34+
---------------------------------------------------------------------------
35+
36+
SSEEAARRCCHHIINNGG
37+
38+
/_p_a_t_t_e_r_n * Search forward for (_N-th) matching line.
39+
?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line.
40+
n * Repeat previous search (for _N-th occurrence).
41+
N * Repeat previous search in reverse direction.
42+
ESC-n * Repeat previous search, spanning files.
43+
ESC-N * Repeat previous search, reverse dir. & spanning files.
44+
ESC-u Undo (toggle) search highlighting.
45+
&_p_a_t_t_e_r_n * Display only matching lines
46+
---------------------------------------------------
47+
A search pattern may begin with one or more of:
48+
^N or ! Search for NON-matching lines.
49+
^E or * Search multiple files (pass thru END OF FILE).
50+
^F or @ Start search at FIRST file (for /) or last file (for ?).
51+
^K Highlight matches, but don't move (KEEP position).
52+
^R Don't use REGULAR EXPRESSIONS.
53+
---------------------------------------------------------------------------
54+
55+
JJUUMMPPIINNGG
56+
57+
g < ESC-< * Go to first line in file (or line _N).
58+
G > ESC-> * Go to last line in file (or line _N).
59+
p % * Go to beginning of file (or _N percent into file).
60+
t * Go to the (_N-th) next tag.
61+
T * Go to the (_N-th) previous tag.
62+
{ ( [ * Find close bracket } ) ].
63+
} ) ] * Find open bracket { ( [.
64+
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
65+
ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>
66+
---------------------------------------------------
67+
Each "find close bracket" command goes forward to the close bracket
68+
matching the (_N-th) open bracket in the top line.
69+
Each "find open bracket" command goes backward to the open bracket
70+
matching the (_N-th) close bracket in the bottom line.
71+
72+
m_<_l_e_t_t_e_r_> Mark the current top line with <letter>.
73+
M_<_l_e_t_t_e_r_> Mark the current bottom line with <letter>.
74+
'_<_l_e_t_t_e_r_> Go to a previously marked position.
75+
'' Go to the previous position.
76+
^X^X Same as '.
77+
ESC-M_<_l_e_t_t_e_r_> Clear a mark.
78+
---------------------------------------------------
79+
A mark is any upper-case or lower-case letter.
80+
Certain marks are predefined:
81+
^ means beginning of the file
82+
$ means end of the file
83+
---------------------------------------------------------------------------
84+
85+
CCHHAANNGGIINNGG FFIILLEESS
86+
87+
:e [_f_i_l_e] Examine a new file.
88+
^X^V Same as :e.
89+
:n * Examine the (_N-th) next file from the command line.
90+
:p * Examine the (_N-th) previous file from the command line.
91+
:x * Examine the first (or _N-th) file from the command line.
92+
:d Delete the current file from the command line list.
93+
= ^G :f Print current file name.
94+
---------------------------------------------------------------------------
95+
96+
MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
97+
98+
-_<_f_l_a_g_> Toggle a command line option [see OPTIONS below].
99+
--_<_n_a_m_e_> Toggle a command line option, by name.
100+
__<_f_l_a_g_> Display the setting of a command line option.
101+
___<_n_a_m_e_> Display the setting of an option, by name.
102+
+_c_m_d Execute the less cmd each time a new file is examined.
103+
104+
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
105+
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
106+
s _f_i_l_e Save input to a file.
107+
v Edit the current file with $VISUAL or $EDITOR.
108+
V Print version number of "less".
109+
---------------------------------------------------------------------------
110+
111+
OOPPTTIIOONNSS
112+
113+
Most options may be changed either on the command line,
114+
or from within less by using the - or -- command.
115+
Options may be given in one of two forms: either a single
116+
character preceded by a -, or a name preceded by --.
117+
118+
-? ........ --help
119+
Display help (from command line).
120+
-a ........ --search-skip-screen
121+
Search skips current screen.
122+
-A ........ --SEARCH-SKIP-SCREEN
123+
Search starts just after target line.
124+
-b [_N] .... --buffers=[_N]
125+
Number of buffers.
126+
-B ........ --auto-buffers
127+
Don't automatically allocate buffers for pipes.
128+
-c ........ --clear-screen
129+
Repaint by clearing rather than scrolling.
130+
-d ........ --dumb
131+
Dumb terminal.
132+
-D [_x_n_._n] . --color=_x_n_._n
133+
Set screen colors. (MS-DOS only)
134+
-e -E .... --quit-at-eof --QUIT-AT-EOF
135+
Quit at end of file.
136+
-f ........ --force
137+
Force open non-regular files.
138+
-F ........ --quit-if-one-screen
139+
Quit if entire file fits on first screen.
140+
-g ........ --hilite-search
141+
Highlight only last match for searches.
142+
-G ........ --HILITE-SEARCH
143+
Don't highlight any matches for searches.
144+
-h [_N] .... --max-back-scroll=[_N]
145+
Backward scroll limit.
146+
-i ........ --ignore-case
147+
Ignore case in searches that do not contain uppercase.
148+
-I ........ --IGNORE-CASE
149+
Ignore case in all searches.
150+
-j [_N] .... --jump-target=[_N]
151+
Screen position of target lines.
152+
-J ........ --status-column
153+
Display a status column at left edge of screen.
154+
-k [_f_i_l_e] . --lesskey-file=[_f_i_l_e]
155+
Use a lesskey file.
156+
-K ........ --quit-on-intr
157+
Exit less in response to ctrl-C.
158+
-L ........ --no-lessopen
159+
Ignore the LESSOPEN environment variable.
160+
-m -M .... --long-prompt --LONG-PROMPT
161+
Set prompt style.
162+
-n -N .... --line-numbers --LINE-NUMBERS
163+
Don't use line numbers.
164+
-o [_f_i_l_e] . --log-file=[_f_i_l_e]
165+
Copy to log file (standard input only).
166+
-O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e]
167+
Copy to log file (unconditionally overwrite).
168+
-p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n]
169+
Start at pattern (from command line).
170+
-P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t]
171+
Define new prompt.
172+
-q -Q .... --quiet --QUIET --silent --SILENT
173+
Quiet the terminal bell.
174+
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
175+
Output "raw" control characters.
176+
-s ........ --squeeze-blank-lines
177+
Squeeze multiple blank lines.
178+
-S ........ --chop-long-lines
179+
Chop (truncate) long lines rather than wrapping.
180+
-t [_t_a_g] .. --tag=[_t_a_g]
181+
Find a tag.
182+
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
183+
Use an alternate tags file.
184+
-u -U .... --underline-special --UNDERLINE-SPECIAL
185+
Change handling of backspaces.
186+
-V ........ --version
187+
Display the version number of "less".
188+
-w ........ --hilite-unread
189+
Highlight first new line after forward-screen.
190+
-W ........ --HILITE-UNREAD
191+
Highlight first new line after any forward movement.
192+
-x [_N[,...]] --tabs=[_N[,...]]
193+
Set tab stops.
194+
-X ........ --no-init
195+
Don't use termcap init/deinit strings.
196+
-y [_N] .... --max-forw-scroll=[_N]
197+
Forward scroll limit.
198+
-z [_N] .... --window=[_N]
199+
Set size of window.
200+
-" [_c[_c]] . --quotes=[_c[_c]]
201+
Set shell quote characters.
202+
-~ ........ --tilde
203+
Don't display tildes after end of file.
204+
-# [_N] .... --shift=[_N]
205+
Horizontal scroll amount (0 = one half screen width)
206+
--follow-name
207+
The F command changes files if the input file is renamed.
208+
--mouse
209+
Enable mouse input.
210+
--no-keypad
211+
Don't send termcap keypad init/deinit strings.
212+
--no-histdups
213+
Remove duplicates from command history.
214+
--rscroll=C
215+
Set the character used to mark truncated lines.
216+
--save-marks
217+
Retain marks across invocations of less.
218+
--use-backslash
219+
Subsequent options use backslash as escape char.
220+
--wheel-lines=N
221+
Each click of the mouse wheel moves N lines.
222+
223+
224+
---------------------------------------------------------------------------
225+
226+
LLIINNEE EEDDIITTIINNGG
227+
228+
These keys can be used to edit text being entered
229+
on the "command line" at the bottom of the screen.
230+
231+
RightArrow ..................... ESC-l ... Move cursor right one character.
232+
LeftArrow ...................... ESC-h ... Move cursor left one character.
233+
ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word.
234+
ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word.
235+
HOME ........................... ESC-0 ... Move cursor to start of line.
236+
END ............................ ESC-$ ... Move cursor to end of line.
237+
BACKSPACE ................................ Delete char to left of cursor.
238+
DELETE ......................... ESC-x ... Delete char under cursor.
239+
ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor.
240+
ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
241+
ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
242+
UpArrow ........................ ESC-k ... Retrieve previous command line.
243+
DownArrow ...................... ESC-j ... Retrieve next command line.
244+
TAB ...................................... Complete filename & cycle.
245+
SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle.
246+
ctrl-L ................................... Complete filename, list all.
247+
248+

0 commit comments

Comments
 (0)