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 version https://git-lfs.github.com/spec/v1
oid sha256:eb4508c64074807d1b9d4d5f37c0a20e5e8dd26b8b3029da77650ff1ebfb257a oid sha256:0e36dad1e42bee8e2ad2d4ee338a553bc66f7605d301f93c3ced0ec1b2958571
size 6272789 size 6300470

View File

@ -5,7 +5,7 @@
/- glob /- glob
/+ default-agent, verb, dbug /+ 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))] +$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states +$ all-states
$% state-0 $% state-0

View File

@ -658,7 +658,7 @@
:+ %add-nodes :+ %add-nodes
[ship term] [ship term]
%- ~(gas by *(map index:store node:store)) %- ~(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] |= [=atom =node:store]
^- [index:store node:store] ^- [index:store node:store]
[(snoc index atom) node] [(snoc index atom) node]
@ -671,7 +671,8 @@
=/ end=(unit time) (slaw %da i.t.t.t.t.t.path) =/ 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=(unit update-log:store) (~(get by update-logs) [ship term])
?~ update-log [~ ~] ?~ 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 @ @ ~] [%x %update-log @ @ ~]
=/ =ship (slav %p i.t.t.path) =/ =ship (slav %p i.t.t.path)

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div> <div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script> <script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.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> </body>
</html> </html>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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