Merge branch 'release/next-js' of https://github.com/urbit/urbit into npm-packages

This commit is contained in:
Tyler Brown Cifu Shuster 2021-02-14 14:14:30 -08:00
commit 2b30227f0f
16 changed files with 111 additions and 95 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f4b93e4d91e42c8444bb22447a0ae7d969ec552ba2d0f4b87a8dd20a41709d4e
size 9345380
oid sha256:ec58605002fafbe6f3a5988fe1db4bd31e2fd40370b30e96db64a98c8f7da0ea
size 9474412

View File

@ -94,16 +94,18 @@
++ rolo
^- rolodex:store
=/ ugroup (scry-group:grp resource)
=/ =rolodex:store
(scry-for:con rolodex:store /all)
%- ~(gas by *rolodex:store)
?~ ugroup
=/ c=(unit contact:store) (get-contact:con our.bowl)
=/ c=(unit contact:store) (~(get by rolodex) our.bowl)
?~ c
[our.bowl *contact:store]~
[our.bowl u.c]~
%+ murn ~(tap in (members:grp resource))
|= s=ship
^- (unit [ship contact:store])
=/ c=(unit contact:store) (get-contact:con s)
=/ c=(unit contact:store) (~(get by rolodex) s)
?~(c ~ `[s u.c])
--
::

View File

@ -104,10 +104,18 @@
|= [rolo=rolodex:store is-public=?]
^- (quip card _state)
=/ our-contact (~(got by rolodex) our.bowl)
=. rolodex (~(uni by rolodex) rolo)
=. rolodex (~(put by rolodex) our.bowl our-contact)
:_ state(rolodex rolodex)
(send-diff [%initial rolodex is-public] %.n)
=/ diff-rolo=rolodex:store
%- ~(gas by *rolodex:store)
%+ skim ~(tap in rolo)
|= [=ship =contact:store]
?~ local-con=(~(get by rolodex) ship) %.y
(gth last-updated.contact last-updated.u.local-con)
=/ new-rolo=rolodex:store
(~(uni by rolodex) diff-rolo)
=. new-rolo (~(put by new-rolo) our.bowl our-contact)
?: =(new-rolo rolodex) `state
:_ state(rolodex new-rolo)
(send-diff [%initial new-rolo is-public] %.n)
::
++ handle-add
|= [=ship =contact:store]

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v3.t4lg5.84a6h.2bi2s.ni2p9.32uor
++ hash 0v7.iotki.j1ptb.mk9vm.borai.jfcr1
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.js"></script>
<script src="/~landscape/js/bundle/index.dcdc4301b299cb03bad0.js"></script>
<script src="/~landscape/js/bundle/index.096bb7cb32b754071b13.js"></script>
</body>
</html>

View File

@ -59,18 +59,16 @@ const edit = (json: ContactUpdate, state: S) => {
if (!field) {
return;
}
const contact = state.contacts?.[ship];
const value = data['edit-field'][field];
if(!contact) {
return;
}
if(field === 'add-group') {
contact.groups.push(value);
state.contacts[ship].groups.push(value);
} else if (field === 'remove-group') {
contact.groups = contact.groups.filter(g => g !== value);
state.contacts[ship].groups =
state.contacts[ship].groups.filter(g => g !== value);
} else {
contact[field] = value;
state.contacts[ship][field] = value;
}
}
};

View File

@ -80,22 +80,19 @@ export function ChatResource(props: ChatResourceProps) {
}, [station]);
const [showBanner, setShowBanner] = useState(false);
const [hasLoadedAllowed, setHasLoadedAllowed] = useState(false);
const [recipients, setRecipients] = useState([]);
const res = resourceFromPath(groupPath);
useEffect(() => {
(async () => {
if (!res) {
return;
}
if (!group) {
return;
}
if (!res) { return; }
if (!group) { return; }
if (group.hidden) {
const members = _.compact(await Promise.all(
Array.from(group.members)
.map((s) => {
.map(s => {
const ship = `~${s}`;
if(s === window.ship) {
return Promise.resolve(null);
@ -105,7 +102,7 @@ export function ChatResource(props: ChatResourceProps) {
'personal',
ship,
true
).then((isAllowed) => {
).then(isAllowed => {
return isAllowed ? null : ship;
});
})
@ -117,6 +114,7 @@ export function ChatResource(props: ChatResourceProps) {
} else {
setShowBanner(false);
}
} else {
const groupShared = await props.api.contacts.fetchIsAllowed(
`~${window.ship}`,
@ -126,6 +124,8 @@ export function ChatResource(props: ChatResourceProps) {
);
setShowBanner(!groupShared);
}
setHasLoadedAllowed(true);
})();
}, [groupPath]);
@ -153,7 +153,10 @@ export function ChatResource(props: ChatResourceProps) {
history={props.history}
graph={graph}
unreadCount={unreadCount}
contacts={!showBanner ? contacts : modifiedContacts}
contacts={
(!showBanner && hasLoadedAllowed) ?
contacts : modifiedContacts
}
association={props.association}
associations={props.associations}
groups={props.groups}
@ -168,9 +171,13 @@ export function ChatResource(props: ChatResourceProps) {
ref={chatInput}
api={props.api}
station={station}
ourContact={!showBanner ? ourContact : null}
ourContact={
(!showBanner && hasLoadedAllowed) ? ourContact : null
}
envelopes={[]}
contacts={contacts}
contacts={
(!showBanner && hasLoadedAllowed) ? contacts : modifiedContacts
}
onUnmount={appendUnsent}
s3={props.s3}
placeholder="Message..."

View File

@ -95,16 +95,8 @@ h2 {
font-family: "Inter", sans-serif;
}
.embed-container {
width: 100%;
height: 14rem;
}
.embed-container iframe {
max-width: 24rem;
width: 100%;
height: 100%;
max-height: 26rem;
max-width: 100%;
}
.mh-16 {

View File

@ -7,14 +7,15 @@ import {
Row,
BaseImage,
Text
} from '@tlon/indigo-react';
} from "@tlon/indigo-react";
import RichText from '~/views/components/RichText'
import useLocalState from "~/logic/state/local";
import { Sigil } from '~/logic/lib/sigil';
import { ViewProfile } from './ViewProfile';
import { EditProfile } from './EditProfile';
import { SetStatusBarModal } from '~/views/components/SetStatusBarModal';
import { uxToHex } from '~/logic/lib/util';
import useLocalState from '~/logic/state/local';
import { useTutorialModal } from '~/views/components/useTutorialModal';
export function Profile(props: any): ReactElement {
@ -61,8 +62,9 @@ export function Profile(props: any): ReactElement {
width="100%"
>
<Row alignItems="center" justifyContent="space-between">
{ship === `~${window.ship}` ? (
<Row>
{ship === `~${window.ship}` ? (
<>
<Text
py='2'
cursor='pointer'
@ -79,14 +81,12 @@ export function Profile(props: any): ReactElement {
ship={`~${window.ship}`}
contact={contact}
/>
</Row>
</>
) : null}
<Text maxWidth='18rem' overflowX='hidden'
textOverflow="ellipsis"
</Row>
<RichText mb='0' py='2' disableRemoteContent maxWidth='18rem' overflowX='hidden' textOverflow="ellipsis"
whiteSpace="nowrap"
overflow="hidden" display="inline-block"
verticalAlign="middle"
>{contact?.status ?? ''}</Text>
overflow="hidden" display="inline-block" verticalAlign="middle">{contact?.status ?? ""}</RichText>
</Row>
<Row width="100%" height="300px">
{cover}

View File

@ -59,7 +59,7 @@ export function InviteItem(props: InviteItemProps) {
if (props.groups?.[resource]?.hidden) {
const { metadata } = associations.graph[resource];
if (name.startsWith('dm--')) {
if (metadata?.module === 'chat') {
history.push(`/~landscape/messages/resource/${metadata.module}${resource}`);
} else {
history.push(`/~landscape/home/resource/${metadata.module}${resource}`);
@ -122,10 +122,7 @@ export function InviteItem(props: InviteItemProps) {
<JoinSkeleton status={status} gapY="3">
<Row py="1" alignItems="center">
<Icon display="block" color="blue" icon="Bullet" mr="2" />
<Text mr="1">You are joining a DM with</Text>
<Text mr="1" mono>
{cite('~hastuc-dibtux')}
</Text>
<Text mr="1">Joining direct message...</Text>
</Row>
</JoinSkeleton>
);

View File

@ -14,6 +14,7 @@ import {
ColProps,
Icon
} from '@tlon/indigo-react';
import RichText from './RichText';
import { withLocalState } from '~/logic/state/local';
import { ProfileStatus } from './ProfileStatus';
@ -133,7 +134,7 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, Record<string, n
>
{img}
</Box>
<Col alignItems="end" justifyContent="flex-end" overflow="hidden">
<Col alignItems="end" justifyContent="flex-end" overflow="hidden" minWidth='0'>
<Row width="100%" >
<Text
fontWeight='600'
@ -153,9 +154,12 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, Record<string, n
contact={contact}
/>
) : (
<Text gray>
<RichText display='inline-block' width='100%' minWidth='0' textOverflow='ellipsis'
overflow='hidden'
whiteSpace='pre'
lineHeight="tall" disableRemoteContent gray>
{contact?.status ? contact.status : ''}
</Text>
</RichText>
)
}
</Col>

View File

@ -33,7 +33,7 @@ const RichText = React.memo(({ disableRemoteContent, ...props }) => (
videoShown: false,
oembedShown: false
} : null;
if (hasProvider(linkProps.href)) {
if (!disableRemoteContent && hasProvider(linkProps.href)) {
return <RemoteContent className="mw-100" url={linkProps.href} />;
}

View File

@ -107,7 +107,7 @@ const StatusBar = (props) => {
width="auto"
alignY="top"
alignX="right"
flexShrink={0}
flexShrink={'0'}
options={
<Col
mt='6'

View File

@ -39,8 +39,10 @@ export function GroupsPane(props: GroupsPaneProps) {
const relativePath = (path: string) => baseUrl + path;
const groupPath = getGroupFromWorkspace(workspace);
const groupContacts = (groupPath && contacts[groupPath]) || undefined;
const rootIdentity = contacts?.['/~/default']?.[window.ship];
const groupContacts = Object.assign({}, ...Array.from(groups?.[groupPath]?.members ?? []).filter(e => contacts[`~${e}`]).map(e => {
return {[e]: contacts[`~${e}`]};
})) || {};
const rootIdentity = contacts?.["/~/default"]?.[window.ship];
const groupAssociation =
(groupPath && associations.groups[groupPath]) || undefined;
const group = (groupPath && groups[groupPath]) || undefined;

View File

@ -101,7 +101,7 @@ export function NewChannel(props: NewChannelProps & RouteComponentProps): ReactE
await waiter(p => Boolean(p?.groups?.[`/ship/~${window.ship}/${resId}`]));
}
actions.setStatus({ success: null });
const resourceUrl = parentPath(location.pathname);
const resourceUrl = (location.pathname.includes("/messages")) ? "/~landscape/messages" : parentPath(location.pathname);
history.push(
`${resourceUrl}/resource/${moduleType}/ship/~${window.ship}/${resId}`
);

View File

@ -31,10 +31,12 @@ import GlobalApi from '~/logic/api/global';
import { StatelessAsyncAction } from '~/views/components/StatelessAsyncAction';
import useLocalState from '~/logic/state/local';
const TruncText = styled(Box)`
const TruncText = styled(Text)`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
min-width: 0;
`;
type Participant = Contact & { patp: string; pending: boolean };
@ -55,7 +57,9 @@ function getParticipants(cs: Contacts, group: Group) {
patp,
pending: false
}));
const members: Participant[] = _.map(Array.from(group.members), m =>
const members: Participant[] = _.map(
Array.from(group.members)
.filter(e => group?.policy?.invite?.pending ? !group.policy.invite.pending.has(e) : true), m =>
emptyContact(m, false)
);
const allMembers = _.unionBy(contacts, members, 'patp');
@ -303,11 +307,13 @@ function Participant(props: {
return (
<>
<Box>{avatar}</Box>
<Col justifyContent="center" gapY="1" height="100%">
<Col justifyContent="center" gapY="1" height="100%" minWidth='0'>
{hasNickname && (
<TruncText title={contact.nickname} maxWidth="85%" color="black">
<Row minWidth='0' flexShrink='1'>
<TruncText title={contact.nickname} color="black">
{contact.nickname}
</TruncText>
</Row>
)}
<Text title={contact.patp} color="gray" fontFamily="mono">
{cite(contact.patp)}