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 *]
|
||||
[%4 state-zero]
|
||||
[%5 state-zero]
|
||||
[%6 state-zero]
|
||||
==
|
||||
::
|
||||
+$ state-zero
|
||||
@ -21,7 +22,7 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
=| [%5 state-zero]
|
||||
=| [%6 state-zero]
|
||||
=* state -
|
||||
%- agent:dbug
|
||||
^- agent:gall
|
||||
@ -36,27 +37,42 @@
|
||||
%_ new-state
|
||||
tiles
|
||||
%- ~(gas by *tiles:store)
|
||||
%+ turn `(list term)`[%weather %clock %dojo ~]
|
||||
%+ turn `(list term)`[%weather %clock %term ~]
|
||||
|= =term
|
||||
:- term
|
||||
^- tile:store
|
||||
?+ term [[%custom ~] %.y]
|
||||
%dojo [[%basic 'Dojo' '/~landscape/img/Dojo.png' '/~dojo'] %.y]
|
||||
?+ term [[%custom ~] %.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-load
|
||||
|= old=vase
|
||||
^- (quip card _this)
|
||||
=/ old-state !<(versioned-state old)
|
||||
|-
|
||||
=| cards=(list card)
|
||||
|- ^- (quip card _this)
|
||||
?: ?=(%6 -.old-state)
|
||||
[cards this(state 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)
|
||||
:- [%pass / %arvo %e %disconnect [~ /]]~
|
||||
=. cards
|
||||
%+ snoc cards
|
||||
[%pass / %arvo %e %disconnect [~ /]]
|
||||
=. tiles.old-state
|
||||
(~(del by tiles.old-state) %chat)
|
||||
=. tiles.old-state
|
||||
@ -65,7 +81,7 @@
|
||||
(~(del by tiles.old-state) %links)
|
||||
=. tile-ordering.old-state
|
||||
(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
|
||||
%_ new-state
|
||||
@ -80,18 +96,22 @@
|
||||
==
|
||||
tile-ordering [%weather %clock %dojo ~]
|
||||
==
|
||||
:_ this(state [%5 new-state])
|
||||
%+ welp
|
||||
:~ [%pass / %arvo %e %disconnect [~ /]]
|
||||
:* %pass /srv %agent [our.bowl %file-server]
|
||||
%poke %file-server-action
|
||||
!>([%serve-dir / /app/landscape %.n %.y])
|
||||
==
|
||||
==
|
||||
%+ turn ~(tap by wex.bowl)
|
||||
|= [[=wire =ship =term] *]
|
||||
^- card
|
||||
[%pass wire %agent [ship term] %leave ~]
|
||||
%_ $
|
||||
old-state [%5 new-state]
|
||||
::
|
||||
cards
|
||||
%+ welp
|
||||
:~ [%pass / %arvo %e %disconnect [~ /]]
|
||||
:* %pass /srv %agent [our.bowl %file-server]
|
||||
%poke %file-server-action
|
||||
!>([%serve-dir / /app/landscape %.n %.y])
|
||||
==
|
||||
==
|
||||
%+ turn ~(tap by wex.bowl)
|
||||
|= [[=wire =ship =term] *]
|
||||
^- card
|
||||
[%pass wire %agent [ship term] %leave ~]
|
||||
==
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
|
@ -1,3 +1,3 @@
|
||||
const defaultApps = ['chat', 'dojo', 'groups', 'link', 'publish'];
|
||||
const defaultApps = ['chat', 'term', 'groups', 'link', 'publish'];
|
||||
|
||||
export default defaultApps;
|
||||
|
@ -9,11 +9,11 @@ export default class BasicTile extends React.PureComponent {
|
||||
|
||||
return (
|
||||
<Tile
|
||||
bg={props.title === 'Dojo' ? '#000000' : 'white'}
|
||||
bg={props.title === 'Terminal' ? '#000000' : 'white'}
|
||||
to={props.linkedUrl}
|
||||
>
|
||||
<Text color={props.title === 'Dojo' ? '#ffffff' : 'black'}>
|
||||
{props.title === 'Dojo'
|
||||
<Text color={props.title === 'Terminal' ? '#ffffff' : 'black'}>
|
||||
{props.title === 'Terminal'
|
||||
? <Icon
|
||||
icon='ChevronEast'
|
||||
color='#fff'
|
||||
|
@ -73,20 +73,20 @@ function DragTileBasic(props: {
|
||||
style: any;
|
||||
}) {
|
||||
const { basic: tile } = props.tile;
|
||||
const isDojo = useMemo(() => tile.title === "Dojo", [tile.title]);
|
||||
const isTerm = useMemo(() => tile.title === "Terminal", [tile.title]);
|
||||
return (
|
||||
<DragTileBox
|
||||
tile={{ type: props.tile }}
|
||||
index={props.index}
|
||||
bg={
|
||||
"white" // isDojo ? "black" : "white"
|
||||
"white" // isTerm ? "black" : "white"
|
||||
}
|
||||
style={props.style}
|
||||
>
|
||||
<Image width="48px" height="48px" src={tile.iconUrl} invert={isDojo} />
|
||||
<Image width="48px" height="48px" src={tile.iconUrl} invert={isTerm} />
|
||||
<Text
|
||||
color={
|
||||
"black" // isDojo ? "white" : "black"
|
||||
"black" // isTerm ? "white" : "black"
|
||||
}
|
||||
>
|
||||
{tile.title}
|
||||
|
@ -5,10 +5,9 @@ export default class Api {
|
||||
this.ship = ship;
|
||||
this.channel = channel;
|
||||
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]);
|
||||
|
||||
window.subscriptionId = this.channel.subscribe(ship, appl, path,
|
@ -45,14 +45,14 @@ export default class DojoApp extends Component {
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>OS1 - Dojo</title>
|
||||
<title>OS1 - Terminal</title>
|
||||
</Helmet>
|
||||
<div
|
||||
style={{ height: '100%' }}
|
||||
>
|
||||
<Route
|
||||
exact
|
||||
path="/~dojo/"
|
||||
path="/~term/"
|
||||
render={(props) => {
|
||||
return (
|
||||
<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 {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
awaiting: false,
|
||||
type: 'Sending to Dojo'
|
||||
};
|
||||
this.state = {};
|
||||
this.keyPress = this.keyPress.bind(this);
|
||||
this.paste = this.paste.bind(this);
|
||||
this.click = this.click.bind(this);
|
||||
@ -98,7 +95,7 @@ export class Input extends Component {
|
||||
tabindex="0"
|
||||
wrap="off"
|
||||
className="mono ml1 flex-auto dib w-100"
|
||||
id="dojo"
|
||||
id="term"
|
||||
cursor={this.props.cursor}
|
||||
onKeyDown={this.keyPress}
|
||||
onClick={this.click}
|
@ -1,4 +1,4 @@
|
||||
input#dojo {
|
||||
input#term {
|
||||
background-color: inherit;
|
||||
color: inherit;
|
||||
}
|
@ -34,7 +34,7 @@ export const Content = (props) => {
|
||||
)}
|
||||
/>
|
||||
<Route
|
||||
path='/~dojo'
|
||||
path='/~term'
|
||||
render={p => (
|
||||
<DojoApp
|
||||
history={p.history}
|
||||
|
Loading…
Reference in New Issue
Block a user