Move file selection to browser component

This commit is contained in:
Alexis Sellier
2021-06-15 17:51:36 +02:00
parent 8f5d8a6841
commit e7f15acd97
2 changed files with 8 additions and 7 deletions
+6 -2
View File
@@ -1,4 +1,5 @@
<script lang="typescript">
import { navigate } from 'svelte-routing';
import type { Config } from '@app/config';
import * as proj from '@app/project';
import Loading from '@app/Loading.svelte';
@@ -14,8 +15,11 @@
export let commit: string;
export let config: Config;
export let path: string;
export let onSelect: (event: { detail: string }) => void;
export let org: string | null = null;
export let org = "";
const onSelect = ({ detail: path }: { detail: string }) => {
navigate(proj.path({ urn, org, commit, path }));
};
const fetchTree = async (path: string) => {
return proj.getTree(urn, commit, path, config);
+2 -5
View File
@@ -1,5 +1,5 @@
<script lang="typescript">
import { Link, navigate } from 'svelte-routing';
import { Link } from 'svelte-routing';
import type { Config } from '@app/config';
import * as proj from '@app/project';
import Loading from '@app/Loading.svelte';
@@ -17,9 +17,6 @@
let getProject = proj.getInfo(urn, config);
let projectRoot = proj.path({ urn, org, commit });
const onSelect = ({ detail: path }: { detail: string }) => {
navigate(proj.path({ urn, org, commit, path }));
};
const back = () => window.history.back();
</script>
@@ -73,7 +70,7 @@
<div class="urn">{urn}</div>
<div class="description">{project.meta.description}</div>
</header>
<Browser {urn} {org} commit={commit || project.head} {path} {onSelect} {config} />
<Browser {urn} {org} commit={commit || project.head} {path} {config} />
{:catch}
<Modal subtle>
<span slot="title">🏜️</span>