Skip to content

Commit

Permalink
[#69712] show url to view the commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin authored and tomaszgielda committed Dec 5, 2024
1 parent 1fb2c7d commit 7294cea
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/myst-git/MystEditorGit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ const Toast = styled.div`
font-family: inherit;
font-size: inherit;
}
a {
display: inline-block;
color: var(--blue-500);
}
`;

const MystEditorGit = ({
Expand Down Expand Up @@ -152,12 +157,14 @@ const MystEditorGit = ({
text: "Commit",
action: async () => {
try {
const newCommit = await commitChanges();
toast.value = "Changes have been commited.";
switchCommit(newCommit, true);
mystState.current.options.includeButtons.value = defaultButtons;
const { hash, message, webUrl } = await commitChanges();
toast.value = { text: "Changes have been commited. ", link: { text: "See in Gitlab", href: webUrl } };
switchCommit({ hash, message }, true);
} catch (error) {
console.error(error);
toast.value = `Error occured while commiting: ${error}`;
toast.value = { text: `Error occured while commiting: ${error}` };
mystState.current.options.includeButtons.value = [...defaultButtons, commitButton];
}
setTimeout(() => (toast.value = null), 8000);
},
Expand Down Expand Up @@ -355,7 +362,14 @@ const MystEditorGit = ({
</GitSidebar>
{toast.value && (
<Toast id="toast">
<span>{toast.value}</span>
<span>
{toast.value.text}
{toast.value.link && (
<a href={toast.value.link.href} target="_blank">
{toast.value.link.text}
</a>
)}
</span>
<button title="Dismiss" onClick={() => (toast.value = null)}>
x
</button>
Expand Down

0 comments on commit 7294cea

Please sign in to comment.