From 462b14bf58fed2741b572a654cdb406e8884f13e Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Tue, 26 Nov 2019 16:53:06 -0500 Subject: [PATCH] subscribe to contact-store, fill groups headers --- pkg/arvo/app/contacts/js/index.js | 30 +++++++------------ .../src/js/{ => components}/groups.js | 3 +- .../contacts/src/js/components/skeleton.js | 2 +- pkg/interface/contacts/src/js/subscription.js | 25 +++++----------- 4 files changed, 20 insertions(+), 40 deletions(-) rename pkg/interface/contacts/src/js/{ => components}/groups.js (70%) diff --git a/pkg/arvo/app/contacts/js/index.js b/pkg/arvo/app/contacts/js/index.js index 4eab02c29..2bca8b16f 100644 --- a/pkg/arvo/app/contacts/js/index.js +++ b/pkg/arvo/app/contacts/js/index.js @@ -58686,17 +58686,13 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ class Subscription { start() { if (api.authTokens) { - this.initializeChat(); + this.initializeContacts(); } else { console.error("~~~ ERROR: Must set api.authTokens before operation ~~~"); } } - initializeChat() { - api.bind('/primary', 'PUT', api.authTokens.ship, 'chat-view', - this.handleEvent.bind(this), - this.handleError.bind(this), - this.handleQuitAndResubscribe.bind(this)); + initializeContacts() { api.bind('/primary', 'PUT', api.authTokens.ship, 'invite-view', this.handleEvent.bind(this), this.handleError.bind(this), @@ -58705,6 +58701,10 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ this.handleEvent.bind(this), this.handleError.bind(this), this.handleQuitAndResubscribe.bind(this)); + api.bind('/primary', 'PUT', api.authTokens.ship, 'contact-store', + this.handleEvent.bind(this), + this.handleError.bind(this), + this.handleQuitAndResubscribe.bind(this)); api.bind('/all', 'PUT', api.authTokens.ship, 'permission-store', this.handleEvent.bind(this), this.handleError.bind(this), @@ -58712,6 +58712,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } handleEvent(diff) { + console.log(diff); store.handleEvent(diff); } @@ -58726,18 +58727,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ handleQuitAndResubscribe(quit) { // TODO: resubscribe } - - fetchMessages(start, end, path) { - console.log(start, end, path); - fetch(`/~chat/paginate/${start}/${end}${path}`) - .then((response) => response.json()) - .then((json) => { - store.handleEvent({ - data: json - }); - }); - } - } let subscription = new Subscription(); @@ -58788,13 +58777,14 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\ } } - const _jsxFileName$3 = "/Users/matilde/git/urbit/pkg/interface/contacts/src/js/groups.js"; + const _jsxFileName$3 = "/Users/matilde/git/urbit/pkg/interface/contacts/src/js/components/groups.js"; class Groups extends react_1 { // drawer to the left render() { return ( react.createElement('div', { className: "br b--gray4 h-100 flex-basis-100-s flex-basis-300-ns" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 7}} - , react.createElement('h2', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 8}}, "Your Root Identity" ) + , react.createElement('h2', { className: "f9 pa4 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 8}}, "Your Root Identity" ) + , react.createElement('h2', { className: "f9 pa4 gray2" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 9}}, "Your Groups" ) ) ) } diff --git a/pkg/interface/contacts/src/js/groups.js b/pkg/interface/contacts/src/js/components/groups.js similarity index 70% rename from pkg/interface/contacts/src/js/groups.js rename to pkg/interface/contacts/src/js/components/groups.js index b6c6d711e..ca1b962ea 100644 --- a/pkg/interface/contacts/src/js/groups.js +++ b/pkg/interface/contacts/src/js/components/groups.js @@ -5,7 +5,8 @@ export class Groups extends Component { render() { return (
-

Your Root Identity

+

Your Root Identity

+

Your Groups

) } diff --git a/pkg/interface/contacts/src/js/components/skeleton.js b/pkg/interface/contacts/src/js/components/skeleton.js index 6d52c13ef..cc225a416 100644 --- a/pkg/interface/contacts/src/js/components/skeleton.js +++ b/pkg/interface/contacts/src/js/components/skeleton.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import classnames from 'classnames'; import { HeaderBar } from './lib/header-bar'; -import { Groups } from '../groups'; +import { Groups } from './groups'; export class Skeleton extends Component { render() { diff --git a/pkg/interface/contacts/src/js/subscription.js b/pkg/interface/contacts/src/js/subscription.js index 09d19a830..b2c1a06d9 100644 --- a/pkg/interface/contacts/src/js/subscription.js +++ b/pkg/interface/contacts/src/js/subscription.js @@ -7,17 +7,13 @@ import urbitOb from 'urbit-ob'; export class Subscription { start() { if (api.authTokens) { - this.initializeChat(); + this.initializeContacts(); } else { console.error("~~~ ERROR: Must set api.authTokens before operation ~~~"); } } - initializeChat() { - api.bind('/primary', 'PUT', api.authTokens.ship, 'chat-view', - this.handleEvent.bind(this), - this.handleError.bind(this), - this.handleQuitAndResubscribe.bind(this)); + initializeContacts() { api.bind('/primary', 'PUT', api.authTokens.ship, 'invite-view', this.handleEvent.bind(this), this.handleError.bind(this), @@ -26,6 +22,10 @@ export class Subscription { this.handleEvent.bind(this), this.handleError.bind(this), this.handleQuitAndResubscribe.bind(this)); + api.bind('/primary', 'PUT', api.authTokens.ship, 'contact-store', + this.handleEvent.bind(this), + this.handleError.bind(this), + this.handleQuitAndResubscribe.bind(this)); api.bind('/all', 'PUT', api.authTokens.ship, 'permission-store', this.handleEvent.bind(this), this.handleError.bind(this), @@ -33,6 +33,7 @@ export class Subscription { } handleEvent(diff) { + console.log(diff); store.handleEvent(diff); } @@ -47,18 +48,6 @@ export class Subscription { handleQuitAndResubscribe(quit) { // TODO: resubscribe } - - fetchMessages(start, end, path) { - console.log(start, end, path); - fetch(`/~chat/paginate/${start}/${end}${path}`) - .then((response) => response.json()) - .then((json) => { - store.handleEvent({ - data: json - }); - }); - } - } export let subscription = new Subscription();