diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index c6809b215..3e4771dcf 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -79,6 +79,7 @@ class Settings::PreferencesController < Settings::BaseController :setting_disable_joke_appearance, :setting_new_features_policy, :setting_theme_instance_ticker, + :setting_hexagon_avatar, :setting_enable_status_reference, :setting_match_visibility_of_references, :setting_post_reference_modal, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b64fc6cb2..944006c2b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -144,6 +144,7 @@ module ApplicationHelper output << "theme-#{current_theme.parameterize}" output << 'system-font' if current_account&.user&.setting_system_font_ui output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion') + output << 'hexagon-avatar' if current_account&.user&.setting_hexagon_avatar output << 'rtl' if locale_direction == 'rtl' output.reject(&:blank?).join(' ') end diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss index fc5932aaf..9b4ec604f 100644 --- a/app/javascript/styles/application.scss +++ b/app/javascript/styles/application.scss @@ -27,3 +27,4 @@ @import 'mastodon/dashboard'; @import 'mastodon/rtl'; @import 'mastodon/accessibility'; +@import 'mastodon/hexagon_avatar'; diff --git a/app/javascript/styles/hexagon_avatar.scss b/app/javascript/styles/hexagon_avatar.scss new file mode 100644 index 000000000..e69de29bb diff --git a/app/javascript/styles/mastodon/hexagon_avatar.scss b/app/javascript/styles/mastodon/hexagon_avatar.scss new file mode 100644 index 000000000..07bd822e3 --- /dev/null +++ b/app/javascript/styles/mastodon/hexagon_avatar.scss @@ -0,0 +1,8 @@ +.hexagon-avatar { + .account__avatar, + .account__avatar-overlay-base, + .account__avatar-overlay-overlay { + -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20id%3D%22nft-hexagon-mask%22%20data-name%3D%22nft-hexagon-mask%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20400%22%3E%3Cpolygon%20points%3D%22300%2026.8%20100%2026.8%200%20200%20100%20373.2%20300%20373.2%20400%20200%20300%2026.8%22%2F%3E%3C%2Fsvg%3E"); + mask-image: url("data:image/svg+xml,%3Csvg%20id%3D%22nft-hexagon-mask%22%20data-name%3D%22nft-hexagon-mask%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20400%22%3E%3Cpolygon%20points%3D%22300%2026.8%20100%2026.8%200%20200%20100%20373.2%20300%20373.2%20400%20200%20300%2026.8%22%2F%3E%3C%2Fsvg%3E"); + } +} diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index 4e35e124d..eda5470a2 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -78,6 +78,7 @@ class UserSettingsDecorator user.settings['theme_instance_ticker'] = theme_instance_ticker if change?('setting_theme_instance_ticker') user.settings['enable_status_reference'] = enable_status_reference_preference if change?('setting_enable_status_reference') user.settings['match_visibility_of_references'] = match_visibility_of_references_preference if change?('setting_match_visibility_of_references') + user.settings['hexagon_avatar'] = hexagon_avatar_preference if change?('setting_hexagon_avatar') end def merged_notification_emails @@ -268,6 +269,10 @@ end settings['setting_theme_instance_ticker'] end + def hexagon_avatar_preference + boolean_cast_setting 'setting_hexagon_avatar' + end + def enable_status_reference_preference boolean_cast_setting 'setting_enable_status_reference' end diff --git a/app/models/user.rb b/app/models/user.rb index 84f359646..9010bde77 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -136,6 +136,7 @@ class User < ApplicationRecord :theme_instance_ticker, :enable_status_reference, :match_visibility_of_references, :post_reference_modal, :add_reference_modal, :unselect_reference_modal, + :hexagon_avatar, to: :settings, prefix: :setting, allow_nil: false diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml index 8a486277e..17acecb9b 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -21,6 +21,9 @@ .fields-row__column.fields-row__column-6 = f.input :setting_theme_instance_ticker, collection: ['none', 'type-0', 'type-1', 'type-2', 'type-3'], label_method: lambda { |item| t("simple_form.hints.defaults.setting_theme_instance_ticker_#{item}") }, wrapper: :with_label, include_blank: false, hint: t('simple_form.hints.defaults.setting_theme_instance_ticker_html'), fedibird_features: true + .fields-group + = f.input :setting_hexagon_avatar, as: :boolean, wrapper: :with_label, hint: true, fedibird_features: true + %h4= t 'appearance.advanced_web_interface' %p.hint= t 'appearance.advanced_web_interface_hint' diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 998dba9d4..ec2fc9bac 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -62,6 +62,7 @@ en: setting_enable_reaction: Enable the reaction display on the timeline and display the reaction button setting_enable_status_reference: Enable the feature where a post references another post setting_follow_button_to_list_adder: Change the behavior of the Follow / Subscribe button, open a dialog where you can select a list to follow / subscribe, or opt out of receiving at home + setting_hexagon_avatar: Display everyone's avatar icon as a hollowed out hexagon (joke feature) setting_hide_followers_count: The number of followers will be hidden in your profile setting_hide_following_count: The number of following will be hidden in your profile setting_hide_network: Who you follow and who follows you will be hidden on your profile @@ -218,6 +219,7 @@ en: setting_enable_status_reference: Enable reference setting_expand_spoilers: Always expand posts marked with content warnings setting_follow_button_to_list_adder: Open list add dialog with follow button + setting_hexagon_avatar: Experience NFT Avatar setting_hide_followers_count: Hide your followers count setting_hide_following_count: Hide your following count setting_hide_network: Hide your social graph diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 7f218fe71..86c1d6908 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -62,6 +62,7 @@ ja: setting_enable_reaction: タイムラインでリアクションの表示を有効にし、リアクションボタンを表示する setting_enable_status_reference: 投稿が別の投稿を参照する機能を有効にします setting_follow_button_to_list_adder: フォロー・購読ボタンの動作を変更し、フォロー・購読するリストを選択したり、ホームで受け取らないよう設定するダイアログを開きます + setting_hexagon_avatar: 全員のアバターアイコンを6角形にくりぬいて表示します(ジョーク機能) setting_hide_followers_count: フォロワー数をプロフィールページで見られないようにします setting_hide_following_count: フォロー数をプロフィールページで見られないようにします setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします @@ -218,6 +219,7 @@ ja: setting_enable_status_reference: 参照を有効にする setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する setting_follow_button_to_list_adder: フォローボタンでリスト追加ダイアログを開く + setting_hexagon_avatar: NFTアイコンを体験する setting_hide_followers_count: フォロワー数を隠す setting_hide_following_count: フォロー数を隠す setting_hide_network: 繋がりを隠す diff --git a/config/settings.yml b/config/settings.yml index 705d77a64..18888f656 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -96,6 +96,7 @@ defaults: &defaults post_reference_modal: false add_reference_modal: true unselect_reference_modal: false + hexagon_avatar: false development: <<: *defaults