Skip to content

Commit

Permalink
User Profile UX
Browse files Browse the repository at this point in the history
- re-logical-ify the navigation for blocks / follows / following
  • Loading branch information
benpate committed Apr 26, 2023
1 parent 5635ff6 commit c6d0fa5
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 179 deletions.
20 changes: 20 additions & 0 deletions _embed/templates/profile-default/inbox-blocks.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- $folders := .Folders -}}

<div class="fullscreen app" hx-get="{{.URL}}" hx-trigger="refreshPage from:window" hx-target="this" hx-swap="outerHTML" hx-push-url="true">
<title>{{.BlockCount}} Blocks | {{.DisplayName}}</title>
<script src="/.templates/profile-default/hyperscript" type="text/hyperscript"></script>

{{- template "inbox-sidebar" $folders -}}

<div class="app-content">

<div role="tablist" class="underlined space-above space-below" hx-push-url="true">
<span role="tab" class="turboclick" hx-get="/@me/following">{{icon "star"}} Following</span>
<span role="tab" class="turboclick" hx-get="/@me/followers">{{icon "person"}} Followers</span>
<span role="tab" class="turboclick" aria-selected="true">{{icon "block-fill"}} Blocks</span>
</div>

{{- template "blocks-editor" . -}}
</div>

</div>
21 changes: 21 additions & 0 deletions _embed/templates/profile-default/inbox-followers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- $folders := .Folders -}}

<div class="fullscreen app" hx-get="{{.URL}}" hx-trigger="refreshPage from:window" hx-target="this" hx-swap="outerHTML">

<title>{{.FollowerCount}} Followers | {{.DisplayName}}</title>

{{- template "inbox-sidebar" $folders -}}

<div class="app-content">

<div role="tablist" class="underlined space-above space-below" hx-push-url="true">
<span role="tab" class="turboclick" hx-get="/@me/following">{{icon "star"}} Following</span>
<span role="tab" class="turboclick" aria-selected="true">{{icon "person-fill"}} Followers</span>
<span role="tab" class="turboclick" hx-get="/@me/blocks">{{icon "block"}} Blocks</span>
</div>

{{ .View "followers-list"}}

</div>

</div>
67 changes: 40 additions & 27 deletions _embed/templates/profile-default/inbox-following-list.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
{{- $following := .Following -}}

<div class="table">
{{- range $following -}}
<div class="flex-row" style="align-items:center" role="button" hx-push-url="true">
<div class="link flex-row" hx-get="/@me/following-add" style="align-items:center" role="button" hx-push-url="false">

<div class="flex-row" style="flex-grow:1">

<div hx-get="/@me/inbox?folderId={{.FolderID.Hex}}&followingId={{.FollowingID.Hex}}" style="width:3em; height:3em; flex-grow:0; flex-shrink:0;">
{{- if ne "" .ImageURL -}}
<img src="{{.ImageURL}}" class="circle" style="height:3em; width:3em;"/>
{{- end -}}
<div style="width:3em; flex-grow:0; flex-shrink:0; text-align:center;">
{{icon "add"}}
</div>

<!--span class="{{.StatusClass}}">{{icon .Icon}}</span-->
<div hx-get="/@me/inbox?folderId={{.FolderID.Hex}}&origin.internalId={{.FollowingID.Hex}}" style="flex-grow:1;">
<div class="ellipsis-block" style="max-height:1.75em;">
{{- if ne "" .Label -}}
<span class="black bold">{{- .Label -}}</span>
{{- else -}}
{{- .URL -}}
<div style="flex-grow:1; text-align:left;">
Follow a Person or Website
</div>
</div>
</div>
{{- range $following -}}
<div class="flex-row" style="align-items:center" role="button" hx-push-url="true">

<div class="flex-row" style="flex-grow:1">

<div hx-get="/@me/inbox?folderId={{.FolderID.Hex}}&followingId={{.FollowingID.Hex}}" style="width:3em; height:3em; flex-grow:0; flex-shrink:0;">
{{- if ne "" .ImageURL -}}
<img src="{{.ImageURL}}" class="circle" style="height:3em; width:3em;"/>
{{- end -}}
</div>
<div class="text-xs text-gray" style="margin:0px;">
{{ if eq "SUCCESS" .Status -}}
{{ icon .Icon }}
{{ .LastPolled | tinyDate }}
{{- else if eq "LOADING" .Status -}}
<span class="green">{{.Status}}</span>
{{- else -}}
<span class="red">{{.Status}}</span>
{{- end -}}

<!--span class="{{.StatusClass}}">{{icon .Icon}}</span-->
<div hx-get="/@me/inbox?folderId={{.FolderID.Hex}}&origin.internalId={{.FollowingID.Hex}}" style="flex-grow:1;">
<div class="ellipsis-block" style="max-height:1.75em;">
{{- if ne "" .Label -}}
<span class="black bold">{{- .Label -}}</span>
{{- else -}}
{{- .URL -}}
{{- end -}}
</div>
<div class="text-xs text-gray" style="margin:0px;">
{{ if eq "SUCCESS" .Status -}}
{{ icon .Icon }}
{{ .LastPolled | tinyDate }}
{{- else if eq "LOADING" .Status -}}
<span class="green">{{.Status}}</span>
{{- else -}}
<span class="red">{{.Status}}</span>
{{- end -}}
</div>
</div>
</div>
</div>

<div class="align-right">
<button class="text-sm" hx-get="/@me/following-edit?followingId={{.FollowingID.Hex}}">Edit</button>
<div class="align-right" hx-push-url="false">
<button class="text-sm" hx-get="/@me/following-edit?followingId={{.FollowingID.Hex}}">Edit</button>
</div>
</div>
</div>
{{- end -}}
{{- end -}}
</div>
23 changes: 10 additions & 13 deletions _embed/templates/profile-default/inbox-following.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
{{- $folders := .Folders -}}

<div hx-get="{{.URL}}" hx-trigger="refreshPage from:window" hx-target="this" hx-swap="outerHTML" hx-push-url="true">
<div class="fullscreen app" hx-get="{{.URL}}" hx-trigger="refreshPage from:window" hx-target="this" hx-swap="outerHTML" hx-push-url="true">
<title>{{.FollowingCount}} Following | {{.DisplayName}}</title>
<script src="/.templates/user-profile/hyperscript" type="text/hyperscript"></script>

<div class="app h-card">
{{- template "inbox-sidebar" $folders -}}

{{- template "inbox-sidebar" $folders -}}
<div class="app-content">

<div class="app-content">

<div class="text-sm float-right">
<button hx-get="/@me/following-add" class="primary">{{icon "add"}} Follow</button>
</div>

<h1>Manage Follows</h1>

{{- template "inbox-following-list" . -}}

<div role="tablist" class="underlined space-above space-below" hx-push-url="true">
<span role="tab" class="turboclick" aria-selected="true">{{icon "star-fill"}} Following</span>
<span role="tab" class="turboclick" hx-get="/@me/followers">{{icon "person"}} Followers</span>
<span role="tab" class="turboclick" hx-get="/@me/blocks">{{icon "block"}} Blocks</span>
</div>

{{- template "inbox-following-list" . -}}

</div>


</div>
6 changes: 3 additions & 3 deletions _embed/templates/profile-default/inbox-sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
{{- end -}}

</form>
<div role="button" hx-get="/@me/inbox-folder-add" class="menu-item turboclick">{{icon "add"}} Add a Folder</div>

<hr>
<div role="button" hx-get="/@me/inbox-folder-add" class="menu-item turboclick">{{icon "add"}} Add a Folder</div>

{{- if .HasSelection -}}
<div role="button" hx-get="/@me/inbox-following" class="menu-item turboclick">{{icon "settings"}} Edit Following</div>
<div role="button" hx-get="/@me/inbox-following" class="menu-item turboclick">{{icon "settings"}} Settings</div>
{{- else -}}
<div role="button" hx-get="/@me/inbox-following" class="selected menu-item turboclick">{{icon "settings-fill"}} Edit Following</div>
<div role="button" hx-get="/@me/inbox-following" class="selected menu-item turboclick">{{icon "settings-fill"}} Settings</div>
{{- end -}}
</div>

Expand Down
22 changes: 0 additions & 22 deletions _embed/templates/profile-default/profile-blocks.html

This file was deleted.

22 changes: 0 additions & 22 deletions _embed/templates/profile-default/profile-followers.html

This file was deleted.

30 changes: 0 additions & 30 deletions _embed/templates/profile-default/profile-following-list.html

This file was deleted.

25 changes: 0 additions & 25 deletions _embed/templates/profile-default/profile-following.html

This file was deleted.

14 changes: 9 additions & 5 deletions _embed/templates/profile-default/profile-sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ <h2 class="gray50" style="margin:0px;">{{.Username}}</h2>
<button type="button" class="primary width-100" hx-get="/@{{.UserID}}/follow">{{icon "add-circle"}} Follow {{.DisplayName}}</button>
</div>
{{- end -}}
<div class="space-above" hx-push-url="true">
<span hx-get="/@{{.Username}}/followers" role="link"><b>{{.FollowerCount}}</b> Followers</span>
&nbsp;
<span hx-get="/@{{.Username}}/following" role="link"><b>{{.FollowingCount}}</b> Following</span>
</div>

{{- if .UserCan "profile-edit" -}}
<div class="space-above">
<a href="/@me/followers" class="text-plain"><b>{{.FollowerCount}}</b> Followers</a>
&nbsp;
<a href="/@me/following" class="text-plain"><b>{{.FollowingCount}}</b> Following</a>
</div>
{{- end -}}

<div class="space-above">
<span class="p-note">{{.StatusMessage}}</span>
</div>
Expand Down
13 changes: 1 addition & 12 deletions _embed/templates/profile-default/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@

<div class="app-content">

{{- if .UserCan "profile-edit" -}}
<div role="tablist" class="underlined space-below" hx-push-url="true">
<span role="tab" class="turboclick" aria-selected="true">{{icon "outbox-fill"}} Posts</span>
<span role="tab" class="turboclick" hx-get="/@{{.UserID}}/following">{{icon "star"}} Following</span>
<span role="tab" class="turboclick" hx-get="/@{{.UserID}}/followers">{{icon "person"}} Followers</span>
<span role="tab" class="turboclick" hx-get="/@{{.UserID}}/blocks">{{icon "block"}} Blocks</span>
</div>
{{- end -}}

{{if .UserCan "outbox-add" -}}
<div hx-target="this" hx-swap="outerHTML" class="text-sm">
<button hx-get="/@me/outbox-add" class="primary">New Post</button>
</div>
{{- .View "outbox-add" -}}
{{- end -}}

<div class="h-feed">
Expand Down
18 changes: 5 additions & 13 deletions _embed/templates/profile-default/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
]
},

"followers": {"step":"view-html", "file":"profile-followers"},
"followers-list": {"step":"view-html", "file":"profile-followers-list"},
"followers": {"step":"view-html", "file":"inbox-followers"},
"followers-list": {"step":"view-html", "file":"inbox-followers-list"},
"follower-add": {
"roles":["self"],
"steps":[
Expand Down Expand Up @@ -169,8 +169,8 @@
]
},

"following": {"step":"view-html", "file":"profile-following"},
"following-list": {"step":"view-html", "file":"profile-following-list"},
"following": {"step":"view-html", "file":"inbox-following"},
"following-list": {"step":"view-html", "file":"inbox-following-list"},
"following-add":{
"roles":["self"],
"steps":[
Expand Down Expand Up @@ -269,7 +269,7 @@
"blocks": {
"roles":["self"],
"step":"view-html",
"file":"profile-blocks"
"file":"inbox-blocks"
},

"feed": {"step":"view-feed"},
Expand Down Expand Up @@ -300,14 +300,6 @@
]}
]
},
"inbox-following": {
"roles":["self"],
"step":"view-html"
},
"inbox-following-list": {
"roles":["self"],
"step":"view-html"
},
"inbox-folder-add": {
"roles":["self"],
"steps": [
Expand Down
Loading

0 comments on commit c6d0fa5

Please sign in to comment.