generated from internetarchive/iaux-typescript-wc-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Demo: add placeholder views #337
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
Open
iisa
wants to merge
68
commits into
main
Choose a base branch
from
empty-with-frame
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 67 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
48265cd
Create basic state management setup
latonv 43ac1a7
Facet state refactoring to minimize repetition
latonv 91bf555
Move facet refactor to different branch
latonv c817ada
First pass extracting CB data source into a reactive controller
latonv e0d95af
Better abstraction for data source
latonv b19c88f
Setup for reactive controller lifecycle
latonv 2854c82
Top-level exports for data source
latonv 2c07607
Remove obsolete state management stub
latonv 489ee52
Build out some more robust interfaces for state management
latonv 948f4a2
Facet state adjustments
latonv 91240b6
Facet state adjustments
latonv f86d31a
Migrate tile mapping function into new data source
latonv 8421e0b
Add methods for tile mapping & check/unchecking to interface
latonv 4bb59d1
Migrate tile mapping/checking methods into data source
latonv 3fed8b5
Keep track of data source size
latonv f67a807
Adjust some cb methods to delegate to data source
latonv dba016e
Include data source size in interface
latonv f4def02
Minor adjustments to how cb retrieves cell models
latonv 8dda6a7
Reorganize some properties
latonv 334246d
Request host updates from reactive controller
latonv de81037
Fix some tests
latonv ba242f2
Add script for quicker test running
latonv f08df72
Streamline models
latonv 446072d
Conform collection browser to search state model
latonv ab66930
Convert derived sortParam property into getter
latonv 9d3483b
Fix some breaking tests related to sortParam
latonv 9c65176
Fix a model property naming issue
latonv 5490564
Connect up data source w/ cb query change handlers
latonv 9138106
Model updates for cb host
latonv 4517c50
Migrate several fetch methods over to data source
latonv 4055bab
Fix some convenience methods in cb
latonv 99fd951
Try migrating some page fetching routines
latonv 710eee9
Adjust search state model to accommodate page fetch
latonv b88ba34
Migrate page fetching & related props into data source
latonv 146103b
Clean up cb a bit and delegate all remaining page fetches
latonv d1f3c4a
Excise collection-name-cache in favor of data source map
latonv fcf3e35
Use basic map for collection titles
latonv 030a8e5
Data source should not fetch facets when suppressed
latonv 2832383
Remove filterMap from search state interface (it's part of the dataso…
latonv 5ee8643
Cleanup to avoid passing data source around
latonv 12a1e60
Cleaning up some lingering details in cb
latonv 6572655
Migrate prefix filters over to data source
latonv 675fcba
Improve data source documentation + general cleanliness
latonv 2b673df
Remove a bit of dead code in cb
latonv 2f19df1
Fetch controller
latonv 619e47b
Cleaner data types for page target params
latonv 43fa399
Export TileModel interface
latonv 082ea45
Use updated search service models
latonv b58cf28
Ensure that profile pages are allowed to perform no-query searches
latonv c6c6160
Add profile target to query keys
latonv db1fc28
Ensure query change updates occur on profile target changes
latonv 354c71e
Use hits/aggregations from page_elements branch if available
latonv c087fda
Rely on search service to handle page_element unpacking
latonv 4240893
Emit event for any query state changes
latonv 3f2ad00
Add debug logging & fix result count bug
latonv c75e755
Fix package version
latonv 9588030
Fix broken test
latonv 8b77dff
Properly reset endOfDataReached upon query change
latonv d60368e
Fix a bug where checking tile in manage view doesn't work
latonv c657f97
Ensure result views are refreshed when checking/unchecking all in man…
latonv 1a40ab0
Sort Bar Test - Ensure Resize Observer fires ONLY when needed
iisa f0b9733
TESTS - Fix some, comment some out that need rework with the refactor…
iisa 6004db0
demo: add placeholder views
iisa 317b916
add empty frame placeholder to demo
iisa c7a3ed5
clean up anti-pattern: move `setPlaceholderType` out of render to wil…
iisa 9b3bade
Checkpoint: 1.14.17-beta.3 - log tweaks, + clean demo
iisa 4dabdfc
checkpoint: 1.14.17-beta.4 - facet fetch logging
iisa 94a0335
checkpoint: 1.14.17-beta.5 - fix red herring, clear infinite scroller…
iisa 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,9 @@ import { | |
| SearchType, | ||
| StringField, | ||
| } from '@internetarchive/search-service'; | ||
| import { LocalCache } from '@internetarchive/local-cache'; | ||
| import { html, css, LitElement, PropertyValues, nothing } from 'lit'; | ||
| import { customElement, property, query, state } from 'lit/decorators.js'; | ||
| import { SharedResizeObserver } from '@internetarchive/shared-resize-observer'; | ||
| import { CollectionNameCache } from '@internetarchive/collection-name-cache'; | ||
|
|
||
| import type { ModalManagerInterface } from '@internetarchive/modal-manager'; | ||
| import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager'; | ||
|
|
@@ -28,13 +26,6 @@ export class AppRoot extends LitElement { | |
|
|
||
| private resizeObserver = new SharedResizeObserver(); | ||
|
|
||
| private localCache = new LocalCache(); | ||
|
|
||
| private collectionNameCache = new CollectionNameCache({ | ||
| searchService: this.searchService, | ||
| localCache: this.localCache, | ||
| }); | ||
|
|
||
| @state() private toggleSlots: boolean = false; | ||
|
|
||
| @state() private currentPage?: number; | ||
|
|
@@ -404,6 +395,55 @@ export class AppRoot extends LitElement { | |
| </label> | ||
| </div> | ||
| </fieldset> | ||
| <fieldset class="Placeholder-type"> | ||
| <legend>Placeholder type</legend> | ||
| <div class="checkbox-control"> | ||
| <input | ||
| type="button" | ||
| id="placeholder-empty-query" | ||
| @click=${() => this.showEmptyPlaceholder('empty query')} | ||
| value="empty query" | ||
| /> | ||
| </div> | ||
| ${this.withinCollection | ||
| ? html` | ||
| <div class="checkbox-control"> | ||
| <input | ||
| type="button" | ||
| id="placeholder-collection-err" | ||
| @click=${() => | ||
| this.showEmptyPlaceholder('collection error')} | ||
| value="collection error" | ||
| /> | ||
| </div> | ||
| <div class="checkbox-control"> | ||
| <input | ||
| type="button" | ||
| id="placeholder-no-results" | ||
| @click=${() => | ||
| this.showEmptyPlaceholder('empty collection')} | ||
| value="empty collection" | ||
| /> | ||
| </div> | ||
| ` | ||
| : nothing} | ||
| <div class="checkbox-control"> | ||
| <input | ||
| type="button" | ||
| id="placeholder-query-err" | ||
| @click=${() => this.showEmptyPlaceholder('query error')} | ||
| value="query error" | ||
| /> | ||
| </div> | ||
| <div class="checkbox-control"> | ||
| <input | ||
| type="button" | ||
| id="placeholder-loading" | ||
| @click=${() => this.showEmptyPlaceholder('placeholder loading')} | ||
| value="placeholder loading" | ||
| /> | ||
| </div> | ||
| </fieldset> | ||
| </div> | ||
| <button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}> | ||
| Toggle Search Controls | ||
|
|
@@ -415,7 +455,6 @@ export class AppRoot extends LitElement { | |
| .baseImageUrl=${'https://archive.org'} | ||
| .searchService=${this.searchService} | ||
| .resizeObserver=${this.resizeObserver} | ||
| .collectionNameCache=${this.collectionNameCache} | ||
| .showHistogramDatePicker=${true} | ||
| .loggedIn=${this.loggedIn} | ||
| .modalManager=${this.modalManager} | ||
|
|
@@ -499,6 +538,50 @@ export class AppRoot extends LitElement { | |
| } | ||
| } | ||
|
|
||
| private async showEmptyPlaceholder(placeholderType: string) { | ||
| switch (placeholderType) { | ||
| case 'empty query': | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we are on demo for developers but we should not use string slugs for checking conditions. I would write these something like |
||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.withinCollection = ''; | ||
| this.collectionBrowser.withinProfile = ''; | ||
| break; | ||
| case 'empty collection': | ||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.withinProfile = ''; | ||
| await this.collectionBrowser.updateComplete; | ||
|
|
||
| break; | ||
| case 'empty profile': | ||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.withinCollection = ''; | ||
| this.collectionBrowser.withinProfile = '@brewster'; | ||
| break; | ||
| case 'collection error': | ||
| this.collectionBrowser.withinCollection = 'acdc'; | ||
| await this.collectionBrowser.updateComplete; | ||
|
|
||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.queryErrorMessage = 'foo message'; | ||
| break; | ||
| case 'query error': | ||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.withinCollection = ''; | ||
| this.collectionBrowser.queryErrorMessage = 'foo message'; | ||
| break; | ||
| case 'placeholder loading': | ||
| this.collectionBrowser.baseQuery = ''; | ||
| this.collectionBrowser.setSearchResultsLoading(true); | ||
| this.collectionBrowser.setFacetsLoading(true); | ||
| this.collectionBrowser.suppressPlaceholders = true; | ||
| this.collectionBrowser.clearResultsOnEmptyQuery = true; | ||
| this.requestUpdate(); | ||
| await this.collectionBrowser.updateComplete; | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| private toggleFacetGroupOutline(e: Event) { | ||
| const target = e.target as HTMLInputElement; | ||
| if (target.checked) { | ||
|
|
@@ -552,6 +635,7 @@ export class AppRoot extends LitElement { | |
| const oldQuery = this.searchQuery; | ||
| this.searchQuery = ''; // Should just reset to the placeholder | ||
| await this.updateComplete; | ||
| this.collectionBrowser.suppressPlaceholders = false; | ||
| // For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence: | ||
| await new Promise(res => { | ||
| setTimeout(res, 0); | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.