Fix parent link in project view

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2021-10-11 17:23:19 +02:00
parent 398f5c8d09
commit 08d7ee6a29
+8 -2
View File
@@ -8,7 +8,7 @@
import { Org } from '@app/base/orgs/Org';
import type { Profile } from '@app/profile';
import type { Info } from '@app/project';
import { formatOrg } from '@app/utils';
import { formatOrg, isAddressEqual } from '@app/utils';
import Browser from './Browser.svelte';
@@ -38,6 +38,12 @@
return { project: info, config: cfg, org: orgProfile };
});
const parentUrl = (profile: Profile) => {
return org === profile.name || isAddressEqual(org, profile.address)
? `/orgs/${profile.nameOrAddress}`
: `/users/${profile.nameOrAddress}`;
};
$: if (projectInfo) {
if (projectInfo.meta.description) {
pageTitle = `${formatOrg(org, config)}/${projectInfo.meta.name}: ${projectInfo.meta.description}`;
@@ -106,7 +112,7 @@
<header>
<div class="title bold">
{#if result.org}
<a class="org-avatar" title={result.org.nameOrAddress} href={`/orgs/${result.org.nameOrAddress}`}>
<a class="org-avatar" title={result.org.nameOrAddress} href={parentUrl(result.org)}>
<Avatar source={result.org.avatar || result.org.address} address={result.org.address}/>
</a>
<span class="divider">/</span>