Alessio 24364a26b0 REFACTOR: rework the rendering helpers
- rendering helpers moved to their own file (separate from response helpers)
- create a unified render helper instead of "buffered_render_basic_X" and "buffered_render_tweet_X"
	- this helper takes 2 data objects: one with global data (tweet trove, logged in user, etc) and one page-specific
	- this lets us remove the disgusting interface type
- modify the User List template to use UserIDs indexing into a global data object instead of a list of Users
2023-12-31 15:56:12 -06:00

44 lines
1.2 KiB
Smarty

{{define "title"}}Search{{end}}
{{define "main"}}
<div class="search-header">
<h2 style="text-align: center">Search results: {{.SearchText}}</h2>
<div class="row tabs-container">
<a
class="tab unstyled-link {{if (not .IsUsersSearch)}}active-tab{{end}}"
href="?type=tweets"
>
<span class="tab-inner">Tweets</span>
</a>
<a
class="tab unstyled-link {{if .IsUsersSearch}}active-tab{{end}}"
href="?type=users"
>
<span class="tab-inner">Users</span>
</a>
</div>
</div>
{{if .IsUsersSearch}}
{{template "list" .UserIDs}}
{{else}}
<div class="sort-order-container">
<span class="sort-order-label">order:</span>
<select name="sort-order" hx-get="#" hx-target="body" hx-push-url="true">
{{range .SortOrderOptions}}
<option
value="{{.}}"
style="text-transform: capitalize;"
{{if (eq ($.SortOrder.String) .)}}
selected
{{end}}
>{{.}}</option>
{{end}}
</select>
</div>
<div class="timeline">
{{template "timeline" .}}
</div>
{{end}}
{{end}}