Merge pull request #4879 from urbit/james/unavailable-refs

permalinks: present error for unavailable references
This commit is contained in:
matildepark 2021-05-07 18:00:56 -04:00 committed by GitHub
commit 183e285390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,9 +111,9 @@ function GraphPermalink(
bg="white" bg="white"
maxWidth={full ? null : "500px"} maxWidth={full ? null : "500px"}
border={full ? null : "1"} border={full ? null : "1"}
borderColor='lightGray' borderColor="lightGray"
borderRadius="2" borderRadius="2"
cursor='pointer' cursor="pointer"
onClick={(e) => { onClick={(e) => {
navigate(e); navigate(e);
}} }}
@ -127,18 +127,22 @@ function GraphPermalink(
showOurContact={showOurContact} showOurContact={showOurContact}
/> />
)} )}
{association ? ( {isInSameResource && (
<Row height='12px' />
)}
{association && !isInSameResource ? (
<PermalinkDetails <PermalinkDetails
known known
showTransclusion={showTransclusion} showTransclusion={showTransclusion}
showDetails={!isInSameResource}
icon={getModuleIcon(association.metadata.config.graph)} icon={getModuleIcon(association.metadata.config.graph)}
title={association.metadata.title} title={association.metadata.title}
permalink={permalink} permalink={permalink}
/> />
) : ( ) : null}
{!association && (
<PermalinkDetails <PermalinkDetails
icon="Groups" icon="Groups"
showDetails={false}
title={graph.slice(5)} title={graph.slice(5)}
permalink={permalink} permalink={permalink}
/> />
@ -155,39 +159,30 @@ function PermalinkDetails(props: {
showDetails?: boolean; showDetails?: boolean;
known?: boolean; known?: boolean;
}) { }) {
const { title, icon, permalink, known, showTransclusion , showDetails } = props; const { title, icon, permalink, known, showTransclusion } = props;
const rowTransclusionStyle = showTransclusion const rowTransclusionStyle = showTransclusion
? { p: '12px 12px 11px 11px' } ? { p: '12px 12px 11px 11px' }
: { p: '12px' }; : { p: '12px' };
if (showDetails) { return (
return ( <Row
<Row {...rowTransclusionStyle}
{...rowTransclusionStyle} alignItems="center"
alignItems="center" justifyContent="space-between"
justifyContent="space-between" width="100%"
width="100%" >
> <Row gapX="2" alignItems="center">
<Row gapX="2" alignItems="center"> <Box width={4} height={4}>
<Box width={4} height={4}> <Center width={4} height={4}>
<Center width={4} height={4}> <Icon icon={icon} color='gray' />
<Icon icon={icon} color='gray' /> </Center>
</Center> </Box>
</Box> <Text gray mono={!known}>
<Text gray mono={!known}> {title}
{title} </Text>
</Text>
</Row>
</Row> </Row>
); </Row>
} else { );
return (
<Row
height='12px'
width="100%"
/>
);
}
} }
export function PermalinkEmbed(props: { export function PermalinkEmbed(props: {