Skip to content

Instantly share code, notes, and snippets.

@sebastinez
Created February 9, 2022 11:03
Show Gist options
  • Save sebastinez/586a349b9a3799b932a28c35ef27dce8 to your computer and use it in GitHub Desktop.
Save sebastinez/586a349b9a3799b932a28c35ef27dce8 to your computer and use it in GitHub Desktop.
diff
diff --git a/src/base/orgs/View/Projects.svelte b/src/base/orgs/View/Projects.svelte
index 5e3af90..b77e19b 100644
--- a/src/base/orgs/View/Projects.svelte
+++ b/src/base/orgs/View/Projects.svelte
@@ -11,7 +11,8 @@
import { Seed } from "@app/base/seeds/Seed";
import AnchorActions from "@app/base/profiles/AnchorActions.svelte";
- export let profile: Profile;
+ export let seed: Seed | null = null;
+ export let profile: Profile | null = null;
export let config: Config;
export let account: string | null;
@@ -19,20 +20,23 @@
let pendingAnchors: Record<string, PendingAnchor> = {};
const loadAnchors = async () => {
- const [pending, confirmed] = await Promise.all([
- profile.pendingAnchors(config),
- profile.confirmedAnchors(config),
- ]);
+ if (profile) {
+ const [pending, confirmed] = await Promise.all([
+ profile.pendingAnchors(config),
+ profile.confirmedAnchors(config),
+ ]);
- anchors = confirmed;
- pendingAnchors = pending;
+ anchors = confirmed;
+ pendingAnchors = pending;
+ }
};
const onClick = (project: ProjectInfo) => {
navigate(
proj.path({
urn: project.urn,
- addressOrName: profile.name ?? profile.address,
+ seed: seed?.host,
+ addressOrName: profile?.name ?? profile?.address,
revision: project.head,
})
);
@@ -64,7 +68,7 @@
<div class="project">
<Widget {project} {anchor} on:click={() => onClick(project)}>
<span class="actions" slot="actions">
- {#if profile.org?.safe && account && anchor}
+ {#if profile?.org?.safe && account && anchor}
{#if pendingAnchor} <!-- Pending anchor -->
<AnchorActions
{account} {config} anchor={pendingAnchor} safe={profil
e.org.safe}
diff --git a/src/base/seeds/View.svelte b/src/base/seeds/View.svelte
index 19a801d..e5c2d07 100644
--- a/src/base/seeds/View.svelte
+++ b/src/base/seeds/View.svelte
@@ -1,24 +1,18 @@
<script lang="ts">
- import { navigate } from "svelte-routing";
import type { Config } from "@app/config";
import { Seed } from "@app/base/seeds/Seed";
- import Widget from "@app/base/projects/Widget.svelte";
import Loading from "@app/Loading.svelte";
import SeedAddress from "@app/SeedAddress.svelte";
import NotFound from "@app/NotFound.svelte";
- import * as proj from "@app/project";
+ import Projects from "@app/base/orgs/View/Projects.svelte";
+ import { session } from '@app/session';
export let config: Config;
export let seedAddress: string;
config = config.withSeed({ host: seedAddress });
- const onProjectClick = (project: proj.ProjectInfo) => {
- navigate(proj.path({
- urn: project.urn,
- seed: seedAddress,
- }));
- };
+ $: account = $session && $session.address;
</script>
<style>
@@ -56,12 +50,6 @@
display: flex;
align-items: center;
}
- .projects {
- margin-top: 2rem;
- }
- .projects .project {
- margin-bottom: 1rem;
- }
.desktop {
display: block !important;
}
@@ -122,15 +110,7 @@
<div class="desktop" />
</div>
<!-- Seed Projects -->
- {#await Seed.getProjects(config) then projects}
- <div class="projects">
- {#each projects as project}
- <div class="project">
- <Widget {project} on:click={() => onProjectClick(project)} /
>
- </div>
- {/each}
- </div>
- {/await}
+ <Projects seed={info} {config} {account} />
</main>
{:catch}
<NotFound title={seedAddress} subtitle="Not able to query information
from this seed." />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment