Skip to content

Commit 1693201

Browse files
committed
Remove hardcoded id
1 parent 4d61f14 commit 1693201

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/base/src/commands/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ export function addCommands(
10691069
console.log('addLandmark command executing');
10701070
// only want to use one story for now so hardcoding the id for now
10711071

1072-
const storyMapId = 'b48c2622-1188-4734-9450-68e3b7623354';
1072+
const storyMapId = UUID.uuid4();
10731073
const newLandmarkId = UUID.uuid4();
10741074
const current = tracker.currentWidget;
10751075
if (!current) {
@@ -1108,7 +1108,7 @@ export function addCommands(
11081108
} else {
11091109
// else need to update tories
11101110
// get first story
1111-
const story = current.model.sharedModel.getStoryMap(storyMapId);
1111+
const story = current.model.getSelectedStory().story;
11121112
if (!story) {
11131113
console.log('brok');
11141114
return;

packages/base/src/panelview/components/story-maps/StoryViewerPanel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ interface IStoryViewerPanelProps {
1515
}
1616

1717
function StoryViewerPanel({ model, togglePreview }: IStoryViewerPanelProps) {
18-
// ! TODO change name and remove rank from schema
1918
const [currentRankDisplayed, setCurrentRankDisplayed] = useState(0);
2019
const [storyData, setStoryData] = useState<IJGISStoryMap | null>(null);
2120

packages/schema/src/model.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,17 @@ export class JupyterGISModel implements IJupyterGISModel {
605605
return this.sharedModel.awareness.clientID;
606606
}
607607

608+
/**
609+
* Placeholder in case we eventually want to support multiple stories
610+
* @returns First/only story
611+
*/
608612
getSelectedStory(): { landmarkId: string; story: IJGISStoryMap | undefined } {
613+
const stories = this.sharedModel.storiesMap;
614+
const storyId = Object.keys(stories)[0];
615+
609616
return {
610-
landmarkId: 'b48c2622-1188-4734-9450-68e3b7623354',
611-
story: this.sharedModel.getStoryMap(
612-
'b48c2622-1188-4734-9450-68e3b7623354',
613-
),
617+
landmarkId: storyId,
618+
story: this.sharedModel.getStoryMap(storyId),
614619
};
615620
}
616621

0 commit comments

Comments
 (0)