Skip to content

Commit

Permalink
studio: make explorer Copy Link point to element in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Oct 26, 2022
1 parent 3c04583 commit 3640697
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const ExplorerContextMenu = observer(
);
}
};
const copyLinkToElementInViewerMode = (): void => {
const copyWorkspaceElementLink = (): void => {
if (node) {
applicationStore
.copyTextToClipboard(
Expand All @@ -279,7 +279,9 @@ const ExplorerContextMenu = observer(
),
)
.then(() =>
applicationStore.notifySuccess('Copied element link to clipboard'),
applicationStore.notifySuccess(
'Copied workspace element link to clipboard',
),
)
.catch(applicationStore.alertUnhandledError);
}
Expand Down Expand Up @@ -333,7 +335,7 @@ const ExplorerContextMenu = observer(
View in Project
</MenuContentItem>
)}
<MenuContentItem onClick={copyLinkToElementInViewerMode}>
<MenuContentItem onClick={copyWorkspaceElementLink}>
Copy Link
</MenuContentItem>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ const ShareProjectModal = observer(
: applicationStore.navigator.generateAddress(
generateViewProjectRoute(projectId),
);
const copyProjectLink = (): void => {
const copyProjectElementLink = (): void => {
applicationStore
.copyTextToClipboard(projectLink)
.then(() =>
applicationStore.notifySuccess('Copied project link to clipboard'),
applicationStore.notifySuccess(
'Copied project element link to clipboard',
),
)
.catch(applicationStore.alertUnhandledError)
.finally(() => closeModal());
Expand Down Expand Up @@ -136,7 +138,7 @@ const ShareProjectModal = observer(
<button
className="btn--wide btn--dark"
disabled={isFetchingProject}
onClick={copyProjectLink}
onClick={copyProjectElementLink}
>
Copy Link
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { EditorStore } from '../EditorStore.js';
import { generateViewEntityRoute } from '../LegendStudioRouter.js';
import { generateEditorRoute } from '../LegendStudioRouter.js';
import { EditorMode } from './EditorMode.js';

export class StandardEditorMode extends EditorMode {
Expand All @@ -27,8 +27,10 @@ export class StandardEditorMode extends EditorMode {
}

generateElementLink(elementPath: string): string {
return generateViewEntityRoute(
return generateEditorRoute(
this.editorStore.sdlcState.activeProject.projectId,
this.editorStore.sdlcState.activeWorkspace.workspaceId,
this.editorStore.sdlcState.activeWorkspace.workspaceType,
elementPath,
);
}
Expand Down

0 comments on commit 3640697

Please sign in to comment.