@@ -1,4 +1,4 @@
1−import React, { useCallback, useState, useEffect } from 'react';
1+import React, { useCallback, useState, useEffect, useMemo } from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
3import { Grid, Button, SelectInput, Flex } from 'indigo-react';
3import { Grid, Button, SelectInput, Flex } from 'indigo-react';
4import * as ob from 'urbit-ob';
4import * as ob from 'urbit-ob';
@@ -22,6 +22,7 @@ import { useLocalRouter } from 'lib/LocalRouter';
22import { useHosting } from 'store/hosting';
22import { useHosting } from 'store/hosting';
23import DownloadKeyfileButton from 'components/DownloadKeyfileButton';
23import DownloadKeyfileButton from 'components/DownloadKeyfileButton';
24import useLifecycle from 'lib/useLifecycle';
24import useLifecycle from 'lib/useLifecycle';
25+import useLocalHosting from 'lib/useLocaHosting';
26export default function UrbitOSHome({ manualNetworkSeed }) {
27export default function UrbitOSHome({ manualNetworkSeed }) {
27 const { pointCursor } = usePointCursor();
28 const { pointCursor } = usePointCursor();
@@ -104,6 +105,13 @@ function Hosting({ manualNetworkSeed }) {
104 disabled,
105 disabled,
105 } = ship;
106 } = ship;
108+ const { running: localRunning, url: localUrl } = useLocalHosting();
110+ let running = useMemo(() => localRunning || ship.running, [
107 useLifecycle(() => {
115 useLifecycle(() => {
108 syncStatus();
116 syncStatus();
@@ -114,6 +122,19 @@ function Hosting({ manualNetworkSeed }) {
114 const options = [{ text: 'Tlon', value: 'tlon' }];
122 const options = [{ text: 'Tlon', value: 'tlon' }];
116 const renderMain = useCallback(() => {
124 const renderMain = useCallback(() => {
117 if (ship.running) {
138 if (ship.running) {
@@ -158,6 +179,7 @@ function Hosting({ manualNetworkSeed }) {
161 ship.missing,
183 ship.missing,
162 ship.running,
184 ship.running,
163 ship.pending,
185 ship.pending,
@@ -202,11 +224,8 @@ function Hosting({ manualNetworkSeed }) {
202 <Grid.Item full className="f5" as={Flex}>
224 <Grid.Item full className="f5" as={Flex}>
203 <Flex.Item>Urbit OS </Flex.Item>
225 <Flex.Item>Urbit OS </Flex.Item>
204 <Flex.Item
226 <Flex.Item
206− { green3: ship.running, gray4: !ship.running },
227+ className={cn({ green3: running, gray4: !running }, 'ml3')}>
209− {ship.running ? 'Connected' : 'Disconnected'}
228+ {running ? 'Connected' : 'Disconnected'}
210 </Flex.Item>
229 </Flex.Item>
211 </Grid.Item>
230 </Grid.Item>
212 <BridgeForm initialValues={{ provider: 'tlon' }}>
231 <BridgeForm initialValues={{ provider: 'tlon' }}>
@@ -214,14 +233,16 @@ function Hosting({ manualNetworkSeed }) {
215 {renderDetails()}
234 {renderDetails()}
216 {renderMain()}
235 {renderMain()}
217− <Grid.Item
237+ <Grid.Item
219− as={SelectInput}
239+ as={SelectInput}
220− name="provider"
240+ name="provider"
221− label="Host Provider"
241+ label="Host Provider"
222− options={options}
242+ options={options}
223− disabled
243+ disabled
227 </BridgeForm>
248 </BridgeForm>