-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34bbc9b
commit 27b7c7d
Showing
9 changed files
with
380 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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,23 @@ | ||
import { ILauncher } from '@jupyterlab/launcher'; | ||
|
||
export interface IFavoritesDatabase { | ||
get(item: ILauncher.IItemOptions): boolean | null; | ||
set(item: ILauncher.IItemOptions, isFavourite: boolean): void; | ||
} | ||
|
||
export class FavoritesDatabase implements IFavoritesDatabase { | ||
constructor() { | ||
// TODO: use settings registry, or state db, or server to persist this info | ||
this._db = new Map(); | ||
} | ||
get(item: ILauncher.IItemOptions) { | ||
return this._db.get(this._itemKey(item)) ?? null; | ||
} | ||
set(item: ILauncher.IItemOptions, isFavourite: boolean) { | ||
this._db.set(this._itemKey(item), isFavourite); | ||
} | ||
private _itemKey(item: ILauncher.IItemOptions): string { | ||
return item.command + '_' + JSON.stringify(item.args); | ||
} | ||
private _db: Map<string, boolean>; | ||
} |
This file contains 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,7 @@ | ||
import { LabIcon } from '@jupyterlab/ui-components'; | ||
import starSvgstr from '../style/icons/md/star.svg'; | ||
|
||
export const starIcon = new LabIcon({ | ||
name: 'jupyterlab-new-launcher:star', | ||
svgstr: starSvgstr | ||
}); |
This file contains 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 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 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 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,4 @@ | ||
declare module '*.svg' { | ||
const script: string; | ||
export default script; | ||
} |
This file contains 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
Oops, something went wrong.