Skip to content

Commit 3c442af

Browse files
Gargronmayaeh
authored andcommitted
Add explanation to featured hashtags page and profile (mastodon#11586)
1 parent c8065e1 commit 3c442af

5 files changed

Lines changed: 45 additions & 13 deletions

File tree

app/controllers/accounts_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def show
1818

1919
@pinned_statuses = []
2020
@endorsed_accounts = @account.endorsed_accounts.to_a.sample(4)
21+
@featured_hashtags = @account.featured_tags.order(statuses_count: :desc)
2122

2223
if current_account && @account.blocking?(current_account)
2324
@statuses = []

app/javascript/styles/mastodon/widgets.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@
109109
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
110110
}
111111

112+
.placeholder-widget {
113+
padding: 16px;
114+
border-radius: 4px;
115+
border: 2px dashed $dark-text-color;
116+
text-align: center;
117+
color: $darker-text-color;
118+
margin-bottom: 10px;
119+
}
120+
112121
.contact-widget,
113122
.landing-page__information.contact-widget {
114123
box-sizing: border-box;
@@ -526,6 +535,12 @@ $fluid-breakpoint: $maximum-width + 20px;
526535
a {
527536
font-size: 14px;
528537
line-height: 20px;
538+
}
539+
}
540+
541+
.notice-widget,
542+
.placeholder-widget {
543+
a {
529544
text-decoration: none;
530545
font-weight: 500;
531546
color: $ui-highlight-color;

app/views/accounts/show.html.haml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,33 @@
5656

5757
= render 'bio', account: @account
5858

59-
- unless @endorsed_accounts.empty?
59+
- if @endorsed_accounts.empty? && @account.id == current_account&.id
60+
.placeholder-widget= t('accounts.endorsements_hint')
61+
- elsif !@endorsed_accounts.empty?
6062
.endorsements-widget
6163
%h4= t 'accounts.choices_html', name: content_tag(:bdi, display_name(@account, custom_emojify: true))
6264

6365
- @endorsed_accounts.each do |account|
6466
= account_link_to account
6567

66-
- @account.featured_tags.order(statuses_count: :desc).each do |featured_tag|
67-
.directory__tag{ class: params[:tag] == featured_tag.name ? 'active' : nil }
68-
= link_to short_account_tag_path(@account, featured_tag.tag) do
69-
%h4
70-
= fa_icon 'hashtag'
71-
= featured_tag.name
72-
%small
73-
- if featured_tag.last_status_at.nil?
74-
= t('accounts.nothing_here')
75-
- else
76-
%time.formatted{ datetime: featured_tag.last_status_at.iso8601, title: l(featured_tag.last_status_at) }= l featured_tag.last_status_at
77-
.trends__item__current= number_to_human featured_tag.statuses_count, strip_insignificant_zeros: true
68+
- if @featured_hashtags.empty? && @account.id == current_account&.id
69+
.placeholder-widget
70+
= t('accounts.featured_tags_hint')
71+
= link_to settings_featured_tags_path do
72+
= t('featured_tags.add_new')
73+
= fa_icon 'chevron-right fw'
74+
- else
75+
- @featured_hashtags.each do |featured_tag|
76+
.directory__tag{ class: params[:tag] == featured_tag.name ? 'active' : nil }
77+
= link_to short_account_tag_path(@account, featured_tag.tag) do
78+
%h4
79+
= fa_icon 'hashtag'
80+
= featured_tag.name
81+
%small
82+
- if featured_tag.last_status_at.nil?
83+
= t('accounts.nothing_here')
84+
- else
85+
%time.formatted{ datetime: featured_tag.last_status_at.iso8601, title: l(featured_tag.last_status_at) }= l featured_tag.last_status_at
86+
.trends__item__current= number_to_human featured_tag.statuses_count, strip_insignificant_zeros: true
7887

7988
= render 'application/sidebar'

app/views/settings/featured_tags/index.html.haml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
- content_for :page_title do
22
= t('settings.featured_tags')
33

4+
%p= t('featured_tags.hint_html')
5+
6+
%hr.spacer/
7+
48
= simple_form_for @featured_tag, url: settings_featured_tags_path do |f|
59
= render 'shared/error_messages', object: @featured_tag
610

config/locales/en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ en:
4545
what_is_mastodon: What is Mastodon?
4646
accounts:
4747
choices_html: "%{name}'s choices:"
48+
endorsements_hint: You can endorse people you follow from the web interface, and they will show up here.
49+
featured_tags_hint: You can feature specific hashtags that will be displayed here.
4850
follow: Follow
4951
followers:
5052
one: Follower
@@ -664,6 +666,7 @@ en:
664666
add_new: Add new
665667
errors:
666668
limit: You have already featured the maximum amount of hashtags
669+
hint_html: "<strong>What are featured hashtags?</strong> They are displayed prominently on your public profile and allow people to browse your public posts specifically under those hashtags. They are a great tool for keeping track of creative works or long-term projects."
667670
filters:
668671
contexts:
669672
home: Home timeline

0 commit comments

Comments
 (0)