Merge branch 'release/next-userspace' into lf/hark-caching

This commit is contained in:
Liam Fitzgerald 2020-11-18 11:00:34 +10:00
commit 65e4a06a64
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
10 changed files with 115 additions and 81 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb4508c64074807d1b9d4d5f37c0a20e5e8dd26b8b3029da77650ff1ebfb257a
size 6272789
oid sha256:0e36dad1e42bee8e2ad2d4ee338a553bc66f7605d301f93c3ced0ec1b2958571
size 6300470

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v3.h5gg6.t76qc.9on82.im1ti.i4vuu
++ hash 0vvse4p.hsbcu.1hjo3.dhct1.t7jqn
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0

View File

@ -658,7 +658,7 @@
:+ %add-nodes
[ship term]
%- ~(gas by *(map index:store node:store))
%+ turn (tap:orm `graph:store`(subset:orm p.children.u.node start end))
%+ turn (tap:orm `graph:store`(subset:orm p.children.u.node end start))
|= [=atom =node:store]
^- [index:store node:store]
[(snoc index atom) node]
@ -671,7 +671,8 @@
=/ end=(unit time) (slaw %da i.t.t.t.t.t.path)
=/ update-log=(unit update-log:store) (~(get by update-logs) [ship term])
?~ update-log [~ ~]
``noun+!>((subset:orm-log u.update-log start end))
:: orm-log is ordered backwards, so swap start and end
``noun+!>((subset:orm-log u.update-log end start))
::
[%x %update-log @ @ ~]
=/ =ship (slav %p i.t.t.path)

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.004a953767d725beb8fc.js"></script>
<script src="/~landscape/js/bundle/index.a3923bdec6badc072f30.js"></script>
</body>
</html>

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import Helmet from 'react-helmet';
import styled from 'styled-components';
@ -10,6 +10,7 @@ import Tiles from './components/tiles';
import Tile from './components/tiles/tile';
import Welcome from './components/welcome';
import Groups from './components/Groups';
import { writeText } from '~/logic/lib/util';
const ScrollbarLessBox = styled(Box)`
scrollbar-width: none !important;
@ -19,9 +20,8 @@ const ScrollbarLessBox = styled(Box)`
}
`;
export default class LaunchApp extends React.Component {
render() {
const { props } = this;
export default function LaunchApp(props) {
const [hashText, setHashText] = useState(props.baseHash);
return (
<>
@ -78,11 +78,17 @@ export default class LaunchApp extends React.Component {
borderRadius={2}
fontSize={0}
p={2}
cursor="pointer"
onClick={() => {
writeText(props.baseHash);
setHashText('copied');
setTimeout(() => {
setHashText(props.baseHash);
}, 2000);
}}
>
{props.baseHash}
{hashText || props.baseHash}
</Box>
</>
);
}
}

View File

@ -34,8 +34,9 @@ export function ChatNotification(props: {
contacts: Rolodex;
groups: Groups;
api: GlobalApi;
remoteContentPolicy: any;
}) {
const { index, contents, read, time, api, timebox } = props;
const { index, contents, read, time, api, timebox, remoteContentPolicy } = props;
const authors = _.map(contents, "author");
const { chat, mention } = index;
@ -46,7 +47,7 @@ export function ChatNotification(props: {
const group = props.groups[groupPath];
const desc = describeNotification(mention, contents.length);
const groupContacts = props.contacts[groupPath];
const groupContacts = props.contacts[groupPath] || {};
const onClick = useCallback(() => {
if (props.archived) {
@ -74,7 +75,8 @@ export function ChatNotification(props: {
/>
<Col pb="3" pl="5">
{_.map(_.take(contents, 5), (content, idx) => {
const to = `/~landscape${groupPath}/resource/chat${appPath}?msg=${content.number}`;
const workspace = group?.hidden ? '/home' : groupPath;
const to = `/~landscape${workspace}/resource/chat${appPath}?msg=${content.number}`;
return (
<Link key={idx} to={to}>
<ChatMessage
@ -85,6 +87,7 @@ export function ChatNotification(props: {
contacts={groupContacts}
fontSize='0'
pt='2'
remoteContentPolicy={remoteContentPolicy}
/>
</Link>
);

View File

@ -59,7 +59,7 @@ const GraphUrl = ({ url, title }) => (
</Box>
);
const GraphNodeContent = ({ contents, mod, description, index }) => {
const GraphNodeContent = ({ contents, mod, description, index, remoteContentPolicy }) => {
const idx = index.slice(1).split("/");
if (mod === "link") {
if (idx.length === 1) {
@ -67,7 +67,7 @@ const GraphNodeContent = ({ contents, mod, description, index }) => {
return <GraphUrl title={text} url={url} />;
} else if (idx.length === 2) {
const [{ text }] = contents;
return <RichText>{text}</RichText>;
return <RichText remoteContentPolicy={remoteContentPolicy}>{text}</RichText>;
}
return null;
}
@ -76,7 +76,7 @@ const GraphNodeContent = ({ contents, mod, description, index }) => {
return null;
} else if (idx[1] === "2") {
const [{ text }] = contents;
return <RichText>{text}</RichText>;
return <RichText remoteContentPolicy={remoteContentPolicy}>{text}</RichText>;
} else if (idx[1] === "1") {
const [{ text: header }, { text: body }] = contents;
const snippet = getSnippet(body);
@ -124,7 +124,8 @@ const GraphNode = ({
graph,
group,
read,
onRead
onRead,
remoteContentPolicy
}) => {
author = deSig(author);
const history = useHistory();
@ -172,6 +173,7 @@ const GraphNode = ({
mod={mod}
description={description}
index={index}
remoteContentPolicy={remoteContentPolicy}
/>
</Row>
</Col>
@ -189,8 +191,9 @@ export function GraphNotification(props: {
associations: Associations;
contacts: Rolodex;
api: GlobalApi;
remoteContentPolicy: any;
}) {
const { contents, index, read, time, api, timebox } = props;
const { contents, index, read, time, api, timebox, remoteContentPolicy } = props;
const authors = _.map(contents, "author");
const { graph, group } = index;
@ -234,6 +237,7 @@ export function GraphNotification(props: {
group={group}
read={read}
onRead={onClick}
remoteContentPolicy={remoteContentPolicy}
/>
))}
</Col>

View File

@ -63,7 +63,7 @@ export function Header(props: {
const time = moment(props.time).format("HH:mm");
const groupTitle =
props.associations.contacts?.[props.group]?.metadata?.title || props.group;
props.associations.contacts?.[props.group]?.metadata?.title;
const app = props.chat ? 'chat' : 'graph';
const channelTitle =
@ -87,8 +87,12 @@ export function Header(props: {
{!!moduleIcon && <Icon icon={moduleIcon as any} />}
{!!channel && <Text fontWeight="500">{channelTitle}</Text>}
<Rule vertical height="12px" />
{groupTitle &&
<>
<Text fontWeight="500">{groupTitle}</Text>
<Rule vertical height="12px"/>
</>
}
<Text fontWeight="regular" color="lightGray">
{time}
</Text>

View File

@ -3,7 +3,7 @@ import f from "lodash/fp";
import _ from "lodash";
import { Icon, Col, Row, Box, Text, Anchor } from "@tlon/indigo-react";
import moment from "moment";
import { Notifications, Rolodex, Timebox, IndexedNotification } from "~/types";
import { Notifications, Rolodex, Timebox, IndexedNotification, Groups } from "~/types";
import { MOMENT_CALENDAR_DATE, daToUnix, resourceAsPath } from "~/logic/lib/util";
import { BigInteger } from "big-integer";
import GlobalApi from "~/logic/api/global";
@ -38,6 +38,7 @@ function filterNotification(associations: Associations, groups: string[]) {
export default function Inbox(props: {
notifications: Notifications;
archive: Notifications;
groups: Groups;
showArchive?: boolean;
api: GlobalApi;
associations: Associations;
@ -145,9 +146,11 @@ export default function Inbox(props: {
contacts={props.contacts}
archive={!!props.showArchive}
associations={props.associations}
groups={props.groups}
graphConfig={props.notificationsGraphConfig}
groupConfig={props.notificationsGroupConfig}
chatConfig={props.notificationsChatConfig}
remoteContentPolicy={props.remoteContentPolicy}
api={api}
/>
)}
@ -163,9 +166,11 @@ export default function Inbox(props: {
archive={!!props.showArchive}
associations={props.associations}
api={api}
groups={props.groups}
graphConfig={props.notificationsGraphConfig}
groupConfig={props.notificationsGroupConfig}
chatConfig={props.notificationsChatConfig}
remoteContentPolicy={props.remoteContentPolicy}
/>
)
)}
@ -186,6 +191,7 @@ function sortIndexedNotification(
function DaySection({
contacts,
groups,
archive,
timeboxes,
latest = false,
@ -194,6 +200,7 @@ function DaySection({
groupConfig,
graphConfig,
chatConfig,
remoteContentPolicy
}) {
const calendar = latest
? MOMENT_CALENDAR_DATE
@ -226,7 +233,9 @@ function DaySection({
notification={not}
archived={archive}
contacts={contacts}
groups={groups}
time={date}
remoteContentPolicy={remoteContentPolicy}
/>
</React.Fragment>
))

View File

@ -8,7 +8,9 @@ import {
NotificationGraphConfig,
GroupNotificationsConfig,
NotifIndex,
Groups,
Associations,
Contacts,
} from "~/types";
import GlobalApi from "~/logic/api/global";
import { getParentIndex } from "~/logic/lib/notification";
@ -24,9 +26,12 @@ interface NotificationProps {
associations: Associations;
api: GlobalApi;
archived: boolean;
groups: Groups;
contacts: Contacts;
graphConfig: NotificationGraphConfig;
groupConfig: GroupNotificationsConfig;
chatConfig: string[];
remoteContentPolicy: any;
}
function getMuted(
@ -137,6 +142,7 @@ export function Notification(props: NotificationProps) {
timebox={props.time}
time={time}
associations={associations}
remoteContentPolicy={props.remoteContentPolicy}
/>
</Wrapper>
);
@ -172,10 +178,11 @@ export function Notification(props: NotificationProps) {
contacts={props.contacts}
read={read}
archived={archived}
groups={{}}
groups={props.groups}
timebox={props.time}
time={time}
associations={associations}
remoteContentPolicy={props.remoteContentPolicy}
/>
</Wrapper>
);