-
-
Notifications
You must be signed in to change notification settings - Fork 469
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
00959d2
Lib search API
28a506b
Do not start tasks to reset scroll in pref editor.
168bbf1
Do not limit lib search results.
5600f9d
Virtualized list item rendering.
ca3b754
Disabled scrolling in widget.
a4a91d6
Reset scrollbar on update.
2b0d397
Generic type for the search options.
3ae1338
Restored raw stylings.
2e8ce5b
Moved focus tracing inside item.
d769858
initial filter UI
a0463a0
Basic filter.
6f4b6b5
Basic style.
0325182
check for updates contrib.
ecef208
Translate search option props.
e00fa2b
Can reset types from an action.
b3e20e4
align message.
36d8fe1
removed comments.
337f48a
API cleanup.
b3d1fe8
Updated message when running tasks.
05f340b
use flex display per filter
3776d92
Show no match.
f693f85
filter bar improvements
francescospissu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
initial filter UI
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
arduino-ide-extension/src/browser/widgets/component-list/filter-renderer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { injectable } from '@theia/core/shared/inversify'; | ||
import * as React from '@theia/core/shared/react'; | ||
import { | ||
BoardSearch, | ||
LibrarySearch, | ||
Searchable, | ||
} from '../../../common/protocol'; | ||
import { firstToUpperCase } from '../../../common/utils'; | ||
|
||
@injectable() | ||
export abstract class FilterRenderer<S extends Searchable.Options> { | ||
render( | ||
options: S, | ||
handlePropChange: (prop: keyof S, value: S[keyof S]) => void | ||
): React.ReactNode { | ||
const props = this.props(); | ||
return ( | ||
<div className="filter-bar"> | ||
{Object.entries(options) | ||
.filter(([prop]) => props.includes(prop as keyof S)) | ||
.map(([prop, value]) => ( | ||
<div key={prop}> | ||
{firstToUpperCase(prop)}: | ||
<select | ||
className="theia-select" | ||
value={value} | ||
onChange={(event) => | ||
handlePropChange(prop as keyof S, event.target.value as any) | ||
} | ||
> | ||
{this.options(prop as keyof S).map((key) => ( | ||
<option key={key} value={key}> | ||
{key} | ||
</option> | ||
))} | ||
</select> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
protected abstract props(): (keyof S)[]; | ||
protected abstract options(key: keyof S): string[]; | ||
} | ||
|
||
@injectable() | ||
export class BoardsFilterRenderer extends FilterRenderer<BoardSearch> { | ||
protected props(): (keyof BoardSearch)[] { | ||
return ['type']; | ||
} | ||
protected options(key: keyof BoardSearch): string[] { | ||
switch (key) { | ||
case 'type': | ||
return BoardSearch.TypeLiterals as any; | ||
default: | ||
throw new Error(`Unexpected key: ${key}`); | ||
} | ||
} | ||
} | ||
|
||
@injectable() | ||
export class LibraryFilterRenderer extends FilterRenderer<LibrarySearch> { | ||
protected props(): (keyof LibrarySearch)[] { | ||
return ['type', 'topic']; | ||
} | ||
protected options(key: keyof LibrarySearch): string[] { | ||
switch (key) { | ||
case 'type': | ||
return LibrarySearch.TypeLiterals as any; | ||
case 'topic': | ||
return LibrarySearch.TopicLiterals as any; | ||
default: | ||
throw new Error(`Unexpected key: ${key}`); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Layout improvements of the filter for boards and libs manager #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account