Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add projects to user profile
Sebastian Martinez committed 4 years ago
commit 77145b13593dcb1314cc83acc4f4d3c135a8297e
parent 44abcdee679b25caa4a1cac1e0664c96eaac75b5
2 files changed +36 -0
modified src/base/orgs/Org.ts
@@ -216,6 +216,14 @@ export class Org {
    }
  }

+
  // Return only Orgs that have a specific user as owner
+
  static async getOrgsByOwner(owner: string, config: Config): Promise<Org[]> {
+
    const orgsResult = await utils.querySubgraph(config.orgs.subgraph, GetOrgsByOwner, { owners: [owner] });
+
    return orgsResult.orgs.map((o: { id: string; owner: string }) => {
+
      return new Org(o.id, o.owner);
+
    });
+
  }
+

  static async getOrgsByMember(memberAddr: string, config: Config): Promise<Org[]> {
    const safeResult = await utils.querySubgraph(
      config.safe.subgraph, GetSafes, { owners: [memberAddr] }
modified src/base/users/View.svelte
@@ -5,6 +5,9 @@
  import Avatar from '@app/Avatar.svelte';
  import { Profile } from '@app/profile';
  import Loading from '@app/Loading.svelte';
+
  import { Org } from '@app/base/orgs/Org';
+
  import Message from '@app/Message.svelte';
+
  import Project from '@app/base/projects/Widget.svelte';

  export let address: string;
  export let config: Config;
@@ -45,6 +48,12 @@
    display: flex; /* Ensures correct vertical positioning of icons */
    margin-right: 1rem;
  }
+
  .projects {
+
    margin-top: 2rem;
+
  }
+
  .projects .project {
+
    margin-bottom: 1rem;
+
  }
</style>

{#await Profile.get(address, config)}
@@ -74,5 +83,24 @@
        </div>
      </div>
    </header>
+
      <div class="projects">
+
        {#await Org.getOrgsByOwner(address, config)}
+
          <Loading center fadeIn />
+
        {:then orgs}
+
          {#each orgs as org}
+
            {#await org.getProjects(config) then projects}
+
              {#each projects as project}
+
                <div class="project">
+
                  <Project {project} org={org.address} {config} seed={profile.seed} />
+
                </div>
+
              {/each}
+
            {:catch err}
+
              <Message error>
+
                <strong>Error: </strong> failed to load projects: {err.message}.
+
              </Message>
+
            {/await}
+
          {/each}
+
        {/await}
+
      </div>
  </main>
{/await}