on main help sign in
add spawned points list to ship view and got software distro working
45297d9John Hyde
README.md+18−2
@@ -25,7 +25,23 @@ To develop you'll need a running ship to point to. To do so you first need to ad
25
25
26Regardless of what you run to develop, Vite will hot-reload code changes as you work so you don't have to constantly refresh.
26Regardless of what you run to develop, Vite will hot-reload code changes as you work so you don't have to constantly refresh.
27
27
28−### Deploying
28+### Deploying with `glob-ames` glob
29+
30+1. Spin up a comet or distribution ship.
31+2. Mount an `%astrolabe` desk. In Dojo:
32+ 1. `|merge %astrolabe our %base` to create a new desk.
33+ 2. `|mount %work` to mount it.
34+3. Install the desk
35+ 1. From the root of the project: `./install.sh path/to/pier/astrolabe`
36+ 2. From the ship's dojo: `|commit %astrolabe`
37+ 3. (if using a comet as a middleman) `|public %astrolabe`
38+ 4. (if using a comet as a middleman) from the actual distribution ship: `|install ~comet-name %astrolabe`
39+ 5. (if using a comet as a middleman) from the actual distribution ship: `|pause %astrolabe`
40+4. Build the UI with `npm run build` in the `ui` directory which will bundle all the code and assets into the `dist/` folder.
41+5. Upload the `dist/` folder as a glob to your distribution ship. Example url: https://distribution.urbit-ship.com/docket/upload
42+6. Publish the desk from dojo: `:treaty|publish %astrolabe`
43+
44+### Deploying with `glob-http` glob
29
45
30To deploy, run `npm run build` in the `ui` directory which will bundle all the code and assets into the `dist/` folder. This can then be made into a glob by doing the following:
46To deploy, run `npm run build` in the `ui` directory which will bundle all the code and assets into the `dist/` folder. This can then be made into a glob by doing the following:
31
47
@@ -41,7 +57,7 @@ To deploy, run `npm run build` in the `ui` directory which will bundle all the c
4110. Once you've uploaded the glob, you should then update the corresponding entry in the docket file at `desk/desk.docket-0`. Both the full URL and the hash should be updated to match the glob we just created, on the line that looks like this:
5710. Once you've uploaded the glob, you should then update the corresponding entry in the docket file at `desk/desk.docket-0`. Both the full URL and the hash should be updated to match the glob we just created, on the line that looks like this:
42
58
43```hoon
59```hoon
44− glob-http+['https://bootstrap.urbit.org/glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob' 0v5.fdf99.nph65.qecq3.ncpjn.q13mb]
60+ glob-http+['https://bootstrap.urbit.org/glob-0v5.fdf99.nph65.qecq3.ncpjn.q13mb.glob' 0v5.fdf99.nph65.qecq3.ncpjn.q13mb]
45```
61```
46
62
4711. This can now be safely committed and deployed.
6311. This can now be safely committed and deployed.
desk/app/astrolabe.hoon+11−2
@@ -28,8 +28,14 @@
28 :_ this
28 :_ this
29 [%pass /azimuth-events %agent [our.bowl %azimuth] %watch /event]~
29 [%pass /azimuth-events %agent [our.bowl %azimuth] %watch /event]~
30::
30::
31−++ on-save on-save:def
31+++ on-save !>(state)
32−++ on-load on-load:def
32+++ on-load
33+ |= old-state=vase
34+ ^- (quip card _this)
35+ =/ old !<(versioned-state old-state)
36+ ?- -.old
37+ %0 `this(state old)
38+ ==
33++ on-poke on-poke:def
39++ on-poke on-poke:def
34++ on-watch on-watch:def
40++ on-watch on-watch:def
35++ on-leave on-leave:def
41++ on-leave on-leave:def
@@ -46,6 +52,9 @@
46 ?~ doc
52 ?~ doc
47 `~
53 `~
48 ``json+!>(s+u.doc)
54 ``json+!>(s+u.doc)
55+ [%x %spawned @ ~]
56+ =/ =ship `@p`(slav %p &3.path)
57+ ``astrolabe-point-set+!>((~(get ju spa) ship))
49 ==
58 ==
50++ on-agent
59++ on-agent
51 |= [=wire =sign:agent:gall]
60 |= [=wire =sign:agent:gall]
desk/desk.docket-0+1−1
@@ -2,7 +2,7 @@
2 info+'Your guide to the Urbit constellations'
2 info+'Your guide to the Urbit constellations'
3 color+0x1f.243c
3 color+0x1f.243c
4 image+'https://raw.githubusercontent.com/johnhyde/astrolabe/main/ui/src/assets/astrolabe-tile.svg'
4 image+'https://raw.githubusercontent.com/johnhyde/astrolabe/main/ui/src/assets/astrolabe-tile.svg'
5− glob-http+['https://bootstrap.urbit.org/glob-0v5.hurm4.ejod5.ngg9h.iub9i.n1j7o.glob' 0v5.hurm4.ejod5.ngg9h.iub9i.n1j7o]
5+ glob-ames+[~dister-midlev-mindyr 0v0]
6 base+'astrolabe'
6 base+'astrolabe'
7 version+[0 0 1]
7 version+[0 0 1]
8 website+'https://github.com/johnhyde/astrolabe'
8 website+'https://github.com/johnhyde/astrolabe'
desk/lib/astrolabe.hoon+10
@@ -10,6 +10,16 @@
10++ enjs
10++ enjs
11 =, enjs:format
11 =, enjs:format
12 |%
12 |%
13+ ++ point-set
14+ |= points=(set ^ship)
15+ ^- json
16+ =+ point-list=~(tap in points)
17+ %+ frond %spawned
18+ :- %a
19+ %+ turn
20+ point-list
21+ |= who=^ship
22+ (ship who)
13 ++ point
23 ++ point
14 |= =^point
24 |= =^point
15 ^- json
25 ^- json
desk/mar/astrolabe/point-set.hoonnew file+13
@@ -0,0 +1,13 @@
1+/+ *astrolabe
2+|_ points=(set ship)
3+++ grab
4+ |%
5+ ++ noun (set ship)
6+ --
7+++ grow
8+ |%
9+ ++ noun points
10+ ++ json (point-set:enjs points)
11+ --
12+++ grad %noun
13+--
desk/mar/astrolabe/point.hoon+1−1
@@ -3,7 +3,7 @@
3++ grab
3++ grab
4 |%
4 |%
5 ++ noun point
5 ++ noun point
6− ++ json point:dejs
6+ :: ++ json point:dejs
7 --
7 --
8++ grow
8++ grow
9 |%
9 |%
ui/package-lock.json+7−7
@@ -26,7 +26,7 @@
26 "cross-env": "^7.0.3",
26 "cross-env": "^7.0.3",
27 "postcss-cli": "^9.1.0",
27 "postcss-cli": "^9.1.0",
28 "sass": "^1.50.0",
28 "sass": "^1.50.0",
29− "svelte": "^3.44.0",
29+ "svelte": "^3.48.0",
30 "svelte-check": "^2.2.7",
30 "svelte-check": "^2.2.7",
31 "svelte-preprocess": "^4.9.8",
31 "svelte-preprocess": "^4.9.8",
32 "svelte-spa-router": "^3.2.0",
32 "svelte-spa-router": "^3.2.0",
@@ -2454,9 +2454,9 @@
2454 }
2454 }
2455 },
2455 },
2456 "node_modules/svelte": {
2456 "node_modules/svelte": {
2457− "version": "3.45.0",
2457+ "version": "3.48.0",
2458− "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.45.0.tgz",
2458+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.48.0.tgz",
2459− "integrity": "sha512-6AWftH2eqqKLYH1HvKpuUWe8OfjflarhegN57P/Cqwc2Rb2F5oIdDtANU/jMscyZMzG0v6nTQox0siZR9cmRVQ==",
2459+ "integrity": "sha512-fN2YRm/bGumvjUpu6yI3BpvZnpIm9I6A7HR4oUNYd7ggYyIwSA/BX7DJ+UXXffLp6XNcUijyLvttbPVCYa/3xQ==",
2460 "dev": true,
2460 "dev": true,
2461 "engines": {
2461 "engines": {
2462 "node": ">= 8"
2462 "node": ">= 8"
@@ -4637,9 +4637,9 @@
4637 "dev": true
4637 "dev": true
4638 },
4638 },
4639 "svelte": {
4639 "svelte": {
4640− "version": "3.45.0",
4640+ "version": "3.48.0",
4641− "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.45.0.tgz",
4641+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.48.0.tgz",
4642− "integrity": "sha512-6AWftH2eqqKLYH1HvKpuUWe8OfjflarhegN57P/Cqwc2Rb2F5oIdDtANU/jMscyZMzG0v6nTQox0siZR9cmRVQ==",
4642+ "integrity": "sha512-fN2YRm/bGumvjUpu6yI3BpvZnpIm9I6A7HR4oUNYd7ggYyIwSA/BX7DJ+UXXffLp6XNcUijyLvttbPVCYa/3xQ==",
4643 "dev": true
4643 "dev": true
4644 },
4644 },
4645 "svelte-check": {
4645 "svelte-check": {
ui/package.json+1−1
@@ -22,7 +22,7 @@
22 "cross-env": "^7.0.3",
22 "cross-env": "^7.0.3",
23 "postcss-cli": "^9.1.0",
23 "postcss-cli": "^9.1.0",
24 "sass": "^1.50.0",
24 "sass": "^1.50.0",
25− "svelte": "^3.44.0",
25+ "svelte": "^3.48.0",
26 "svelte-check": "^2.2.7",
26 "svelte-check": "^2.2.7",
27 "svelte-preprocess": "^4.9.8",
27 "svelte-preprocess": "^4.9.8",
28 "svelte-spa-router": "^3.2.0",
28 "svelte-spa-router": "^3.2.0",
ui/src/components/ShipListing.svelte+16−2
@@ -1,16 +1,30 @@
1<script lang="ts">
1<script lang="ts">
2+
2 import Sigil from "./Sigil.svelte";
3 import Sigil from "./Sigil.svelte";
4+ import { push } from 'svelte-spa-router'
5+ import { normalizeId } from '../lib/id';
6+ import { linkToShip as generateLinkToShip } from '../lib/link';
3 export let ship: any;
7 export let ship: any;
8+ export let linkToShip: boolean = false;
9+
10+ $: patp = normalizeId(ship.patp);
11+
12+ function handleClick() {
13+ if (linkToShip) {
14+ push(generateLinkToShip(patp));
15+ }
16+ }
4</script>
17</script>
5
18
6<div class="flex flex-wrap p-4 border-b last:border-none items-center"
19<div class="flex flex-wrap p-4 border-b last:border-none items-center"
20+ on:click={handleClick}
7 on:click
21 on:click
8 >
22 >
9− <Sigil patp={ship.patp} size={48} />
23+ <Sigil {patp} size={48} />
10 <!-- {#if ship.avatar}
24 <!-- {#if ship.avatar}
11 <img src={ship.avatar} class="h-12 w-12 mr-4" />
25 <img src={ship.avatar} class="h-12 w-12 mr-4" />
12 {/if} -->
26 {/if} -->
13 <p class="ml-4 break-words" >
27 <p class="ml-4 break-words" >
14− {ship.patp}<br/>{ship.nickname ? `(${ship.nickname})` : ''}
28+ {patp}<br/>{ship.nickname ? `(${ship.nickname})` : ''}
15 </p>
29 </p>
16</div>
30</div>
ui/src/components/ShipView.svelte+40−3
@@ -11,6 +11,7 @@
11 import ShipLink from './ShipLink.svelte';
11 import ShipLink from './ShipLink.svelte';
12 import EthAddressLink from './EthAddressLink.svelte';
12 import EthAddressLink from './EthAddressLink.svelte';
13 import CollapsibleContent from './CollapsibleContent.svelte';
13 import CollapsibleContent from './CollapsibleContent.svelte';
14+ import ShipListing from './ShipListing.svelte';
14
15
15 export let patp: string;
16 export let patp: string;
16
17
@@ -18,6 +19,9 @@
18 let rawPointInfoPromise: any;
19 let rawPointInfoPromise: any;
19 let rawPointInfo: any = {};
20 let rawPointInfo: any = {};
20 let pointInfo: any = {};
21 let pointInfo: any = {};
22+ let rawSpawnedPointsPromise: any;
23+ let rawSpawnedPoints: any = {};
24+ let spawnedPoints: string[] = [];
21 const api: UrbitApi = new UrbitApi('');
25 const api: UrbitApi = new UrbitApi('');
22 const spawnStatusOptions = {
26 const spawnStatusOptions = {
23 unspawned: {
27 unspawned: {
@@ -55,6 +59,7 @@
55 $: shipClass = clan(patp);
59 $: shipClass = clan(patp);
56 $: azPoint = ['galaxy', 'star', 'planet'].includes(shipClass);
60 $: azPoint = ['galaxy', 'star', 'planet'].includes(shipClass);
57 $: canSpawnPoints = ['galaxy', 'star'].includes(shipClass);
61 $: canSpawnPoints = ['galaxy', 'star'].includes(shipClass);
62+ $: spawnableClassPlural = !canSpawnPoints ? '' : (shipClass === 'galaxy' ? 'Stars' : 'Planets');
58 $: {
63 $: {
59 let parents = [patp];
64 let parents = [patp];
60 let galaxyFound = false;
65 let galaxyFound = false;
@@ -85,6 +90,23 @@
85 });
90 });
86 }
91 }
87 }
92 }
93+ $: {
94+ rawSpawnedPoints = {};
95+ if (canSpawnPoints) {
96+ rawSpawnedPointsPromise = api.scry<any>({ app: 'astrolabe', path: `/spawned/${patp}` });
97+ rawSpawnedPointsPromise.then((info) => {
98+ rawSpawnedPoints = info;
99+ }).catch((error) => {
100+ rawSpawnedPoints.error = error;
101+ });
102+ }
103+ }
104+ $: {
105+ spawnedPoints = [];
106+ if (rawSpawnedPoints.spawned) {
107+ spawnedPoints = rawSpawnedPoints.spawned.map(patp => normalizeId(patp));
108+ }
109+ }
88 $: {
110 $: {
89 pointInfo = {};
111 pointInfo = {};
90 let spawnStatus: any,
112 let spawnStatus: any,
@@ -290,9 +312,24 @@
290 </div>
312 </div>
291 </div>
313 </div>
292 {#if canSpawnPoints}
314 {#if canSpawnPoints}
293− <div>
315+ <div class="mt-5 p-3 border-t">
316+ {#await rawPointInfoPromise then}
317+ <h3 class="text-lg">
318+ {#if pointInfo.spawnedCount}
294− <h3 class="text-lg">Spawned Points: {pointInfo.spawnedCount || ''}</h3>
319+ {pointInfo.spawnedCount} Spawned {spawnableClassPlural}:
295− <span class="text-green-600">// TODO</span>
320+ {:else}
321+ No Spawned {spawnableClassPlural}
322+ {/if}
323+ </h3>
324+ {/await}
325+ {#await rawSpawnedPointsPromise}
326+ Loading {spawnableClassPlural}...
327+ {:then}
328+ <!-- TODO: pagination -->
329+ {#each spawnedPoints as patp, i}
330+ <ShipListing ship={{ patp }} linkToShip />
331+ {/each}
332+ {/await}
296 </div>
333 </div>
297 {/if}
334 {/if}
298</div>
335</div>
ui/src/components/Sigil.svelte+1−1
@@ -28,7 +28,7 @@
28 }
28 }
29</script>
29</script>
30
30
31−<div>
31+<div class="flex-grow" style:max-width="{size}px">
32 {#if displaySigil}
32 {#if displaySigil}
33 {@html svgString}
33 {@html svgString}
34 {:else}
34 {:else}
ui/src/styles/tailwind-output.css+12
@@ -509,6 +509,9 @@ Ensure the default browser behavior of the `hidden` attribute.
509.mt-4 {
509.mt-4 {
510 margin-top: 1rem;
510 margin-top: 1rem;
511}
511}
512+.mt-5 {
513+ margin-top: 1.25rem;
514+}
512.-mt-1 {
515.-mt-1 {
513 margin-top: -0.25rem;
516 margin-top: -0.25rem;
514}
517}
@@ -527,6 +530,9 @@ Ensure the default browser behavior of the `hidden` attribute.
527.-mt-0 {
530.-mt-0 {
528 margin-top: -0px;
531 margin-top: -0px;
529}
532}
533+.mt-3 {
534+ margin-top: 0.75rem;
535+}
530.-mt-0\.5 {
536.-mt-0\.5 {
531 margin-top: -0.125rem;
537 margin-top: -0.125rem;
532}
538}
@@ -743,6 +749,9 @@ Ensure the default browser behavior of the `hidden` attribute.
743.border-b {
749.border-b {
744 border-bottom-width: 1px;
750 border-bottom-width: 1px;
745}
751}
752+.border-t {
753+ border-top-width: 1px;
754+}
746.border-white {
755.border-white {
747 --tw-border-opacity: 1;
756 --tw-border-opacity: 1;
748 border-color: rgb(255 255 255 / var(--tw-border-opacity));
757 border-color: rgb(255 255 255 / var(--tw-border-opacity));
@@ -841,6 +850,9 @@ Ensure the default browser behavior of the `hidden` attribute.
841.p-1 {
850.p-1 {
842 padding: 0.25rem;
851 padding: 0.25rem;
843}
852}
853+.p-5 {
854+ padding: 1.25rem;
855+}
844.py-0\.5 {
856.py-0\.5 {
845 padding-top: 0.125rem;
857 padding-top: 0.125rem;
846 padding-bottom: 0.125rem;
858 padding-bottom: 0.125rem;