|
2 | 2 | import BranchCommitList from './BranchCommitList.svelte';
|
3 | 3 | import BranchHeader from './BranchHeader.svelte';
|
4 | 4 | import CommitRow from './CommitRow.svelte';
|
| 5 | + import ScrollableContainer from '../ScrollableContainer.svelte'; |
5 | 6 | import ReduxResult from '$components/ReduxResult.svelte';
|
6 | 7 | import { BaseBranchService } from '$lib/baseBranch/baseBranchService';
|
7 | 8 | import { createCommitPath } from '$lib/routes/routes.svelte';
|
|
35 | 36 | </div>
|
36 | 37 | </div>
|
37 | 38 | {/snippet}
|
38 |
| -{#snippet commitHere(args: { commitId: string; last?: boolean })} |
| 39 | + |
| 40 | +{#snippet commitHere(args: { commitId: string; last?: boolean; branchName: string })} |
39 | 41 | <button
|
40 | 42 | class="commit-here"
|
41 | 43 | type="button"
|
42 | 44 | class:last={args.last}
|
43 |
| - onclick={() => goto(createCommitPath(projectId, stackId, branchName, args.commitId))} |
| 45 | + onclick={() => goto(createCommitPath(projectId, stackId, args.branchName, args.commitId))} |
44 | 46 | >
|
45 | 47 | <div class="commit-here__circle"></div>
|
46 | 48 | <div class="commit-here__line"></div>
|
47 | 49 | <div class="commit-here__label text-11 text-semibold">Commit here</div>
|
48 | 50 | </button>
|
49 | 51 | {/snippet}
|
50 |
| -<div class="commit-goes-here"> |
51 |
| - <ReduxResult result={branchesResult.current}> |
52 |
| - {#snippet children(branches)} |
53 |
| - {#each branches as branch, i} |
54 |
| - {@const lastBranch = i === branches.length - 1} |
55 |
| - <div class="branch" class:selected={branch.name === branchName}> |
56 |
| - <div class="header-wrapper"> |
57 |
| - <BranchHeader |
| 52 | + |
| 53 | +<ScrollableContainer> |
| 54 | + <div class="commit-goes-here"> |
| 55 | + <ReduxResult result={branchesResult.current}> |
| 56 | + {#snippet children(branches)} |
| 57 | + {#each branches as branch, i} |
| 58 | + {@const lastBranch = i === branches.length - 1} |
| 59 | + <div class="branch" class:selected={branch.name === branchName}> |
| 60 | + <div class="header-wrapper"> |
| 61 | + <BranchHeader |
| 62 | + {projectId} |
| 63 | + {stackId} |
| 64 | + {branch} |
| 65 | + onclick={() => { |
| 66 | + goto(createCommitPath(projectId, stackId, branch.name), { |
| 67 | + replaceState: true |
| 68 | + }); |
| 69 | + }} |
| 70 | + isTopBranch={i === 0} |
| 71 | + lineColor="var(--clr-commit-local)" |
| 72 | + readonly |
| 73 | + /> |
| 74 | + </div> |
| 75 | + <BranchCommitList |
58 | 76 | {projectId}
|
59 | 77 | {stackId}
|
60 |
| - {branch} |
61 |
| - isTopBranch={i === 0} |
62 |
| - lineColor="var(--clr-commit-local)" |
63 |
| - readonly |
64 |
| - /> |
65 |
| - </div> |
66 |
| - <BranchCommitList |
67 |
| - {projectId} |
68 |
| - {stackId} |
69 |
| - branchName={branch.name} |
70 |
| - selectedCommitId={parentId} |
71 |
| - > |
72 |
| - {#snippet localAndRemoteTemplate({ commit, commitKey, first, last, selected })} |
73 |
| - {@const baseSha = $baseBranch?.baseSha} |
74 |
| - {#if selected} |
75 |
| - {@render indicator({ first })} |
76 |
| - {/if} |
77 |
| - <div class="commit-wrapper" class:last> |
78 |
| - {#if !selected} |
79 |
| - {@render commitHere({ commitId: commit.id })} |
| 78 | + branchName={branch.name} |
| 79 | + selectedBranchName={branchName} |
| 80 | + selectedCommitId={parentId} |
| 81 | + > |
| 82 | + {#snippet emptyBranchCommitHere()} |
| 83 | + {@render indicator({ first: true })} |
| 84 | + {/snippet} |
| 85 | + {#snippet localAndRemoteTemplate({ commit, commitKey, first, last, selected })} |
| 86 | + {@const baseSha = $baseBranch?.baseSha} |
| 87 | + {#if selected && branchName === branch.name} |
| 88 | + {@render indicator({ first })} |
80 | 89 | {/if}
|
81 |
| - <CommitRow |
82 |
| - {projectId} |
83 |
| - {commitKey} |
84 |
| - {first} |
85 |
| - {commit} |
86 |
| - lastCommit={last} |
87 |
| - lineColor="var(--clr-commit-local)" |
88 |
| - opacity={0.4} |
89 |
| - borderTop={selected} |
90 |
| - onclick={() => |
91 |
| - goto(createCommitPath(projectId, stackId, branchName, commit.id), { |
92 |
| - replaceState: true |
93 |
| - })} |
94 |
| - /> |
95 |
| - {#if lastBranch && last && baseSha && parentId !== baseSha} |
96 |
| - {@render commitHere({ commitId: baseSha, last: true })} |
| 90 | + <div class="commit-wrapper" class:last> |
| 91 | + {#if !selected} |
| 92 | + {@render commitHere({ commitId: commit.id, branchName: branch.name })} |
| 93 | + {/if} |
| 94 | + <CommitRow |
| 95 | + {projectId} |
| 96 | + {commitKey} |
| 97 | + {first} |
| 98 | + {commit} |
| 99 | + lastCommit={last} |
| 100 | + lineColor="var(--clr-commit-local)" |
| 101 | + opacity={0.4} |
| 102 | + borderTop={selected} |
| 103 | + onclick={() => |
| 104 | + goto(createCommitPath(projectId, stackId, branch.name, commit.id), { |
| 105 | + replaceState: true |
| 106 | + })} |
| 107 | + /> |
| 108 | + {#if lastBranch && last && baseSha && parentId !== baseSha} |
| 109 | + {@render commitHere({ commitId: baseSha, last: true, branchName: branch.name })} |
| 110 | + {/if} |
| 111 | + </div> |
| 112 | + {#if lastBranch && last && parentId === baseSha} |
| 113 | + {@render indicator({ last: true })} |
97 | 114 | {/if}
|
98 |
| - </div> |
99 |
| - {#if lastBranch && last && parentId === baseSha} |
100 |
| - {@render indicator({ last: true })} |
101 |
| - {/if} |
102 |
| - {/snippet} |
103 |
| - </BranchCommitList> |
104 |
| - </div> |
105 |
| - {/each} |
106 |
| - {/snippet} |
107 |
| - </ReduxResult> |
108 |
| -</div> |
| 115 | + {/snippet} |
| 116 | + </BranchCommitList> |
| 117 | + </div> |
| 118 | + {/each} |
| 119 | + {/snippet} |
| 120 | + </ReduxResult> |
| 121 | + </div> |
| 122 | +</ScrollableContainer> |
109 | 123 |
|
110 | 124 | <style lang="postcss">
|
111 | 125 | .commit-goes-here {
|
|
124 | 138 | background-color: var(--clr-bg-1);
|
125 | 139 | }
|
126 | 140 | }
|
| 141 | +
|
| 142 | + .branch .empty-branch-commit-here .indicator { |
| 143 | + border-radius: 0 0 var(--radius-l) var(--radius-l); |
| 144 | + } |
| 145 | +
|
127 | 146 | .header-wrapper {
|
128 | 147 | opacity: 0.4;
|
129 | 148 | }
|
|
142 | 161 | }
|
143 | 162 | &.last {
|
144 | 163 | border-bottom: none;
|
| 164 | + border-radius: 0 0 var(--radius-l) var(--radius-l); |
145 | 165 | }
|
146 | 166 | }
|
147 | 167 | .pin {
|
|
168 | 188 | display: flex;
|
169 | 189 | width: 100%;
|
170 | 190 | background-color: var(--clr-bg-2);
|
171 |
| - &.last { |
| 191 | +
|
| 192 | + &.last:not(:has(~ .indicator)) { |
172 | 193 | border-radius: 0 0 var(--radius-l) var(--radius-l);
|
173 | 194 | }
|
174 | 195 | }
|
175 | 196 |
|
| 197 | + .last .indicator { |
| 198 | + border-radius: 0 0 var(--radius-l) var(--radius-l); |
| 199 | + } |
| 200 | +
|
176 | 201 | /* COMMIT HERE */
|
177 | 202 | .commit-here {
|
178 | 203 | width: 100%;
|
|
0 commit comments