mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
webterm: dojo -> term
Includes updating the tile data in launch.
This commit is contained in:
parent
089f6515ed
commit
fbda1de612
@ -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,18 +96,22 @@
|
|||||||
==
|
==
|
||||||
tile-ordering [%weather %clock %dojo ~]
|
tile-ordering [%weather %clock %dojo ~]
|
||||||
==
|
==
|
||||||
:_ this(state [%5 new-state])
|
%_ $
|
||||||
%+ welp
|
old-state [%5 new-state]
|
||||||
:~ [%pass / %arvo %e %disconnect [~ /]]
|
::
|
||||||
:* %pass /srv %agent [our.bowl %file-server]
|
cards
|
||||||
%poke %file-server-action
|
%+ welp
|
||||||
!>([%serve-dir / /app/landscape %.n %.y])
|
:~ [%pass / %arvo %e %disconnect [~ /]]
|
||||||
==
|
:* %pass /srv %agent [our.bowl %file-server]
|
||||||
==
|
%poke %file-server-action
|
||||||
%+ turn ~(tap by wex.bowl)
|
!>([%serve-dir / /app/landscape %.n %.y])
|
||||||
|= [[=wire =ship =term] *]
|
==
|
||||||
^- card
|
==
|
||||||
[%pass wire %agent [ship term] %leave ~]
|
%+ turn ~(tap by wex.bowl)
|
||||||
|
|= [[=wire =ship =term] *]
|
||||||
|
^- card
|
||||||
|
[%pass wire %agent [ship term] %leave ~]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ on-poke
|
++ on-poke
|
||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const defaultApps = ['chat', 'dojo', 'groups', 'link', 'publish'];
|
const defaultApps = ['chat', 'term', 'groups', 'link', 'publish'];
|
||||||
|
|
||||||
export default defaultApps;
|
export default defaultApps;
|
||||||
|
@ -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'
|
||||||
|
@ -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}
|
||||||
|
@ -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,
|
@ -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">
|
@ -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}
|
@ -1,4 +1,4 @@
|
|||||||
input#dojo {
|
input#term {
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user