Skip to content

Commit

Permalink
Fix #97, Pico SDK version selector as advanced option for examples
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
  • Loading branch information
paulober committed Oct 3, 2024
1 parent 7371ab2 commit 05dc290
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/webview/newProjectPanel.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ export class NewProjectPanel {
</div>
</div>
<div class="grid gap-6 md:grid-cols-2 mt-6">
<div>
<div id="pico-sdk-selector">
<label for="sel-pico-sdk" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Select Pico SDK version</label>
<select id="sel-pico-sdk" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
${picoSDKsHtml}
Expand Down
7 changes: 7 additions & 0 deletions web/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,15 @@ window.toggleCreateFromExampleMode = function (forceOn, forceOff) {
const projectNameGrid = document.getElementById('project-name-grid');
const projectNameDropdownButton = document.getElementById('project-name-dropdown-button');
const defaultBoardTypeOption = document.getElementById('sel-default');
const picoSDKSelector = document.getElementById('pico-sdk-selector');

if (isExampleMode && (forceOn === undefined || !forceOn) && (forceOff === undefined || forceOff)) {
// clear input to avoid crashing the webview
projectNameInput.value = '';

picoSDKSelector.classList.remove('advanced-option');
picoSDKSelector.hidden = false;

if (createFromExampleBtn) {
createFromExampleBtn.setAttribute('data-example-mode', 'false');
createFromExampleBtn.innerText = 'Example';
Expand Down Expand Up @@ -166,6 +170,9 @@ window.toggleCreateFromExampleMode = function (forceOn, forceOff) {
hideCustomInputs(projectOptionsDivs, false);
}
} else if (forceOff === undefined || !forceOff) {
picoSDKSelector.classList.add('advanced-option');
picoSDKSelector.hidden = true;

if (createFromExampleBtn) {
createFromExampleBtn.setAttribute('data-example-mode', 'true');
createFromExampleBtn.innerText = 'Custom';
Expand Down

0 comments on commit 05dc290

Please sign in to comment.