Skip to content

Commit

Permalink
chore(core): add folder open to modified files view
Browse files Browse the repository at this point in the history
  • Loading branch information
rudoi committed May 24, 2024
1 parent c1efffa commit 90748d5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions birdie/src/routes/source/submit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import { getRepoStatus, revertFiles, submit } from '$lib/repo';
import {
allModifiedFiles,
appConfig,
commitMessage,
repoConfig,
repoStatus,
selectedFiles
} from '$lib/stores';
import { openUrl } from '$lib/utils';
let loading = false;
let submitting = false;
Expand All @@ -26,6 +28,14 @@
!loading &&
$repoConfig?.trunkBranch === $repoStatus?.branch;
const handleOpenDirectory = async (path: string) => {
const parent = path.split('/').slice(0, -1).join('/');
const fullPath = `${$appConfig.repoPath}/${parent}`;
await openUrl(fullPath);
};
const refreshFiles = async (triggerLoading: boolean) => {
if (triggerLoading) {
loading = true;
Expand Down Expand Up @@ -132,6 +142,7 @@
disabled={loading}
bind:selectedFiles={$selectedFiles}
bind:selectAll
onOpenDirectory={handleOpenDirectory}
modifiedFiles={$allModifiedFiles}
onRevertFiles={handleRevertFiles}
snapshotsEnabled={false}
Expand Down
11 changes: 10 additions & 1 deletion core/ui/src/lib/components/repo/ModifiedFilesCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import {
CloseCircleSolid,
FileEditSolid,
FolderOpenSolid,
InfoCircleSolid,
PlusSolid
} from 'flowbite-svelte-icons';
Expand All @@ -28,6 +29,7 @@
export let snapshotsEnabled = true;
export let selectAll: boolean = false;
export let onRevertFiles: (files: string[]) => Promise<void>;
export let onOpenDirectory: (path: string) => Promise<void>;
let showRevertConfirmation = false;
let shiftHeld = false;
Expand Down Expand Up @@ -234,7 +236,14 @@
</Tooltip>
{/if}
</TableBodyCell>
<TableBodyCell class="p-1 whitespace-nowrap font-medium">
<TableBodyCell class="p-1 flex gap-1 items-center h-full whitespace-nowrap font-medium">
<Button
outline
size="xs"
class="p-1 border-0 focus-within:ring-0 dark:focus-within:ring-0"
on:click={async () => onOpenDirectory(file.path)}
><FolderOpenSolid class="w-4 h-4" /></Button
>
<Button
outline
size="xs"
Expand Down
10 changes: 10 additions & 0 deletions friendshipper/src/routes/source/submit/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
repoStatus,
selectedFiles
} from '$lib/stores';
import { openUrl } from '$lib/utils';
let loading = false;
let fetchingPulls = false;
Expand Down Expand Up @@ -76,6 +77,14 @@
preferencesOpen = false;
});
const handleOpenDirectory = async (path: string) => {
const parent = path.split('/').slice(0, -1).join('/');
const fullPath = `${$appConfig.repoPath}/${parent}`;
await openUrl(fullPath);
};
const refreshFiles = async (triggerLoading: boolean) => {
if (triggerLoading) {
loading = true;
Expand Down Expand Up @@ -383,6 +392,7 @@
bind:selectedFiles={$selectedFiles}
bind:selectAll
modifiedFiles={$allModifiedFiles}
onOpenDirectory={handleOpenDirectory}
onRevertFiles={handleRevertFiles}
onSaveSnapshot={handleSaveSnapshot}
/>
Expand Down

0 comments on commit 90748d5

Please sign in to comment.