How do I find the source code, in VS code, for a component, after running and seeing it locally? - reactjs

I am working on my first front-end project for someone and he send me the souce code to modify some buttons, but because is the first time for me, I cannot find them in the source code due to the app having a lot of files, is there any way to do this in a smart way ?

Open the folder that contains the project in VS Code. Click the search icon, type a fragment of the jsx used to render the component in question, like <MyButton and you should see all of the instances of it. Click on one to open it in the editor and then rightclick on <MyButton in the source code and click "Go to definition."
If you don't know the name of the component then you can do basically the same thing with the caption for the button or its image file name.

Related

Salesforce communities how to edit CSS

I need help in how to identify which .Class CSS in communities I have to edit?
I am able to inspect the what changes needs to be done but unable to understand that in communities how do I edit it as I cannot find the class in it.Issue with button.
I am able to inspect it, but when I try to edit my changes made to communities, I am unable to find .slds-size_2-of-12 in communities. I am trying to make the changes from this Edit Css Make changes in communities. Please any one can guide me a little.
If the buttons come from aura/lwc custom code you should be able to set CSS on that component's level and it'lll override community defaults.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_css.htm - empty file should be generated for you automatically
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_css - there will be no empty file, create one in same directory as rest of component, with same name (myComponent.js, myComponent.html -> add myComponent.css). Here's a bit advanced example: https://salesforce.stackexchange.com/a/339936/799
If you're after community-wide change - in the Builder go to Security "tab" and there should be a menu to "edit head markup", you can paste some CSS overrides here. For example use this to hide Chatter "+ Follow" button on all pages. Since it's standard - you couldn't do it in component-level CSS.

CodenameOne Cannot Add Image to Button Using GUI Builder

I am using the CodenameOne GUI builder to add an image to a button.
I added the image to the res file and then clicked [Pick Image] in the Property Inspector (see my screenshots). The button image (a plus sign) appears in the GUI.
I hit 'save' in the GUI Builder and then close it, then go back to NetBeans and run a debug simulation, and the icon appears, so far so good. .
But now I run the debug simulation again and the button image is gone!
I open the GUI Builder and it's gone there as well: the button has reverted to [Pick Image] and, when I click [Pick Image], my image is missing from the res file.
What is going on here? I repeated this three times with the same result- I literally ran the Debug sim twice without doing anything in between and the icon disappears, and there is no indication in the Output messages to indicate that there is a problem.
The Form1.gui file shows a reference to the icon image so maybe the resource file is being cleared in between makes?
<component type="Button" icon="resFile:plus.png" name="Up" actionEvent="true">
</component>
[EDIT] I found that if I add the images using the CNO Designer on the theme.res file, the images 'stick' and I can get a good build.
HOWEVER, when I make code changes and then open the GUI Builder again the images are removed from the res file.
can you add a code snippet of how you add the image ...
According to the error message, you may have chosen the incorrect path, or maybe you have added the path incorrectly in the code.
Unfortunately, the old CN1 Designer is not compatible with the CSS compiler. If your project uses CSS, you should add images to the resource file directly in CSS (e.g. by adding it as a background-image on some element), or import it via the GUI builder, as, adding it that way will also add a reference to the image inside the .css file.
This stems from the CSS compiler pruning "unused" images in the resource file. If the image isn't referenced in the CSS file anywhere, it will be removed from the output .res file.

How to know which element receives the click()?

I am writing a script that goes to an Amazon URL and clicks on the 'Buy Now' button. That's it. I have to use WebdriverIO, javascript, and ChromeDriver. The problem is that I can't get this button to be clicked no matter which selector I use. I am able to manually do it just fine. But in the Code Inspect below, every combination of div/id/name, span/id/close, or input/id/name has resulted in no clicks. I know the script can see that web object because when I do a BuyNow.getText() to console, it prints out 'Buy Now'. And I know the xpath I use is good because I paste it into Inspect/Find and the exact element lights up yellow. Oh and the .click(), even though Visual Studio Code flags as deprecated, works just fine in previous scripts.
When I manually click on a button, is there a way to see what was the exact element that received this click?
let BuyNow = $(<XPATH>)
BuyNow.click()
Code Inspect
Ok so I found out what the problem was. It had nothing to do with my XPATH selectors, any one of which to the elements in the Code Inspect picture would have worked (example: let BuyNow = *[id='buy-now-button']). The issue is that in the WDIO config file, I had a custom Chrome Profile being used. Which is fine, the Chrome.exe I was using was pointing to another custom Chrome Profile. I thought these two were the same, but the folders paths were getting messed up. Once I resolved them, and had both the Chrome.Exe and WDIO config pointing to the same customer folder, Chrome started to allow me to select buttons. I think that the WDIO code was looking at one user profile of chrome, and the desktop chrome browser that I was using was another user profile.
Solved. Fun Stuff but not really.

Wijmo and Dotnetnuke 7. Has anyone tried it? Not working

Has anyone tried using the wijmo widgets in DNN 7.+ ?
For my example I'm trying to use the upload widget.
If I upload to a path on my server and test, it works (As in the dialog appears to choose a file... the popup)
If I load it within a page on the site, the button shows but nothing happens when clicked.
All script files and necessary markup are correct.
No console erros, nothing. Very confusing.
Wijmo widgets work in DNN 7.+.
The “action” option should be changed to the server’s address of upload.ashx file.
Note: the upload sample can’t be opened by file path(d:/……/upload.html), please make sure it is opened on server.
Thanks,
Richa

dotnetnuke: links to external files not working

We currently are running DotNetNuke 4.0.6. On the portals there are links that we have created to access files located on fileshares. When we set them up and save the page, then when we click that link nothing happens.
I have currently set the link up like this:
Link Type - URL
Protocol - Other
URL - file://///myfileshare/filesharename/folder1/folder2/myitem.pdf
If I select anything else (http, https, ftp) it doesn't work. When I mouse over the link it looks to be rendering correctly.
Can anyone help with why this may be happening? Am I missing a setting or selecting the wrong item?
The text in the editor is this:
Service Station for
Please remember the information presented in the newsletter is confidential and should not be shared outside the company.
Read more... (where "Read More" is the link)
There are a few items that you want to remember here.
Users need to have access to that share, so it is possible that could be your issue
It looks like you have a few extra //'s in your link. Should be file://, might need to switch to HTML view in the editor to modify.

Resources