webterm: dojo -> term

Includes updating the tile data in launch.
This commit is contained in:
fang 2020-11-09 20:27:41 +01:00
parent 089f6515ed
commit fbda1de612
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
13 changed files with 57 additions and 41 deletions

View File

@ -12,6 +12,7 @@
[%3 *] [%3 *]
[%4 state-zero] [%4 state-zero]
[%5 state-zero] [%5 state-zero]
[%6 state-zero]
== ==
:: ::
+$ state-zero +$ state-zero
@ -21,7 +22,7 @@
== ==
-- --
:: ::
=| [%5 state-zero] =| [%6 state-zero]
=* state - =* state -
%- agent:dbug %- agent:dbug
^- agent:gall ^- agent:gall
@ -36,27 +37,42 @@
%_ new-state %_ new-state
tiles tiles
%- ~(gas by *tiles:store) %- ~(gas by *tiles:store)
%+ turn `(list term)`[%weather %clock %dojo ~] %+ turn `(list term)`[%weather %clock %term ~]
|= =term |= =term
:- term :- term
^- tile:store ^- tile:store
?+ term [[%custom ~] %.y] ?+ term [[%custom ~] %.y]
%dojo [[%basic 'Dojo' '/~landscape/img/Dojo.png' '/~dojo'] %.y] %term [[%basic 'Terminal' '/~landscape/img/term.png' '/~term'] %.y]
== ==
tile-ordering [%weather %clock %dojo ~] tile-ordering [%weather %clock %term ~]
== ==
[~ this(state [%5 new-state])] [~ this(state [%6 new-state])]
:: ::
++ on-save !>(state) ++ on-save !>(state)
++ on-load ++ on-load
|= old=vase |= old=vase
^- (quip card _this) ^- (quip card _this)
=/ old-state !<(versioned-state old) =/ old-state !<(versioned-state old)
|- =| cards=(list card)
|- ^- (quip card _this)
?: ?=(%6 -.old-state)
[cards this(state old-state)]
?: ?=(%5 -.old-state) ?: ?=(%5 -.old-state)
`this(state old-state) :: replace %dojo with %term
::
=. tiles.old-state
%+ ~(put by (~(del by tiles.old-state) %dojo))
%term
:_ is-shown:(~(gut by tiles.old-state) %dojo *tile:store)
[%basic 'Terminal' '/~landscape/img/term.png' '/~term']
=. tile-ordering.old-state
%+ turn tile-ordering.old-state
|=(t=term ?:(=(%dojo t) %term t))
$(old-state [%6 +.old-state])
?: ?=(%4 -.old-state) ?: ?=(%4 -.old-state)
:- [%pass / %arvo %e %disconnect [~ /]]~ =. cards
%+ snoc cards
[%pass / %arvo %e %disconnect [~ /]]
=. tiles.old-state =. tiles.old-state
(~(del by tiles.old-state) %chat) (~(del by tiles.old-state) %chat)
=. tiles.old-state =. tiles.old-state
@ -65,7 +81,7 @@
(~(del by tiles.old-state) %links) (~(del by tiles.old-state) %links)
=. tile-ordering.old-state =. tile-ordering.old-state
(skip tile-ordering.old-state |=(=term ?=(?(%links %chat %publish) term))) (skip tile-ordering.old-state |=(=term ?=(?(%links %chat %publish) term)))
this(state [%5 +.old-state]) $(old-state [%5 +.old-state])
=/ new-state *state-zero =/ new-state *state-zero
=. new-state =. new-state
%_ new-state %_ new-state
@ -80,7 +96,10 @@
== ==
tile-ordering [%weather %clock %dojo ~] tile-ordering [%weather %clock %dojo ~]
== ==
:_ this(state [%5 new-state]) %_ $
old-state [%5 new-state]
::
cards
%+ welp %+ welp
:~ [%pass / %arvo %e %disconnect [~ /]] :~ [%pass / %arvo %e %disconnect [~ /]]
:* %pass /srv %agent [our.bowl %file-server] :* %pass /srv %agent [our.bowl %file-server]
@ -92,6 +111,7 @@
|= [[=wire =ship =term] *] |= [[=wire =ship =term] *]
^- card ^- card
[%pass wire %agent [ship term] %leave ~] [%pass wire %agent [ship term] %leave ~]
==
:: ::
++ on-poke ++ on-poke
|= [=mark =vase] |= [=mark =vase]

View File

@ -1,3 +1,3 @@
const defaultApps = ['chat', 'dojo', 'groups', 'link', 'publish']; const defaultApps = ['chat', 'term', 'groups', 'link', 'publish'];
export default defaultApps; export default defaultApps;

View File

@ -9,11 +9,11 @@ export default class BasicTile extends React.PureComponent {
return ( return (
<Tile <Tile
bg={props.title === 'Dojo' ? '#000000' : 'white'} bg={props.title === 'Terminal' ? '#000000' : 'white'}
to={props.linkedUrl} to={props.linkedUrl}
> >
<Text color={props.title === 'Dojo' ? '#ffffff' : 'black'}> <Text color={props.title === 'Terminal' ? '#ffffff' : 'black'}>
{props.title === 'Dojo' {props.title === 'Terminal'
? <Icon ? <Icon
icon='ChevronEast' icon='ChevronEast'
color='#fff' color='#fff'

View File

@ -73,20 +73,20 @@ function DragTileBasic(props: {
style: any; style: any;
}) { }) {
const { basic: tile } = props.tile; const { basic: tile } = props.tile;
const isDojo = useMemo(() => tile.title === "Dojo", [tile.title]); const isTerm = useMemo(() => tile.title === "Terminal", [tile.title]);
return ( return (
<DragTileBox <DragTileBox
tile={{ type: props.tile }} tile={{ type: props.tile }}
index={props.index} index={props.index}
bg={ bg={
"white" // isDojo ? "black" : "white" "white" // isTerm ? "black" : "white"
} }
style={props.style} style={props.style}
> >
<Image width="48px" height="48px" src={tile.iconUrl} invert={isDojo} /> <Image width="48px" height="48px" src={tile.iconUrl} invert={isTerm} />
<Text <Text
color={ color={
"black" // isDojo ? "white" : "black" "black" // isTerm ? "white" : "black"
} }
> >
{tile.title} {tile.title}

View File

@ -5,10 +5,9 @@ export default class Api {
this.ship = ship; this.ship = ship;
this.channel = channel; this.channel = channel;
this.bindPaths = []; this.bindPaths = [];
this.dojoId = 'soto-' + Math.random().toString(36).substring(2);
} }
bind(path, method, ship = this.ship, appl = 'dojo', success, fail) { bind(path, method, ship = this.ship, appl = 'herm', success, fail) {
this.bindPaths = _.uniq([...this.bindPaths, path]); this.bindPaths = _.uniq([...this.bindPaths, path]);
window.subscriptionId = this.channel.subscribe(ship, appl, path, window.subscriptionId = this.channel.subscribe(ship, appl, path,

View File

@ -45,14 +45,14 @@ export default class DojoApp extends Component {
return ( return (
<> <>
<Helmet> <Helmet>
<title>OS1 - Dojo</title> <title>OS1 - Terminal</title>
</Helmet> </Helmet>
<div <div
style={{ height: '100%' }} style={{ height: '100%' }}
> >
<Route <Route
exact exact
path="/~dojo/" path="/~term/"
render={(props) => { render={(props) => {
return ( return (
<div className="w-100 h-100 flex-m flex-l flex-xl"> <div className="w-100 h-100 flex-m flex-l flex-xl">

View File

@ -5,10 +5,7 @@ import { Spinner } from '~/views/components/Spinner';
export class Input extends Component { export class Input extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {};
awaiting: false,
type: 'Sending to Dojo'
};
this.keyPress = this.keyPress.bind(this); this.keyPress = this.keyPress.bind(this);
this.paste = this.paste.bind(this); this.paste = this.paste.bind(this);
this.click = this.click.bind(this); this.click = this.click.bind(this);
@ -98,7 +95,7 @@ export class Input extends Component {
tabindex="0" tabindex="0"
wrap="off" wrap="off"
className="mono ml1 flex-auto dib w-100" className="mono ml1 flex-auto dib w-100"
id="dojo" id="term"
cursor={this.props.cursor} cursor={this.props.cursor}
onKeyDown={this.keyPress} onKeyDown={this.keyPress}
onClick={this.click} onClick={this.click}

View File

@ -1,4 +1,4 @@
input#dojo { input#term {
background-color: inherit; background-color: inherit;
color: inherit; color: inherit;
} }

View File

@ -34,7 +34,7 @@ export const Content = (props) => {
)} )}
/> />
<Route <Route
path='/~dojo' path='/~term'
render={p => ( render={p => (
<DojoApp <DojoApp
history={p.history} history={p.history}