-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into base-branch-improve…
…ments
- Loading branch information
Showing
50 changed files
with
1,281 additions
and
735 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,51 @@ | ||
<script lang="ts"> | ||
import ContextMenu from '$lib/components/contextmenu/ContextMenu.svelte'; | ||
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte'; | ||
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte'; | ||
import { copyToClipboard } from '$lib/utils/clipboard'; | ||
import { openExternalUrl } from '$lib/utils/url'; | ||
import type { Commit, DetailedCommit } from '$lib/vbranches/types'; | ||
interface Props { | ||
targetElement: HTMLElement | null; | ||
commit: DetailedCommit | Commit; | ||
commitUrl: string | undefined; | ||
} | ||
const { targetElement, commit, commitUrl }: Props = $props(); | ||
const target = $derived(targetElement ?? undefined); | ||
let contextMenu = $state<ContextMenu>(); | ||
export function open(e: MouseEvent) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
contextMenu?.open(e); | ||
} | ||
function copySha() { | ||
copyToClipboard(commit.id); | ||
contextMenu?.close(); | ||
} | ||
function openInBrowser() { | ||
if (commitUrl) openExternalUrl(commitUrl); | ||
contextMenu?.close(); | ||
} | ||
function copyCommitMessage() { | ||
copyToClipboard(commit.description); | ||
contextMenu?.close(); | ||
} | ||
</script> | ||
|
||
<ContextMenu bind:this={contextMenu} {target} openByMouse> | ||
<ContextMenuSection> | ||
<ContextMenuItem label="Copy SHA" on:click={copySha} /> | ||
{#if commitUrl} | ||
<ContextMenuItem label="Open in browser" on:click={openInBrowser} /> | ||
{/if} | ||
<ContextMenuItem label="Copy commit message" on:click={copyCommitMessage} /> | ||
</ContextMenuSection> | ||
</ContextMenu> |
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
Oops, something went wrong.