Skip to content

Commit c820a33

Browse files
authored
Tooltip-refactoring-+-new-component (#4804)
* tooltip component + custom svelte transitions * update some tooltips * replace old toogle * replace old tooltip hook * remove old tooltip hook * lint fixes * design tokens update
1 parent 98c3f5d commit c820a33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+659
-582
lines changed

apps/desktop/src/lib/branch/ActiveBranchStatus.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
icon="pr-small"
4848
style="success"
4949
kind="solid"
50-
help="These changes have been integrated upstream, update your workspace to make this lane disappear."
50+
tooltip="Changes have been integrated upstream, update your workspace to make this lane disappear."
5151
reversedDirection>Integrated</Button
5252
>
5353
{:else}
@@ -56,7 +56,7 @@
5656
size="tag"
5757
icon="virtual-branch-small"
5858
style="neutral"
59-
help="These changes are in your working directory."
59+
tooltip="Changes are in your working directory"
6060
reversedDirection>Virtual</Button
6161
>
6262
{/if}
@@ -68,7 +68,7 @@
6868
style="neutral"
6969
shrinkable
7070
disabled
71-
help="Branch name that will be used when pushing. You can change it from the lane menu."
71+
tooltip={'Branch name that will be used when pushing.\nChange it from the lane menu'}
7272
>
7373
{name}
7474
</Button>
@@ -81,7 +81,7 @@
8181
style="neutral"
8282
kind="solid"
8383
icon="remote-branch-small"
84-
help="At least some of your changes have been pushed"
84+
tooltip="Some changes have been pushed"
8585
reversedDirection>Remote</Button
8686
>
8787
<Button

apps/desktop/src/lib/branch/BranchHeader.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
<div class="draggable" data-drag-handle>
133133
<Icon name="draggable" />
134134
</div>
135-
<Button style="ghost" outline icon="unfold-lane" help="Expand lane" onclick={expandLane} />
135+
<Button style="ghost" outline icon="unfold-lane" tooltip="Expand lane" onclick={expandLane} />
136136
</div>
137137

138138
<div class="collapsed-lane__info-wrap" bind:clientHeight={headerInfoHeight}>
@@ -147,7 +147,7 @@
147147
clickable={false}
148148
style="warning"
149149
kind="soft"
150-
help="Uncommitted changes"
150+
tooltip="Uncommitted changes"
151151
>
152152
{uncommittedChanges}
153153
{uncommittedChanges === 1 ? 'change' : 'changes'}
@@ -198,7 +198,7 @@
198198
clickable={false}
199199
icon="locked-small"
200200
style="warning"
201-
help="Applying this branch will add merge conflict markers that you will have to resolve"
201+
tooltip="Applying this branch will add merge conflict markers that you will have to resolve"
202202
>
203203
Conflict
204204
</Button>
@@ -214,7 +214,7 @@
214214
<Button
215215
style="pop"
216216
kind="soft"
217-
help="New changes will land here"
217+
tooltip="New changes will land here"
218218
icon="target"
219219
clickable={false}
220220
>
@@ -224,7 +224,7 @@
224224
<Button
225225
style="ghost"
226226
outline
227-
help="When selected, new changes will land here"
227+
tooltip="When selected, new changes land here"
228228
icon="target"
229229
onclick={async () => {
230230
isTargetBranchAnimated = true;
@@ -242,7 +242,7 @@
242242
<PullRequestButton
243243
click={async ({ draft }) => await createPr({ draft })}
244244
disabled={branch.commits.length === 0 || !$gitHost}
245-
help={!$gitHost ? 'You can enable git host integration in the settings' : ''}
245+
tooltip={!$gitHost ? 'You can enable git host integration in the settings' : ''}
246246
loading={isLoading}
247247
/>
248248
{/if}

apps/desktop/src/lib/branch/BranchLaneContextMenu.svelte

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import { VirtualBranch } from '$lib/vbranches/types';
1515
import Button from '@gitbutler/ui/Button.svelte';
1616
import Modal from '@gitbutler/ui/Modal.svelte';
17+
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
1718
1819
interface Props {
1920
contextMenuEl?: ContextMenu;
@@ -138,13 +139,9 @@
138139

139140
<ContextMenuSection>
140141
<ContextMenuItem label="Allow rebasing" on:click={toggleAllowRebasing}>
141-
<Toggle
142-
small
143-
slot="control"
144-
bind:checked={allowRebasing}
145-
on:click={toggleAllowRebasing}
146-
help="Allows changing commits after push (force push needed)"
147-
/>
142+
<Tooltip slot="control" text={'Allows changing commits after push\n(force push needed)'}>
143+
<Toggle small bind:checked={allowRebasing} on:click={toggleAllowRebasing} />
144+
</Tooltip>
148145
</ContextMenuItem>
149146
</ContextMenuSection>
150147

apps/desktop/src/lib/branch/BranchPreviewHeader.svelte

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Button from '@gitbutler/ui/Button.svelte';
1111
import Icon from '@gitbutler/ui/Icon.svelte';
1212
import Modal from '@gitbutler/ui/Modal.svelte';
13-
import { tooltip } from '@gitbutler/ui/utils/tooltip';
13+
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
1414
import type { PullRequest } from '$lib/gitHost/interface/types';
1515
import type { Branch } from '$lib/vbranches/types';
1616
import { goto } from '$app/navigation';
@@ -40,13 +40,18 @@
4040
<BranchLabel disabled name={branch.name} />
4141
<div class="header__remote-branch">
4242
{#if remoteBranch}
43-
<div
44-
class="status-tag text-11 text-semibold remote"
45-
use:tooltip={'At least some of your changes have been pushed'}
46-
>
47-
<Icon name="remote-branch-small" />
48-
{localBranch ? 'local and remote' : 'remote'}
49-
</div>
43+
<Tooltip text="At least some of your changes have been pushed'">
44+
<Button
45+
size="tag"
46+
icon="remote-branch-small"
47+
style="neutral"
48+
kind="solid"
49+
clickable={false}
50+
>
51+
{localBranch ? 'local and remote' : 'remote'}
52+
</Button>
53+
</Tooltip>
54+
5055
{#if gitHostBranch}
5156
<Button
5257
size="tag"
@@ -93,7 +98,7 @@
9398
<Button
9499
style="ghost"
95100
outline
96-
help="Restores these changes into your working directory"
101+
tooltip="Restores these changes into your working directory"
97102
icon="plus-small"
98103
loading={isApplying}
99104
disabled={$mode?.type !== 'OpenWorkspace'}
@@ -120,7 +125,7 @@
120125
<Button
121126
style="ghost"
122127
outline
123-
help="Deletes the local branch. If this branch is also present on a remote, it will not be deleted there."
128+
tooltip="Deletes the local branch. If this branch is also present on a remote, it will not be deleted there."
124129
icon="bin-small"
125130
loading={isDeleting}
126131
disabled={!localBranch}

apps/desktop/src/lib/commit/CommitCard.svelte

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import Button from '@gitbutler/ui/Button.svelte';
2727
import Icon from '@gitbutler/ui/Icon.svelte';
2828
import Modal from '@gitbutler/ui/Modal.svelte';
29+
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
2930
import { getTimeAgo } from '@gitbutler/ui/utils/timeAgo';
30-
import { tooltip } from '@gitbutler/ui/utils/tooltip';
3131
import { type Snippet } from 'svelte';
3232
3333
export let branch: VirtualBranch | undefined = undefined;
@@ -299,24 +299,25 @@
299299

300300
<div class="text-11 commit__subtitle">
301301
{#if commit.isSigned}
302-
<div class="commit__signed" use:tooltip={{ text: 'Signed', delay: 500 }}>
303-
<Icon name="success-outline-small" />
304-
</div>
302+
<Tooltip text="Signed">
303+
<div class="commit__signed">
304+
<Icon name="success-outline-small" />
305+
</div>
306+
</Tooltip>
305307

306308
<span class="commit__subtitle-divider">•</span>
307309
{/if}
308310

309311
{#if conflicted}
310-
<div
311-
class="commit__conflicted"
312-
use:tooltip={{
313-
text: 'Conflicted commits must be resolved before they can be ammended or squashed.\n\nPlease resolve conflicts using the "Resolve conflicts" button'
314-
}}
312+
<Tooltip
313+
text={"Conflicted commits must be resolved before they can be ammended or squashed.\nPlease resolve conflicts using the 'Resolve conflicts' button"}
315314
>
316-
<Icon name="warning-small" />
315+
<div class="commit__conflicted">
316+
<Icon name="warning-small" />
317317

318-
Conflicted
319-
</div>
318+
Conflicted
319+
</div>
320+
</Tooltip>
320321

321322
<span class="commit__subtitle-divider">•</span>
322323
{/if}
@@ -593,6 +594,7 @@
593594
594595
text-decoration: underline;
595596
text-underline-offset: 2px;
597+
transition: color var(--transition-fast);
596598
597599
&:hover {
598600
color: var(--clr-text-1);

apps/desktop/src/lib/commit/CommitDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import { persistedCommitMessage, projectRunCommitHooks } from '$lib/config/config';
44
import { getContext, getContextStore } from '$lib/utils/context';
55
import { intersectionObserver } from '$lib/utils/intersectionObserver';
6-
import { slideFade } from '$lib/utils/svelteTransitions';
76
import { BranchController } from '$lib/vbranches/branchController';
87
import { Ownership } from '$lib/vbranches/ownership';
98
import { VirtualBranch } from '$lib/vbranches/types';
109
import Button from '@gitbutler/ui/Button.svelte';
10+
import { slideFade } from '@gitbutler/ui/utils/transitions';
1111
import type { Writable } from 'svelte/store';
1212
1313
export let projectId: string;

apps/desktop/src/lib/commit/CommitList.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
wide
229229
loading={isPushingCommits}
230230
disabled={localCommitsConflicted}
231-
help={localCommitsConflicted
231+
tooltip={localCommitsConflicted
232232
? 'In order to push, please resolve any conflicted commits.'
233233
: undefined}
234234
onclick={async () => {

apps/desktop/src/lib/commit/CommitMessageInput.svelte

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import { VirtualBranch, LocalFile } from '$lib/vbranches/types';
2222
import Checkbox from '@gitbutler/ui/Checkbox.svelte';
2323
import Icon from '@gitbutler/ui/Icon.svelte';
24-
import { tooltip } from '@gitbutler/ui/utils/tooltip';
24+
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
2525
import { createEventDispatcher, onMount } from 'svelte';
2626
import { fly } from 'svelte/transition';
2727
@@ -179,57 +179,52 @@
179179
{/if}
180180

181181
{#if title.length > 50}
182-
<div
183-
transition:fly={{ y: 2, duration: 150 }}
184-
class="commit-box__textarea-tooltip"
185-
use:tooltip={{
186-
text: '50 characters or less is best. Extra info can be added in the description.',
187-
delay: 200
188-
}}
189-
>
190-
<Icon name="idea" />
191-
</div>
182+
<Tooltip text={'50 characters or less is best.\nUse description for more details'}>
183+
<div transition:fly={{ y: 2, duration: 150 }} class="commit-box__textarea-tooltip">
184+
<Icon name="idea" />
185+
</div>
186+
</Tooltip>
192187
{/if}
193188

194-
<div
195-
class="commit-box__texarea-actions"
196-
class:commit-box-actions_expanded={isExpanded}
197-
use:tooltip={!aiConfigurationValid
198-
? 'You must be logged in or have provided your own API key to use this feature'
189+
<Tooltip
190+
text={!aiConfigurationValid
191+
? 'You must be logged in or have provided your own API key'
199192
: !$aiGenEnabled
200-
? 'You must have summary generation enabled to use this feature'
201-
: ''}
193+
? 'You must have summary generation enabled'
194+
: undefined}
202195
>
203-
<DropDownButton
204-
style="ghost"
205-
outline
206-
icon="ai-small"
207-
disabled={!($aiGenEnabled && aiConfigurationValid)}
208-
loading={aiLoading}
209-
menuPosition="top"
210-
onclick={async () => await generateCommitMessage($branch.files)}
211-
>
212-
Generate message
213-
214-
{#snippet contextMenuSlot()}
215-
<ContextMenuSection>
216-
<ContextMenuItem
217-
label="Extra concise"
218-
on:click={() => ($commitGenerationExtraConcise = !$commitGenerationExtraConcise)}
219-
>
220-
<Checkbox small slot="control" bind:checked={$commitGenerationExtraConcise} />
221-
</ContextMenuItem>
222-
223-
<ContextMenuItem
224-
label="Use emojis 😎"
225-
on:click={() => ($commitGenerationUseEmojis = !$commitGenerationUseEmojis)}
226-
>
227-
<Checkbox small slot="control" bind:checked={$commitGenerationUseEmojis} />
228-
</ContextMenuItem>
229-
</ContextMenuSection>
230-
{/snippet}
231-
</DropDownButton>
232-
</div>
196+
<div class="commit-box__texarea-actions" class:commit-box-actions_expanded={isExpanded}>
197+
<DropDownButton
198+
style="ghost"
199+
outline
200+
icon="ai-small"
201+
disabled={!($aiGenEnabled && aiConfigurationValid)}
202+
loading={aiLoading}
203+
menuPosition="top"
204+
onclick={async () => await generateCommitMessage($branch.files)}
205+
>
206+
Generate message
207+
208+
{#snippet contextMenuSlot()}
209+
<ContextMenuSection>
210+
<ContextMenuItem
211+
label="Extra concise"
212+
on:click={() => ($commitGenerationExtraConcise = !$commitGenerationExtraConcise)}
213+
>
214+
<Checkbox small slot="control" bind:checked={$commitGenerationExtraConcise} />
215+
</ContextMenuItem>
216+
217+
<ContextMenuItem
218+
label="Use emojis 😎"
219+
on:click={() => ($commitGenerationUseEmojis = !$commitGenerationUseEmojis)}
220+
>
221+
<Checkbox small slot="control" bind:checked={$commitGenerationUseEmojis} />
222+
</ContextMenuItem>
223+
</ContextMenuSection>
224+
{/snippet}
225+
</DropDownButton>
226+
</div>
227+
</Tooltip>
233228
</div>
234229
{/if}
235230

apps/desktop/src/lib/components/BaseBranch.svelte

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Button from '@gitbutler/ui/Button.svelte';
1111
import Checkbox from '@gitbutler/ui/Checkbox.svelte';
1212
import Modal from '@gitbutler/ui/Modal.svelte';
13-
import { tooltip } from '@gitbutler/ui/utils/tooltip';
13+
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
1414
import type { BaseBranch } from '$lib/baseBranch/baseBranch';
1515
1616
export let base: BaseBranch;
@@ -49,7 +49,7 @@
4949
<Button
5050
style="pop"
5151
kind="solid"
52-
help={`Merges the commits from ${base.branchName} into the base of all applied virtual branches`}
52+
tooltip={`Merges the commits from ${base.branchName} into the base of all applied virtual branches`}
5353
disabled={$mode?.type !== 'OpenWorkspace'}
5454
onclick={() => {
5555
if ($mergeUpstreamWarningDismissed) {
@@ -77,12 +77,9 @@
7777
{/if}
7878

7979
<div>
80-
<h1
81-
class="text-13 info-text text-bold"
82-
use:tooltip={'This is the current base for your virtual branches.'}
83-
>
84-
Local
85-
</h1>
80+
<Tooltip text="Current base for virtual branches.">
81+
<h1 class="text-13 info-text text-bold">Local</h1>
82+
</Tooltip>
8683
{#each base.recentCommits as commit, index}
8784
<CommitCard
8885
{commit}

apps/desktop/src/lib/components/InsertEmptyCommitAction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
icon="plus-small"
2424
size="tag"
2525
width={26}
26-
help="Insert empty commit"
26+
tooltip="Insert empty commit"
2727
helpShowDelay={500}
2828
onclick={() => dispatch('click')}
2929
/>

0 commit comments

Comments
 (0)