diff --git a/pkg/arvo/app/publish.hoon b/pkg/arvo/app/publish.hoon index 5f64d52567..93f3df0b3e 100644 --- a/pkg/arvo/app/publish.hoon +++ b/pkg/arvo/app/publish.hoon @@ -173,7 +173,7 @@ =/ uid (sham %publish who book eny.bol) =/ inv=invite :* our.bol %publish /notebook/[book] who - (crip "invite for notebook {}/{}") + (crip "invite for notebook {}/{(trip book)}") == =/ act=invite-action [%invite /publish uid inv] [%pass /invite %agent [who %invite-hook] %poke %invite-action !>(act)] @@ -523,12 +523,11 @@ now.bol ~ ~ ~ == - =/ group-path=path - ?: =(writers.new-book /) - /~/publish/(scot %p our.bol)/[book-name] - writers.new-book =+ ^- [grp-car=(list card) write-pax=path read-pax=path] - (make-groups book-name group-path ~ %.n %.n) + ?: =(writers.new-book /) + =/ group-path /~/publish/(scot %p our.bol)/[book-name] + (make-groups book-name group-path ~ %.n %.n) + [~ writers.info subscribers.info] =. writers.new-book write-pax =. subscribers.new-book read-pax =+ ^- [read-cards=(list card) notes=(map @tas note)] @@ -881,7 +880,7 @@ =/ uid (sham %publish who book eny.bol) =/ inv=invite :* our.bol %publish /notebook/[book] who - (crip "invite for notebook {}/{}") + (crip "invite for notebook {}/{(trip book)}") == =/ act=invite-action [%invite /publish uid inv] [%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)] @@ -899,7 +898,7 @@ ?< =('~' i.group-path.group) :_ [group-path.group group-path.group] %- zing - :~ (create-security group-path.group group-path.group %channel) + :~ (create-security group-path.group group-path.group %village) [(perm-hook-poke [%add-owned group-path.group group-path.group])]~ (generate-invites book (~(del in u.grp) our.bol)) == @@ -914,19 +913,19 @@ :_ [group-path.group group-path.group] %- zing :~ [(contact-view-create [%create group-path.group invitees.group])]~ - (create-security group-path.group group-path.group %channel) + (create-security group-path.group group-path.group %village) [(perm-hook-poke [%add-owned group-path.group group-path.group])]~ (generate-invites book (~(del in invitees.group) our.bol)) == :: make unmanaged group - ?> ?=(^ group-path.group) - ?> =('~' i.group-path.group) =* write-path group-path.group =/ read-path (weld write-path /read) =/ scry-path=path ;:(weld /=group-store/(scot %da now.bol) group-path.group /noun) =/ grp .^((unit ^group) %gx scry-path) ?^ grp [~ write-path read-path] + ?> ?=(^ group-path.group) + ?> =('~' i.group-path.group) :_ [write-path read-path] %- zing :~ [(group-poke [%bundle write-path])]~ diff --git a/pkg/interface/publish/src/js/components/lib/sidebar-invite.js b/pkg/interface/publish/src/js/components/lib/sidebar-invite.js new file mode 100644 index 0000000000..5e8bce9a1a --- /dev/null +++ b/pkg/interface/publish/src/js/components/lib/sidebar-invite.js @@ -0,0 +1,51 @@ +import React, { Component } from 'react'; +import classnames from 'classnames'; +import _ from 'lodash'; + +export class SidebarInvite extends Component { + + onAccept() { + let action = { + accept: { + path: '/publish', + uid: this.props.uid, + } + } + window.api.action("invite-store", "invite-action", action); + } + + onDecline() { + let action = { + decline: { + path: '/publish', + uid: this.props.uid, + } + } + window.api.action("invite-store", "invite-action", action); + } + + render() { + const { props } = this; + + return ( +
+
+

+ {props.invite.text} +

+
+ + Accept Invite + + + Decline + +
+ ) + } +} + diff --git a/pkg/interface/publish/src/js/components/lib/sidebar.js b/pkg/interface/publish/src/js/components/lib/sidebar.js index 0e209969e3..861f1db523 100644 --- a/pkg/interface/publish/src/js/components/lib/sidebar.js +++ b/pkg/interface/publish/src/js/components/lib/sidebar.js @@ -1,6 +1,7 @@ import React, { Component } from 'react' import { Route, Link } from 'react-router-dom'; import { NotebookItem } from './notebook-item'; +import { SidebarInvite } from './sidebar-invite'; export class Sidebar extends Component { constructor(props) { @@ -105,6 +106,18 @@ export class Sidebar extends Component { hiddenClasses = props.sidebarShown; }; + let sidebarInvites = !(props.invites && props.invites['/publish']) + ? null + : Object.keys(props.invites['/publish']) + .map((uid, i) => { + return ( + + ) + }); + let notebookItems = [...state.sortedBooks].map(([path, book]) => { let selected = (props.path === path); let author = path.split("/")[0]; @@ -159,10 +172,13 @@ export class Sidebar extends Component { -
{notebooks}
+
+ {sidebarInvites} + {notebookItems} +
); } } -export default Sidebar; \ No newline at end of file +export default Sidebar; diff --git a/pkg/interface/publish/src/js/components/root.js b/pkg/interface/publish/src/js/components/root.js index 27d22817de..ff7760edcf 100644 --- a/pkg/interface/publish/src/js/components/root.js +++ b/pkg/interface/publish/src/js/components/root.js @@ -31,6 +31,7 @@ export class Root extends Component { active={"sidebar"} rightPanelHide={true} sidebarShown={true} + invites={state.invites} notebooks={state.notebooks}>
@@ -52,6 +53,7 @@ export class Root extends Component { active={"rightPanel"} rightPanelHide={false} sidebarShown={true} + invites={state.invites} notebooks={state.notebooks}> @@ -93,6 +96,7 @@ export class Root extends Component { active={"rightPanel"} rightPanelHide={false} sidebarShown={true} + invites={state.invites} notebooks={state.notebooks} path={path}>