urbit / shrub

An operating function (Prototype)
https://urbit.org
MIT License
29 stars 2 forks source link

Profiles, Homepages, Widgets #119

Open bonbud-macryg opened 1 month ago

bonbud-macryg commented 4 weeks ago

DevEx should look something like this.

Depending on full profiles spec

++  deps
  %-  ~(gas by *deps:neo)
  :~  :-  %profiles
      :+  req=|  [pro/%sig (sy %sig ~)]
      :+  ~  %z
      %-  ~(gas by *lads:neo)
      :~  :-  [|/%tas &/%profile-image |]
          [or/~[pro/%jpg pro/%png] (sy %sig ~)]
          :-  [|/%tas &/%header-image |]
          [or/~[pro/%jpg pro/%png] (sy %sig ~)]
          :-  [|/%tas &/%sigil-color |]
          [pro/%hexadecimal (sy %sig ~)]
          :-  [|/%tas &/%sigil-background-color |]
          [pro/%hexadecimal (sy %sig ~)]
          :-  [|/%tas &/%display-name |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%first-name |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%last-name |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%organization |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%phone-number |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%email |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%url |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%date-of-birth |]
          [pro/%time (sy %sig ~)]
          :-  [|/%tas &/%username |/%t |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas |/%tas &]
          [pro/%sig (sy %sig ~)]
      ==
  ==

Depending on a subset of the profiles spec

++  deps
  %-  ~(gas by *deps:neo)
  :~  :-  %profiles
      :+  req=|  [pro/%sig (sy %sig ~)]
      :+  ~  %z
      %-  ~(gas by *lads:neo)
      :~  :-  [|/%tas &/%first-name |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%last-name |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%phone-number |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%email |]
          [pro/%txt (sy %sig ~)]
          :-  [|/%tas &/%date-of-birth |]
          [pro/%time (sy %sig ~)]
          :-  [|/%tas |/%tas &]
          [pro/%sig (sy %sig ~)]
      ==
  ==

If necessary (is it?) the final lad covers all the kids we see explicitly constrained in /imp/profiles but which we don't write out in this +deps arm, and any kids not explicitly constrained by /imp/profiles. For the developer, it’s only important to declare e.g. “it matters to me that my shrub knows the user’s date of birth, and that I know the user’s date of birth is a valid %time.”

The /imp/profiles UI will usually be an iframe within another shrub’s UI.

Shrubs may be aware of several of your profiles, but in practice I assume they’ll only ever want one, so the “select a profile” iframe need only grant the shrub access to one profile. We could have several behaviours within the same iframe, and have the developer specify which behaviour they want in the iframe’s attributes.

We may also gate specific pieces of data in each profile to each shrub. So we might ask the user to pick a profile then say “Allow this shrub to access your First name, Last name, Email, Phone number, Home Address?” The developer could request specific pieces of info in the iframe attributes and imp/profiles could grant acccess to those shrubs accordingly.