mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Add projects to user profile
Signed-off-by: Sebastian Martinez <sebastinez@me.com> Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -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] }
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user