|
1 | 1 | <script lang="ts">
|
| 2 | + import FileList from '$components/FileList.svelte'; |
2 | 3 | import ReduxResult from '$components/ReduxResult.svelte';
|
3 | 4 | import SnapshotAttachment from '$components/SnapshotAttachment.svelte';
|
4 | 5 | import { createdOnDay, HISTORY_SERVICE } from '$lib/history/history';
|
5 | 6 | import { MODE_SERVICE } from '$lib/mode/modeService';
|
6 | 7 | import { toHumanReadableTime } from '$lib/utils/time';
|
7 | 8 | import { inject } from '@gitbutler/core/context';
|
8 |
| - import { Button, Icon, FileListItem } from '@gitbutler/ui'; |
| 9 | + import { Button, Icon, ScrollableContainer } from '@gitbutler/ui'; |
9 | 10 | import { focusable } from '@gitbutler/ui/focus/focusable';
|
10 | 11 | import type { Snapshot, SnapshotDetails } from '$lib/history/types';
|
11 | 12 | import type iconsJson from '@gitbutler/ui/data/icons.json';
|
|
15 | 16 | isWithinRestore?: boolean;
|
16 | 17 | onRestoreClick: () => void;
|
17 | 18 | onDiffClick: (filePath: string) => void;
|
18 |
| - selectedFile?: |
19 |
| - | { |
20 |
| - entryId: string; |
21 |
| - path: string; |
22 |
| - } |
23 |
| - | undefined; |
24 | 19 | projectId: string;
|
25 | 20 | }
|
26 | 21 |
|
27 |
| - const { |
28 |
| - projectId, |
29 |
| - entry, |
30 |
| - isWithinRestore = true, |
31 |
| - selectedFile = undefined, |
32 |
| - onRestoreClick, |
33 |
| - onDiffClick |
34 |
| - }: Props = $props(); |
| 22 | + const { projectId, entry, isWithinRestore = true, onRestoreClick, onDiffClick }: Props = $props(); |
35 | 23 |
|
36 | 24 | function getShortSha(sha: string | undefined) {
|
37 | 25 | if (!sha) return '';
|
|
223 | 211 | <ReduxResult result={snapshotDiff.result} {projectId}>
|
224 | 212 | {#snippet children(files)}
|
225 | 213 | {#if files.length > 0 && !isRestoreSnapshot}
|
226 |
| - <SnapshotAttachment foldable={files.length > 2} foldedAmount={files.length}> |
227 |
| - <div class="files-attacment" use:focusable={{ vertical: true }}> |
228 |
| - {#each files as file, idx} |
229 |
| - <div |
230 |
| - use:focusable={{ |
231 |
| - focusable: true, |
232 |
| - onActive: () => onDiffClick(file.path) |
233 |
| - }} |
234 |
| - > |
235 |
| - <FileListItem |
236 |
| - listMode="list" |
237 |
| - filePath={file.path} |
238 |
| - selected={selectedFile?.path === file.path && |
239 |
| - selectedFile?.entryId === entry.id} |
240 |
| - hideBorder={idx === files.length - 1} |
241 |
| - /> |
242 |
| - </div> |
243 |
| - {/each} |
244 |
| - </div> |
| 214 | + <SnapshotAttachment |
| 215 | + foldable={files.length > 2} |
| 216 | + foldedAmount={files.length} |
| 217 | + foldedHeight="7rem" |
| 218 | + > |
| 219 | + <ScrollableContainer> |
| 220 | + <FileList |
| 221 | + selectionId={{ type: 'snapshot', snapshotId: entry.id }} |
| 222 | + {projectId} |
| 223 | + stackId={undefined} |
| 224 | + changes={files} |
| 225 | + listMode="list" |
| 226 | + hideLastFileBorder={false} |
| 227 | + onselect={(change) => onDiffClick(change.path)} |
| 228 | + /> |
| 229 | + </ScrollableContainer> |
245 | 230 | </SnapshotAttachment>
|
246 | 231 | {/if}
|
247 | 232 | {/snippet}
|
|
386 | 371 | white-space: nowrap;
|
387 | 372 | }
|
388 | 373 |
|
389 |
| - /* ATTACHMENT FILES */ |
390 |
| - .files-attacment { |
391 |
| - display: flex; |
392 |
| - flex-direction: column; |
393 |
| - } |
394 |
| -
|
395 | 374 | /* ATTACHMENT RESTORE */
|
396 | 375 | .restored-attacment {
|
397 | 376 | display: flex;
|
|
0 commit comments