Skip to content

Commit

Permalink
Edit Mode page: Display commit info
Browse files Browse the repository at this point in the history
Display information about the commit in the edit mode page
  • Loading branch information
estib-vega committed Sep 19, 2024
1 parent 2c6c30a commit ae85e80
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions apps/desktop/src/lib/components/EditMode.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script lang="ts">
// import { Project } from '$lib/backend/projects';
import { Project } from '$lib/backend/projects';
import { RemoteCommitService } from '$lib/commits/service';
import ActionView from '$lib/layout/ActionView.svelte';
import { ModeService, type EditModeMetadata } from '$lib/modes/service';
import { UncommitedFilesWatcher } from '$lib/uncommitedFiles/watcher';
import { getContext } from '$lib/utils/context';
import { Commit, type RemoteFile } from '$lib/vbranches/types';
import Button from '@gitbutler/ui/Button.svelte';
import InfoButton from '@gitbutler/ui/InfoButton.svelte';
import Avatar from '@gitbutler/ui/avatar/Avatar.svelte';
import FileListItem from '@gitbutler/ui/file/FileListItem.svelte';
import type { RemoteFile } from '$lib/vbranches/types';
import type { FileStatus } from '@gitbutler/ui/file/types';
interface Props {
Expand All @@ -17,7 +18,8 @@
const { editModeMetadata }: Props = $props();
// const project = getContext(Project);
const project = getContext(Project);
const remoteCommitService = getContext(RemoteCommitService);
const uncommitedFileWatcher = getContext(UncommitedFilesWatcher);
const modeService = getContext(ModeService);
Expand All @@ -27,13 +29,20 @@
let modeServiceSaving = $state<'inert' | 'loading' | 'completed'>('inert');
let initialFiles = $state<RemoteFile[]>([]);
let commit = $state<Commit | undefined>(undefined);
$effect(() => {
modeService.getInitialIndexState().then((files) => {
initialFiles = files;
});
});
$effect(() => {
remoteCommitService.find(project.id, editModeMetadata.commitOid).then((maybeCommit) => {
commit = maybeCommit;
});
});
interface FileEntry {
name: string;
path: string;
Expand Down Expand Up @@ -144,13 +153,14 @@

<div class="commit-data">
<div class="card commit-card">
<h3 class="text-13 text-semibold commit-card__title">Awesome title</h3>
<h3 class="text-13 text-semibold commit-card__title">
{commit?.descriptionTitle ?? 'unknown'}
</h3>
<div class="text-11 commit-card__details">
<span class="">{editModeMetadata.commitOid.slice(0, 7)}</span>
<span class="commit-card__divider">•</span>
<span class="">Author</span>
<span class="">{commit?.author.name ?? 'unknown'}</span>
</div>

<div class="commit-card__type-indicator"></div>
</div>

Expand Down

0 comments on commit ae85e80

Please sign in to comment.