mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
Merge branch 'release/next-userspace' into release/2021-7-22
This commit is contained in:
commit
5f341acc47
@ -25,8 +25,6 @@
|
||||
^- (list @tas)
|
||||
:~ %group-store
|
||||
%metadata-store
|
||||
%contact-store
|
||||
%contact-hook
|
||||
%invite-store
|
||||
%graph-store
|
||||
==
|
||||
|
@ -103,6 +103,9 @@ const addMembers = (json: GroupUpdate, state: GroupState): GroupState => {
|
||||
if ('addMembers' in json) {
|
||||
const { resource, ships } = json.addMembers;
|
||||
const resourcePath = resourceAsPath(resource);
|
||||
if(!(resourcePath in state.groups)) {
|
||||
return;
|
||||
}
|
||||
for (const member of ships) {
|
||||
state.groups[resourcePath].members.add(member);
|
||||
if (
|
||||
|
@ -77,7 +77,7 @@ function GroupRoutes(props: { group: string; url: string }) {
|
||||
return null;
|
||||
}
|
||||
if(!graphKeys.has(`${ship.slice(1)}/${name}`)) {
|
||||
if(graphKeys.size > 0) {
|
||||
if(graphKeys.size > 1) { // TODO: Better loading logic see https://github.com/urbit/landscape/issues/1063
|
||||
return <Redirect
|
||||
to={toQuery(
|
||||
{ auto: 'y', redir: location.pathname },
|
||||
|
@ -2,7 +2,7 @@ import { BaseAnchor, Box, Center, Col, Icon, Row, Text } from '@tlon/indigo-reac
|
||||
import { Association, GraphNode, resourceFromPath, GraphConfig } from '@urbit/api';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import _ from 'lodash';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import {
|
||||
getPermalinkForGraph, GraphPermalink as IGraphPermalink, parsePermalink
|
||||
} from '~/logic/lib/permalinks';
|
||||
@ -76,7 +76,6 @@ function GraphPermalink(
|
||||
}
|
||||
) {
|
||||
const { full = false, showOurContact, pending, graph, group, index, transcluded } = props;
|
||||
const history = useHistory();
|
||||
const location = useLocation();
|
||||
const { ship, name } = resourceFromPath(graph);
|
||||
const node = useGraphState(
|
||||
@ -114,11 +113,6 @@ function GraphPermalink(
|
||||
const showTransclusion = Boolean(association && node && transcluded < 1);
|
||||
const permalink = getPermalinkForGraph(group, graph, index);
|
||||
|
||||
const navigate = (e) => {
|
||||
e.stopPropagation();
|
||||
history.push(`/perma${permalink.slice(16)}`);
|
||||
};
|
||||
|
||||
const [nodeGroupHost, nodeGroupName] = association?.group.split('/').slice(-2) ?? ['Unknown', 'Unknown'];
|
||||
const [nodeChannelHost, nodeChannelName] = association?.resource
|
||||
.split('/')
|
||||
@ -141,15 +135,16 @@ function GraphPermalink(
|
||||
|
||||
return (
|
||||
<Col
|
||||
as={Link}
|
||||
to={`/perma${permalink.slice(16)}`}
|
||||
width="100%"
|
||||
bg="white"
|
||||
maxWidth={full ? null : '500px'}
|
||||
border={full ? null : '1'}
|
||||
borderColor="lightGray"
|
||||
borderRadius={2}
|
||||
cursor="pointer"
|
||||
onClick={(e) => {
|
||||
navigate(e);
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
{loading && association && !errored && Placeholder((association.metadata.config as GraphConfig).graph)}
|
||||
@ -167,7 +162,6 @@ function GraphPermalink(
|
||||
showTransclusion={showTransclusion}
|
||||
icon={getModuleIcon((association.metadata.config as GraphConfig).graph as GraphModule)}
|
||||
title={association.metadata.title}
|
||||
permalink={permalink}
|
||||
/>
|
||||
)}
|
||||
{association && isInSameResource && transcluded === 2 && !loading && (
|
||||
@ -176,7 +170,6 @@ function GraphPermalink(
|
||||
showTransclusion={showTransclusion}
|
||||
icon={getModuleIcon((association.metadata.config as GraphConfig).graph as GraphModule)}
|
||||
title={association.metadata.title}
|
||||
permalink={permalink}
|
||||
/>
|
||||
)}
|
||||
{isInSameResource && transcluded !== 2 && !loading && <Row height='2' />}
|
||||
@ -185,7 +178,6 @@ function GraphPermalink(
|
||||
icon="Groups"
|
||||
showDetails={false}
|
||||
title={graph.slice(5)}
|
||||
permalink={permalink}
|
||||
/>
|
||||
)}
|
||||
</Col>
|
||||
@ -195,7 +187,6 @@ function GraphPermalink(
|
||||
function PermalinkDetails(props: {
|
||||
title: string;
|
||||
icon: any;
|
||||
permalink: string;
|
||||
showTransclusion?: boolean;
|
||||
showDetails?: boolean;
|
||||
known?: boolean;
|
||||
|
@ -1,56 +1,63 @@
|
||||
import { Box, Col, Icon, Row, Text } from '@tlon/indigo-react';
|
||||
import React, { ReactElement, useCallback } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useModal } from '~/logic/lib/useModal';
|
||||
import useMetadataState, { usePreview } from '~/logic/state/metadata';
|
||||
import { PropFunc } from '~/types';
|
||||
import { JoinGroup } from '../landscape/components/JoinGroup';
|
||||
import { MetadataIcon } from '../landscape/components/MetadataIcon';
|
||||
|
||||
export function GroupLink(
|
||||
props: {
|
||||
resource: string;
|
||||
detailed?: boolean;
|
||||
} & PropFunc<typeof Row>
|
||||
): ReactElement {
|
||||
const { resource, ...rest } = props;
|
||||
type GroupLinkProps = {
|
||||
resource: string;
|
||||
detailed?: boolean;
|
||||
} & PropFunc<typeof Row>
|
||||
|
||||
export function GroupLink({
|
||||
resource,
|
||||
borderColor,
|
||||
...rest
|
||||
}: GroupLinkProps): ReactElement {
|
||||
const name = resource.slice(6);
|
||||
const joined = useMetadataState(
|
||||
useCallback(s => resource in s.associations.groups, [resource])
|
||||
);
|
||||
const history = useHistory();
|
||||
|
||||
const { modal, showModal } = useModal({
|
||||
modal: <JoinGroup autojoin={name} />
|
||||
});
|
||||
});
|
||||
|
||||
const { preview } = usePreview(resource);
|
||||
|
||||
return (
|
||||
<Box
|
||||
maxWidth="500px"
|
||||
cursor='pointer'
|
||||
{...rest}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
backgroundColor='white'
|
||||
borderColor={props.borderColor}
|
||||
>
|
||||
<>
|
||||
{modal}
|
||||
<Row
|
||||
width="100%"
|
||||
{...rest}
|
||||
as={Link}
|
||||
to={joined ? `/~landscape/ship/${name}` : `/perma/group/${name}`}
|
||||
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
e.stopPropagation();
|
||||
|
||||
if (e.metaKey || e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
showModal();
|
||||
}}
|
||||
flexShrink={1}
|
||||
alignItems="center"
|
||||
width="100%"
|
||||
maxWidth="500px"
|
||||
py={2}
|
||||
pr={2}
|
||||
onClick={
|
||||
joined ? () => history.push(`/~landscape/ship/${name}`) : showModal
|
||||
}
|
||||
cursor='pointer'
|
||||
backgroundColor='white'
|
||||
borderColor={borderColor}
|
||||
opacity={preview ? '1' : '0.6'}
|
||||
>
|
||||
<MetadataIcon height={6} width={6} metadata={preview ? preview.metadata : { color: '0x0' , picture: '' }} />
|
||||
<Col>
|
||||
<Col>
|
||||
<Text ml={2} fontWeight="medium" mono={!preview}>
|
||||
{preview ? preview.metadata.title : name}
|
||||
</Text>
|
||||
@ -70,6 +77,6 @@ export function GroupLink(
|
||||
</Box>
|
||||
</Col>
|
||||
</Row>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
Text
|
||||
} from '@tlon/indigo-react';
|
||||
import React, { useRef } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { Link, useHistory } from 'react-router-dom';
|
||||
import { Sigil } from '~/logic/lib/sigil';
|
||||
import { uxToHex } from '~/logic/lib/util';
|
||||
import useContactState from '~/logic/state/contact';
|
||||
@ -75,11 +75,12 @@ const StatusBar = (props) => {
|
||||
>
|
||||
<Row>
|
||||
<Button
|
||||
as={Link}
|
||||
to="/"
|
||||
width='32px'
|
||||
borderColor='lightGray'
|
||||
mr={2}
|
||||
px={2}
|
||||
onClick={() => history.push('/')}
|
||||
{...props}
|
||||
>
|
||||
<Icon icon='Dashboard' color='black' />
|
||||
@ -126,9 +127,10 @@ const StatusBar = (props) => {
|
||||
<Icon icon="Bug" color="#000000" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem
|
||||
as={Link}
|
||||
to="/~landscape/messages"
|
||||
width='32px'
|
||||
mr={2}
|
||||
onClick={() => props.history.push('/~landscape/messages')}
|
||||
>
|
||||
<Icon icon='Messages' />
|
||||
</StatusBarItem>
|
||||
@ -150,24 +152,26 @@ const StatusBar = (props) => {
|
||||
boxShadow='0px 0px 0px 3px'
|
||||
>
|
||||
<Row
|
||||
as={Link}
|
||||
to={`/~profile/~${ship}`}
|
||||
color='black'
|
||||
cursor='pointer'
|
||||
fontSize={1}
|
||||
fontWeight='500'
|
||||
px={3}
|
||||
py={2}
|
||||
onClick={() => history.push(`/~profile/~${ship}`)}
|
||||
>
|
||||
View Profile
|
||||
</Row>
|
||||
<Row
|
||||
as={Link}
|
||||
to="/~settings"
|
||||
color='black'
|
||||
cursor='pointer'
|
||||
fontSize={1}
|
||||
fontWeight='500'
|
||||
px={3}
|
||||
py={2}
|
||||
onClick={() => history.push('/~settings')}
|
||||
>
|
||||
System Preferences
|
||||
</Row>
|
||||
|
Loading…
Reference in New Issue
Block a user