Skip to content

Commit ab725a4

Browse files
authored
update history sidebar ui and remove unused sidebar domains (#8132)
* ui update: history sideview * remove unused domains * remove unused route components * added `isNewProjectSettings`
1 parent 26ae409 commit ab725a4

File tree

9 files changed

+79
-186
lines changed

9 files changed

+79
-186
lines changed

apps/desktop/src/components/ChromeHeader.svelte

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { Project } from '$lib/project/project';
88
import { ProjectsService } from '$lib/project/projectsService';
99
import { ircPath, projectPath } from '$lib/routes/routes.svelte';
10+
import * as events from '$lib/utils/events';
1011
import { getContext, maybeGetContext } from '@gitbutler/shared/context';
1112
import Button from '@gitbutler/ui/Button.svelte';
1213
import Icon from '@gitbutler/ui/Icon.svelte';
@@ -59,9 +60,9 @@
5960
<IntegrateUpstreamModal bind:this={modal} projectId={selectedProjectId} />
6061
{/if}
6162

62-
<div class="header" class:mac={platformName === 'macos'} data-tauri-drag-region>
63-
<div class="left" data-tauri-drag-region>
64-
<div class="left-buttons" class:macos={platformName === 'macos'}>
63+
<div class="chrome-header" class:mac={platformName === 'macos'} data-tauri-drag-region>
64+
<div class="chrome-left" data-tauri-drag-region>
65+
<div class="chrome-left-buttons" class:macos={platformName === 'macos'}>
6566
<SyncButton {projectId} size="button" />
6667
{#if upstreamCommits > 0}
6768
<Button style="pop" onclick={openModal} disabled={!selectedProjectId}
@@ -70,7 +71,7 @@
7071
{/if}
7172
</div>
7273
</div>
73-
<div class="center" data-tauri-drag-region>
74+
<div class="chrome-center" data-tauri-drag-region>
7475
<Select
7576
searchable
7677
value={selectedProjectId}
@@ -128,7 +129,8 @@
128129
</OptionsGroup>
129130
</Select>
130131
</div>
131-
<div class="right" data-tauri-drag-region>
132+
<div class="chrome-right" data-tauri-drag-region>
133+
<Button kind="ghost" icon="timeline" onclick={() => events.emit('openHistory')} />
132134
<NotificationButton
133135
hasUnread={isNotificationsUnread}
134136
onclick={() => {
@@ -139,42 +141,43 @@
139141
</div>
140142

141143
<style>
142-
.header {
144+
.chrome-header {
143145
display: flex;
144146
padding: 14px;
145147
align-items: center;
146148
justify-content: space-between;
147149
overflow: hidden;
148150
}
149151
150-
.left {
152+
.chrome-left {
151153
display: flex;
152154
gap: 14px;
153155
}
154156
155-
.center {
157+
.chrome-center {
156158
flex-shrink: 1;
157159
}
158160
159-
.right {
161+
.chrome-right {
160162
display: flex;
163+
gap: 4px;
161164
justify-content: right;
162165
}
163166
164167
/** Flex basis 0 means they grow by the same amount. */
165-
.right,
166-
.left {
168+
.chrome-right,
169+
.chrome-left {
167170
flex-basis: 0;
168171
flex-grow: 1;
169172
}
170173
171-
.left-buttons {
174+
.chrome-left-buttons {
172175
display: flex;
173176
gap: 8px;
174177
}
175178
176179
/** Mac padding added here to not affect header flex-box sizing. */
177-
.mac .left-buttons {
180+
.mac .chrome-left-buttons {
178181
padding-left: 70px;
179182
}
180183

apps/desktop/src/components/ChromeSidebar.svelte

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
import { Project } from '$lib/project/project';
66
import {
77
branchesPath,
8-
historyPath,
98
ircPath,
109
isBranchesPath,
11-
isHistoryPath,
1210
isIrcPath,
13-
isProjectSettingsPath,
14-
isTargetPath,
11+
isNewProjectSettingsPath,
1512
isWorkspacePath,
1613
newProjectSettingsPath,
1714
newSettingsPath,
18-
targetPath,
1915
workspacePath
2016
} from '$lib/routes/routes.svelte';
2117
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
@@ -124,63 +120,6 @@
124120
</svg>
125121
</Button>
126122
</div>
127-
<div>
128-
{#if isTargetPath()}
129-
<div class="active-page-indicator" in:slide={{ axis: 'x', duration: 150 }}></div>
130-
{/if}
131-
<Button
132-
kind="outline"
133-
onclick={() => goto(targetPath(project.id))}
134-
width={34}
135-
class={['btn-square', isTargetPath() && 'btn-active']}
136-
tooltip="Target"
137-
>
138-
<svg viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
139-
<path
140-
d="M10.6906 1C12.1197 1 13.4402 1.7624 14.1547 3L15.8453 5.9282C16.5598 7.16581 16.5598 8.6906 15.8453 9.9282L14.1547 12.8564C13.4402 14.094 12.1197 14.8564 10.6906 14.8564H7.3094C5.88034 14.8564 4.55983 14.094 3.8453 12.8564L2.1547 9.9282C1.44017 8.6906 1.44017 7.16581 2.1547 5.9282L3.8453 3C4.55983 1.7624 5.88034 1 7.3094 1H10.6906Z"
141-
stroke-width="1.5"
142-
stroke="var(--clr-target-bg)"
143-
fill="var(--clr-target-bg)"
144-
/>
145-
<path d="M9 14.5V10.5M9 5V1" stroke-width="1.5" stroke="var(--clr-target-lines)" />
146-
<path
147-
d="M2.25 7.75L6.25 7.75M11.75 7.75L15.75 7.75"
148-
stroke-width="1.5"
149-
stroke="var(--clr-target-lines)"
150-
/>
151-
<circle cx="9" cy="8" r="1" stroke="var(--clr-target-lines)" />
152-
</svg>
153-
</Button>
154-
</div>
155-
<div>
156-
{#if isHistoryPath()}
157-
<div class="active-page-indicator" in:slide={{ axis: 'x', duration: 150 }}></div>
158-
{/if}
159-
<Button
160-
kind="outline"
161-
onclick={() => goto(historyPath(project.id))}
162-
width={34}
163-
class={['btn-square', isHistoryPath() && 'btn-active']}
164-
tooltip="History"
165-
>
166-
<svg
167-
viewBox="0 0 18 18"
168-
fill="none"
169-
xmlns="http://www.w3.org/2000/svg"
170-
stroke-width="1.5"
171-
style="padding: 1px;"
172-
>
173-
<rect
174-
width="18"
175-
height="18"
176-
rx="6"
177-
stroke="var(--clr-history-bg)"
178-
fill="var(--clr-history-bg)"
179-
/>
180-
<path d="M8 3V10H13" stroke-width="1.5" stroke="var(--clr-history-arrows)" />
181-
</svg>
182-
</Button>
183-
</div>
184123
{#if $ircEnabled}
185124
<div>
186125
{#if isIrcPath()}
@@ -189,27 +128,26 @@
189128
<Button
190129
kind="outline"
191130
onclick={() => goto(ircPath(project.id))}
131+
icon="chat"
192132
width={34}
193133
class={['btn-square', isIrcPath() && 'btn-active']}
194134
tooltip="History"
195-
>
196-
irc
197-
</Button>
135+
/>
198136
</div>
199137
{/if}
200138
</div>
201139
<div class="bottom">
202140
<div class="bottom__primary-actions">
203141
<div>
204-
{#if isProjectSettingsPath()}
142+
{#if isNewProjectSettingsPath()}
205143
<div class="active-page-indicator" in:slide={{ axis: 'x', duration: 150 }}></div>
206144
{/if}
207145
<Button
208146
icon="settings"
209147
kind="outline"
210148
onclick={() => goto(newProjectSettingsPath(project.id))}
211149
width={34}
212-
class={['btn-square', isProjectSettingsPath() && 'btn-active']}
150+
class={['btn-square', isNewProjectSettingsPath() && 'btn-active']}
213151
tooltipPosition="top"
214152
tooltipAlign="start"
215153
tooltip="Project settings"

0 commit comments

Comments
 (0)