diff options
| author | bobzel <zzzman@gmail.com> | 2024-04-28 13:08:09 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-04-28 13:08:09 -0400 |
| commit | 729114c0867e3cc8d8e0668bae451976b387cb34 (patch) | |
| tree | 210350ff6716651c542fb4ecf8782e68d4dda9a3 /src/client/views/newlightbox | |
| parent | 33b52b9344768b4db034cceed3c1ccab9a30c949 (diff) | |
simplified explore mode implementation
Diffstat (limited to 'src/client/views/newlightbox')
| -rw-r--r-- | src/client/views/newlightbox/Header/LightboxHeader.tsx | 12 | ||||
| -rw-r--r-- | src/client/views/newlightbox/NewLightboxView.tsx | 23 |
2 files changed, 14 insertions, 21 deletions
diff --git a/src/client/views/newlightbox/Header/LightboxHeader.tsx b/src/client/views/newlightbox/Header/LightboxHeader.tsx index 76efe0185..f89d3173a 100644 --- a/src/client/views/newlightbox/Header/LightboxHeader.tsx +++ b/src/client/views/newlightbox/Header/LightboxHeader.tsx @@ -53,17 +53,7 @@ export const NewLightboxHeader = (props: INewLightboxHeader) => { <IconButton size={Size.XSMALL} onClick={() => setSaved(!saved)} color={Colors.DARK_GRAY} icon={saved ? <BsBookmarkFill /> : <BsBookmark />} /> </div> <div style={{ gridColumn: 2, gridRow: 2, height: '100%', display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}> - <Button - onClick={() => { - console.log(NewLightboxView.ExploreMode); - NewLightboxView.SetExploreMode(!NewLightboxView.ExploreMode); - }} - size={Size.XSMALL} - color={Colors.DARK_GRAY} - type={Type.SEC} - text={'t-SNE 2D Embeddings'} - icon={<MdTravelExplore />} - /> + <Button onClick={() => NewLightboxView.SetExploreMode(!NewLightboxView.ExploreMode)} size={Size.XSMALL} color={Colors.DARK_GRAY} type={Type.SEC} text={'t-SNE 2D Embeddings'} icon={<MdTravelExplore />} /> </div> </div> ); diff --git a/src/client/views/newlightbox/NewLightboxView.tsx b/src/client/views/newlightbox/NewLightboxView.tsx index dcbc9fc50..6de4efc0d 100644 --- a/src/client/views/newlightbox/NewLightboxView.tsx +++ b/src/client/views/newlightbox/NewLightboxView.tsx @@ -6,7 +6,7 @@ import { returnEmptyDoclist, returnEmptyFilter, returnTrue } from '../../../Clie import { emptyFunction } from '../../../Utils'; import { Doc, DocListCast, Opt } from '../../../fields/Doc'; import { InkTool } from '../../../fields/InkField'; -import { Cast, NumCast, StrCast } from '../../../fields/Types'; +import { Cast, NumCast, StrCast, toList } from '../../../fields/Types'; import { DocUtils } from '../../documents/Documents'; import { DocumentManager } from '../../util/DocumentManager'; import { LinkManager } from '../../util/LinkManager'; @@ -204,15 +204,19 @@ export class NewLightboxView extends React.Component<LightboxViewProps> { this._docFilters = (f => (this._docFilters ? [this._docFilters.push(f) as any, this._docFilters][1] : [f]))(`cookies:${cookie}:provide`); } } - public static AddDocTab = (doc: Doc, location: OpenWhere, layoutTemplate?: Doc | string) => { + public static AddDocTab = (docsIn: Doc | Doc[], location: OpenWhere, layoutTemplate?: Doc | string) => { SelectionManager.DeselectAll(); - return NewLightboxView.SetNewLightboxDoc( - doc, - undefined, - [...DocListCast(doc[Doc.LayoutFieldKey(doc)]), ...DocListCast(doc[Doc.LayoutFieldKey(doc) + '_annotations']).filter(anno => anno.annotationOn !== doc), ...(NewLightboxView._future ?? [])].sort( - (a: Doc, b: Doc) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow) - ), - layoutTemplate + const doc = toList(docsIn).lastElement(); + return ( + doc && + NewLightboxView.SetNewLightboxDoc( + doc, + undefined, + [...DocListCast(doc[Doc.LayoutFieldKey(doc)]), ...DocListCast(doc[Doc.LayoutFieldKey(doc) + '_annotations']).filter(anno => anno.annotationOn !== doc), ...(NewLightboxView._future ?? [])].sort( + (a: Doc, b: Doc) => NumCast(b._timecodeToShow) - NumCast(a._timecodeToShow) + ), + layoutTemplate + ) ); }; docFilters = () => NewLightboxView._docFilters || []; @@ -312,7 +316,6 @@ export class NewLightboxView extends React.Component<LightboxViewProps> { whenChildContentsActiveChanged={emptyFunction} addDocTab={this.addDocTab} pinToPres={TabDocView.PinDoc} - onBrowseClickScript={DocumentView.exploreMode} focus={emptyFunction} /> </GestureOverlay> |
