@@ -154,50 +154,13 @@ const handleOpenSettings = () => {
154154 */
155155const showDetails = ref (false )
156156const showLogs = ref (false )
157- const showBootnodes = ref (false )
158157const showSquare = ref (false )
159158
160159/**
161160 * Bootnodes
162161 */
163- const bootnodes = ref ([])
164- const rawBootnodes = ref ([])
165162const config = ref ()
166163
167- const isBootnodesChanged = ref (false )
168- const handleRevertBootnodesChanges = () => {
169- isBootnodesChanged .value = false
170-
171- bootnodes .value = rawBootnodes .value
172- bootnodesTerm .value = bootnodes .value .join (" \n " )
173-
174- setTimeout (() => resizeTextarea (), 0 )
175- }
176-
177- const hasWrongBootnode = ref (false )
178- const bootnodesTerm = ref ()
179-
180- const textareaEl = ref ()
181- const resizeTextarea = () => {
182- textareaEl .value .style .height = " auto"
183- textareaEl .value .style .height = 12 + textareaEl .value .scrollHeight + " px"
184- }
185- const handleTextareaKeyup = (e ) => {
186- e .stopPropagation ()
187-
188- resizeTextarea ()
189-
190- const newBootnodes = bootnodesTerm .value .split (" \n " ).filter ((b ) => b .length )
191- newBootnodes .forEach ((b ) => {
192- hasWrongBootnode .value = ! b .startsWith (" /" ) || b .split (" /" ).filter ((b ) => b .length ).length !== 4
193- })
194-
195- config .value .bootnodes = newBootnodes
196- bootnodes .value = config .value .bootnodes
197-
198- if (! isBootnodesChanged .value ) isBootnodesChanged .value = true
199- }
200-
201164/**
202165 * Timing
203166 */
@@ -257,19 +220,14 @@ const getEventsLogIconColor = () => {
257220
258221const initConfig = () => {
259222 config .value = NodeConfig .default (selectedNetwork .value )
260- rawBootnodes .value = config .value .bootnodes
261- bootnodes .value = config .value .bootnodes
262-
263- bootnodesTerm .value = bootnodes .value .join (" \n " )
223+ nodeStore .rawBootnodes = config .value .bootnodes
224+ nodeStore .bootnodes = config .value .bootnodes
264225}
265226
266227watch (
267- () => showBootnodes .value ,
268- async () => {
269- if (! showBootnodes .value ) return
270-
271- await nextTick ()
272- resizeTextarea ()
228+ () => nodeStore .bootnodes ,
229+ () => {
230+ config .value .bootnodes = nodeStore .bootnodes
273231 },
274232)
275233
@@ -503,20 +461,7 @@ watch(
503461 </Text >
504462 </Flex >
505463
506- <Flex align =" center" gap =" 6" >
507- <Tooltip position =" end" >
508- <Icon name =" info" size =" 14" color =" secondary" />
509-
510- <template #content >
511- <Flex align =" end" direction =" column" gap =" 6" >
512- <Text >Light node tooltip (WIP)</Text >
513- <Text color =" tertiary" ></Text >
514- </Flex >
515- </template >
516- </Tooltip >
517-
518- <Icon @click =" handleOpenSettings" name =" settings" size =" 14" color =" secondary" style =" cursor : pointer " />
519- </Flex >
464+ <Icon @click =" handleOpenSettings" name =" settings" size =" 14" color =" secondary" style =" cursor : pointer " />
520465 </Flex >
521466
522467 <Flex direction =" column" gap =" 8" >
@@ -588,7 +533,7 @@ watch(
588533 <Flex direction =" column" gap =" 6" >
589534 <Text size =" 12" weight =" 600" color =" primary" >Caution about running a node on a mobile</Text >
590535 <Text size =" 12" weight =" 500" color =" tertiary" height =" 140" >
591- Running a light node on mobile devices can affect the performance of your device and cause your phone to
536+ Running a light node on mobile devices may affect the performance of your device and cause your phone to
592537 discharge quickly. Therefore, a node can be started with the charger connected.
593538 </Text >
594539 </Flex >
@@ -702,58 +647,6 @@ watch(
702647 </Flex >
703648 </Flex >
704649
705- <Flex direction =" column" gap =" 4" :class =" $style.secondary_card" >
706- <Flex @click =" showBootnodes = !showBootnodes" align =" center" justify =" between" :class =" $style.header" >
707- <Text size =" 12" weight =" 600" color =" secondary" >
708- Bootnodes  ; <Text color =" tertiary" >{{ bootnodes.length }}</Text >
709- </Text >
710- <Icon
711- name =" chevron"
712- size =" 12"
713- color =" secondary"
714- :style =" { transform: `rotate(${showBootnodes ? '180deg' : '0'})` }"
715- />
716- </Flex >
717-
718- <Flex v-if =" showBootnodes" direction =" column" gap =" 12" :class =" $style.content" >
719- <textarea
720- ref =" textareaEl"
721- v-model =" bootnodesTerm"
722- @keyup =" handleTextareaKeyup"
723- autocomplete =" false"
724- spellcheck =" false"
725- :class =" [$style.bootnodes_container, status === StatusMap.Started && $style.disabled]"
726- >
727- </textarea >
728-
729- <Flex align =" center" justify =" between" wide >
730- <Flex align =" center" gap =" 4" >
731- <Icon name =" info" size =" 12" :color =" hasWrongBootnode ? 'yellow' : 'tertiary'" />
732-
733- <Text v-if =" !hasWrongBootnode" size =" 12" weight =" 600" color =" tertiary" >
734- Each address on a new line.
735- </Text >
736- <Text v-else size =" 12" weight =" 600" color =" yellow" > Specified bootnodes contains an error </Text >
737-
738- <Text v-if =" status === StatusMap.Started" size =" 12" weight =" 600" color =" tertiary" >
739- Editing disabled.
740- </Text >
741- </Flex >
742-
743- <Flex
744- v-if =" isBootnodesChanged"
745- @click =" handleRevertBootnodesChanges"
746- align =" center"
747- gap =" 4"
748- style =" cursor : pointer "
749- >
750- <Icon name =" revert" size =" 12" color =" primary" />
751- <Text size =" 12" weight =" 600" color =" secondary" > Revert to default</Text >
752- </Flex >
753- </Flex >
754- </Flex >
755- </Flex >
756-
757650 <Flex direction =" column" gap =" 4" :class =" $style.secondary_card" >
758651 <Flex
759652 @click =" showSquare = !showSquare"
@@ -762,7 +655,8 @@ watch(
762655 :class =" [$style.header, status !== StatusMap.Started && $style.disabled]"
763656 >
764657 <Text size =" 12" weight =" 600" color =" secondary" >
765- Square Visualization <Text color =" tertiary" >for {{ comma(frontHead) }}</Text >
658+ Square Visualization
659+ <Text v-if =" status === StatusMap.Started" color =" tertiary" >for {{ comma(frontHead) }}</Text >
766660 </Text >
767661
768662 <Icon
@@ -793,7 +687,7 @@ watch(
793687 type =" secondary"
794688 size =" small"
795689 wide
796- :disabled =" [StatusMap.Starting, StatusMap.Started].includes(status) || !bootnodes.length"
690+ :disabled =" [StatusMap.Starting, StatusMap.Started].includes(status) || !nodeStore. bootnodes.length"
797691 >
798692 <Icon v-if =" status === StatusMap.Started" name =" zap-circle" size =" 12" color =" brand" />
799693 {{
@@ -1004,29 +898,6 @@ watch(
1004898 }
1005899}
1006900
1007- .bootnode_label {
1008- white-space : nowrap ;
1009-
1010- overflow : hidden ;
1011- text-overflow : ellipsis ;
1012- }
1013-
1014- .bootnodes_container {
1015- all : unset ;
1016-
1017- font-size : 12px ;
1018- line-height : 100% ;
1019- font-weight : 500 ;
1020- color : var (--txt-secondary );
1021- white-space : nowrap ;
1022-
1023- &.disabled {
1024- pointer-events : none ;
1025-
1026- color : var (--txt-tertiary );
1027- }
1028- }
1029-
1030901.warning {
1031902 background : var (--op-5 );
1032903 border-radius : 8px ;
0 commit comments