mirror of
https://github.com/urbit/shrub.git
synced 2024-11-27 18:34:48 +03:00
added invites to sidebar in publish
This commit is contained in:
parent
9e0923f579
commit
93b9c6d5d9
@ -173,7 +173,7 @@
|
||||
=/ uid (sham %publish who book eny.bol)
|
||||
=/ inv=invite
|
||||
:* our.bol %publish /notebook/[book] who
|
||||
(crip "invite for notebook {<who>}/{<book>}")
|
||||
(crip "invite for notebook {<our.bol>}/{(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 {<who>}/{<book>}")
|
||||
(crip "invite for notebook {<our.bol>}/{(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])]~
|
||||
|
@ -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 (
|
||||
<div className='pa3 bb b--gray4'>
|
||||
<div className='w-100 v-mid'>
|
||||
<p className="dib f9 mono gray4-d">
|
||||
{props.invite.text}
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
className="dib pointer pa2 f9 bg-green2 white mt4"
|
||||
onClick={this.onAccept.bind(this)}>
|
||||
Accept Invite
|
||||
</a>
|
||||
<a
|
||||
className="dib pointer ml4 pa2 f9 bg-black bg-gray0-d white mt4"
|
||||
onClick={this.onDecline.bind(this)}>
|
||||
Decline
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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 (
|
||||
<SidebarInvite
|
||||
uid={uid}
|
||||
invite={props.invites['/publish'][uid]}
|
||||
key={i} />
|
||||
)
|
||||
});
|
||||
|
||||
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 {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="overflow-y-scroll h-100">{notebooks}</div>
|
||||
<div className="overflow-y-scroll h-100">
|
||||
{sidebarInvites}
|
||||
{notebookItems}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Sidebar;
|
||||
export default Sidebar;
|
||||
|
@ -31,6 +31,7 @@ export class Root extends Component {
|
||||
active={"sidebar"}
|
||||
rightPanelHide={true}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}>
|
||||
<div className={`h-100 w-100 overflow-x-hidden flex flex-column
|
||||
bg-white bg-gray0-d dn db-ns`}>
|
||||
@ -52,6 +53,7 @@ export class Root extends Component {
|
||||
active={"rightPanel"}
|
||||
rightPanelHide={false}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}>
|
||||
<NewScreen
|
||||
notebooks={state.notebooks}
|
||||
@ -70,6 +72,7 @@ export class Root extends Component {
|
||||
active={"rightPanel"}
|
||||
rightPanelHide={false}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}>
|
||||
<JoinScreen notebooks={state.notebooks} {...props} />
|
||||
</Skeleton>
|
||||
@ -93,6 +96,7 @@ export class Root extends Component {
|
||||
active={"rightPanel"}
|
||||
rightPanelHide={false}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}
|
||||
path={path}>
|
||||
<NewPost
|
||||
@ -111,6 +115,7 @@ export class Root extends Component {
|
||||
active={"rightPanel"}
|
||||
rightPanelHide={false}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}
|
||||
path={path}>
|
||||
<Notebook
|
||||
@ -137,6 +142,7 @@ export class Root extends Component {
|
||||
active={"rightPanel"}
|
||||
rightPanelHide={false}
|
||||
sidebarShown={true}
|
||||
invites={state.invites}
|
||||
notebooks={state.notebooks}
|
||||
path={path}>
|
||||
<Note
|
||||
|
@ -30,6 +30,7 @@ export class Skeleton extends Component {
|
||||
active={props.active}
|
||||
notebooks={props.notebooks}
|
||||
path={props.path}
|
||||
invites={props.invites}
|
||||
/>
|
||||
<div className={"h-100 w-100 overflow-container " + rightPanelHide} style={{
|
||||
flexGrow: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user