Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 6, 2023
1 parent f9c687b commit 957c0fa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
31 changes: 23 additions & 8 deletions src/renderer/src/stories/FileSystemSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,17 @@ export class FilesystemSelector extends LitElement {
return;
}

const resolvedValueDisplay = (isArray
const resolvedValueDisplay = isArray
? len > 1
? `${this.value[0]} and ${len - 1} other${len > 2 ? "s" : ""}`
: this.value[0]
: this.value)
: this.value;


const objectTypeReference = this.multiple ? this.type === 'directory' ? 'directories' : 'files' : `a ${this.type}`
const objectTypeReference = this.multiple
? this.type === "directory"
? "directories"
: "files"
: `a ${this.type}`;

return html`
<button
Expand Down Expand Up @@ -192,10 +195,22 @@ export class FilesystemSelector extends LitElement {
this.#handleFiles(pathArr);
}}
>
${resolvedValueDisplay ? html`
${resolvedValueDisplay}
${dialog ? "" : html`<br /><small>Cannot get full ${this.type} path${this.multiple ? "s" : ""} on web distribution</small>`}
` : html`<span>Drop ${objectTypeReference} here, or click to choose ${objectTypeReference}</span>${this.multiple && this.type === 'directory' ? html`<br /><small>Multiple directory support only available using drag-and-drop.</small>` : ''}`}
${resolvedValueDisplay
? html`
${resolvedValueDisplay}
${dialog
? ""
: html`<br /><small
>Cannot get full ${this.type} path${this.multiple ? "s" : ""} on web
distribution</small
>`}
`
: html`<span>Drop ${objectTypeReference} here, or click to choose ${objectTypeReference}</span
>${this.multiple && this.type === "directory"
? html`<br /><small
>Multiple directory support only available using drag-and-drop.</small
>`
: ""}`}
</button>
`;
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/stories/FileSystemSelector.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Folder.args = {
};

export const FileMultiple = Template.bind({});
FileMultiple.args = { multiple: true }
FileMultiple.args = { multiple: true };

export const FolderMultiple = Template.bind({});
FolderMultiple.args = {
type: "directory",
multiple: true
multiple: true,
};
1 change: 0 additions & 1 deletion src/renderer/src/stories/JSONSchemaInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ export class JSONSchemaInput extends LitElement {
} else if (info.type === "string" || info.type === "number") {
const fileSystemFormat = isFilesystemSelector(info.format);
if (fileSystemFormat) return createFilesystemSelector(fileSystemFormat);

// Handle long string formats
else if (info.format === "long" || isArray)
return html`<textarea
Expand Down

0 comments on commit 957c0fa

Please sign in to comment.