diff --git a/app/src/lib/components/CommitCard.svelte b/app/src/lib/components/CommitCard.svelte index b6ad06933..b743fa0f0 100644 --- a/app/src/lib/components/CommitCard.svelte +++ b/app/src/lib/components/CommitCard.svelte @@ -8,9 +8,9 @@ import Modal from '$lib/components/Modal.svelte'; import Tag from '$lib/components/Tag.svelte'; import { persistedCommitMessage } from '$lib/config/config'; - import { featureAdvancedCommitOperations } from '$lib/config/uiFeatureFlags'; import { draggable } from '$lib/dragging/draggable'; import { DraggableCommit, nonDraggable } from '$lib/dragging/draggables'; + import { copyToClipboard } from '$lib/utils/clipboard'; import { getContext, getContextStore } from '$lib/utils/context'; import { getTimeAgo } from '$lib/utils/timeAgo'; import { openExternalUrl } from '$lib/utils/url'; @@ -40,7 +40,6 @@ const branchController = getContext(BranchController); const baseBranch = getContextStore(BaseBranch); const project = getContext(Project); - const advancedCommitOperations = featureAdvancedCommitOperations(); const commitStore = createCommitStore(commit); $: commitStore.set(commit); @@ -93,13 +92,8 @@ branchController.reorderCommit(branch.id, commit.id, offset); } - let isUndoable = false; + let isUndoable = !!branch?.active && commit instanceof Commit; - $: if ($advancedCommitOperations) { - isUndoable = !!branch?.active && commit instanceof Commit; - } else { - isUndoable = isHeadCommit; - } const hasCommitUrl = !commit.isLocal && commitUrl; let commitMessageModal: Modal; @@ -197,29 +191,29 @@ {commit.descriptionTitle} - {#if $advancedCommitOperations} -
- - {#if commit.changeId} - {commit.changeId.split('-')[0]} - {:else} - {commit.id.substring(0, 6)} - {/if} +
+ + copyToClipboard(commit.id)} + role="button" + tabindex="0" + > + {commit.id.substring(0, 7)} - {#if commit.isSigned} - - {/if} - + {#if commit.isSigned} + + {/if} + - + - {getTimeAgo(commit.createdAt)}{type == 'remote' || type == 'upstream' - ? ` by ${commit.author.name}` - : ''} -
- {/if} + {getTimeAgo(commit.createdAt)}{type == 'remote' || type == 'upstream' + ? ` by ${commit.author.name}` + : ''} +
{/if} @@ -240,51 +234,49 @@ undoCommit(commit); }}>Undo - {#if $advancedCommitOperations} - Edit message - { - e.stopPropagation(); - reorderCommit(commit, -1); - }}>Move Up - { - e.stopPropagation(); - reorderCommit(commit, 1); - }}>Move Down - { - e.stopPropagation(); - insertBlankCommit(commit, -1); - }}>Add Before - { - e.stopPropagation(); - insertBlankCommit(commit, 1); - }}>Add After - {/if} + Edit message + { + e.stopPropagation(); + reorderCommit(commit, -1); + }}>Move Up + { + e.stopPropagation(); + reorderCommit(commit, 1); + }}>Move Down + { + e.stopPropagation(); + insertBlankCommit(commit, -1); + }}>Add Before + { + e.stopPropagation(); + insertBlankCommit(commit, 1); + }}>Add After {/if} {#if hasCommitUrl} { const key = 'featureBaseBranchSwitching'; return persisted(false, key); } - -export function featureAdvancedCommitOperations(): Persisted { - const key = 'featureAdvancedCommitOperations'; - return persisted(false, key); -} diff --git a/app/src/lib/utils/tooltip.ts b/app/src/lib/utils/tooltip.ts index 194d7b000..573fbd072 100644 --- a/app/src/lib/utils/tooltip.ts +++ b/app/src/lib/utils/tooltip.ts @@ -1,10 +1,12 @@ export interface ToolTipOptions { text: string; + noMaxWidth?: boolean; delay?: number; } const defaultOptions: Partial = { - delay: 1200 + delay: 1200, + noMaxWidth: false }; export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string | undefined) { @@ -15,7 +17,8 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string let timeoutId: any; // Options - let { text, delay } = defaultOptions; + // eslint-disable-next-line prefer-const + let { text, delay, noMaxWidth } = defaultOptions; // Most use cases only involve passing a string, so we allow either opts of // simple text. @@ -23,7 +26,7 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string if (typeof opts == 'string') { text = opts; } else if (opts) { - ({ text, delay } = opts || {}); + ({ text, delay, noMaxWidth } = opts || {}); } if (tooltip && text) tooltip.innerText = text; } @@ -52,6 +55,7 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string tooltip = document.createElement('div') as HTMLDivElement; // TODO: Can we co-locate tooltip.js & tooltip.postcss? tooltip.classList.add('tooltip', 'text-base-11'); // see tooltip.postcss + if (noMaxWidth) tooltip.classList.add('no-max-width'); tooltip.innerText = text; document.body.appendChild(tooltip); adjustPosition(); diff --git a/app/src/routes/settings/experimental/+page.svelte b/app/src/routes/settings/experimental/+page.svelte index 4efde9d02..c2fc46024 100644 --- a/app/src/routes/settings/experimental/+page.svelte +++ b/app/src/routes/settings/experimental/+page.svelte @@ -2,12 +2,8 @@ import SectionCard from '$lib/components/SectionCard.svelte'; import Toggle from '$lib/components/Toggle.svelte'; import ContentWrapper from '$lib/components/settings/ContentWrapper.svelte'; - import { - featureBaseBranchSwitching, - featureAdvancedCommitOperations - } from '$lib/config/uiFeatureFlags'; + import { featureBaseBranchSwitching } from '$lib/config/uiFeatureFlags'; const baseBranchSwitching = featureBaseBranchSwitching(); - const advancedCommitOperations = featureAdvancedCommitOperations(); @@ -29,20 +25,6 @@ /> - - Advanced commit operations - - Allows for reordeing of commits, changing the message as well as undoing of commits anywhere - in the stack. In addition it allows for adding an empty commit between two other commits. - - - ($advancedCommitOperations = !$advancedCommitOperations)} - /> - -