Improved delete chat experience. Not finished yet.

This commit is contained in:
Logan Allen 2019-06-25 15:15:16 -07:00
parent cbfd911b77
commit 495df688b5
5 changed files with 114 additions and 32 deletions

View File

@ -46,7 +46,7 @@ export class ChatScreen extends Component {
}
componentDidUpdate(prevProps, prevState) {
const { props } = this;
const { props, state } = this;
if (prevProps.match.params.ship !== props.match.params.ship ||
prevProps.match.params.station !== props.match.params.station
@ -65,6 +65,8 @@ export class ChatScreen extends Component {
this.updateNumPeople();
this.scrollToBottom();
});
} else if (!(state.station in props.configs)) {
props.history.push('/~chat');
}
}

View File

@ -216,7 +216,9 @@ export class Root extends Component {
<SettingsScreen
{...props}
api={api}
peers={state.peers} />
peers={state.peers}
circles={state.circles}
/>
</Skeleton>
);
}} />

View File

@ -12,6 +12,7 @@ export class SettingsScreen extends Component {
station: props.match.params.ship + "/" + props.match.params.station,
circle: props.match.params.station,
host: props.match.params.ship,
isLoading: false
};
}
@ -39,13 +40,38 @@ export class SettingsScreen extends Component {
]);
}
props.history.push('/~chat');
this.setState({
isLoading: true
});
}
render() {
const { props, state } = this;
let peers = props.peers[state.station] || [window.ship];
if (!!state.isLoading) {
console.log(props.circles);
if (!props.circles.contains(state.station)) {
props.history.push('/~chat');
}
return (
<div className="h-100 w-100 overflow-x-hidden flex flex-column">
<div className='pl2 pt2 bb mb3'>
<h2>{state.circle}</h2>
<ChatTabBar
{...props}
station={state.station}
numPeers={peers.length} />
</div>
<div className="w-100 cf pa3">
<h2>Deleting...</h2>
</div>
</div>
);
}
return (
<div className="h-100 w-100 overflow-x-hidden flex flex-column">
<div className='pl2 pt2 bb mb3'>

View File

@ -426,13 +426,35 @@
::
configs (~(del by configs.str.sta) affectedcir)
==
=/ fakecir/circle:hall
:- our.bol
%- crip
%+ weld (trip 'hall-internal-') (trip nom.affectedcir)
::
?~ (~(get by configs.str) fakecir)
:: just forward the delete to our clients
::
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
%+ weld
(send-chat-update [[%inbox newinbox] str])
(send-chat-update [[%delete affectedcir] str])
:: if we get a delete from another ship, delete our fake circle copy
::
~& %deletefake
=/ deletefake/poke
:- %hall-action
[%delete nom.fakecir ~]
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
%+ weld
[ost.bol %poke /fake [our.bol %hall] deletefake]~
%+ weld
(send-chat-update [[%inbox newinbox] str])
(send-chat-update [[%delete affectedcir] str])
::
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
%+ weld
(send-chat-update [[%inbox newinbox] str])
(send-chat-update [[%delete affectedcir] str])
==
:: end of branching on dif.sto type
==

View File

@ -57281,7 +57281,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
componentDidUpdate(prevProps, prevState) {
const { props } = this;
const { props, state } = this;
if (prevProps.match.params.ship !== props.match.params.ship ||
prevProps.match.params.station !== props.match.params.station
@ -57300,6 +57300,8 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
this.updateNumPeople();
this.scrollToBottom();
});
} else if (!(state.station in props.configs)) {
props.history.push('/~chat');
}
}
@ -57389,7 +57391,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
return (
react.createElement('a', {
className: "vanilla hoverline text-600 text-mono" ,
href: prettyShip(msg.gam.aut)[1], __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 155}}
href: prettyShip(msg.gam.aut)[1], __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 157}}
, prettyShip(`~${msg.gam.aut}`)[0]
)
);
@ -57399,7 +57401,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
react.createElement(Message, {
key: msg.gam.uid + Math.random(),
msg: msg.gam,
details: details, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 164}} )
details: details, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 166}} )
);
}
@ -57421,18 +57423,18 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
return (
react.createElement('div', { key: state.station,
className: "h-100 w-100 overflow-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 188}}
, react.createElement('div', { className: "pl2 pt2 bb" , __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 190}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$c, lineNumber: 191}}, state.circle)
className: "h-100 w-100 overflow-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 190}}
, react.createElement('div', { className: "pl2 pt2 bb" , __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 192}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$c, lineNumber: 193}}, state.circle)
, react.createElement(ChatTabBar, { ...props,
station: state.station,
numPeers: peers.length, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 192}} )
numPeers: peers.length, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 194}} )
)
, react.createElement('div', {
className: "overflow-y-scroll pt3 flex flex-column-reverse" ,
style: { height: 'calc(100% - 157px)' },
onScroll: this.onScroll, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 196}}
, react.createElement('div', { ref: el => { this.scrollElement = el; }, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 200}})
onScroll: this.onScroll, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 198}}
, react.createElement('div', { ref: el => { this.scrollElement = el; }, __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 202}})
, chatMessages
)
, react.createElement(ChatInput, {
@ -57440,7 +57442,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
numMsgs: lastMsgNum,
station: state.station,
circle: state.circle,
placeholder: "Message...", __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 203}} )
placeholder: "Message...", __self: this, __source: {fileName: _jsxFileName$c, lineNumber: 205}} )
)
)
}
@ -57631,6 +57633,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
station: props.match.params.ship + "/" + props.match.params.station,
circle: props.match.params.station,
host: props.match.params.ship,
isLoading: false
};
}
@ -57658,33 +57661,58 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
]);
}
props.history.push('/~chat');
this.setState({
isLoading: true
});
}
render() {
const { props, state } = this;
let peers = props.peers[state.station] || [window.ship];
if (!!state.isLoading) {
console.log(props.circles);
if (!props.circles.contains(state.station)) {
props.history.push('/~chat');
}
return (
react.createElement('div', { className: "h-100 w-100 overflow-x-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 60}}
, react.createElement('div', { className: "pl2 pt2 bb mb3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 61}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 62}}, state.circle)
, react.createElement(ChatTabBar, {
...props,
station: state.station,
numPeers: peers.length, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 63}} )
)
, react.createElement('div', { className: "w-100 cf pa3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 68}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 69}}, "Deleting...")
)
)
);
}
return (
react.createElement('div', { className: "h-100 w-100 overflow-x-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 50}}
, react.createElement('div', { className: "pl2 pt2 bb mb3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 51}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 52}}, state.circle)
react.createElement('div', { className: "h-100 w-100 overflow-x-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 76}}
, react.createElement('div', { className: "pl2 pt2 bb mb3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 77}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 78}}, state.circle)
, react.createElement(ChatTabBar, {
...props,
station: state.station,
numPeers: peers.length, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 53}} )
numPeers: peers.length, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 79}} )
)
, react.createElement('div', { className: "w-100 cf pa3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 58}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 59}}, "Settings")
, react.createElement('div', { className: "w-50 fl pl2 mt3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 60}}
, react.createElement('p', { className: "body-regular", __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 61}}, "Delete Chat" )
, react.createElement('p', { className: "label-regular gray mb3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 62}}, "Permanently delete this chat."
, react.createElement('div', { className: "w-100 cf pa3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 84}}
, react.createElement('h2', {__self: this, __source: {fileName: _jsxFileName$f, lineNumber: 85}}, "Settings")
, react.createElement('div', { className: "w-50 fl pl2 mt3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 86}}
, react.createElement('p', { className: "body-regular", __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 87}}, "Delete Chat" )
, react.createElement('p', { className: "label-regular gray mb3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 88}}, "Permanently delete this chat."
)
, react.createElement('a', { onClick: this.deleteChat.bind(this),
className: "pointer btn-font underline nice-red" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 65}}, "-> Delete" )
className: "pointer btn-font underline nice-red" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 91}}, "-> Delete" )
)
, react.createElement('div', { className: "w-50 fr pr2 mt3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 68}}
, react.createElement('div', { className: "w-50 fr pr2 mt3" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 94}}
)
)
@ -58016,7 +58044,9 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
, react.createElement(SettingsScreen, {
...props,
api: api,
peers: state.peers, __self: this, __source: {fileName: _jsxFileName$h, lineNumber: 216}} )
peers: state.peers,
circles: state.circles, __self: this, __source: {fileName: _jsxFileName$h, lineNumber: 216}}
)
)
);
}, __self: this, __source: {fileName: _jsxFileName$h, lineNumber: 201}} )