diff options
author | kibigo! <marrus-sh@users.noreply.github.com> | 2017-11-17 19:11:18 -0800 |
---|---|---|
committer | kibigo! <marrus-sh@users.noreply.github.com> | 2017-11-17 19:29:16 -0800 |
commit | 45c44989c8fb6e24badd18bb83ac5f68de0aceaf (patch) | |
tree | 794d088986d8518506e3e1eec0c8ffb7da5604b8 /app | |
parent | 5a9982b425d3db65d813eb0314a27cea16f0f52d (diff) |
Forking glitch theme
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/glitch/actions/local_settings.js | 93 | ||||
-rw-r--r-- | app/javascript/glitch/components/account/header.js | 227 | ||||
-rw-r--r-- | app/javascript/glitch/components/compose/advanced_options/container.js | 66 | ||||
-rw-r--r-- | app/javascript/glitch/components/compose/advanced_options/index.js | 163 | ||||
-rw-r--r-- | app/javascript/glitch/components/compose/advanced_options/toggle.js | 103 | ||||
-rw-r--r-- | app/javascript/glitch/components/local_settings/container.js | 24 | ||||
-rw-r--r-- | app/javascript/glitch/components/notification/container.js | 48 | ||||
-rw-r--r-- | app/javascript/glitch/components/notification/follow.js | 72 | ||||
-rw-r--r-- | app/javascript/glitch/components/notification/overlay/container.js | 49 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/action_bar.js | 187 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/container.js | 263 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/gallery/index.js | 79 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/gallery/item.js | 158 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/index.js | 760 | ||||
-rw-r--r-- | app/javascript/glitch/components/status/player.js | 203 | ||||
-rw-r--r-- | app/javascript/glitch/reducers/local_settings.js | 126 | ||||
-rw-r--r-- | app/javascript/mastodon/components/status.js | 249 | ||||
-rw-r--r-- | app/javascript/mastodon/components/status_content.js | 188 | ||||
-rw-r--r-- | app/javascript/mastodon/features/account/components/header.js | 131 | ||||
-rw-r--r-- | app/javascript/mastodon/features/notifications/components/notification.js | 155 | ||||
-rw-r--r-- | app/javascript/mastodon/features/standalone/compose/index.js | 20 | ||||
-rw-r--r-- | app/javascript/mastodon/features/ui/util/async-components.js | 118 | ||||
-rw-r--r-- | app/javascript/mastodon/test_setup.js | 5 | ||||
-rw-r--r-- | app/javascript/packs/about.js | 6 | ||||
-rw-r--r-- | app/javascript/packs/application.js | 4 | ||||
-rw-r--r-- | app/javascript/packs/common.js | 3 | ||||
-rw-r--r-- | app/javascript/packs/public.js | 16 | ||||
-rw-r--r-- | app/javascript/packs/share.js | 6 | ||||
-rw-r--r-- | app/javascript/styles/application.scss | 23 | ||||
-rw-r--r-- | app/javascript/styles/variables-glitch.scss | 3 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/accounts.js (renamed from app/javascript/mastodon/actions/accounts.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/alerts.js (renamed from app/javascript/mastodon/actions/alerts.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/blocks.js (renamed from app/javascript/mastodon/actions/blocks.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/bundles.js (renamed from app/javascript/mastodon/actions/bundles.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/cards.js (renamed from app/javascript/mastodon/actions/cards.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/columns.js (renamed from app/javascript/mastodon/actions/columns.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/compose.js (renamed from app/javascript/mastodon/actions/compose.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/domain_blocks.js (renamed from app/javascript/mastodon/actions/domain_blocks.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/emojis.js (renamed from app/javascript/mastodon/actions/emojis.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/favourites.js (renamed from app/javascript/mastodon/actions/favourites.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/height_cache.js (renamed from app/javascript/mastodon/actions/height_cache.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/interactions.js (renamed from app/javascript/mastodon/actions/interactions.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/local_settings.js | 24 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/modal.js (renamed from app/javascript/mastodon/actions/modal.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/mutes.js (renamed from app/javascript/mastodon/actions/mutes.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/notifications.js (renamed from app/javascript/mastodon/actions/notifications.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/onboarding.js (renamed from app/javascript/mastodon/actions/onboarding.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/pin_statuses.js (renamed from app/javascript/mastodon/actions/pin_statuses.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/push_notifications.js (renamed from app/javascript/mastodon/actions/push_notifications.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/reports.js (renamed from app/javascript/mastodon/actions/reports.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/search.js (renamed from app/javascript/mastodon/actions/search.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/settings.js (renamed from app/javascript/mastodon/actions/settings.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/statuses.js (renamed from app/javascript/mastodon/actions/statuses.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/store.js (renamed from app/javascript/mastodon/actions/store.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/streaming.js (renamed from app/javascript/mastodon/actions/streaming.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/actions/timelines.js (renamed from app/javascript/mastodon/actions/timelines.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar-test.js.snap (renamed from app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar_overlay-test.js.snap (renamed from app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/__snapshots__/button-test.js.snap (renamed from app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/__snapshots__/display_name-test.js.snap (renamed from app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/avatar-test.js (renamed from app/javascript/mastodon/components/__tests__/avatar-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/avatar_overlay-test.js (renamed from app/javascript/mastodon/components/__tests__/avatar_overlay-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/button-test.js (renamed from app/javascript/mastodon/components/__tests__/button-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/__tests__/display_name-test.js (renamed from app/javascript/mastodon/components/__tests__/display_name-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/account.js (renamed from app/javascript/mastodon/components/account.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/attachment_list.js (renamed from app/javascript/mastodon/components/attachment_list.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/autosuggest_emoji.js (renamed from app/javascript/mastodon/components/autosuggest_emoji.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/autosuggest_textarea.js (renamed from app/javascript/mastodon/components/autosuggest_textarea.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/avatar.js (renamed from app/javascript/mastodon/components/avatar.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/avatar_overlay.js (renamed from app/javascript/mastodon/components/avatar_overlay.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/button.js (renamed from app/javascript/mastodon/components/button.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/collapsable.js (renamed from app/javascript/mastodon/components/collapsable.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/column.js (renamed from app/javascript/mastodon/components/column.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/column_back_button.js (renamed from app/javascript/mastodon/components/column_back_button.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/column_back_button_slim.js (renamed from app/javascript/mastodon/components/column_back_button_slim.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/column_header.js (renamed from app/javascript/mastodon/components/column_header.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/display_name.js (renamed from app/javascript/mastodon/components/display_name.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/dropdown_menu.js (renamed from app/javascript/mastodon/components/dropdown_menu.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/extended_video_player.js (renamed from app/javascript/mastodon/components/extended_video_player.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/icon_button.js (renamed from app/javascript/mastodon/components/icon_button.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/intersection_observer_article.js (renamed from app/javascript/mastodon/components/intersection_observer_article.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/load_more.js (renamed from app/javascript/mastodon/components/load_more.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/loading_indicator.js (renamed from app/javascript/mastodon/components/loading_indicator.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/media_gallery.js (renamed from app/javascript/mastodon/components/media_gallery.js) | 51 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/missing_indicator.js (renamed from app/javascript/mastodon/components/missing_indicator.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/notification_purge_buttons.js (renamed from app/javascript/glitch/components/column/notif_cleaning_widget/notification_purge_buttons.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/permalink.js (renamed from app/javascript/mastodon/components/permalink.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/relative_timestamp.js (renamed from app/javascript/mastodon/components/relative_timestamp.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/scrollable_list.js (renamed from app/javascript/mastodon/components/scrollable_list.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/setting_text.js (renamed from app/javascript/mastodon/components/setting_text.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status.js | 436 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_action_bar.js (renamed from app/javascript/mastodon/components/status_action_bar.js) | 13 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_content.js (renamed from app/javascript/glitch/components/status/content.js) | 44 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_header.js (renamed from app/javascript/glitch/components/status/header.js) | 36 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_list.js (renamed from app/javascript/mastodon/components/status_list.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_prepend.js (renamed from app/javascript/glitch/components/status/prepend.js) | 76 | ||||
-rw-r--r-- | app/javascript/themes/glitch/components/status_visibility_icon.js (renamed from app/javascript/glitch/components/status/visibility_icon.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/account_container.js (renamed from app/javascript/mastodon/containers/account_container.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/card_container.js (renamed from app/javascript/mastodon/containers/card_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/compose_container.js (renamed from app/javascript/mastodon/containers/compose_container.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/dropdown_menu_container.js (renamed from app/javascript/mastodon/containers/dropdown_menu_container.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/intersection_observer_article_container.js (renamed from app/javascript/mastodon/containers/intersection_observer_article_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/mastodon.js (renamed from app/javascript/mastodon/containers/mastodon.js) | 14 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/media_gallery_container.js (renamed from app/javascript/mastodon/containers/media_gallery_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/notification_purge_buttons_container.js (renamed from app/javascript/glitch/components/column/notif_cleaning_widget/container.js) | 43 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/status_container.js (renamed from app/javascript/mastodon/containers/status_container.js) | 46 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/timeline_container.js (renamed from app/javascript/mastodon/containers/timeline_container.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/containers/video_container.js (renamed from app/javascript/mastodon/containers/video_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account/components/action_bar.js (renamed from app/javascript/mastodon/features/account/components/action_bar.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account/components/header.js | 99 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account_gallery/components/media_item.js (renamed from app/javascript/mastodon/features/account_gallery/components/media_item.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account_gallery/index.js (renamed from app/javascript/mastodon/features/account_gallery/index.js) | 16 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account_timeline/components/header.js (renamed from app/javascript/mastodon/features/account_timeline/components/header.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account_timeline/containers/header_container.js (renamed from app/javascript/mastodon/features/account_timeline/containers/header_container.js) | 16 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/account_timeline/index.js (renamed from app/javascript/mastodon/features/account_timeline/index.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/blocks/index.js (renamed from app/javascript/mastodon/features/blocks/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/community_timeline/components/column_settings.js (renamed from app/javascript/mastodon/features/community_timeline/components/column_settings.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/community_timeline/containers/column_settings_container.js (renamed from app/javascript/mastodon/features/community_timeline/containers/column_settings_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/community_timeline/index.js (renamed from app/javascript/mastodon/features/community_timeline/index.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/advanced_options.js | 62 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/advanced_options_toggle.js | 35 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/attach_options.js (renamed from app/javascript/glitch/components/compose/attach_options/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/autosuggest_account.js (renamed from app/javascript/mastodon/features/compose/components/autosuggest_account.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/character_counter.js (renamed from app/javascript/mastodon/features/compose/components/character_counter.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/compose_form.js (renamed from app/javascript/mastodon/features/compose/components/compose_form.js) | 16 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/dropdown.js (renamed from app/javascript/glitch/components/compose/dropdown/index.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/emoji_picker_dropdown.js (renamed from app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/navigation_bar.js (renamed from app/javascript/mastodon/features/compose/components/navigation_bar.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/privacy_dropdown.js (renamed from app/javascript/mastodon/features/compose/components/privacy_dropdown.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/reply_indicator.js (renamed from app/javascript/mastodon/features/compose/components/reply_indicator.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/search.js (renamed from app/javascript/mastodon/features/compose/components/search.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/search_results.js (renamed from app/javascript/mastodon/features/compose/components/search_results.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/text_icon_button.js (renamed from app/javascript/mastodon/features/compose/components/text_icon_button.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/upload.js (renamed from app/javascript/mastodon/features/compose/components/upload.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/upload_button.js (renamed from app/javascript/mastodon/features/compose/components/upload_button.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/upload_form.js (renamed from app/javascript/mastodon/features/compose/components/upload_form.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/upload_progress.js (renamed from app/javascript/mastodon/features/compose/components/upload_progress.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/components/warning.js (renamed from app/javascript/mastodon/features/compose/components/warning.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/advanced_options_container.js | 20 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/autosuggest_account_container.js (renamed from app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/compose_form_container.js (renamed from app/javascript/mastodon/features/compose/containers/compose_form_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/emoji_picker_dropdown_container.js (renamed from app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/navigation_container.js (renamed from app/javascript/mastodon/features/compose/containers/navigation_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/privacy_dropdown_container.js (renamed from app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/reply_indicator_container.js (renamed from app/javascript/mastodon/features/compose/containers/reply_indicator_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/search_container.js (renamed from app/javascript/mastodon/features/compose/containers/search_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/search_results_container.js (renamed from app/javascript/mastodon/features/compose/containers/search_results_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/sensitive_button_container.js (renamed from app/javascript/mastodon/features/compose/containers/sensitive_button_container.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/spoiler_button_container.js (renamed from app/javascript/mastodon/features/compose/containers/spoiler_button_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/upload_button_container.js (renamed from app/javascript/mastodon/features/compose/containers/upload_button_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/upload_container.js (renamed from app/javascript/mastodon/features/compose/containers/upload_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/upload_form_container.js (renamed from app/javascript/mastodon/features/compose/containers/upload_form_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/upload_progress_container.js (renamed from app/javascript/mastodon/features/compose/containers/upload_progress_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/containers/warning_container.js (renamed from app/javascript/mastodon/features/compose/containers/warning_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/compose/index.js (renamed from app/javascript/mastodon/features/compose/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/direct_timeline/containers/column_settings_container.js (renamed from app/javascript/mastodon/features/direct_timeline/containers/column_settings_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/direct_timeline/index.js (renamed from app/javascript/mastodon/features/direct_timeline/index.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/favourited_statuses/index.js (renamed from app/javascript/mastodon/features/favourited_statuses/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/favourites/index.js (renamed from app/javascript/mastodon/features/favourites/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/follow_requests/components/account_authorize.js (renamed from app/javascript/mastodon/features/follow_requests/components/account_authorize.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/follow_requests/containers/account_authorize_container.js (renamed from app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/follow_requests/index.js (renamed from app/javascript/mastodon/features/follow_requests/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/followers/index.js (renamed from app/javascript/mastodon/features/followers/index.js) | 14 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/following/index.js (renamed from app/javascript/mastodon/features/following/index.js) | 14 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/generic_not_found/index.js (renamed from app/javascript/mastodon/features/generic_not_found/index.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/getting_started/index.js (renamed from app/javascript/mastodon/features/getting_started/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/hashtag_timeline/index.js (renamed from app/javascript/mastodon/features/hashtag_timeline/index.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/home_timeline/components/column_settings.js (renamed from app/javascript/mastodon/features/home_timeline/components/column_settings.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/home_timeline/containers/column_settings_container.js (renamed from app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/home_timeline/index.js (renamed from app/javascript/mastodon/features/home_timeline/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/index.js (renamed from app/javascript/glitch/components/local_settings/index.js) | 22 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/navigation/index.js (renamed from app/javascript/glitch/components/local_settings/navigation/index.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/navigation/item/index.js (renamed from app/javascript/glitch/components/local_settings/navigation/item/index.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/navigation/item/style.scss (renamed from app/javascript/glitch/components/local_settings/navigation/item/style.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/navigation/style.scss (renamed from app/javascript/glitch/components/local_settings/navigation/style.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/page/index.js (renamed from app/javascript/glitch/components/local_settings/page/index.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/page/item/index.js (renamed from app/javascript/glitch/components/local_settings/page/item/index.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/page/item/style.scss (renamed from app/javascript/glitch/components/local_settings/page/item/style.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/page/style.scss (renamed from app/javascript/glitch/components/local_settings/page/style.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/local_settings/style.scss (renamed from app/javascript/glitch/components/local_settings/style.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/mutes/index.js (renamed from app/javascript/mastodon/features/mutes/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/clear_column_button.js (renamed from app/javascript/mastodon/features/notifications/components/clear_column_button.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/column_settings.js (renamed from app/javascript/mastodon/features/notifications/components/column_settings.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/follow.js | 97 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/notification.js (renamed from app/javascript/glitch/components/notification/index.js) | 38 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/overlay.js (renamed from app/javascript/glitch/components/notification/overlay/notification_overlay.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/components/setting_toggle.js (renamed from app/javascript/mastodon/features/notifications/components/setting_toggle.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/containers/column_settings_container.js (renamed from app/javascript/mastodon/features/notifications/containers/column_settings_container.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/containers/notification_container.js (renamed from app/javascript/mastodon/features/notifications/containers/notification_container.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/containers/overlay_container.js | 18 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/notifications/index.js (renamed from app/javascript/mastodon/features/notifications/index.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/pinned_statuses/index.js (renamed from app/javascript/mastodon/features/pinned_statuses/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/public_timeline/containers/column_settings_container.js (renamed from app/javascript/mastodon/features/public_timeline/containers/column_settings_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/public_timeline/index.js (renamed from app/javascript/mastodon/features/public_timeline/index.js) | 12 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/reblogs/index.js (renamed from app/javascript/mastodon/features/reblogs/index.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/report/components/status_check_box.js (renamed from app/javascript/mastodon/features/report/components/status_check_box.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/report/containers/status_check_box_container.js (renamed from app/javascript/mastodon/features/report/containers/status_check_box_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/standalone/compose/index.js | 20 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/standalone/hashtag_timeline/index.js (renamed from app/javascript/mastodon/features/standalone/hashtag_timeline/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/standalone/public_timeline/index.js (renamed from app/javascript/mastodon/features/standalone/public_timeline/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/status/components/action_bar.js (renamed from app/javascript/mastodon/features/status/components/action_bar.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/status/components/card.js (renamed from app/javascript/mastodon/features/status/components/card.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/status/components/detailed_status.js (renamed from app/javascript/mastodon/features/status/components/detailed_status.js) | 20 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/status/containers/card_container.js (renamed from app/javascript/mastodon/features/status/containers/card_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/status/index.js (renamed from app/javascript/mastodon/features/status/index.js) | 26 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/__tests__/column-test.js (renamed from app/javascript/mastodon/features/ui/components/__tests__/column-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/actions_modal.js (renamed from app/javascript/mastodon/features/ui/components/actions_modal.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/boost_modal.js (renamed from app/javascript/mastodon/features/ui/components/boost_modal.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/bundle.js (renamed from app/javascript/mastodon/features/ui/components/bundle.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/bundle_column_error.js (renamed from app/javascript/mastodon/features/ui/components/bundle_column_error.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/bundle_modal_error.js (renamed from app/javascript/mastodon/features/ui/components/bundle_modal_error.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/column.js (renamed from app/javascript/mastodon/features/ui/components/column.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/column_header.js (renamed from app/javascript/mastodon/features/ui/components/column_header.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/column_link.js (renamed from app/javascript/mastodon/features/ui/components/column_link.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/column_loading.js (renamed from app/javascript/mastodon/features/ui/components/column_loading.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/column_subheading.js (renamed from app/javascript/mastodon/features/ui/components/column_subheading.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/columns_area.js (renamed from app/javascript/mastodon/features/ui/components/columns_area.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/confirmation_modal.js (renamed from app/javascript/mastodon/features/ui/components/confirmation_modal.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/doodle_modal.js (renamed from app/javascript/mastodon/features/ui/components/doodle_modal.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/drawer_loading.js (renamed from app/javascript/mastodon/features/ui/components/drawer_loading.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/embed_modal.js (renamed from app/javascript/mastodon/features/ui/components/embed_modal.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/image_loader.js (renamed from app/javascript/mastodon/features/ui/components/image_loader.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/media_modal.js (renamed from app/javascript/mastodon/features/ui/components/media_modal.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/modal_loading.js (renamed from app/javascript/mastodon/features/ui/components/modal_loading.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/modal_root.js (renamed from app/javascript/mastodon/features/ui/components/modal_root.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/mute_modal.js (renamed from app/javascript/mastodon/features/ui/components/mute_modal.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/onboarding_modal.js (renamed from app/javascript/mastodon/features/ui/components/onboarding_modal.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/report_modal.js (renamed from app/javascript/mastodon/features/ui/components/report_modal.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/tabs_bar.js (renamed from app/javascript/mastodon/features/ui/components/tabs_bar.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/upload_area.js (renamed from app/javascript/mastodon/features/ui/components/upload_area.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/components/video_modal.js (renamed from app/javascript/mastodon/features/ui/components/video_modal.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/bundle_container.js (renamed from app/javascript/mastodon/features/ui/containers/bundle_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/columns_area_container.js (renamed from app/javascript/mastodon/features/ui/containers/columns_area_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/loading_bar_container.js (renamed from app/javascript/mastodon/features/ui/containers/loading_bar_container.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/modal_container.js (renamed from app/javascript/mastodon/features/ui/containers/modal_container.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/notifications_container.js (renamed from app/javascript/mastodon/features/ui/containers/notifications_container.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/containers/status_list_container.js (renamed from app/javascript/mastodon/features/ui/containers/status_list_container.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/ui/index.js (renamed from app/javascript/mastodon/features/ui/index.js) | 16 | ||||
-rw-r--r-- | app/javascript/themes/glitch/features/video/index.js (renamed from app/javascript/mastodon/features/video/index.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/index.js | 14 | ||||
-rw-r--r-- | app/javascript/themes/glitch/middleware/errors.js (renamed from app/javascript/mastodon/middleware/errors.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/middleware/loading_bar.js (renamed from app/javascript/mastodon/middleware/loading_bar.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/middleware/sounds.js (renamed from app/javascript/mastodon/middleware/sounds.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/accounts.js (renamed from app/javascript/mastodon/reducers/accounts.js) | 24 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/accounts_counters.js (renamed from app/javascript/mastodon/reducers/accounts_counters.js) | 26 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/alerts.js (renamed from app/javascript/mastodon/reducers/alerts.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/cards.js (renamed from app/javascript/mastodon/reducers/cards.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/compose.js (renamed from app/javascript/mastodon/reducers/compose.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/contexts.js (renamed from app/javascript/mastodon/reducers/contexts.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/custom_emojis.js (renamed from app/javascript/mastodon/reducers/custom_emojis.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/height_cache.js (renamed from app/javascript/mastodon/reducers/height_cache.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/index.js (renamed from app/javascript/mastodon/reducers/index.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/local_settings.js | 45 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/media_attachments.js (renamed from app/javascript/mastodon/reducers/media_attachments.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/meta.js (renamed from app/javascript/mastodon/reducers/meta.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/modal.js (renamed from app/javascript/mastodon/reducers/modal.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/mutes.js (renamed from app/javascript/mastodon/reducers/mutes.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/notifications.js (renamed from app/javascript/mastodon/reducers/notifications.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/push_notifications.js (renamed from app/javascript/mastodon/reducers/push_notifications.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/relationships.js (renamed from app/javascript/mastodon/reducers/relationships.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/reports.js (renamed from app/javascript/mastodon/reducers/reports.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/search.js (renamed from app/javascript/mastodon/reducers/search.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/settings.js (renamed from app/javascript/mastodon/reducers/settings.js) | 10 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/status_lists.js (renamed from app/javascript/mastodon/reducers/status_lists.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/statuses.js (renamed from app/javascript/mastodon/reducers/statuses.js) | 18 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/timelines.js (renamed from app/javascript/mastodon/reducers/timelines.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/glitch/reducers/user_lists.js (renamed from app/javascript/mastodon/reducers/user_lists.js) | 8 | ||||
-rw-r--r-- | app/javascript/themes/glitch/selectors/index.js (renamed from app/javascript/mastodon/selectors/index.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/service_worker/entry.js (renamed from app/javascript/mastodon/service_worker/entry.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/service_worker/web_push_notifications.js (renamed from app/javascript/mastodon/service_worker/web_push_notifications.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/store/configureStore.js (renamed from app/javascript/mastodon/store/configureStore.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/_mixins.scss (renamed from app/javascript/styles/mastodon/_mixins.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/about.scss (renamed from app/javascript/styles/mastodon/about.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/accounts.scss (renamed from app/javascript/styles/mastodon/accounts.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/admin.scss (renamed from app/javascript/styles/mastodon/admin.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/basics.scss (renamed from app/javascript/styles/mastodon/basics.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/boost.scss (renamed from app/javascript/styles/mastodon/boost.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/compact_header.scss (renamed from app/javascript/styles/mastodon/compact_header.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/components.scss (renamed from app/javascript/styles/mastodon/components.scss) | 1 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/containers.scss (renamed from app/javascript/styles/mastodon/containers.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/doodle.scss (renamed from app/javascript/styles/doodle.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/emoji_picker.scss (renamed from app/javascript/styles/mastodon/emoji_picker.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/footer.scss (renamed from app/javascript/styles/mastodon/footer.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/forms.scss (renamed from app/javascript/styles/mastodon/forms.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/index.scss | 22 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/landing_strip.scss (renamed from app/javascript/styles/mastodon/landing_strip.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/lists.scss (renamed from app/javascript/styles/mastodon/lists.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/reset copy.scss (renamed from app/javascript/styles/mastodon/reset.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/reset.scss | 91 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/rtl.scss (renamed from app/javascript/styles/mastodon/rtl.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/stream_entries.scss (renamed from app/javascript/styles/mastodon/stream_entries.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/tables.scss (renamed from app/javascript/styles/mastodon/tables.scss) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/styles/variables.scss (renamed from app/javascript/styles/mastodon/variables.scss) | 3 | ||||
-rw-r--r-- | app/javascript/themes/glitch/theme.yml | 18 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/api.js (renamed from app/javascript/mastodon/api.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/async-components.js | 115 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/base_polyfills.js (renamed from app/javascript/mastodon/base_polyfills.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/bio_metadata.js (renamed from app/javascript/glitch/util/bio_metadata.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/counter.js (renamed from app/javascript/mastodon/features/compose/util/counter.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/__tests__/emoji-test.js (renamed from app/javascript/mastodon/features/emoji/__tests__/emoji-test.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/__tests__/emoji_index-test.js (renamed from app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_compressed.js (renamed from app/javascript/mastodon/features/emoji/emoji_compressed.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_map.json (renamed from app/javascript/mastodon/features/emoji/emoji_map.json) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_mart_data_light.js (renamed from app/javascript/mastodon/features/emoji/emoji_mart_data_light.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_mart_search_light.js (renamed from app/javascript/mastodon/features/emoji/emoji_mart_search_light.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_picker.js (renamed from app/javascript/mastodon/features/emoji/emoji_picker.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_unicode_mapping_light.js (renamed from app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/emoji_utils.js (renamed from app/javascript/mastodon/features/emoji/emoji_utils.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/index.js (renamed from app/javascript/mastodon/features/emoji/emoji.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/unicode_to_filename.js (renamed from app/javascript/mastodon/features/emoji/unicode_to_filename.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/emoji/unicode_to_unified_name.js (renamed from app/javascript/mastodon/features/emoji/unicode_to_unified_name.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/extra_polyfills.js (renamed from app/javascript/mastodon/extra_polyfills.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/fullscreen.js (renamed from app/javascript/mastodon/features/ui/util/fullscreen.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/get_rect_from_entry.js (renamed from app/javascript/mastodon/features/ui/util/get_rect_from_entry.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/initial_state.js (renamed from app/javascript/mastodon/initial_state.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/intersection_observer_wrapper.js (renamed from app/javascript/mastodon/features/ui/util/intersection_observer_wrapper.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/is_mobile.js (renamed from app/javascript/mastodon/is_mobile.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/link_header.js (renamed from app/javascript/mastodon/link_header.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/load_polyfills.js (renamed from app/javascript/mastodon/load_polyfills.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/main.js (renamed from app/javascript/mastodon/main.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/optional_motion.js (renamed from app/javascript/mastodon/features/ui/util/optional_motion.js) | 2 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/performance.js (renamed from app/javascript/mastodon/performance.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/react_router_helpers.js (renamed from app/javascript/mastodon/features/ui/util/react_router_helpers.js) | 6 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/ready.js (renamed from app/javascript/mastodon/ready.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/reduced_motion.js (renamed from app/javascript/mastodon/features/ui/util/reduced_motion.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/rtl.js (renamed from app/javascript/mastodon/rtl.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/schedule_idle_task.js (renamed from app/javascript/mastodon/features/ui/util/schedule_idle_task.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/scroll.js (renamed from app/javascript/mastodon/scroll.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/stream.js (renamed from app/javascript/mastodon/stream.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/url_regex.js (renamed from app/javascript/mastodon/features/compose/util/url_regex.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/uuid.js (renamed from app/javascript/mastodon/uuid.js) | 0 | ||||
-rw-r--r-- | app/javascript/themes/glitch/util/web_push_subscription.js (renamed from app/javascript/mastodon/web_push_subscription.js) | 4 | ||||
-rw-r--r-- | app/javascript/themes/vanilla/theme.yml (renamed from app/javascript/themes/default/theme.yml) | 2 |
333 files changed, 1714 insertions, 4235 deletions
diff --git a/app/javascript/glitch/actions/local_settings.js b/app/javascript/glitch/actions/local_settings.js deleted file mode 100644 index 93c5a9a17..000000000 --- a/app/javascript/glitch/actions/local_settings.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - -`actions/local_settings` -======================== - -> For more information on the contents of this file, please contact: -> -> - kibigo! [@kibi@glitch.social] - -This file provides our Redux actions related to local settings. It -consists of the following: - - - __`changesLocalSetting(key, value)` :__ - Changes the local setting with the given `key` to the given - `value`. `key` **MUST** be an array of strings, as required by - `Immutable.Map.prototype.getIn()`. - - - __`saveLocalSettings()` :__ - Saves the local settings to `localStorage` as a JSON object. We - shouldn't ever need to call this ourselves. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Constants: ----------- - -We provide the following constants: - - - __`LOCAL_SETTING_CHANGE` :__ - This string constant is used to dispatch a setting change to our - reducer in `reducers/local_settings`, where the setting is - actually changed. - -*/ - -export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -`changeLocalSetting(key, value)`: ---------------------------------- - -Changes the local setting with the given `key` to the given `value`. -`key` **MUST** be an array of strings, as required by -`Immutable.Map.prototype.getIn()`. - -To accomplish this, we just dispatch a `LOCAL_SETTING_CHANGE` to our -reducer in `reducers/local_settings`. - -*/ - -export function changeLocalSetting(key, value) { - return dispatch => { - dispatch({ - type: LOCAL_SETTING_CHANGE, - key, - value, - }); - - dispatch(saveLocalSettings()); - }; -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -`saveLocalSettings()`: ----------------------- - -Saves the local settings to `localStorage` as a JSON object. -`changeLocalSetting()` calls this whenever it changes a setting. We -shouldn't ever need to call this ourselves. - -> __TODO :__ -> Right now `saveLocalSettings()` doesn't keep track of which user -> is currently signed in, but it might be better to give each user -> their *own* local settings. - -*/ - -export function saveLocalSettings() { - return (_, getState) => { - const localSettings = getState().get('local_settings').toJS(); - localStorage.setItem('mastodon-settings', JSON.stringify(localSettings)); - }; -}; diff --git a/app/javascript/glitch/components/account/header.js b/app/javascript/glitch/components/account/header.js deleted file mode 100644 index 7bc1a2189..000000000 --- a/app/javascript/glitch/components/account/header.js +++ /dev/null @@ -1,227 +0,0 @@ -/* - -`<AccountHeader>` -================= - -> For more information on the contents of this file, please contact: -> -> - kibigo! [@kibi@glitch.social] - -Original file by @gargron@mastodon.social et al as part of -tootsuite/mastodon. We've expanded it in order to handle user bio -frontmatter. - -The `<AccountHeader>` component provides the header for account -timelines. It is a fairly simple component which mostly just consists -of a `render()` method. - -__Props:__ - - - __`account` (`ImmutablePropTypes.map`) :__ - The account to render a header for. - - - __`me` (`PropTypes.number.isRequired`) :__ - The id of the currently-signed-in account. - - - __`onFollow` (`PropTypes.func.isRequired`) :__ - The function to call when the user clicks the "follow" button. - - - __`intl` (`PropTypes.object.isRequired`) :__ - Our internationalization object, inserted by `@injectIntl`. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -// Mastodon imports // -import emojify from '../../../mastodon/features/emoji/emoji'; -import IconButton from '../../../mastodon/components/icon_button'; -import Avatar from '../../../mastodon/components/avatar'; -import { me } from '../../../mastodon/initial_state'; - -// Our imports // -import { processBio } from '../../util/bio_metadata'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Inital setup: -------------- - -The `messages` constant is used to define any messages that we need -from inside props. In our case, these are the `unfollow`, `follow`, and -`requested` messages used in the `title` of our buttons. - -*/ - -const messages = defineMessages({ - unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, - follow: { id: 'account.follow', defaultMessage: 'Follow' }, - requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' }, -}); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Implementation: ---------------- - -*/ - -@injectIntl -export default class AccountHeader extends ImmutablePureComponent { - - static propTypes = { - account : ImmutablePropTypes.map, - onFollow : PropTypes.func.isRequired, - intl : PropTypes.object.isRequired, - }; - -/* - -### `render()` - -The `render()` function is used to render our component. - -*/ - - render () { - const { account, intl } = this.props; - -/* - -If no `account` is provided, then we can't render a header. Otherwise, -we get the `displayName` for the account, if available. If it's blank, -then we set the `displayName` to just be the `username` of the account. - -*/ - - if (!account) { - return null; - } - - let displayName = account.get('display_name_html'); - let info = ''; - let actionBtn = ''; - let following = false; - -/* - -Next, we handle the account relationships. If the account follows the -user, then we add an `info` message. If the user has requested a -follow, then we disable the `actionBtn` and display an hourglass. -Otherwise, if the account isn't blocked, we set the `actionBtn` to the -appropriate icon. - -*/ - - if (me !== account.get('id')) { - if (account.getIn(['relationship', 'followed_by'])) { - info = ( - <span className='account--follows-info'> - <FormattedMessage id='account.follows_you' defaultMessage='Follows you' /> - </span> - ); - } - if (account.getIn(['relationship', 'requested'])) { - actionBtn = ( - <div className='account--action-button'> - <IconButton size={26} disabled icon='hourglass' title={intl.formatMessage(messages.requested)} /> - </div> - ); - } else if (!account.getIn(['relationship', 'blocking'])) { - following = account.getIn(['relationship', 'following']); - actionBtn = ( - <div className='account--action-button'> - <IconButton - size={26} - icon={following ? 'user-times' : 'user-plus'} - active={following ? true : false} - title={intl.formatMessage(following ? messages.unfollow : messages.follow)} - onClick={this.props.onFollow} - /> - </div> - ); - } - } - -/* - we extract the `text` and -`metadata` from our account's `note` using `processBio()`. - -*/ - - const { text, metadata } = processBio(account.get('note')); - -/* - -Here, we render our component using all the things we've defined above. - -*/ - - return ( - <div className='account__header__wrapper'> - <div - className='account__header' - style={{ backgroundImage: `url(${account.get('header')})` }} - > - <div> - <a href={account.get('url')} target='_blank' rel='noopener'> - <span className='account__header__avatar'> - <Avatar account={account} size={90} /> - </span> - <span - className='account__header__display-name' - dangerouslySetInnerHTML={{ __html: displayName }} - /> - </a> - <span className='account__header__username'> - @{account.get('acct')} - {account.get('locked') ? <i className='fa fa-lock' /> : null} - </span> - <div className='account__header__content' dangerouslySetInnerHTML={{ __html: emojify(text) }} /> - - {info} - {actionBtn} - </div> - </div> - - {metadata.length && ( - <table className='account__metadata'> - <tbody> - {(() => { - let data = []; - for (let i = 0; i < metadata.length; i++) { - data.push( - <tr key={i}> - <th scope='row'><div dangerouslySetInnerHTML={{ __html: emojify(metadata[i][0]) }} /></th> - <td><div dangerouslySetInnerHTML={{ __html: emojify(metadata[i][1]) }} /></td> - </tr> - ); - } - return data; - })()} - </tbody> - </table> - ) || null} - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/compose/advanced_options/container.js b/app/javascript/glitch/components/compose/advanced_options/container.js deleted file mode 100644 index 160f22737..000000000 --- a/app/javascript/glitch/components/compose/advanced_options/container.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - -`<ComposeAdvancedOptionsContainer>` -=================================== - -This container connects `<ComposeAdvancedOptions>` to the Redux store. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import { connect } from 'react-redux'; - -// Mastodon imports // -import { toggleComposeAdvancedOption } from '../../../../mastodon/actions/compose'; - -// Our imports // -import ComposeAdvancedOptions from '.'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -State mapping: --------------- - -The `mapStateToProps()` function maps various state properties to the -props of our component. The only property we care about is -`compose.advanced_options`. - -*/ - -const mapStateToProps = state => ({ - values: state.getIn(['compose', 'advanced_options']), -}); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Dispatch mapping: ------------------ - -The `mapDispatchToProps()` function maps dispatches to our store to the -various props of our component. We just need to provide a dispatch for -when an advanced option toggle changes. - -*/ - -const mapDispatchToProps = dispatch => ({ - - onChange (option) { - dispatch(toggleComposeAdvancedOption(option)); - }, - -}); - -export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions); diff --git a/app/javascript/glitch/components/compose/advanced_options/index.js b/app/javascript/glitch/components/compose/advanced_options/index.js deleted file mode 100644 index 8251baf4d..000000000 --- a/app/javascript/glitch/components/compose/advanced_options/index.js +++ /dev/null @@ -1,163 +0,0 @@ -/* - -`<ComposeAdvancedOptions>` -========================== - -> For more information on the contents of this file, please contact: -> -> - surinna [@srn@dev.glitch.social] - -This adds an advanced options dropdown to the toot compose box, for -toggles that don't necessarily fit elsewhere. - -__Props:__ - - - __`values` (`ImmutablePropTypes.contains(…).isRequired`) :__ - An Immutable map with the following values: - - - __`do_not_federate` (`PropTypes.bool.isRequired`) :__ - Specifies whether or not to federate the status. - - - __`onChange` (`PropTypes.func.isRequired`) :__ - The function to call when a toggle is changed. We pass this from - our container to the toggle. - - - __`intl` (`PropTypes.object.isRequired`) :__ - Our internationalization object, inserted by `@injectIntl`. - -__State:__ - - - __`open` :__ - This tells whether the dropdown is currently open or closed. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { injectIntl, defineMessages } from 'react-intl'; - -// Our imports // -import ComposeAdvancedOptionsToggle from './toggle'; -import ComposeDropdown from '../dropdown/index'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Inital setup: -------------- - -The `messages` constant is used to define any messages that we need -from inside props. These are the various titles and labels on our -toggles. - -`iconStyle` styles the icon used for the dropdown button. - -*/ - -const messages = defineMessages({ - local_only_short : - { id: 'advanced-options.local-only.short', defaultMessage: 'Local-only' }, - local_only_long : - { id: 'advanced-options.local-only.long', defaultMessage: 'Do not post to other instances' }, - advanced_options_icon_title : - { id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' }, -}); - -/* - -Implementation: ---------------- - -*/ - -@injectIntl -export default class ComposeAdvancedOptions extends React.PureComponent { - - static propTypes = { - values : ImmutablePropTypes.contains({ - do_not_federate : PropTypes.bool.isRequired, - }).isRequired, - onChange : PropTypes.func.isRequired, - intl : PropTypes.object.isRequired, - }; - - -/* - -### `render()` - -`render()` actually puts our component on the screen. - -*/ - - render () { - const { intl, values } = this.props; - -/* - -The `options` array provides all of the available advanced options -alongside their icon, text, and name. - -*/ - const options = [ - { icon: 'wifi', shortText: messages.local_only_short, longText: messages.local_only_long, name: 'do_not_federate' }, - ]; - -/* - -`anyEnabled` tells us if any of our advanced options have been enabled. - -*/ - - const anyEnabled = values.some((enabled) => enabled); - -/* - -`optionElems` takes our `options` and creates -`<ComposeAdvancedOptionsToggle>`s out of them. We use the `name` of the -toggle as its `key` so that React can keep track of it. - -*/ - - const optionElems = options.map((option) => { - return ( - <ComposeAdvancedOptionsToggle - onChange={this.props.onChange} - active={values.get(option.name)} - key={option.name} - name={option.name} - shortText={intl.formatMessage(option.shortText)} - longText={intl.formatMessage(option.longText)} - /> - ); - }); - -/* - -Finally, we can render our component. - -*/ - return ( - <ComposeDropdown - title={intl.formatMessage(messages.advanced_options_icon_title)} - icon='home' - highlight={anyEnabled} - > - {optionElems} - </ComposeDropdown> - ); - } - -} diff --git a/app/javascript/glitch/components/compose/advanced_options/toggle.js b/app/javascript/glitch/components/compose/advanced_options/toggle.js deleted file mode 100644 index d6907472a..000000000 --- a/app/javascript/glitch/components/compose/advanced_options/toggle.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - -`<ComposeAdvancedOptionsToggle>` -================================ - -> For more information on the contents of this file, please contact: -> -> - surinna [@srn@dev.glitch.social] - -This creates the toggle used by `<ComposeAdvancedOptions>`. - -__Props:__ - - - __`onChange` (`PropTypes.func`) :__ - This provides the function to call when the toggle is - (de-?)activated. - - - __`active` (`PropTypes.bool`) :__ - This prop controls whether the toggle is currently active or not. - - - __`name` (`PropTypes.string`) :__ - This identifies the toggle, and is sent to `onChange()` when it is - called. - - - __`shortText` (`PropTypes.string`) :__ - This is a short string used as the title of the toggle. - - - __`longText` (`PropTypes.string`) :__ - This is a longer string used as a subtitle for the toggle. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import React from 'react'; -import PropTypes from 'prop-types'; -import Toggle from 'react-toggle'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Implementation: ---------------- - -*/ - -export default class ComposeAdvancedOptionsToggle extends React.PureComponent { - - static propTypes = { - onChange: PropTypes.func.isRequired, - active: PropTypes.bool.isRequired, - name: PropTypes.string.isRequired, - shortText: PropTypes.string.isRequired, - longText: PropTypes.string.isRequired, - } - -/* - -### `onToggle()` - -The `onToggle()` function simply calls the `onChange()` prop with the -toggle's `name`. - -*/ - - onToggle = () => { - this.props.onChange(this.props.name); - } - -/* - -### `render()` - -The `render()` function is used to render our component. We just render -a `<Toggle>` and place next to it our text. - -*/ - - render() { - const { active, shortText, longText } = this.props; - return ( - <div role='button' tabIndex='0' className='advanced-options-dropdown__option' onClick={this.onToggle}> - <div className='advanced-options-dropdown__option__toggle'> - <Toggle checked={active} onChange={this.onToggle} /> - </div> - <div className='advanced-options-dropdown__option__content'> - <strong>{shortText}</strong> - {longText} - </div> - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/local_settings/container.js b/app/javascript/glitch/components/local_settings/container.js deleted file mode 100644 index 4569db99f..000000000 --- a/app/javascript/glitch/components/local_settings/container.js +++ /dev/null @@ -1,24 +0,0 @@ -// Package imports // -import { connect } from 'react-redux'; - -// Mastodon imports // -import { closeModal } from '../../../mastodon/actions/modal'; - -// Our imports // -import { changeLocalSetting } from '../../../glitch/actions/local_settings'; -import LocalSettings from '.'; - -const mapStateToProps = state => ({ - settings: state.get('local_settings'), -}); - -const mapDispatchToProps = dispatch => ({ - onChange (setting, value) { - dispatch(changeLocalSetting(setting, value)); - }, - onClose () { - dispatch(closeModal()); - }, -}); - -export default connect(mapStateToProps, mapDispatchToProps)(LocalSettings); diff --git a/app/javascript/glitch/components/notification/container.js b/app/javascript/glitch/components/notification/container.js deleted file mode 100644 index dc4c2168a..000000000 --- a/app/javascript/glitch/components/notification/container.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - -`<NotificationContainer>` -========================= - -This container connects `<Notification>`s to the Redux store. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import { connect } from 'react-redux'; - -// Our imports // -import Notification from '.'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -const mapStateToProps = (state, props) => { - // replace account id with object - let leNotif = props.notification.set('account', state.getIn(['accounts', props.notification.get('account')])); - - // populate markedForDelete from state - is mysteriously lost somewhere - for (let n of state.getIn(['notifications', 'items'])) { - if (n.get('id') === props.notification.get('id')) { - leNotif = leNotif.set('markedForDelete', n.get('markedForDelete')); - break; - } - } - - return ({ - notification: leNotif, - settings: state.get('local_settings'), - notifCleaning: state.getIn(['notifications', 'cleaningMode']), - }); -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -export default connect(mapStateToProps)(Notification); diff --git a/app/javascript/glitch/components/notification/follow.js b/app/javascript/glitch/components/notification/follow.js deleted file mode 100644 index e2c21bf35..000000000 --- a/app/javascript/glitch/components/notification/follow.js +++ /dev/null @@ -1,72 +0,0 @@ -// `<NotificationFollow>` -// ====================== - -// * * * * * * * // - -// Imports -// ------- - -// Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -// Mastodon imports. -import Permalink from '../../../mastodon/components/permalink'; -import AccountContainer from '../../../mastodon/containers/account_container'; - -// Our imports. -import NotificationOverlayContainer from '../notification/overlay/container'; - -// * * * * * * * // - -// Implementation -// -------------- - -export default class NotificationFollow extends ImmutablePureComponent { - - static propTypes = { - id : PropTypes.string.isRequired, - account : ImmutablePropTypes.map.isRequired, - notification : ImmutablePropTypes.map.isRequired, - }; - - render () { - const { account, notification } = this.props; - - // Links to the display name. - const displayName = account.get('display_name_html') || account.get('username'); - const link = ( - <Permalink - className='notification__display-name' - href={account.get('url')} - title={account.get('acct')} - to={`/accounts/${account.get('id')}`} - dangerouslySetInnerHTML={{ __html: displayName }} - /> - ); - - // Renders. - return ( - <div className='notification notification-follow'> - <div className='notification__message'> - <div className='notification__favourite-icon-wrapper'> - <i className='fa fa-fw fa-user-plus' /> - </div> - - <FormattedMessage - id='notification.follow' - defaultMessage='{name} followed you' - values={{ name: link }} - /> - </div> - - <AccountContainer id={account.get('id')} withNote={false} /> - <NotificationOverlayContainer notification={notification} /> - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/notification/overlay/container.js b/app/javascript/glitch/components/notification/overlay/container.js deleted file mode 100644 index 089f615f0..000000000 --- a/app/javascript/glitch/components/notification/overlay/container.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - -`<NotificationOverlayContainer>` -========================= - -This container connects `<NotificationOverlay>`s to the Redux store. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import { connect } from 'react-redux'; - -// Our imports // -import NotificationOverlay from './notification_overlay'; -import { markNotificationForDelete } from '../../../../mastodon/actions/notifications'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Dispatch mapping: ------------------ - -The `mapDispatchToProps()` function maps dispatches to our store to the -various props of our component. We only need to provide a dispatch for -deleting notifications. - -*/ - -const mapDispatchToProps = dispatch => ({ - onMarkForDelete(id, yes) { - dispatch(markNotificationForDelete(id, yes)); - }, -}); - -const mapStateToProps = state => ({ - show: state.getIn(['notifications', 'cleaningMode']), -}); - -export default connect(mapStateToProps, mapDispatchToProps)(NotificationOverlay); diff --git a/app/javascript/glitch/components/status/action_bar.js b/app/javascript/glitch/components/status/action_bar.js deleted file mode 100644 index 34588b008..000000000 --- a/app/javascript/glitch/components/status/action_bar.js +++ /dev/null @@ -1,187 +0,0 @@ -// Package imports // -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -// Mastodon imports // -import RelativeTimestamp from '../../../mastodon/components/relative_timestamp'; -import IconButton from '../../../mastodon/components/icon_button'; -import DropdownMenuContainer from '../../../mastodon/containers/dropdown_menu_container'; -import { me } from '../../../mastodon/initial_state'; - -const messages = defineMessages({ - delete: { id: 'status.delete', defaultMessage: 'Delete' }, - mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' }, - mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' }, - block: { id: 'account.block', defaultMessage: 'Block @{name}' }, - reply: { id: 'status.reply', defaultMessage: 'Reply' }, - share: { id: 'status.share', defaultMessage: 'Share' }, - replyAll: { id: 'status.replyAll', defaultMessage: 'Reply to thread' }, - reblog: { id: 'status.reblog', defaultMessage: 'Boost' }, - cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' }, - favourite: { id: 'status.favourite', defaultMessage: 'Favourite' }, - open: { id: 'status.open', defaultMessage: 'Expand this status' }, - report: { id: 'status.report', defaultMessage: 'Report @{name}' }, - muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' }, - unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' }, - pin: { id: 'status.pin', defaultMessage: 'Pin on profile' }, - unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' }, - embed: { id: 'status.embed', defaultMessage: 'Embed' }, -}); - -@injectIntl -export default class StatusActionBar extends ImmutablePureComponent { - - static contextTypes = { - router: PropTypes.object, - }; - - static propTypes = { - status: ImmutablePropTypes.map.isRequired, - onReply: PropTypes.func, - onFavourite: PropTypes.func, - onReblog: PropTypes.func, - onDelete: PropTypes.func, - onMention: PropTypes.func, - onMute: PropTypes.func, - onBlock: PropTypes.func, - onReport: PropTypes.func, - onEmbed: PropTypes.func, - onMuteConversation: PropTypes.func, - onPin: PropTypes.func, - withDismiss: PropTypes.bool, - intl: PropTypes.object.isRequired, - }; - - // Avoid checking props that are functions (and whose equality will always - // evaluate to false. See react-immutable-pure-component for usage. - updateOnProps = [ - 'status', - 'withDismiss', - ] - - handleReplyClick = () => { - this.props.onReply(this.props.status, this.context.router.history); - } - - handleShareClick = () => { - navigator.share({ - text: this.props.status.get('search_index'), - url: this.props.status.get('url'), - }); - } - - handleFavouriteClick = () => { - this.props.onFavourite(this.props.status); - } - - handleReblogClick = (e) => { - this.props.onReblog(this.props.status, e); - } - - handleDeleteClick = () => { - this.props.onDelete(this.props.status); - } - - handlePinClick = () => { - this.props.onPin(this.props.status); - } - - handleMentionClick = () => { - this.props.onMention(this.props.status.get('account'), this.context.router.history); - } - - handleMuteClick = () => { - this.props.onMute(this.props.status.get('account')); - } - - handleBlockClick = () => { - this.props.onBlock(this.props.status.get('account')); - } - - handleOpen = () => { - this.context.router.history.push(`/statuses/${this.props.status.get('id')}`); - } - - handleEmbed = () => { - this.props.onEmbed(this.props.status); - } - - handleReport = () => { - this.props.onReport(this.props.status); - } - - handleConversationMuteClick = () => { - this.props.onMuteConversation(this.props.status); - } - - render () { - const { status, intl, withDismiss } = this.props; - - const mutingConversation = status.get('muted'); - const anonymousAccess = !me; - const publicStatus = ['public', 'unlisted'].includes(status.get('visibility')); - - let menu = []; - let reblogIcon = 'retweet'; - let replyIcon; - let replyTitle; - - menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); - - if (publicStatus) { - menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); - } - - menu.push(null); - - if (status.getIn(['account', 'id']) === me || withDismiss) { - menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick }); - menu.push(null); - } - - if (status.getIn(['account', 'id']) === me) { - if (publicStatus) { - menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick }); - } - - menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick }); - } else { - menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick }); - menu.push(null); - menu.push({ text: intl.formatMessage(messages.mute, { name: status.getIn(['account', 'username']) }), action: this.handleMuteClick }); - menu.push({ text: intl.formatMessage(messages.block, { name: status.getIn(['account', 'username']) }), action: this.handleBlockClick }); - menu.push({ text: intl.formatMessage(messages.report, { name: status.getIn(['account', 'username']) }), action: this.handleReport }); - } - - if (status.get('in_reply_to_id', null) === null) { - replyIcon = 'reply'; - replyTitle = intl.formatMessage(messages.reply); - } else { - replyIcon = 'reply-all'; - replyTitle = intl.formatMessage(messages.replyAll); - } - - const shareButton = ('share' in navigator) && status.get('visibility') === 'public' && ( - <IconButton className='status__action-bar-button' title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShareClick} /> - ); - - return ( - <div className='status__action-bar'> - <IconButton className='status__action-bar-button' disabled={anonymousAccess} title={replyTitle} icon={replyIcon} onClick={this.handleReplyClick} /> - <IconButton className='status__action-bar-button' disabled={anonymousAccess || !publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} /> - <IconButton className='status__action-bar-button star-icon' disabled={anonymousAccess} animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /> - {shareButton} - - <div className='status__action-bar-dropdown'> - <DropdownMenuContainer disabled={anonymousAccess} status={status} items={menu} icon='ellipsis-h' size={18} direction='right' ariaLabel='More' /> - </div> - - <a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a> - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/status/container.js b/app/javascript/glitch/components/status/container.js deleted file mode 100644 index 0054abd14..000000000 --- a/app/javascript/glitch/components/status/container.js +++ /dev/null @@ -1,263 +0,0 @@ -/* - -`<StatusContainer>` -=================== - -Original file by @gargron@mastodon.social et al as part of -tootsuite/mastodon. Documentation by @kibi@glitch.social. The code -detecting reblogs has been moved here from <Status>. - -*/ - - /* * * * */ - -/* - -Imports: --------- - -*/ - -// Package imports // -import React from 'react'; -import { connect } from 'react-redux'; -import { - defineMessages, - injectIntl, - FormattedMessage, -} from 'react-intl'; - -// Mastodon imports // -import { makeGetStatus } from '../../../mastodon/selectors'; -import { - replyCompose, - mentionCompose, -} from '../../../mastodon/actions/compose'; -import { - reblog, - favourite, - unreblog, - unfavourite, - pin, - unpin, -} from '../../../mastodon/actions/interactions'; -import { blockAccount } from '../../../mastodon/actions/accounts'; -import { initMuteModal } from '../../../mastodon/actions/mutes'; -import { - muteStatus, - unmuteStatus, - deleteStatus, -} from '../../../mastodon/actions/statuses'; -import { initReport } from '../../../mastodon/actions/reports'; -import { openModal } from '../../../mastodon/actions/modal'; - -// Our imports // -import Status from '.'; - - /* * * * */ - -/* - -Inital setup: -------------- - -The `messages` constant is used to define any messages that we will -need in our component. In our case, these are the various confirmation -messages used with statuses. - -*/ - -const messages = defineMessages({ - deleteConfirm : { - id : 'confirmations.delete.confirm', - defaultMessage : 'Delete', - }, - deleteMessage : { - id : 'confirmations.delete.message', - defaultMessage : 'Are you sure you want to delete this status?', - }, - blockConfirm : { - id : 'confirmations.block.confirm', - defaultMessage : 'Block', - }, -}); - - /* * * * */ - -/* - -State mapping: --------------- - -The `mapStateToProps()` function maps various state properties to the -props of our component. We wrap this in a `makeMapStateToProps()` -function to give us closure and preserve `getStatus()` across function -calls. - -*/ - -const makeMapStateToProps = () => { - const getStatus = makeGetStatus(); - - const mapStateToProps = (state, ownProps) => { - - let status = getStatus(state, ownProps.id); - - if(status === null) { - console.error(`ERROR! NULL STATUS! ${ownProps.id}`); - // work-around: find first good status - for (let k of state.get('statuses').keys()) { - status = getStatus(state, k); - if (status !== null) break; - } - } - - let reblogStatus = status.get('reblog', null); - let account = undefined; - let prepend = undefined; - -/* - -Here we process reblogs. If our status is a reblog, then we create a -`prependMessage` to pass along to our `<Status>` along with the -reblogger's `account`, and set `coreStatus` (the one we will actually -render) to the status which has been reblogged. - -*/ - - if (reblogStatus !== null && typeof reblogStatus === 'object') { - account = status.get('account'); - status = reblogStatus; - prepend = 'reblogged_by'; - } - -/* - -Here are the props we pass to `<Status>`. - -*/ - - return { - status : status, - account : account || ownProps.account, - settings : state.get('local_settings'), - prepend : prepend || ownProps.prepend, - reblogModal : state.getIn(['meta', 'boost_modal']), - deleteModal : state.getIn(['meta', 'delete_modal']), - }; - }; - - return mapStateToProps; -}; - - /* * * * */ - -/* - -Dispatch mapping: ------------------ - -The `mapDispatchToProps()` function maps dispatches to our store to the -various props of our component. We need to provide dispatches for all -of the things you can do with a status: reply, reblog, favourite, et -cetera. - -For a few of these dispatches, we open up confirmation modals; the rest -just immediately execute their corresponding actions. - -*/ - -const mapDispatchToProps = (dispatch, { intl }) => ({ - - onReply (status, router) { - dispatch(replyCompose(status, router)); - }, - - onModalReblog (status) { - dispatch(reblog(status)); - }, - - onReblog (status, e) { - if (status.get('reblogged')) { - dispatch(unreblog(status)); - } else { - if (e.shiftKey || !this.reblogModal) { - this.onModalReblog(status); - } else { - dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog })); - } - } - }, - - onFavourite (status) { - if (status.get('favourited')) { - dispatch(unfavourite(status)); - } else { - dispatch(favourite(status)); - } - }, - - onPin (status) { - if (status.get('pinned')) { - dispatch(unpin(status)); - } else { - dispatch(pin(status)); - } - }, - - onEmbed (status) { - dispatch(openModal('EMBED', { url: status.get('url') })); - }, - - onDelete (status) { - if (!this.deleteModal) { - dispatch(deleteStatus(status.get('id'))); - } else { - dispatch(openModal('CONFIRM', { - message: intl.formatMessage(messages.deleteMessage), - confirm: intl.formatMessage(messages.deleteConfirm), - onConfirm: () => dispatch(deleteStatus(status.get('id'))), - })); - } - }, - - onMention (account, router) { - dispatch(mentionCompose(account, router)); - }, - - onOpenMedia (media, index) { - dispatch(openModal('MEDIA', { media, index })); - }, - - onOpenVideo (media, time) { - dispatch(openModal('VIDEO', { media, time })); - }, - - onBlock (account) { - dispatch(openModal('CONFIRM', { - message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />, - confirm: intl.formatMessage(messages.blockConfirm), - onConfirm: () => dispatch(blockAccount(account.get('id'))), - })); - }, - - onReport (status) { - dispatch(initReport(status.get('account'), status)); - }, - - onMute (account) { - dispatch(initMuteModal(account)); - }, - - onMuteConversation (status) { - if (status.get('muted')) { - dispatch(unmuteStatus(status.get('id'))); - } else { - dispatch(muteStatus(status.get('id'))); - } - }, -}); - -export default injectIntl( - connect(makeMapStateToProps, mapDispatchToProps)(Status) -); diff --git a/app/javascript/glitch/components/status/gallery/index.js b/app/javascript/glitch/components/status/gallery/index.js deleted file mode 100644 index ae03dc08d..000000000 --- a/app/javascript/glitch/components/status/gallery/index.js +++ /dev/null @@ -1,79 +0,0 @@ -// Package imports // -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; - -// Mastodon imports // -import IconButton from '../../../../mastodon/components/icon_button'; - -// Our imports // -import StatusGalleryItem from './item'; - -const messages = defineMessages({ - toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, -}); - -@injectIntl -export default class StatusGallery extends React.PureComponent { - - static propTypes = { - sensitive: PropTypes.bool, - media: ImmutablePropTypes.list.isRequired, - letterbox: PropTypes.bool, - fullwidth: PropTypes.bool, - height: PropTypes.number.isRequired, - onOpenMedia: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - autoPlayGif: PropTypes.bool.isRequired, - }; - - state = { - visible: !this.props.sensitive, - }; - - handleOpen = () => { - this.setState({ visible: !this.state.visible }); - } - - handleClick = (index) => { - this.props.onOpenMedia(this.props.media, index); - } - - render () { - const { media, intl, sensitive, letterbox, fullwidth } = this.props; - - let children; - - if (!this.state.visible) { - let warning; - - if (sensitive) { - warning = <FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' />; - } else { - warning = <FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' />; - } - - children = ( - <div role='button' tabIndex='0' className='media-spoiler' onClick={this.handleOpen}> - <span className='media-spoiler__warning'>{warning}</span> - <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> - </div> - ); - } else { - const size = media.take(4).size; - children = media.take(4).map((attachment, i) => <StatusGalleryItem key={attachment.get('id')} onClick={this.handleClick} attachment={attachment} autoPlayGif={this.props.autoPlayGif} index={i} size={size} letterbox={letterbox} />); - } - - return ( - <div className={`media-gallery ${fullwidth ? 'full-width' : ''}`} style={{ height: `${this.props.height}px` }}> - <div className={`spoiler-button ${this.state.visible ? 'spoiler-button--visible' : ''}`}> - <IconButton title={intl.formatMessage(messages.toggle_visible)} icon={this.state.visible ? 'eye' : 'eye-slash'} overlay onClick={this.handleOpen} /> - </div> - - {children} - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/status/gallery/item.js b/app/javascript/glitch/components/status/gallery/item.js deleted file mode 100644 index 7fcc14377..000000000 --- a/app/javascript/glitch/components/status/gallery/item.js +++ /dev/null @@ -1,158 +0,0 @@ -// Package imports // -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; - -// Mastodon imports // -import { isIOS } from '../../../../mastodon/is_mobile'; - -export default class StatusGalleryItem extends React.PureComponent { - - static propTypes = { - attachment: ImmutablePropTypes.map.isRequired, - index: PropTypes.number.isRequired, - size: PropTypes.number.isRequired, - letterbox: PropTypes.bool, - onClick: PropTypes.func.isRequired, - autoPlayGif: PropTypes.bool.isRequired, - }; - - handleMouseEnter = (e) => { - if (this.hoverToPlay()) { - e.target.play(); - } - } - - handleMouseLeave = (e) => { - if (this.hoverToPlay()) { - e.target.pause(); - e.target.currentTime = 0; - } - } - - hoverToPlay () { - const { attachment, autoPlayGif } = this.props; - return !autoPlayGif && attachment.get('type') === 'gifv'; - } - - handleClick = (e) => { - const { index, onClick } = this.props; - - if (e.button === 0) { - e.preventDefault(); - onClick(index); - } - - e.stopPropagation(); - } - - render () { - const { attachment, index, size, letterbox } = this.props; - - let width = 50; - let height = 100; - let top = 'auto'; - let left = 'auto'; - let bottom = 'auto'; - let right = 'auto'; - - if (size === 1) { - width = 100; - } - - if (size === 4 || (size === 3 && index > 0)) { - height = 50; - } - - if (size === 2) { - if (index === 0) { - right = '2px'; - } else { - left = '2px'; - } - } else if (size === 3) { - if (index === 0) { - right = '2px'; - } else if (index > 0) { - left = '2px'; - } - - if (index === 1) { - bottom = '2px'; - } else if (index > 1) { - top = '2px'; - } - } else if (size === 4) { - if (index === 0 || index === 2) { - right = '2px'; - } - - if (index === 1 || index === 3) { - left = '2px'; - } - - if (index < 2) { - bottom = '2px'; - } else { - top = '2px'; - } - } - - let thumbnail = ''; - - if (attachment.get('type') === 'image') { - const previewUrl = attachment.get('preview_url'); - const previewWidth = attachment.getIn(['meta', 'small', 'width']); - - const originalUrl = attachment.get('url'); - const originalWidth = attachment.getIn(['meta', 'original', 'width']); - - const srcSet = `${originalUrl} ${originalWidth}w, ${previewUrl} ${previewWidth}w`; - const sizes = `(min-width: 1025px) ${320 * (width / 100)}px, ${width}vw`; - - thumbnail = ( - <a - className='media-gallery__item-thumbnail' - href={attachment.get('remote_url') || originalUrl} - onClick={this.handleClick} - target='_blank' - > - <img - className={letterbox ? 'letterbox' : ''} - src={previewUrl} srcSet={srcSet} - sizes={sizes} - alt={attachment.get('description')} - title={attachment.get('description')} - /> - </a> - ); - } else if (attachment.get('type') === 'gifv') { - const autoPlay = !isIOS() && this.props.autoPlayGif; - - thumbnail = ( - <div className={`media-gallery__gifv ${autoPlay ? 'autoplay' : ''}`}> - <video - className={`media-gallery__item-gifv-thumbnail${letterbox ? ' letterbox' : ''}`} - role='application' - src={attachment.get('url')} - onClick={this.handleClick} - onMouseEnter={this.handleMouseEnter} - onMouseLeave={this.handleMouseLeave} - autoPlay={autoPlay} - loop - muted - /> - - <span className='media-gallery__gifv__label'>GIF</span> - </div> - ); - } - - return ( - <div className='media-gallery__item' key={attachment.get('id')} style={{ left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%` }}> - {thumbnail} - </div> - ); - } - -} diff --git a/app/javascript/glitch/components/status/index.js b/app/javascript/glitch/components/status/index.js deleted file mode 100644 index 33a9730e5..000000000 --- a/app/javascript/glitch/components/status/index.js +++ /dev/null @@ -1,760 +0,0 @@ -/* - -`<Status>` -========== - -Original file by @gargron@mastodon.social et al as part of -tootsuite/mastodon. *Heavily* rewritten (and documented!) by -@kibi@glitch.social as a part of glitch-soc/mastodon. The following -features have been added: - - - Better separating the "guts" of statuses from their wrapper(s) - - Collapsing statuses - - Moving images inside of CWs - -A number of aspects of this original file have been split off into -their own components for better maintainance; for these, see: - - - <StatusHeader> - - <StatusPrepend> - -…And, of course, the other <Status>-related components as well. - -*/ - - /* * * * */ - -/* - -Imports: --------- - -*/ - -// Package imports // -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; - -// Mastodon imports // -import scheduleIdleTask from '../../../mastodon/features/ui/util/schedule_idle_task'; -import { autoPlayGif } from '../../../mastodon/initial_state'; - -// Our imports // -import StatusPrepend from './prepend'; -import StatusHeader from './header'; -import StatusContent from './content'; -import StatusActionBar from './action_bar'; -import StatusGallery from './gallery'; -import StatusPlayer from './player'; -import NotificationOverlayContainer from '../notification/overlay/container'; - - /* * * * */ - -/* - -The `<Status>` component: -------------------------- - -The `<Status>` component is a container for statuses. It consists of a -few parts: - - - The `<StatusPrepend>`, which contains tangential information about - the status, such as who reblogged it. - - The `<StatusHeader>`, which contains the avatar and username of the - status author, as well as a media icon and the "collapse" toggle. - - The `<StatusContent>`, which contains the content of the status. - - The `<StatusActionBar>`, which provides actions to be performed - on statuses, like reblogging or sending a reply. - -### Context - - - __`router` (`PropTypes.object`) :__ - We need to get our router from the surrounding React context. - -### Props - - - __`id` (`PropTypes.number`) :__ - The id of the status. - - - __`status` (`ImmutablePropTypes.map`) :__ - The status object, straight from the store. - - - __`account` (`ImmutablePropTypes.map`) :__ - Don't be confused by this one! This is **not** the account which - posted the status, but the associated account with any further - action (eg, a reblog or a favourite). - - - __`settings` (`ImmutablePropTypes.map`) :__ - These are our local settings, fetched from our store. We need this - to determine how best to collapse our statuses, among other things. - - - __`onFavourite`, `onReblog`, `onModalReblog`, `onDelete`, - `onMention`, `onMute`, `onMuteConversation`, onBlock`, `onReport`, - `onOpenMedia`, `onOpenVideo` (`PropTypes.func`) :__ - These are all functions passed through from the - `<StatusContainer>`. We don't deal with them directly here. - - - __`reblogModal`, `deleteModal` (`PropTypes.bool`) :__ - These tell whether or not the user has modals activated for - reblogging and deleting statuses. They are used by the `onReblog` - and `onDelete` functions, but we don't deal with them here. - - - __`muted` (`PropTypes.bool`) :__ - This has nothing to do with a user or conversation mute! "Muted" is - what Mastodon internally calls the subdued look of statuses in the - notifications column. This should be `true` for notifications, and - `false` otherwise. - - - __`collapse` (`PropTypes.bool`) :__ - This prop signals a directive from a higher power to (un)collapse - a status. Most of the time it should be `undefined`, in which case - we do nothing. - - - __`prepend` (`PropTypes.string`) :__ - The type of prepend: `'reblogged_by'`, `'reblog'`, or - `'favourite'`. - - - __`withDismiss` (`PropTypes.bool`) :__ - Whether or not the status can be dismissed. Used for notifications. - - - __`intersectionObserverWrapper` (`PropTypes.object`) :__ - This holds our intersection observer. In Mastodon parlance, - an "intersection" is just when the status is viewable onscreen. - -### State - - - __`isExpanded` :__ - Should be either `true`, `false`, or `null`. The meanings of - these values are as follows: - - - __`true` :__ The status contains a CW and the CW is expanded. - - __`false` :__ The status is collapsed. - - __`null` :__ The status is not collapsed or expanded. - - - __`isIntersecting` :__ - This boolean tells us whether or not the status is currently - onscreen. - - - __`isHidden` :__ - This boolean tells us if the status has been unrendered to save - CPUs. - -*/ - -export default class Status extends ImmutablePureComponent { - - static contextTypes = { - router : PropTypes.object, - }; - - static propTypes = { - id : PropTypes.string, - status : ImmutablePropTypes.map, - account : ImmutablePropTypes.map, - settings : ImmutablePropTypes.map, - notification : ImmutablePropTypes.map, - onFavourite : PropTypes.func, - onReblog : PropTypes.func, - onModalReblog : PropTypes.func, - onDelete : PropTypes.func, - onPin : PropTypes.func, - onMention : PropTypes.func, - onMute : PropTypes.func, - onMuteConversation : PropTypes.func, - onBlock : PropTypes.func, - onEmbed : PropTypes.func, - onHeightChange : PropTypes.func, - onReport : PropTypes.func, - onOpenMedia : PropTypes.func, - onOpenVideo : PropTypes.func, - reblogModal : PropTypes.bool, - deleteModal : PropTypes.bool, - muted : PropTypes.bool, - collapse : PropTypes.bool, - prepend : PropTypes.string, - withDismiss : PropTypes.bool, - intersectionObserverWrapper : PropTypes.object, - }; - - state = { - isExpanded : null, - isIntersecting : true, - isHidden : false, - markedForDelete : false, - } - -/* - -### Implementation - -#### `updateOnProps` and `updateOnStates`. - -`updateOnProps` and `updateOnStates` tell the component when to update. -We specify them explicitly because some of our props are dynamically= -generated functions, which would otherwise always trigger an update. -Of course, this means that if we add an important prop, we will need -to remember to specify it here. - -*/ - - updateOnProps = [ - 'status', - 'account', - 'settings', - 'prepend', - 'boostModal', - 'muted', - 'collapse', - 'notification', - ] - - updateOnStates = [ - 'isExpanded', - 'markedForDelete', - ] - -/* - -#### `componentWillReceiveProps()`. - -If our settings have changed to disable collapsed statuses, then we -need to make sure that we uncollapse every one. We do that by watching -for changes to `settings.collapsed.enabled` in -`componentWillReceiveProps()`. - -We also need to watch for changes on the `collapse` prop---if this -changes to anything other than `undefined`, then we need to collapse or -uncollapse our status accordingly. - -*/ - - componentWillReceiveProps (nextProps) { - if (!nextProps.settings.getIn(['collapsed', 'enabled'])) { - if (this.state.isExpanded === false) { - this.setExpansion(null); - } - } else if ( - nextProps.collapse !== this.props.collapse && - nextProps.collapse !== undefined - ) this.setExpansion(nextProps.collapse ? false : null); - } - -/* - -#### `componentDidMount()`. - -When mounting, we just check to see if our status should be collapsed, -and collapse it if so. We don't need to worry about whether collapsing -is enabled here, because `setExpansion()` already takes that into -account. - -The cases where a status should be collapsed are: - - - The `collapse` prop has been set to `true` - - The user has decided in local settings to collapse all statuses. - - The user has decided to collapse all notifications ('muted' - statuses). - - The user has decided to collapse long statuses and the status is - over 400px (without media, or 650px with). - - The status is a reply and the user has decided to collapse all - replies. - - The status contains media and the user has decided to collapse all - statuses with media. - -We also start up our intersection observer to monitor our statuses. -`componentMounted` lets us know that everything has been set up -properly and our intersection observer is good to go. - -*/ - - componentDidMount () { - const { node, handleIntersection } = this; - const { - status, - settings, - collapse, - muted, - id, - intersectionObserverWrapper, - prepend, - } = this.props; - const autoCollapseSettings = settings.getIn(['collapsed', 'auto']); - - if ( - collapse || - autoCollapseSettings.get('all') || ( - autoCollapseSettings.get('notifications') && muted - ) || ( - autoCollapseSettings.get('lengthy') && - node.clientHeight > ( - status.get('media_attachments').size && !muted ? 650 : 400 - ) - ) || ( - autoCollapseSettings.get('reblogs') && - prepend === 'reblogged_by' - ) || ( - autoCollapseSettings.get('replies') && - status.get('in_reply_to_id', null) !== null - ) || ( - autoCollapseSettings.get('media') && - !(status.get('spoiler_text').length) && - status.get('media_attachments').size - ) - ) this.setExpansion(false); - - if (!intersectionObserverWrapper) return; - else intersectionObserverWrapper.observe( - id, - node, - handleIntersection - ); - - this.componentMounted = true; - } - -/* - -#### `shouldComponentUpdate()`. - -If the status is about to be both offscreen (not intersecting) and -hidden, then we only need to update it if it's not that way currently. -If the status is moving from offscreen to onscreen, then we *have* to -re-render, so that we can unhide the element if necessary. - -If neither of these cases are true, we can leave it up to our -`updateOnProps` and `updateOnStates` arrays. - -*/ - - shouldComponentUpdate (nextProps, nextState) { - switch (true) { - case !nextState.isIntersecting && nextState.isHidden: - return this.state.isIntersecting || !this.state.isHidden; - case nextState.isIntersecting && !this.state.isIntersecting: - return true; - default: - return super.shouldComponentUpdate(nextProps, nextState); - } - } - -/* - -#### `componentDidUpdate()`. - -If our component is being rendered for any reason and an update has -triggered, this will save its height. - -This is, frankly, a bit overkill, as the only instance when we -actually *need* to update the height right now should be when the -value of `isExpanded` has changed. But it makes for more readable -code and prevents bugs in the future where the height isn't set -properly after some change. - -*/ - - componentDidUpdate () { - if ( - this.state.isIntersecting || !this.state.isHidden - ) this.saveHeight(); - } - -/* - -#### `componentWillUnmount()`. - -If our component is about to unmount, then we'd better unset -`this.componentMounted`. - -*/ - - componentWillUnmount () { - this.componentMounted = false; - } - -/* - -#### `handleIntersection()`. - -`handleIntersection()` either hides the status (if it is offscreen) or -unhides it (if it is onscreen). It's called by -`intersectionObserverWrapper.observe()`. - -If our status isn't intersecting, we schedule an idle task (using the -aptly-named `scheduleIdleTask()`) to hide the status at the next -available opportunity. - -tootsuite/mastodon left us with the following enlightening comment -regarding this function: - -> Edge 15 doesn't support isIntersecting, but we can infer it - -It then implements a polyfill (intersectionRect.height > 0) which isn't -actually sufficient. The short answer is, this behaviour isn't really -supported on Edge but we can get kinda close. - -*/ - - handleIntersection = (entry) => { - const isIntersecting = ( - typeof entry.isIntersecting === 'boolean' ? - entry.isIntersecting : - entry.intersectionRect.height > 0 - ); - this.setState( - (prevState) => { - if (prevState.isIntersecting && !isIntersecting) { - scheduleIdleTask(this.hideIfNotIntersecting); - } - return { - isIntersecting : isIntersecting, - isHidden : false, - }; - } - ); - } - -/* - -#### `hideIfNotIntersecting()`. - -This function will hide the status if we're still not intersecting. -Hiding the status means that it will just render an empty div instead -of actual content, which saves RAMS and CPUs or some such. - -*/ - - hideIfNotIntersecting = () => { - if (!this.componentMounted) return; - this.setState( - (prevState) => ({ isHidden: !prevState.isIntersecting }) - ); - } - -/* - -#### `saveHeight()`. - -`saveHeight()` saves the height of our status so that when whe hide it -we preserve its dimensions. We only want to store our height, though, -if our status has content (otherwise, it would imply that it is -already hidden). - -*/ - - saveHeight = () => { - if (this.node && this.node.children.length) { - this.height = this.node.getBoundingClientRect().height; - } - } - -/* - -#### `setExpansion()`. - -`setExpansion()` sets the value of `isExpanded` in our state. It takes -one argument, `value`, which gives the desired value for `isExpanded`. -The default for this argument is `null`. - -`setExpansion()` automatically checks for us whether toot collapsing -is enabled, so we don't have to. - -We use a `switch` statement to simplify our code. - -*/ - - setExpansion = (value) => { - switch (true) { - case value === undefined || value === null: - this.setState({ isExpanded: null }); - break; - case !value && this.props.settings.getIn(['collapsed', 'enabled']): - this.setState({ isExpanded: false }); - break; - case !!value: - this.setState({ isExpanded: true }); - break; - } - } - -/* - -#### `handleRef()`. - -`handleRef()` just saves a reference to our status node to `this.node`. -It also saves our height, in case the height of our node has changed. - -*/ - - handleRef = (node) => { - this.node = node; - this.saveHeight(); - } - -/* - -#### `parseClick()`. - -`parseClick()` takes a click event and responds appropriately. -If our status is collapsed, then clicking on it should uncollapse it. -If `Shift` is held, then clicking on it should collapse it. -Otherwise, we open the url handed to us in `destination`, if -applicable. - -*/ - - parseClick = (e, destination) => { - const { router } = this.context; - const { status } = this.props; - const { isExpanded } = this.state; - if (!router) return; - if (destination === undefined) { - destination = `/statuses/${ - status.getIn(['reblog', 'id'], status.get('id')) - }`; - } - if (e.button === 0) { - if (isExpanded === false) this.setExpansion(null); - else if (e.shiftKey) { - this.setExpansion(false); - document.getSelection().removeAllRanges(); - } else router.history.push(destination); - e.preventDefault(); - } - } - -/* - -#### `render()`. - -`render()` actually puts our element on the screen. The particulars of -this operation are further explained in the code below. - -*/ - - render () { - const { - parseClick, - setExpansion, - saveHeight, - handleRef, - } = this; - const { router } = this.context; - const { - status, - account, - settings, - collapsed, - muted, - prepend, - intersectionObserverWrapper, - onOpenVideo, - onOpenMedia, - notification, - ...other - } = this.props; - const { isExpanded, isIntersecting, isHidden } = this.state; - let background = null; - let attachments = null; - let media = null; - let mediaIcon = null; - -/* - -If we don't have a status, then we don't render anything. - -*/ - - if (status === null) { - return null; - } - -/* - -If our status is offscreen and hidden, then we render an empty <div> in -its place. We fill it with "content" but note that opacity is set to 0. - -*/ - - if (!isIntersecting && isHidden) { - return ( - <div - ref={this.handleRef} - data-id={status.get('id')} - style={{ - height : `${this.height}px`, - opacity : 0, - overflow : 'hidden', - }} - > - { - status.getIn(['account', 'display_name']) || - status.getIn(['account', 'username']) - } - {status.get('content')} - </div> - ); - } - -/* - -If user backgrounds for collapsed statuses are enabled, then we -initialize our background accordingly. This will only be rendered if -the status is collapsed. - -*/ - - if ( - settings.getIn(['collapsed', 'backgrounds', 'user_backgrounds']) - ) background = status.getIn(['account', 'header']); - -/* - -This handles our media attachments. Note that we don't show media on -muted (notification) statuses. If the media type is unknown, then we -simply ignore it. - -After we have generated our appropriate media element and stored it in -`media`, we snatch the thumbnail to use as our `background` if media -backgrounds for collapsed statuses are enabled. - -*/ - - attachments = status.get('media_attachments'); - if (attachments.size && !muted) { - if (attachments.some((item) => item.get('type') === 'unknown')) { - - } else if ( - attachments.getIn([0, 'type']) === 'video' - ) { - media = ( // Media type is 'video' - <StatusPlayer - media={attachments.get(0)} - sensitive={status.get('sensitive')} - letterbox={settings.getIn(['media', 'letterbox'])} - fullwidth={settings.getIn(['media', 'fullwidth'])} - height={250} - onOpenVideo={onOpenVideo} - /> - ); - mediaIcon = 'video-camera'; - } else { // Media type is 'image' or 'gifv' - media = ( - <StatusGallery - media={attachments} - sensitive={status.get('sensitive')} - letterbox={settings.getIn(['media', 'letterbox'])} - fullwidth={settings.getIn(['media', 'fullwidth'])} - height={250} - onOpenMedia={onOpenMedia} - autoPlayGif={autoPlayGif} - /> - ); - mediaIcon = 'picture-o'; - } - - if ( - !status.get('sensitive') && - !(status.get('spoiler_text').length > 0) && - settings.getIn(['collapsed', 'backgrounds', 'preview_images']) - ) background = attachments.getIn([0, 'preview_url']); - } - -/* - -Here we prepare extra data-* attributes for CSS selectors. -Users can use those for theming, hiding avatars etc via UserStyle - -*/ - - const selectorAttribs = { - 'data-status-by': `@${status.getIn(['account', 'acct'])}`, - }; - - if (prepend && account) { - const notifKind = { - favourite: 'favourited', - reblog: 'boosted', - reblogged_by: 'boosted', - }[prepend]; - - selectorAttribs[`data-${notifKind}-by`] = `@${account.get('acct')}`; - } - -/* - -Finally, we can render our status. We just put the pieces together -from above. We only render the action bar if the status isn't -collapsed. - -*/ - - return ( - <article - className={ - `status${ - muted ? ' muted' : '' - } status-${status.get('visibility')}${ - isExpanded === false ? ' collapsed' : '' - }${ - isExpanded === false && background ? ' has-background' : '' - }${ - this.state.markedForDelete ? ' marked-for-delete' : '' - }` - } - style={{ - backgroundImage: ( - isExpanded === false && background ? - `url(${background})` : - 'none' - ), - }} - ref={handleRef} - {...selectorAttribs} - > - {prepend && account ? ( - <StatusPrepend - type={prepend} - account={account} - parseClick={parseClick} - notificationId={this.props.notificationId} - /> - ) : null} - <StatusHeader - status={status} - friend={account} - mediaIcon={mediaIcon} - collapsible={settings.getIn(['collapsed', 'enabled'])} - collapsed={isExpanded === false} - parseClick={parseClick} - setExpansion={setExpansion} - /> - <StatusContent - status={status} - media={media} - mediaIcon={mediaIcon} - expanded={isExpanded} - setExpansion={setExpansion} - onHeightUpdate={saveHeight} - parseClick={parseClick} - disabled={!router} - /> - {isExpanded !== false ? ( - <StatusActionBar - {...other} - status={status} - account={status.get('account')} - /> - ) : null} - {notification ? ( - <NotificationOverlayContainer - notification={notification} - /> - ) : null} - </article> - ); - - } - -} diff --git a/app/javascript/glitch/components/status/player.js b/app/javascript/glitch/components/status/player.js deleted file mode 100644 index cc65cd34e..000000000 --- a/app/javascript/glitch/components/status/player.js +++ /dev/null @@ -1,203 +0,0 @@ -// Package imports // -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; - -// Mastodon imports // -import IconButton from '../../../mastodon/components/icon_button'; -import { isIOS } from '../../../mastodon/is_mobile'; - -const messages = defineMessages({ - toggle_sound: { id: 'video_player.toggle_sound', defaultMessage: 'Toggle sound' }, - toggle_visible: { id: 'video_player.toggle_visible', defaultMessage: 'Toggle visibility' }, - expand_video: { id: 'video_player.expand', defaultMessage: 'Expand video' }, -}); - -@injectIntl -export default class StatusPlayer extends React.PureComponent { - - static contextTypes = { - router: PropTypes.object, - }; - - static propTypes = { - media: ImmutablePropTypes.map.isRequired, - letterbox: PropTypes.bool, - fullwidth: PropTypes.bool, - height: PropTypes.number, - sensitive: PropTypes.bool, - intl: PropTypes.object.isRequired, - autoplay: PropTypes.bool, - onOpenVideo: PropTypes.func.isRequired, - }; - - static defaultProps = { - height: 110, - }; - - state = { - visible: !this.props.sensitive, - preview: true, - muted: true, - hasAudio: true, - videoError: false, - }; - - handleClick = () => { - this.setState({ muted: !this.state.muted }); - } - - handleVideoClick = (e) => { - e.stopPropagation(); - - const node = this.video; - - if (node.paused) { - node.play(); - } else { - node.pause(); - } - } - - handleOpen = () => { - this.setState({ preview: !this.state.preview }); - } - - handleVisibility = () => { - this.setState({ - visible: !this.state.visible, - preview: true, - }); - } - - handleExpand = () => { - this.video.pause(); - this.props.onOpenVideo(this.props.media, this.video.currentTime); - } - - setRef = (c) => { - this.video = c; - } - - handleLoadedData = () => { - if (('WebkitAppearance' in document.documentElement.style && this.video.audioTracks.length === 0) || this.video.mozHasAudio === false) { - this.setState({ hasAudio: false }); - } - } - - handleVideoError = () => { - this.setState({ videoError: true }); - } - - componentDidMount () { - if (!this.video) { - return; - } - - this.video.addEventListener('loadeddata', this.handleLoadedData); - this.video.addEventListener('error', this.handleVideoError); - } - - componentDidUpdate () { - if (!this.video) { - return; - } - - this.video.addEventListener('loadeddata', this.handleLoadedData); - this.video.addEventListener('error', this.handleVideoError); - } - - componentWillUnmount () { - if (!this.video) { - return; - } - - this.video.removeEventListener('loadeddata', this.handleLoadedData); - this.video.removeEventListener('error', this.handleVideoError); - } - - render () { - const { media, intl, letterbox, fullwidth, height, sensitive, autoplay } = this.props; - - let spoilerButton = ( - <div className={`status__video-player-spoiler ${this.state.visible ? 'status__video-player-spoiler--visible' : ''}`}> - <IconButton overlay title={intl.formatMessage(messages.toggle_visible)} icon={this.state.visible ? 'eye' : 'eye-slash'} onClick={this.handleVisibility} /> - </div> - ); - - let expandButton = !this.context.router ? '' : ( - <div className='status__video-player-expand'> - <IconButton overlay title={intl.formatMessage(messages.expand_video)} icon='expand' onClick={this.handleExpand} /> - </div> - ); - - let muteButton = ''; - - if (this.state.hasAudio) { - muteButton = ( - <div className='status__video-player-mute'> - <IconButton overlay title={intl.formatMessage(messages.toggle_sound)} icon={this.state.muted ? 'volume-off' : 'volume-up'} onClick={this.handleClick} /> - </div> - ); - } - - if (!this.state.visible) { - if (sensitive) { - return ( - <div role='button' tabIndex='0' style={{ height: `${height}px` }} className={`media-spoiler ${fullwidth ? 'full-width' : ''}`} onClick={this.handleVisibility}> - {spoilerButton} - <span className='media-spoiler__warning'><FormattedMessage id='status.sensitive_warning' defaultMessage='Sensitive content' /></span> - <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> - </div> - ); - } else { - return ( - <div role='button' tabIndex='0' style={{ height: `${height}px` }} className={`media-spoiler ${fullwidth ? 'full-width' : ''}`} onClick={this.handleVisibility}> - {spoilerButton} - <span className='media-spoiler__warning'><FormattedMessage id='status.media_hidden' defaultMessage='Media hidden' /></span> - <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> - </div> - ); - } - } - - if (this.state.preview && !autoplay) { - return ( - <div role='button' tabIndex='0' className={`media-spoiler-video ${fullwidth ? 'full-width' : ''}`} style={{ height: `${height}px`, backgroundImage: `url(${media.get('preview_url')})` }} onClick={this.handleOpen}> - {spoilerButton} - <div className='media-spoiler-video-play-icon'><i className='fa fa-play' /></div> - </div> - ); - } - - if (this.state.videoError) { - return ( - <div style={{ height: `${height}px` }} className='video-error-cover' > - <span className='media-spoiler__warning'><FormattedMessage id='video_player.video_error' defaultMessage='Video could not be played' /></span> - </div> - ); - } - - return ( - <div className={`status__video-player ${fullwidth ? 'full-width' : ''}`} style={{ height: `${height}px` }}> - {spoilerButton} - {muteButton} - {expandButton} - - <video - className={`status__video-player-video${letterbox ? ' letterbox' : ''}`} - role='button' - tabIndex='0' - ref={this.setRef} - src={media.get('url')} - autoPlay={!isIOS()} - loop - muted={this.state.muted} - onClick={this.handleVideoClick} - /> - </div> - ); - } - -} diff --git a/app/javascript/glitch/reducers/local_settings.js b/app/javascript/glitch/reducers/local_settings.js deleted file mode 100644 index 03654fbe2..000000000 --- a/app/javascript/glitch/reducers/local_settings.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - -`reducers/local_settings` -======================== - -> For more information on the contents of this file, please contact: -> -> - kibigo! [@kibi@glitch.social] - -This file provides our Redux reducers related to local settings. The -associated actions are: - - - __`STORE_HYDRATE` :__ - Used to hydrate the store with its initial values. - - - __`LOCAL_SETTING_CHANGE` :__ - Used to change the value of a local setting in the store. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // -import { Map as ImmutableMap } from 'immutable'; - -// Mastodon imports // -import { STORE_HYDRATE } from '../../mastodon/actions/store'; - -// Our imports // -import { LOCAL_SETTING_CHANGE } from '../actions/local_settings'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -initialState: -------------- - -You can see the default values for all of our local settings here. -These are only used if no previously-saved values exist. - -*/ - -const initialState = ImmutableMap({ - layout : 'auto', - stretch : true, - navbar_under : false, - side_arm : 'none', - collapsed : ImmutableMap({ - enabled : true, - auto : ImmutableMap({ - all : false, - notifications : true, - lengthy : true, - reblogs : false, - replies : false, - media : false, - }), - backgrounds : ImmutableMap({ - user_backgrounds : false, - preview_images : false, - }), - }), - media : ImmutableMap({ - letterbox : true, - fullwidth : true, - }), -}); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Helper functions: ------------------ - -### `hydrate(state, localSettings)` - -`hydrate()` is used to hydrate the `local_settings` part of our store -with its initial values. The `state` will probably just be the -`initialState`, and the `localSettings` should be whatever we pulled -from `localStorage`. - -*/ - -const hydrate = (state, localSettings) => state.mergeDeep(localSettings); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -`localSettings(state = initialState, action)`: ----------------------------------------------- - -This function holds our actual reducer. - -If our action is `STORE_HYDRATE`, then we call `hydrate()` with the -`local_settings` property of the provided `action.state`. - -If our action is `LOCAL_SETTING_CHANGE`, then we set `action.key` in -our state to the provided `action.value`. Note that `action.key` MUST -be an array, since we use `setIn()`. - -> __Note :__ -> We call this function `localSettings`, but its associated object -> in the store is `local_settings`. - -*/ - -export default function localSettings(state = initialState, action) { - switch(action.type) { - case STORE_HYDRATE: - return hydrate(state, action.state.get('local_settings')); - case LOCAL_SETTING_CHANGE: - return state.setIn(action.key, action.value); - default: - return state; - } -}; diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js deleted file mode 100644 index 5a01c0cdd..000000000 --- a/app/javascript/mastodon/components/status.js +++ /dev/null @@ -1,249 +0,0 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/status - -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import Avatar from './avatar'; -import AvatarOverlay from './avatar_overlay'; -import RelativeTimestamp from './relative_timestamp'; -import DisplayName from './display_name'; -import StatusContent from './status_content'; -import StatusActionBar from './status_action_bar'; -import { FormattedMessage } from 'react-intl'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { MediaGallery, Video } from '../features/ui/util/async-components'; -import { HotKeys } from 'react-hotkeys'; -import classNames from 'classnames'; - -// We use the component (and not the container) since we do not want -// to use the progress bar to show download progress -import Bundle from '../features/ui/components/bundle'; - -export default class Status extends ImmutablePureComponent { - - static contextTypes = { - router: PropTypes.object, - }; - - static propTypes = { - status: ImmutablePropTypes.map, - account: ImmutablePropTypes.map, - onReply: PropTypes.func, - onFavourite: PropTypes.func, - onReblog: PropTypes.func, - onDelete: PropTypes.func, - onPin: PropTypes.func, - onOpenMedia: PropTypes.func, - onOpenVideo: PropTypes.func, - onBlock: PropTypes.func, - onEmbed: PropTypes.func, - onHeightChange: PropTypes.func, - muted: PropTypes.bool, - hidden: PropTypes.bool, - onMoveUp: PropTypes.func, - onMoveDown: PropTypes.func, - }; - - state = { - isExpanded: false, - } - - // Avoid checking props that are functions (and whose equality will always - // evaluate to false. See react-immutable-pure-component for usage. - updateOnProps = [ - 'status', - 'account', - 'muted', - 'hidden', - ] - - updateOnStates = ['isExpanded'] - - handleClick = () => { - if (!this.context.router) { - return; - } - - const { status } = this.props; - this.context.router.history.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`); - } - - handleAccountClick = (e) => { - if (this.context.router && e.button === 0) { - const id = e.currentTarget.getAttribute('data-id'); - e.preventDefault(); - this.context.router.history.push(`/accounts/${id}`); - } - } - - handleExpandedToggle = () => { - this.setState({ isExpanded: !this.state.isExpanded }); - }; - - renderLoadingMediaGallery () { - return <div className='media_gallery' style={{ height: '110px' }} />; - } - - renderLoadingVideoPlayer () { - return <div className='media-spoiler-video' style={{ height: '110px' }} />; - } - - handleOpenVideo = startTime => { - this.props.onOpenVideo(this._properStatus().getIn(['media_attachments', 0]), startTime); - } - - handleHotkeyReply = e => { - e.preventDefault(); - this.props.onReply(this._properStatus(), this.context.router.history); - } - - handleHotkeyFavourite = () => { - this.props.onFavourite(this._properStatus()); - } - - handleHotkeyBoost = e => { - this.props.onReblog(this._properStatus(), e); - } - - handleHotkeyMention = e => { - e.preventDefault(); - this.props.onMention(this._properStatus().get('account'), this.context.router.history); - } - - handleHotkeyOpen = () => { - this.context.router.history.push(`/statuses/${this._properStatus().get('id')}`); - } - - handleHotkeyOpenProfile = () => { - this.context.router.history.push(`/accounts/${this._properStatus().getIn(['account', 'id'])}`); - } - - handleHotkeyMoveUp = () => { - this.props.onMoveUp(this.props.status.get('id')); - } - - handleHotkeyMoveDown = () => { - this.props.onMoveDown(this.props.status.get('id')); - } - - _properStatus () { - const { status } = this.props; - - if (status.get('reblog', null) !== null && typeof status.get('reblog') === 'object') { - return status.get('reblog'); - } else { - return status; - } - } - - render () { - let media = null; - let statusAvatar, prepend; - - const { hidden } = this.props; - const { isExpanded } = this.state; - - let { status, account, ...other } = this.props; - - if (status === null) { - return null; - } - - if (hidden) { - return ( - <div> - {status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])} - {status.get('content')} - </div> - ); - } - - if (status.get('reblog', null) !== null && typeof status.get('reblog') === 'object') { - const display_name_html = { __html: status.getIn(['account', 'display_name_html']) }; - - prepend = ( - <div className='status__prepend'> - <div className='status__prepend-icon-wrapper'><i className='fa fa-fw fa-retweet status__prepend-icon' /></div> - <FormattedMessage id='status.reblogged_by' defaultMessage='{name} boosted' values={{ name: <a onClick={this.handleAccountClick} data-id={status.getIn(['account', 'id'])} href={status.getIn(['account', 'url'])} className='status__display-name muted'><strong dangerouslySetInnerHTML={display_name_html} /></a> }} /> - </div> - ); - - account = status.get('account'); - status = status.get('reblog'); - } - - if (status.get('media_attachments').size > 0 && !this.props.muted) { - if (status.get('media_attachments').some(item => item.get('type') === 'unknown')) { - - } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { - const video = status.getIn(['media_attachments', 0]); - - media = ( - <Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} > - {Component => <Component - preview={video.get('preview_url')} - src={video.get('url')} - width={239} - height={110} - sensitive={status.get('sensitive')} - onOpenVideo={this.handleOpenVideo} - />} - </Bundle> - ); - } else { - media = ( - <Bundle fetchComponent={MediaGallery} loading={this.renderLoadingMediaGallery} > - {Component => <Component media={status.get('media_attachments')} sensitive={status.get('sensitive')} height={110} onOpenMedia={this.props.onOpenMedia} />} - </Bundle> - ); - } - } - - if (account === undefined || account === null) { - statusAvatar = <Avatar account={status.get('account')} size={48} />; - }else{ - statusAvatar = <AvatarOverlay account={status.get('account')} friend={account} />; - } - - const handlers = this.props.muted ? {} : { - reply: this.handleHotkeyReply, - favourite: this.handleHotkeyFavourite, - boost: this.handleHotkeyBoost, - mention: this.handleHotkeyMention, - open: this.handleHotkeyOpen, - openProfile: this.handleHotkeyOpenProfile, - moveUp: this.handleHotkeyMoveUp, - moveDown: this.handleHotkeyMoveDown, - }; - - return ( - <HotKeys handlers={handlers}> - <div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0}> - {prepend} - - <div className={classNames('status', `status-${status.get('visibility')}`, { muted: this.props.muted })} data-id={status.get('id')}> - <div className='status__info'> - <a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a> - - <a onClick={this.handleAccountClick} target='_blank' data-id={status.getIn(['account', 'id'])} href={status.getIn(['account', 'url'])} title={status.getIn(['account', 'acct'])} className='status__display-name'> - <div className='status__avatar'> - {statusAvatar} - </div> - - <DisplayName account={status.get('account')} /> - </a> - </div> - - <StatusContent status={status} onClick={this.handleClick} expanded={isExpanded} onExpandedToggle={this.handleExpandedToggle} /> - - {media} - - <StatusActionBar status={status} account={account} {...other} /> - </div> - </div> - </HotKeys> - ); - } - -} diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js deleted file mode 100644 index 0f7f15dfc..000000000 --- a/app/javascript/mastodon/components/status_content.js +++ /dev/null @@ -1,188 +0,0 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/status/content - -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { isRtl } from '../rtl'; -import { FormattedMessage } from 'react-intl'; -import Permalink from './permalink'; -import classnames from 'classnames'; - -export default class StatusContent extends React.PureComponent { - - static contextTypes = { - router: PropTypes.object, - }; - - static propTypes = { - status: ImmutablePropTypes.map.isRequired, - expanded: PropTypes.bool, - onExpandedToggle: PropTypes.func, - onClick: PropTypes.func, - }; - - state = { - hidden: true, - }; - - _updateStatusLinks () { - const node = this.node; - const links = node.querySelectorAll('a'); - - for (var i = 0; i < links.length; ++i) { - let link = links[i]; - if (link.classList.contains('status-link')) { - continue; - } - link.classList.add('status-link'); - - let mention = this.props.status.get('mentions').find(item => link.href === item.get('url')); - - if (mention) { - link.addEventListener('click', this.onMentionClick.bind(this, mention), false); - link.setAttribute('title', mention.get('acct')); - } else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) { - link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false); - } else { - link.setAttribute('title', link.href); - } - - link.setAttribute('target', '_blank'); - link.setAttribute('rel', 'noopener'); - } - } - - componentDidMount () { - this._updateStatusLinks(); - } - - componentDidUpdate () { - this._updateStatusLinks(); - } - - onMentionClick = (mention, e) => { - if (this.context.router && e.button === 0) { - e.preventDefault(); - this.context.router.history.push(`/accounts/${mention.get('id')}`); - } - } - - onHashtagClick = (hashtag, e) => { - hashtag = hashtag.replace(/^#/, '').toLowerCase(); - - if (this.context.router && e.button === 0) { - e.preventDefault(); - this.context.router.history.push(`/timelines/tag/${hashtag}`); - } - } - - handleMouseDown = (e) => { - this.startXY = [e.clientX, e.clientY]; - } - - handleMouseUp = (e) => { - if (!this.startXY) { - return; - } - - const [ startX, startY ] = this.startXY; - const [ deltaX, deltaY ] = [Math.abs(e.clientX - startX), Math.abs(e.clientY - startY)]; - - if (e.target.localName === 'button' || e.target.localName === 'a' || (e.target.parentNode && (e.target.parentNode.localName === 'button' || e.target.parentNode.localName === 'a'))) { - return; - } - - if (deltaX + deltaY < 5 && e.button === 0 && this.props.onClick) { - this.props.onClick(); - } - - this.startXY = null; - } - - handleSpoilerClick = (e) => { - e.preventDefault(); - - if (this.props.onExpandedToggle) { - // The parent manages the state - this.props.onExpandedToggle(); - } else { - this.setState({ hidden: !this.state.hidden }); - } - } - - setRef = (c) => { - this.node = c; - } - - render () { - const { status } = this.props; - - const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden; - - const content = { __html: status.get('contentHtml') }; - const spoilerContent = { __html: status.get('spoilerHtml') }; - const directionStyle = { direction: 'ltr' }; - const classNames = classnames('status__content', { - 'status__content--with-action': this.props.onClick && this.context.router, - 'status__content--with-spoiler': status.get('spoiler_text').length > 0, - }); - - if (isRtl(status.get('search_index'))) { - directionStyle.direction = 'rtl'; - } - - if (status.get('spoiler_text').length > 0) { - let mentionsPlaceholder = ''; - - const mentionLinks = status.get('mentions').map(item => ( - <Permalink to={`/accounts/${item.get('id')}`} href={item.get('url')} key={item.get('id')} className='mention'> - @<span>{item.get('username')}</span> - </Permalink> - )).reduce((aggregate, item) => [...aggregate, item, ' '], []); - - const toggleText = hidden ? <FormattedMessage id='status.show_more' defaultMessage='Show more' /> : <FormattedMessage id='status.show_less' defaultMessage='Show less' />; - - if (hidden) { - mentionsPlaceholder = <div>{mentionLinks}</div>; - } - - return ( - <div className={classNames} ref={this.setRef} tabIndex='0' onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}> - <p style={{ marginBottom: hidden && status.get('mentions').isEmpty() ? '0px' : null }}> - <span dangerouslySetInnerHTML={spoilerContent} /> - {' '} - <button tabIndex='0' className='status__content__spoiler-link' onClick={this.handleSpoilerClick}>{toggleText}</button> - </p> - - {mentionsPlaceholder} - - <div tabIndex={!hidden ? 0 : null} className={`status__content__text ${!hidden ? 'status__content__text--visible' : ''}`} style={directionStyle} dangerouslySetInnerHTML={content} /> - </div> - ); - } else if (this.props.onClick) { - return ( - <div - ref={this.setRef} - tabIndex='0' - className={classNames} - style={directionStyle} - onMouseDown={this.handleMouseDown} - onMouseUp={this.handleMouseUp} - dangerouslySetInnerHTML={content} - /> - ); - } else { - return ( - <div - tabIndex='0' - ref={this.setRef} - className='status__content' - style={directionStyle} - dangerouslySetInnerHTML={content} - /> - ); - } - } - -} diff --git a/app/javascript/mastodon/features/account/components/header.js b/app/javascript/mastodon/features/account/components/header.js deleted file mode 100644 index b3a73a590..000000000 --- a/app/javascript/mastodon/features/account/components/header.js +++ /dev/null @@ -1,131 +0,0 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/account/header - -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import PropTypes from 'prop-types'; -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import IconButton from '../../../components/icon_button'; -import Motion from '../../ui/util/optional_motion'; -import spring from 'react-motion/lib/spring'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { autoPlayGif, me } from '../../../initial_state'; - -const messages = defineMessages({ - unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, - follow: { id: 'account.follow', defaultMessage: 'Follow' }, - requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, -}); - -class Avatar extends ImmutablePureComponent { - - static propTypes = { - account: ImmutablePropTypes.map.isRequired, - }; - - state = { - isHovered: false, - }; - - handleMouseOver = () => { - if (this.state.isHovered) return; - this.setState({ isHovered: true }); - } - - handleMouseOut = () => { - if (!this.state.isHovered) return; - this.setState({ isHovered: false }); - } - - render () { - const { account } = this.props; - const { isHovered } = this.state; - - return ( - <Motion defaultStyle={{ radius: 90 }} style={{ radius: spring(isHovered ? 30 : 90, { stiffness: 180, damping: 12 }) }}> - {({ radius }) => - <a - href={account.get('url')} - className='account__header__avatar' - role='presentation' - target='_blank' - rel='noopener' - style={{ borderRadius: `${radius}px`, backgroundImage: `url(${autoPlayGif || isHovered ? account.get('avatar') : account.get('avatar_static')})` }} - onMouseOver={this.handleMouseOver} - onMouseOut={this.handleMouseOut} - onFocus={this.handleMouseOver} - onBlur={this.handleMouseOut} - > - <span style={{ display: 'none' }}>{account.get('acct')}</span> - </a> - } - </Motion> - ); - } - -} - -@injectIntl -export default class Header extends ImmutablePureComponent { - - static propTypes = { - account: ImmutablePropTypes.map, - onFollow: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - }; - - render () { - const { account, intl } = this.props; - - if (!account) { - return null; - } - - let info = ''; - let actionBtn = ''; - let lockedIcon = ''; - - if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { - info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>; - } - - if (me !== account.get('id')) { - if (account.getIn(['relationship', 'requested'])) { - actionBtn = ( - <div className='account--action-button'> - <IconButton size={26} active icon='hourglass' title={intl.formatMessage(messages.requested)} onClick={this.props.onFollow} /> - </div> - ); - } else if (!account.getIn(['relationship', 'blocking'])) { - actionBtn = ( - <div className='account--action-button'> - <IconButton size={26} icon={account.getIn(['relationship', 'following']) ? 'user-times' : 'user-plus'} active={account.getIn(['relationship', 'following'])} title={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.props.onFollow} /> - </div> - ); - } - } - - if (account.get('locked')) { - lockedIcon = <i className='fa fa-lock' />; - } - - const content = { __html: account.get('note_emojified') }; - const displayNameHtml = { __html: account.get('display_name_html') }; - - return ( - <div className='account__header' style={{ backgroundImage: `url(${account.get('header')})` }}> - <div> - <Avatar account={account} /> - - <span className='account__header__display-name' dangerouslySetInnerHTML={displayNameHtml} /> - <span className='account__header__username'>@{account.get('acct')} {lockedIcon}</span> - <div className='account__header__content' dangerouslySetInnerHTML={content} /> - - {info} - {actionBtn} - </div> - </div> - ); - } - -} diff --git a/app/javascript/mastodon/features/notifications/components/notification.js b/app/javascript/mastodon/features/notifications/components/notification.js deleted file mode 100644 index 903526822..000000000 --- a/app/javascript/mastodon/features/notifications/components/notification.js +++ /dev/null @@ -1,155 +0,0 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/notification - -import React from 'react'; -import PropTypes from 'prop-types'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import StatusContainer from '../../../containers/status_container'; -import AccountContainer from '../../../containers/account_container'; -import { FormattedMessage } from 'react-intl'; -import Permalink from '../../../components/permalink'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { HotKeys } from 'react-hotkeys'; - -export default class Notification extends ImmutablePureComponent { - - static contextTypes = { - router: PropTypes.object, - }; - - static propTypes = { - notification: ImmutablePropTypes.map.isRequired, - hidden: PropTypes.bool, - onMoveUp: PropTypes.func.isRequired, - onMoveDown: PropTypes.func.isRequired, - onMention: PropTypes.func.isRequired, - }; - - handleMoveUp = () => { - const { notification, onMoveUp } = this.props; - onMoveUp(notification.get('id')); - } - - handleMoveDown = () => { - const { notification, onMoveDown } = this.props; - onMoveDown(notification.get('id')); - } - - handleOpen = () => { - const { notification } = this.props; - - if (notification.get('status')) { - this.context.router.history.push(`/statuses/${notification.get('status')}`); - } else { - this.handleOpenProfile(); - } - } - - handleOpenProfile = () => { - const { notification } = this.props; - this.context.router.history.push(`/accounts/${notification.getIn(['account', 'id'])}`); - } - - handleMention = e => { - e.preventDefault(); - - const { notification, onMention } = this.props; - onMention(notification.get('account'), this.context.router.history); - } - - getHandlers () { - return { - moveUp: this.handleMoveUp, - moveDown: this.handleMoveDown, - open: this.handleOpen, - openProfile: this.handleOpenProfile, - mention: this.handleMention, - reply: this.handleMention, - }; - } - - renderFollow (account, link) { - return ( - <HotKeys handlers={this.getHandlers()}> - <div className='notification notification-follow focusable' tabIndex='0'> - <div className='notification__message'> - <div className='notification__favourite-icon-wrapper'> - <i className='fa fa-fw fa-user-plus' /> - </div> - - <FormattedMessage id='notification.follow' defaultMessage='{name} followed you' values={{ name: link }} /> - </div> - - <AccountContainer id={account.get('id')} withNote={false} hidden={this.props.hidden} /> - </div> - </HotKeys> - ); - } - - renderMention (notification) { - return ( - <StatusContainer - id={notification.get('status')} - withDismiss - hidden={this.props.hidden} - onMoveDown={this.handleMoveDown} - onMoveUp={this.handleMoveUp} - /> - ); - } - - renderFavourite (notification, link) { - return ( - <HotKeys handlers={this.getHandlers()}> - <div className='notification notification-favourite focusable' tabIndex='0'> - <div className='notification__message'> - <div className='notification__favourite-icon-wrapper'> - <i className='fa fa-fw fa-star star-icon' /> - </div> - <FormattedMessage id='notification.favourite' defaultMessage='{name} favourited your status' values={{ name: link }} /> - </div> - - <StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={!!this.props.hidden} /> - </div> - </HotKeys> - ); - } - - renderReblog (notification, link) { - return ( - <HotKeys handlers={this.getHandlers()}> - <div className='notification notification-reblog focusable' tabIndex='0'> - <div className='notification__message'> - <div className='notification__favourite-icon-wrapper'> - <i className='fa fa-fw fa-retweet' /> - </div> - <FormattedMessage id='notification.reblog' defaultMessage='{name} boosted your status' values={{ name: link }} /> - </div> - - <StatusContainer id={notification.get('status')} account={notification.get('account')} muted withDismiss hidden={this.props.hidden} /> - </div> - </HotKeys> - ); - } - - render () { - const { notification } = this.props; - const account = notification.get('account'); - const displayNameHtml = { __html: account.get('display_name_html') }; - const link = <Permalink className='notification__display-name' href={account.get('url')} title={account.get('acct')} to={`/accounts/${account.get('id')}`} dangerouslySetInnerHTML={displayNameHtml} />; - - switch(notification.get('type')) { - case 'follow': - return this.renderFollow(account, link); - case 'mention': - return this.renderMention(notification); - case 'favourite': - return this.renderFavourite(notification, link); - case 'reblog': - return this.renderReblog(notification, link); - } - - return null; - } - -} diff --git a/app/javascript/mastodon/features/standalone/compose/index.js b/app/javascript/mastodon/features/standalone/compose/index.js deleted file mode 100644 index 0d764575f..000000000 --- a/app/javascript/mastodon/features/standalone/compose/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import ComposeFormContainer from '../../compose/containers/compose_form_container'; -import NotificationsContainer from '../../ui/containers/notifications_container'; -import LoadingBarContainer from '../../ui/containers/loading_bar_container'; -import ModalContainer from '../../ui/containers/modal_container'; - -export default class Compose extends React.PureComponent { - - render () { - return ( - <div> - <ComposeFormContainer /> - <NotificationsContainer /> - <ModalContainer /> - <LoadingBarContainer className='loading-bar' /> - </div> - ); - } - -} diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js deleted file mode 100644 index dc8e9dfb9..000000000 --- a/app/javascript/mastodon/features/ui/util/async-components.js +++ /dev/null @@ -1,118 +0,0 @@ -export function EmojiPicker () { - return import(/* webpackChunkName: "emoji_picker" */'../../emoji/emoji_picker'); -} - -export function Compose () { - return import(/* webpackChunkName: "features/compose" */'../../compose'); -} - -export function Notifications () { - return import(/* webpackChunkName: "features/notifications" */'../../notifications'); -} - -export function HomeTimeline () { - return import(/* webpackChunkName: "features/home_timeline" */'../../home_timeline'); -} - -export function PublicTimeline () { - return import(/* webpackChunkName: "features/public_timeline" */'../../public_timeline'); -} - -export function CommunityTimeline () { - return import(/* webpackChunkName: "features/community_timeline" */'../../community_timeline'); -} - -export function HashtagTimeline () { - return import(/* webpackChunkName: "features/hashtag_timeline" */'../../hashtag_timeline'); -} - -export function DirectTimeline() { - return import(/* webpackChunkName: "features/direct_timeline" */'../../direct_timeline'); -} - -export function Status () { - return import(/* webpackChunkName: "features/status" */'../../status'); -} - -export function GettingStarted () { - return import(/* webpackChunkName: "features/getting_started" */'../../getting_started'); -} - -export function PinnedStatuses () { - return import(/* webpackChunkName: "features/pinned_statuses" */'../../pinned_statuses'); -} - -export function AccountTimeline () { - return import(/* webpackChunkName: "features/account_timeline" */'../../account_timeline'); -} - -export function AccountGallery () { - return import(/* webpackChunkName: "features/account_gallery" */'../../account_gallery'); -} - -export function Followers () { - return import(/* webpackChunkName: "features/followers" */'../../followers'); -} - -export function Following () { - return import(/* webpackChunkName: "features/following" */'../../following'); -} - -export function Reblogs () { - return import(/* webpackChunkName: "features/reblogs" */'../../reblogs'); -} - -export function Favourites () { - return import(/* webpackChunkName: "features/favourites" */'../../favourites'); -} - -export function FollowRequests () { - return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests'); -} - -export function GenericNotFound () { - return import(/* webpackChunkName: "features/generic_not_found" */'../../generic_not_found'); -} - -export function FavouritedStatuses () { - return import(/* webpackChunkName: "features/favourited_statuses" */'../../favourited_statuses'); -} - -export function Blocks () { - return import(/* webpackChunkName: "features/blocks" */'../../blocks'); -} - -export function Mutes () { - return import(/* webpackChunkName: "features/mutes" */'../../mutes'); -} - -export function OnboardingModal () { - return import(/* webpackChunkName: "modals/onboarding_modal" */'../components/onboarding_modal'); -} - -export function MuteModal () { - return import(/* webpackChunkName: "modals/mute_modal" */'../components/mute_modal'); -} - -export function ReportModal () { - return import(/* webpackChunkName: "modals/report_modal" */'../components/report_modal'); -} - -export function SettingsModal () { - return import(/* webpackChunkName: "modals/settings_modal" */'glitch/components/local_settings/container'); -} - -// THESE AREN'T USED BY US; SEE `glitch/components/status` AND `mastodon/features/status`. // -// IF MASTODON EVER CHANGES DETAILED STATUSES TO REQUIRE THEM, WE'LL NEED TO UPDATE THE URLS OR SOMETHING LOL. // - -export function MediaGallery () { - return import(/* webpackChunkName: "status/media_gallery" */'../../../components/media_gallery'); -} - -export function Video () { - return import(/* webpackChunkName: "features/video" */'../../video'); -} - -export function EmbedModal () { - return import(/* webpackChunkName: "modals/embed_modal" */'../components/embed_modal'); -} diff --git a/app/javascript/mastodon/test_setup.js b/app/javascript/mastodon/test_setup.js deleted file mode 100644 index 80148379b..000000000 --- a/app/javascript/mastodon/test_setup.js +++ /dev/null @@ -1,5 +0,0 @@ -import { configure } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -const adapter = new Adapter(); -configure({ adapter }); diff --git a/app/javascript/packs/about.js b/app/javascript/packs/about.js index 50c81198e..6ce8757dc 100644 --- a/app/javascript/packs/about.js +++ b/app/javascript/packs/about.js @@ -1,9 +1,9 @@ -import loadPolyfills from '../mastodon/load_polyfills'; +import loadPolyfills from 'themes/glitch/util/load_polyfills'; require.context('../images/', true); function loaded() { - const TimelineContainer = require('../mastodon/containers/timeline_container').default; + const TimelineContainer = require('themes/glitch/containers/timeline_container').default; const React = require('react'); const ReactDOM = require('react-dom'); const mountNode = document.getElementById('mastodon-timeline'); @@ -15,7 +15,7 @@ function loaded() { } function main() { - const ready = require('../mastodon/ready').default; + const ready = require('themes/glitch/util/ready').default; ready(loaded); } diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index d275c3bb0..21dc78986 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,3 +1,7 @@ +// THIS IS THE `vanilla` THEME PACK FILE!! +// IT'S HERE FOR UPSTREAM COMPATIBILITY!! +// THE `glitch` PACK FILE IS IN `themes/glitch/index.js`!! + import loadPolyfills from '../mastodon/load_polyfills'; // import default stylesheet with variables diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js index 5ac6504d4..96e6f4b16 100644 --- a/app/javascript/packs/common.js +++ b/app/javascript/packs/common.js @@ -1,9 +1,6 @@ import { start } from 'rails-ujs'; import 'font-awesome/css/font-awesome.css'; -// import common styling -require('../styles/common.scss'); - require.context('../images/', true); start(); diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 59d0e98dd..4362905da 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -1,6 +1,6 @@ -import loadPolyfills from '../mastodon/load_polyfills'; -import { processBio } from '../glitch/util/bio_metadata'; -import ready from '../mastodon/ready'; +import loadPolyfills from 'themes/glitch/util/load_polyfills'; +import { processBio } from 'themes/glitch/util/bio_metadata'; +import ready from 'themes/glitch/util/ready'; window.addEventListener('message', e => { const data = e.data || {}; @@ -22,12 +22,12 @@ function main() { const { length } = require('stringz'); const IntlRelativeFormat = require('intl-relativeformat').default; const { delegate } = require('rails-ujs'); - const emojify = require('../mastodon/features/emoji/emoji').default; - const { getLocale } = require('../mastodon/locales'); + const emojify = require('../themes/glitch/features/emoji/emoji').default; + const { getLocale } = require('mastodon/locales'); const { localeData } = getLocale(); - const VideoContainer = require('../mastodon/containers/video_container').default; - const MediaGalleryContainer = require('../mastodon/containers/media_gallery_container').default; - const CardContainer = require('../mastodon/containers/card_container').default; + const VideoContainer = require('../themes/glitch/containers/video_container').default; + const MediaGalleryContainer = require('../themes/glitch/containers/media_gallery_container').default; + const CardContainer = require('../themes/glitch/containers/card_container').default; const React = require('react'); const ReactDOM = require('react-dom'); diff --git a/app/javascript/packs/share.js b/app/javascript/packs/share.js index 51e4ae38b..9cd95bcee 100644 --- a/app/javascript/packs/share.js +++ b/app/javascript/packs/share.js @@ -1,9 +1,9 @@ -import loadPolyfills from '../mastodon/load_polyfills'; +import loadPolyfills from 'themes/glitch/util/load_polyfills'; require.context('../images/', true); function loaded() { - const ComposeContainer = require('../mastodon/containers/compose_container').default; + const ComposeContainer = require('themes/glitch/containers/compose_container').default; const React = require('react'); const ReactDOM = require('react-dom'); const mountNode = document.getElementById('mastodon-compose'); @@ -15,7 +15,7 @@ function loaded() { } function main() { - const ready = require('../mastodon/ready').default; + const ready = require('themes/glitch/util/ready').default; ready(loaded); } diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss deleted file mode 100644 index efd34393f..000000000 --- a/app/javascript/styles/application.scss +++ /dev/null @@ -1,23 +0,0 @@ -@import 'mastodon/mixins'; -@import 'mastodon/variables'; -@import 'variables-glitch'; -@import 'fonts/roboto'; -@import 'fonts/roboto-mono'; -@import 'fonts/montserrat'; - -@import 'mastodon/reset'; -@import 'mastodon/basics'; -@import 'mastodon/containers'; -@import 'mastodon/lists'; -@import 'mastodon/footer'; -@import 'mastodon/compact_header'; -@import 'mastodon/landing_strip'; -@import 'mastodon/forms'; -@import 'mastodon/accounts'; -@import 'mastodon/stream_entries'; -@import 'mastodon/components'; -@import 'mastodon/emoji_picker'; -@import 'mastodon/about'; -@import 'mastodon/tables'; -@import 'mastodon/admin'; -@import 'mastodon/rtl'; diff --git a/app/javascript/styles/variables-glitch.scss b/app/javascript/styles/variables-glitch.scss deleted file mode 100644 index 44d3322f2..000000000 --- a/app/javascript/styles/variables-glitch.scss +++ /dev/null @@ -1,3 +0,0 @@ -// glitch-soc added variables - -$dismiss-overlay-width: 4rem; diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/themes/glitch/actions/accounts.js index f63325658..f1a8c5471 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/themes/glitch/actions/accounts.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; export const ACCOUNT_FETCH_REQUEST = 'ACCOUNT_FETCH_REQUEST'; export const ACCOUNT_FETCH_SUCCESS = 'ACCOUNT_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/alerts.js b/app/javascript/themes/glitch/actions/alerts.js index f37fdeeb6..f37fdeeb6 100644 --- a/app/javascript/mastodon/actions/alerts.js +++ b/app/javascript/themes/glitch/actions/alerts.js diff --git a/app/javascript/mastodon/actions/blocks.js b/app/javascript/themes/glitch/actions/blocks.js index 553283a71..6ba9460f0 100644 --- a/app/javascript/mastodon/actions/blocks.js +++ b/app/javascript/themes/glitch/actions/blocks.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; import { fetchRelationships } from './accounts'; export const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; diff --git a/app/javascript/mastodon/actions/bundles.js b/app/javascript/themes/glitch/actions/bundles.js index ecc9c8f7d..ecc9c8f7d 100644 --- a/app/javascript/mastodon/actions/bundles.js +++ b/app/javascript/themes/glitch/actions/bundles.js diff --git a/app/javascript/mastodon/actions/cards.js b/app/javascript/themes/glitch/actions/cards.js index baf04833a..2a1bc369a 100644 --- a/app/javascript/mastodon/actions/cards.js +++ b/app/javascript/themes/glitch/actions/cards.js @@ -1,4 +1,4 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; export const STATUS_CARD_FETCH_REQUEST = 'STATUS_CARD_FETCH_REQUEST'; export const STATUS_CARD_FETCH_SUCCESS = 'STATUS_CARD_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/columns.js b/app/javascript/themes/glitch/actions/columns.js index bcb0cdf98..bcb0cdf98 100644 --- a/app/javascript/mastodon/actions/columns.js +++ b/app/javascript/themes/glitch/actions/columns.js diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/themes/glitch/actions/compose.js index 3ee9e1e7b..07c469477 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/themes/glitch/actions/compose.js @@ -1,6 +1,6 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; import { throttle } from 'lodash'; -import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light'; +import { search as emojiSearch } from 'themes/glitch/util/emoji/emoji_mart_search_light'; import { useEmoji } from './emojis'; import { diff --git a/app/javascript/mastodon/actions/domain_blocks.js b/app/javascript/themes/glitch/actions/domain_blocks.js index 44363697a..0a880394a 100644 --- a/app/javascript/mastodon/actions/domain_blocks.js +++ b/app/javascript/themes/glitch/actions/domain_blocks.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; export const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST'; export const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS'; diff --git a/app/javascript/mastodon/actions/emojis.js b/app/javascript/themes/glitch/actions/emojis.js index 7cd9d4b7b..7cd9d4b7b 100644 --- a/app/javascript/mastodon/actions/emojis.js +++ b/app/javascript/themes/glitch/actions/emojis.js diff --git a/app/javascript/mastodon/actions/favourites.js b/app/javascript/themes/glitch/actions/favourites.js index 09ce51fce..e9b3559af 100644 --- a/app/javascript/mastodon/actions/favourites.js +++ b/app/javascript/themes/glitch/actions/favourites.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; export const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; export const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; diff --git a/app/javascript/mastodon/actions/height_cache.js b/app/javascript/themes/glitch/actions/height_cache.js index 4c752993f..4c752993f 100644 --- a/app/javascript/mastodon/actions/height_cache.js +++ b/app/javascript/themes/glitch/actions/height_cache.js diff --git a/app/javascript/mastodon/actions/interactions.js b/app/javascript/themes/glitch/actions/interactions.js index 7b5f4bd9c..d61a7ba2a 100644 --- a/app/javascript/mastodon/actions/interactions.js +++ b/app/javascript/themes/glitch/actions/interactions.js @@ -1,4 +1,4 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; export const REBLOG_REQUEST = 'REBLOG_REQUEST'; export const REBLOG_SUCCESS = 'REBLOG_SUCCESS'; diff --git a/app/javascript/themes/glitch/actions/local_settings.js b/app/javascript/themes/glitch/actions/local_settings.js new file mode 100644 index 000000000..28660a4e8 --- /dev/null +++ b/app/javascript/themes/glitch/actions/local_settings.js @@ -0,0 +1,24 @@ +export const LOCAL_SETTING_CHANGE = 'LOCAL_SETTING_CHANGE'; + +export function changeLocalSetting(key, value) { + return dispatch => { + dispatch({ + type: LOCAL_SETTING_CHANGE, + key, + value, + }); + + dispatch(saveLocalSettings()); + }; +}; + +// __TODO :__ +// Right now `saveLocalSettings()` doesn't keep track of which user +// is currently signed in, but it might be better to give each user +// their *own* local settings. +export function saveLocalSettings() { + return (_, getState) => { + const localSettings = getState().get('local_settings').toJS(); + localStorage.setItem('mastodon-settings', JSON.stringify(localSettings)); + }; +}; diff --git a/app/javascript/mastodon/actions/modal.js b/app/javascript/themes/glitch/actions/modal.js index 80e15c28e..80e15c28e 100644 --- a/app/javascript/mastodon/actions/modal.js +++ b/app/javascript/themes/glitch/actions/modal.js diff --git a/app/javascript/mastodon/actions/mutes.js b/app/javascript/themes/glitch/actions/mutes.js index 3474250fe..bb19e8657 100644 --- a/app/javascript/mastodon/actions/mutes.js +++ b/app/javascript/themes/glitch/actions/mutes.js @@ -1,6 +1,6 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; import { fetchRelationships } from './accounts'; -import { openModal } from '../../mastodon/actions/modal'; +import { openModal } from 'themes/glitch/actions/modal'; export const MUTES_FETCH_REQUEST = 'MUTES_FETCH_REQUEST'; export const MUTES_FETCH_SUCCESS = 'MUTES_FETCH_SUCCESS'; @@ -100,4 +100,4 @@ export function toggleHideNotifications() { return dispatch => { dispatch({ type: MUTES_TOGGLE_HIDE_NOTIFICATIONS }); }; -} \ No newline at end of file +} diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/themes/glitch/actions/notifications.js index 4a4462e1d..fbf06f7c4 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/themes/glitch/actions/notifications.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; import { List as ImmutableList } from 'immutable'; import IntlMessageFormat from 'intl-messageformat'; import { fetchRelationships } from './accounts'; diff --git a/app/javascript/mastodon/actions/onboarding.js b/app/javascript/themes/glitch/actions/onboarding.js index a161c50ef..a161c50ef 100644 --- a/app/javascript/mastodon/actions/onboarding.js +++ b/app/javascript/themes/glitch/actions/onboarding.js diff --git a/app/javascript/mastodon/actions/pin_statuses.js b/app/javascript/themes/glitch/actions/pin_statuses.js index 3f40f6c2d..b3e064e58 100644 --- a/app/javascript/mastodon/actions/pin_statuses.js +++ b/app/javascript/themes/glitch/actions/pin_statuses.js @@ -1,10 +1,10 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; -import { me } from '../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; export function fetchPinnedStatuses() { return (dispatch, getState) => { diff --git a/app/javascript/mastodon/actions/push_notifications.js b/app/javascript/themes/glitch/actions/push_notifications.js index 55661d2b0..55661d2b0 100644 --- a/app/javascript/mastodon/actions/push_notifications.js +++ b/app/javascript/themes/glitch/actions/push_notifications.js diff --git a/app/javascript/mastodon/actions/reports.js b/app/javascript/themes/glitch/actions/reports.js index b19a07285..93f9085b2 100644 --- a/app/javascript/mastodon/actions/reports.js +++ b/app/javascript/themes/glitch/actions/reports.js @@ -1,4 +1,4 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; import { openModal, closeModal } from './modal'; export const REPORT_INIT = 'REPORT_INIT'; diff --git a/app/javascript/mastodon/actions/search.js b/app/javascript/themes/glitch/actions/search.js index 78c6109f7..414e4755e 100644 --- a/app/javascript/mastodon/actions/search.js +++ b/app/javascript/themes/glitch/actions/search.js @@ -1,4 +1,4 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; export const SEARCH_CHANGE = 'SEARCH_CHANGE'; export const SEARCH_CLEAR = 'SEARCH_CLEAR'; diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/themes/glitch/actions/settings.js index 79adca18c..79adca18c 100644 --- a/app/javascript/mastodon/actions/settings.js +++ b/app/javascript/themes/glitch/actions/settings.js diff --git a/app/javascript/mastodon/actions/statuses.js b/app/javascript/themes/glitch/actions/statuses.js index 2204e0b14..702f4e9b6 100644 --- a/app/javascript/mastodon/actions/statuses.js +++ b/app/javascript/themes/glitch/actions/statuses.js @@ -1,4 +1,4 @@ -import api from '../api'; +import api from 'themes/glitch/util/api'; import { deleteFromTimelines } from './timelines'; import { fetchStatusCard } from './cards'; diff --git a/app/javascript/mastodon/actions/store.js b/app/javascript/themes/glitch/actions/store.js index a1db0fdd5..a1db0fdd5 100644 --- a/app/javascript/mastodon/actions/store.js +++ b/app/javascript/themes/glitch/actions/store.js diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/themes/glitch/actions/streaming.js index e60ddacd9..ccf6c27d8 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/themes/glitch/actions/streaming.js @@ -1,4 +1,4 @@ -import { connectStream } from '../stream'; +import { connectStream } from 'themes/glitch/util/stream'; import { updateTimeline, deleteFromTimelines, @@ -7,7 +7,7 @@ import { disconnectTimeline, } from './timelines'; import { updateNotifications, refreshNotifications } from './notifications'; -import { getLocale } from '../locales'; +import { getLocale } from 'mastodon/locales'; const { messages } = getLocale(); diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/themes/glitch/actions/timelines.js index 935bbb6f0..5ce14fbe9 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/themes/glitch/actions/timelines.js @@ -1,4 +1,4 @@ -import api, { getLinks } from '../api'; +import api, { getLinks } from 'themes/glitch/util/api'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; export const TIMELINE_UPDATE = 'TIMELINE_UPDATE'; diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap b/app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar-test.js.snap index 4005c860f..4005c860f 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.js.snap +++ b/app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar-test.js.snap diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap b/app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar_overlay-test.js.snap index d9e5e5252..d9e5e5252 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar_overlay-test.js.snap +++ b/app/javascript/themes/glitch/components/__tests__/__snapshots__/avatar_overlay-test.js.snap diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap b/app/javascript/themes/glitch/components/__tests__/__snapshots__/button-test.js.snap index 707cbf673..707cbf673 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/button-test.js.snap +++ b/app/javascript/themes/glitch/components/__tests__/__snapshots__/button-test.js.snap diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap b/app/javascript/themes/glitch/components/__tests__/__snapshots__/display_name-test.js.snap index 533359ffe..533359ffe 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/display_name-test.js.snap +++ b/app/javascript/themes/glitch/components/__tests__/__snapshots__/display_name-test.js.snap diff --git a/app/javascript/mastodon/components/__tests__/avatar-test.js b/app/javascript/themes/glitch/components/__tests__/avatar-test.js index dd3f7b7d2..dd3f7b7d2 100644 --- a/app/javascript/mastodon/components/__tests__/avatar-test.js +++ b/app/javascript/themes/glitch/components/__tests__/avatar-test.js diff --git a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js b/app/javascript/themes/glitch/components/__tests__/avatar_overlay-test.js index 44addea83..44addea83 100644 --- a/app/javascript/mastodon/components/__tests__/avatar_overlay-test.js +++ b/app/javascript/themes/glitch/components/__tests__/avatar_overlay-test.js diff --git a/app/javascript/mastodon/components/__tests__/button-test.js b/app/javascript/themes/glitch/components/__tests__/button-test.js index 924ba39dc..924ba39dc 100644 --- a/app/javascript/mastodon/components/__tests__/button-test.js +++ b/app/javascript/themes/glitch/components/__tests__/button-test.js diff --git a/app/javascript/mastodon/components/__tests__/display_name-test.js b/app/javascript/themes/glitch/components/__tests__/display_name-test.js index 0d040c4cd..0d040c4cd 100644 --- a/app/javascript/mastodon/components/__tests__/display_name-test.js +++ b/app/javascript/themes/glitch/components/__tests__/display_name-test.js diff --git a/app/javascript/mastodon/components/account.js b/app/javascript/themes/glitch/components/account.js index 2c3a00064..d0ff77050 100644 --- a/app/javascript/mastodon/components/account.js +++ b/app/javascript/themes/glitch/components/account.js @@ -7,7 +7,7 @@ import Permalink from './permalink'; import IconButton from './icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me } from '../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ follow: { id: 'account.follow', defaultMessage: 'Follow' }, diff --git a/app/javascript/mastodon/components/attachment_list.js b/app/javascript/themes/glitch/components/attachment_list.js index b3d00b335..b3d00b335 100644 --- a/app/javascript/mastodon/components/attachment_list.js +++ b/app/javascript/themes/glitch/components/attachment_list.js diff --git a/app/javascript/mastodon/components/autosuggest_emoji.js b/app/javascript/themes/glitch/components/autosuggest_emoji.js index ce4383a60..3c6f915e4 100644 --- a/app/javascript/mastodon/components/autosuggest_emoji.js +++ b/app/javascript/themes/glitch/components/autosuggest_emoji.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light'; +import unicodeMapping from 'themes/glitch/util/emoji/emoji_unicode_mapping_light'; const assetHost = process.env.CDN_HOST || ''; diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/themes/glitch/components/autosuggest_textarea.js index a065ac988..fa93847a2 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/themes/glitch/components/autosuggest_textarea.js @@ -1,9 +1,9 @@ import React from 'react'; -import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; +import AutosuggestAccountContainer from 'themes/glitch/features/compose/containers/autosuggest_account_container'; import AutosuggestEmoji from './autosuggest_emoji'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { isRtl } from '../rtl'; +import { isRtl } from 'themes/glitch/util/rtl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Textarea from 'react-textarea-autosize'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/components/avatar.js b/app/javascript/themes/glitch/components/avatar.js index dd155f059..dd155f059 100644 --- a/app/javascript/mastodon/components/avatar.js +++ b/app/javascript/themes/glitch/components/avatar.js diff --git a/app/javascript/mastodon/components/avatar_overlay.js b/app/javascript/themes/glitch/components/avatar_overlay.js index 2ecf9fa44..2ecf9fa44 100644 --- a/app/javascript/mastodon/components/avatar_overlay.js +++ b/app/javascript/themes/glitch/components/avatar_overlay.js diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/themes/glitch/components/button.js index 16868010c..16868010c 100644 --- a/app/javascript/mastodon/components/button.js +++ b/app/javascript/themes/glitch/components/button.js diff --git a/app/javascript/mastodon/components/collapsable.js b/app/javascript/themes/glitch/components/collapsable.js index 42ea37ec2..8bc0a54f4 100644 --- a/app/javascript/mastodon/components/collapsable.js +++ b/app/javascript/themes/glitch/components/collapsable.js @@ -1,5 +1,5 @@ import React from 'react'; -import Motion from '../features/ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import PropTypes from 'prop-types'; diff --git a/app/javascript/mastodon/components/column.js b/app/javascript/themes/glitch/components/column.js index 2e1467595..adeba9cc1 100644 --- a/app/javascript/mastodon/components/column.js +++ b/app/javascript/themes/glitch/components/column.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import detectPassiveEvents from 'detect-passive-events'; -import { scrollTop } from '../scroll'; +import { scrollTop } from 'themes/glitch/util/scroll'; export default class Column extends React.PureComponent { diff --git a/app/javascript/mastodon/components/column_back_button.js b/app/javascript/themes/glitch/components/column_back_button.js index 50c3bf11f..50c3bf11f 100644 --- a/app/javascript/mastodon/components/column_back_button.js +++ b/app/javascript/themes/glitch/components/column_back_button.js diff --git a/app/javascript/mastodon/components/column_back_button_slim.js b/app/javascript/themes/glitch/components/column_back_button_slim.js index 2cdf1b25b..2cdf1b25b 100644 --- a/app/javascript/mastodon/components/column_back_button_slim.js +++ b/app/javascript/themes/glitch/components/column_back_button_slim.js diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/themes/glitch/components/column_header.js index 71530ffdd..e601082c8 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/themes/glitch/components/column_header.js @@ -5,7 +5,7 @@ import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; // Glitch imports -import NotificationPurgeButtonsContainer from '../../glitch/components/column/notif_cleaning_widget/container'; +import NotificationPurgeButtonsContainer from 'themes/glitch/containers/notification_purge_buttons_container'; const messages = defineMessages({ show: { id: 'column_header.show_settings', defaultMessage: 'Show settings' }, diff --git a/app/javascript/mastodon/components/display_name.js b/app/javascript/themes/glitch/components/display_name.js index 2cf84f8f4..2cf84f8f4 100644 --- a/app/javascript/mastodon/components/display_name.js +++ b/app/javascript/themes/glitch/components/display_name.js diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/themes/glitch/components/dropdown_menu.js index 3a3ebf487..d30dc2aaf 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/themes/glitch/components/dropdown_menu.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import IconButton from './icon_button'; import Overlay from 'react-overlays/lib/Overlay'; -import Motion from '../features/ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import detectPassiveEvents from 'detect-passive-events'; diff --git a/app/javascript/mastodon/components/extended_video_player.js b/app/javascript/themes/glitch/components/extended_video_player.js index f8bd067e8..f8bd067e8 100644 --- a/app/javascript/mastodon/components/extended_video_player.js +++ b/app/javascript/themes/glitch/components/extended_video_player.js diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/themes/glitch/components/icon_button.js index d0c1b049f..31cdf4703 100644 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/themes/glitch/components/icon_button.js @@ -1,5 +1,5 @@ import React from 'react'; -import Motion from '../features/ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import PropTypes from 'prop-types'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/components/intersection_observer_article.js b/app/javascript/themes/glitch/components/intersection_observer_article.js index e2ce9ec96..f0139ac75 100644 --- a/app/javascript/mastodon/components/intersection_observer_article.js +++ b/app/javascript/themes/glitch/components/intersection_observer_article.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import scheduleIdleTask from '../features/ui/util/schedule_idle_task'; -import getRectFromEntry from '../features/ui/util/get_rect_from_entry'; +import scheduleIdleTask from 'themes/glitch/util/schedule_idle_task'; +import getRectFromEntry from 'themes/glitch/util/get_rect_from_entry'; import { is } from 'immutable'; // Diff these props in the "rendered" state diff --git a/app/javascript/mastodon/components/load_more.js b/app/javascript/themes/glitch/components/load_more.js index c4c8c94a2..c4c8c94a2 100644 --- a/app/javascript/mastodon/components/load_more.js +++ b/app/javascript/themes/glitch/components/load_more.js diff --git a/app/javascript/mastodon/components/loading_indicator.js b/app/javascript/themes/glitch/components/loading_indicator.js index d6a5adb6f..d6a5adb6f 100644 --- a/app/javascript/mastodon/components/loading_indicator.js +++ b/app/javascript/themes/glitch/components/loading_indicator.js diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/themes/glitch/components/media_gallery.js index 5ed46dc93..05390c82f 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/themes/glitch/components/media_gallery.js @@ -1,15 +1,12 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/status/gallery - import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { is } from 'immutable'; import IconButton from './icon_button'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { isIOS } from '../is_mobile'; +import { isIOS } from 'themes/glitch/util/is_mobile'; import classNames from 'classnames'; -import { autoPlayGif } from '../initial_state'; +import { autoPlayGif } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Toggle visibility' }, @@ -26,6 +23,7 @@ class Item extends React.PureComponent { standalone: PropTypes.bool, index: PropTypes.number.isRequired, size: PropTypes.number.isRequired, + letterbox: PropTypes.bool, onClick: PropTypes.func.isRequired, }; @@ -65,7 +63,7 @@ class Item extends React.PureComponent { } render () { - const { attachment, index, size, standalone } = this.props; + const { attachment, index, size, standalone, letterbox } = this.props; let width = 50; let height = 100; @@ -137,7 +135,7 @@ class Item extends React.PureComponent { onClick={this.handleClick} target='_blank' > - <img src={previewUrl} srcSet={srcSet} sizes={sizes} alt={attachment.get('description')} title={attachment.get('description')} /> + <img className={letterbox ? 'letterbox' : null} src={previewUrl} srcSet={srcSet} sizes={sizes} alt={attachment.get('description')} title={attachment.get('description')} /> </a> ); } else if (attachment.get('type') === 'gifv') { @@ -146,7 +144,7 @@ class Item extends React.PureComponent { thumbnail = ( <div className={classNames('media-gallery__gifv', { autoplay: autoPlay })}> <video - className='media-gallery__item-gifv-thumbnail' + className={`media-gallery__item-gifv-thumbnail${letterbox ? ' letterbox' : ''}`} aria-label={attachment.get('description')} role='application' src={attachment.get('url')} @@ -178,9 +176,10 @@ export default class MediaGallery extends React.PureComponent { static propTypes = { sensitive: PropTypes.bool, standalone: PropTypes.bool, + letterbox: PropTypes.bool, + fullwidth: PropTypes.bool, media: ImmutablePropTypes.list.isRequired, size: PropTypes.object, - height: PropTypes.number.isRequired, onOpenMedia: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; @@ -207,41 +206,17 @@ export default class MediaGallery extends React.PureComponent { this.props.onOpenMedia(this.props.media, index); } - handleRef = (node) => { - if (node && this.isStandaloneEligible()) { - // offsetWidth triggers a layout, so only calculate when we need to - this.setState({ - width: node.offsetWidth, - }); - } - } - isStandaloneEligible() { const { media, standalone } = this.props; return standalone && media.size === 1 && media.getIn([0, 'meta', 'small', 'aspect']); } render () { - const { media, intl, sensitive, height } = this.props; - const { width, visible } = this.state; + const { media, intl, sensitive, letterbox, fullwidth } = this.props; + const { visible } = this.state; let children; - const style = {}; - - if (this.isStandaloneEligible()) { - if (!visible && width) { - // only need to forcibly set the height in "sensitive" mode - style.height = width / this.props.media.getIn([0, 'meta', 'small', 'aspect']); - } else { - // layout automatically, using image's natural aspect ratio - style.height = ''; - } - } else { - // crop the image - style.height = height; - } - if (!visible) { let warning; @@ -252,7 +227,7 @@ export default class MediaGallery extends React.PureComponent { } children = ( - <button className='media-spoiler' onClick={this.handleOpen} style={style} ref={this.handleRef}> + <button className='media-spoiler' onClick={this.handleOpen}> <span className='media-spoiler__warning'>{warning}</span> <span className='media-spoiler__trigger'><FormattedMessage id='status.sensitive_toggle' defaultMessage='Click to view' /></span> </button> @@ -263,12 +238,12 @@ export default class MediaGallery extends React.PureComponent { if (this.isStandaloneEligible()) { children = <Item standalone onClick={this.handleClick} attachment={media.get(0)} />; } else { - children = media.take(4).map((attachment, i) => <Item key={attachment.get('id')} onClick={this.handleClick} attachment={attachment} index={i} size={size} />); + children = media.take(4).map((attachment, i) => <Item key={attachment.get('id')} onClick={this.handleClick} attachment={attachment} index={i} size={size} letterbox={letterbox} />); } } return ( - <div className='media-gallery' style={style}> + <div className={`media-gallery ${fullwidth ? 'full-width' : ''}`}> <div className={classNames('spoiler-button', { 'spoiler-button--visible': visible })}> <IconButton title={intl.formatMessage(messages.toggle_visible)} icon={visible ? 'eye' : 'eye-slash'} overlay onClick={this.handleOpen} /> </div> diff --git a/app/javascript/mastodon/components/missing_indicator.js b/app/javascript/themes/glitch/components/missing_indicator.js index 87df7f61c..87df7f61c 100644 --- a/app/javascript/mastodon/components/missing_indicator.js +++ b/app/javascript/themes/glitch/components/missing_indicator.js diff --git a/app/javascript/glitch/components/column/notif_cleaning_widget/notification_purge_buttons.js b/app/javascript/themes/glitch/components/notification_purge_buttons.js index 62c887fb7..e0c1543b0 100644 --- a/app/javascript/glitch/components/column/notif_cleaning_widget/notification_purge_buttons.js +++ b/app/javascript/themes/glitch/components/notification_purge_buttons.js @@ -11,10 +11,6 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -// Mastodon imports // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - const messages = defineMessages({ btnAll : { id: 'notification_purge.btn_all', defaultMessage: 'Select\nall' }, btnNone : { id: 'notification_purge.btn_none', defaultMessage: 'Select\nnone' }, diff --git a/app/javascript/mastodon/components/permalink.js b/app/javascript/themes/glitch/components/permalink.js index d726d37a2..d726d37a2 100644 --- a/app/javascript/mastodon/components/permalink.js +++ b/app/javascript/themes/glitch/components/permalink.js diff --git a/app/javascript/mastodon/components/relative_timestamp.js b/app/javascript/themes/glitch/components/relative_timestamp.js index 51588e78c..51588e78c 100644 --- a/app/javascript/mastodon/components/relative_timestamp.js +++ b/app/javascript/themes/glitch/components/relative_timestamp.js diff --git a/app/javascript/mastodon/components/scrollable_list.js b/app/javascript/themes/glitch/components/scrollable_list.js index 71228ca6c..ccdcd7c85 100644 --- a/app/javascript/mastodon/components/scrollable_list.js +++ b/app/javascript/themes/glitch/components/scrollable_list.js @@ -1,13 +1,13 @@ import React, { PureComponent } from 'react'; import { ScrollContainer } from 'react-router-scroll-4'; import PropTypes from 'prop-types'; -import IntersectionObserverArticleContainer from '../containers/intersection_observer_article_container'; +import IntersectionObserverArticleContainer from 'themes/glitch/containers/intersection_observer_article_container'; import LoadMore from './load_more'; -import IntersectionObserverWrapper from '../features/ui/util/intersection_observer_wrapper'; +import IntersectionObserverWrapper from 'themes/glitch/util/intersection_observer_wrapper'; import { throttle } from 'lodash'; import { List as ImmutableList } from 'immutable'; import classNames from 'classnames'; -import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../features/ui/util/fullscreen'; +import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'themes/glitch/util/fullscreen'; export default class ScrollableList extends PureComponent { diff --git a/app/javascript/mastodon/components/setting_text.js b/app/javascript/themes/glitch/components/setting_text.js index a6dde4c0f..a6dde4c0f 100644 --- a/app/javascript/mastodon/components/setting_text.js +++ b/app/javascript/themes/glitch/components/setting_text.js diff --git a/app/javascript/themes/glitch/components/status.js b/app/javascript/themes/glitch/components/status.js new file mode 100644 index 000000000..cf2fbe21e --- /dev/null +++ b/app/javascript/themes/glitch/components/status.js @@ -0,0 +1,436 @@ +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import StatusPrepend from './status_prepend'; +import StatusHeader from './status_header'; +import StatusContent from './status_content'; +import StatusActionBar from './status_action_bar'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { MediaGallery, Video } from 'themes/glitch/util/async-components'; +import { HotKeys } from 'react-hotkeys'; +import NotificationOverlayContainer from 'themes/glitch/features/notifications/containers/overlay_container'; + +// We use the component (and not the container) since we do not want +// to use the progress bar to show download progress +import Bundle from '../features/ui/components/bundle'; + +export default class Status extends ImmutablePureComponent { + + static contextTypes = { + router: PropTypes.object, + }; + + static propTypes = { + id: PropTypes.string, + status: ImmutablePropTypes.map, + account: ImmutablePropTypes.map, + onReply: PropTypes.func, + onFavourite: PropTypes.func, + onReblog: PropTypes.func, + onDelete: PropTypes.func, + onPin: PropTypes.func, + onOpenMedia: PropTypes.func, + onOpenVideo: PropTypes.func, + onBlock: PropTypes.func, + onEmbed: PropTypes.func, + onHeightChange: PropTypes.func, + muted: PropTypes.bool, + collapse: PropTypes.bool, + hidden: PropTypes.bool, + prepend: PropTypes.string, + withDismiss: PropTypes.bool, + onMoveUp: PropTypes.func, + onMoveDown: PropTypes.func, + }; + + state = { + isExpanded: null, + markedForDelete: false, + } + + // Avoid checking props that are functions (and whose equality will always + // evaluate to false. See react-immutable-pure-component for usage. + updateOnProps = [ + 'status', + 'account', + 'settings', + 'prepend', + 'boostModal', + 'muted', + 'collapse', + 'notification', + ] + + updateOnStates = [ + 'isExpanded', + 'markedForDelete', + ] + + // If our settings have changed to disable collapsed statuses, then we + // need to make sure that we uncollapse every one. We do that by watching + // for changes to `settings.collapsed.enabled` in + // `componentWillReceiveProps()`. + + // We also need to watch for changes on the `collapse` prop---if this + // changes to anything other than `undefined`, then we need to collapse or + // uncollapse our status accordingly. + componentWillReceiveProps (nextProps) { + if (!nextProps.settings.getIn(['collapsed', 'enabled'])) { + if (this.state.isExpanded === false) { + this.setExpansion(null); + } + } else if ( + nextProps.collapse !== this.props.collapse && + nextProps.collapse !== undefined + ) this.setExpansion(nextProps.collapse ? false : null); + } + + // When mounting, we just check to see if our status should be collapsed, + // and collapse it if so. We don't need to worry about whether collapsing + // is enabled here, because `setExpansion()` already takes that into + // account. + + // The cases where a status should be collapsed are: + // + // - The `collapse` prop has been set to `true` + // - The user has decided in local settings to collapse all statuses. + // - The user has decided to collapse all notifications ('muted' + // statuses). + // - The user has decided to collapse long statuses and the status is + // over 400px (without media, or 650px with). + // - The status is a reply and the user has decided to collapse all + // replies. + // - The status contains media and the user has decided to collapse all + // statuses with media. + // - The status is a reblog the user has decided to collapse all + // statuses which are reblogs. + componentDidMount () { + const { node } = this; + const { + status, + settings, + collapse, + muted, + prepend, + } = this.props; + const autoCollapseSettings = settings.getIn(['collapsed', 'auto']); + + if (function () { + switch (true) { + case collapse: + case autoCollapseSettings.get('all'): + case autoCollapseSettings.get('notifications') && muted: + case autoCollapseSettings.get('lengthy') && node.clientHeight > ( + status.get('media_attachments').size && !muted ? 650 : 400 + ): + case autoCollapseSettings.get('reblogs') && prepend === 'reblogged_by': + case autoCollapseSettings.get('replies') && status.get('in_reply_to_id', null) !== null: + case autoCollapseSettings.get('media') && !(status.get('spoiler_text').length) && status.get('media_attachments').size: + return true; + default: + return false; + } + }()) this.setExpansion(false); + } + + // `setExpansion()` sets the value of `isExpanded` in our state. It takes + // one argument, `value`, which gives the desired value for `isExpanded`. + // The default for this argument is `null`. + + // `setExpansion()` automatically checks for us whether toot collapsing + // is enabled, so we don't have to. + setExpansion = (value) => { + switch (true) { + case value === undefined || value === null: + this.setState({ isExpanded: null }); + break; + case !value && this.props.settings.getIn(['collapsed', 'enabled']): + this.setState({ isExpanded: false }); + break; + case !!value: + this.setState({ isExpanded: true }); + break; + } + } + + // `parseClick()` takes a click event and responds appropriately. + // If our status is collapsed, then clicking on it should uncollapse it. + // If `Shift` is held, then clicking on it should collapse it. + // Otherwise, we open the url handed to us in `destination`, if + // applicable. + parseClick = (e, destination) => { + const { router } = this.context; + const { status } = this.props; + const { isExpanded } = this.state; + if (!router) return; + if (destination === undefined) { + destination = `/statuses/${ + status.getIn(['reblog', 'id'], status.get('id')) + }`; + } + if (e.button === 0) { + if (isExpanded === false) this.setExpansion(null); + else if (e.shiftKey) { + this.setExpansion(false); + document.getSelection().removeAllRanges(); + } else router.history.push(destination); + e.preventDefault(); + } + } + + handleAccountClick = (e) => { + if (this.context.router && e.button === 0) { + const id = e.currentTarget.getAttribute('data-id'); + e.preventDefault(); + this.context.router.history.push(`/accounts/${id}`); + } + } + + handleExpandedToggle = () => { + this.setExpansion(this.state.isExpanded || !this.props.status.get('spoiler') ? null : true); + }; + + handleOpenVideo = startTime => { + this.props.onOpenVideo(this.props.status.getIn(['media_attachments', 0]), startTime); + } + + handleHotkeyReply = e => { + e.preventDefault(); + this.props.onReply(this.props.status, this.context.router.history); + } + + handleHotkeyFavourite = () => { + this.props.onFavourite(this.props.status); + } + + handleHotkeyBoost = e => { + this.props.onReblog(this.props.status, e); + } + + handleHotkeyMention = e => { + e.preventDefault(); + this.props.onMention(this.props.status.get('account'), this.context.router.history); + } + + handleHotkeyOpen = () => { + this.context.router.history.push(`/statuses/${this.props.status.get('id')}`); + } + + handleHotkeyOpenProfile = () => { + this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); + } + + handleHotkeyMoveUp = () => { + this.props.onMoveUp(this.props.status.get('id')); + } + + handleHotkeyMoveDown = () => { + this.props.onMoveDown(this.props.status.get('id')); + } + + renderLoadingMediaGallery () { + return <div className='media_gallery' style={{ height: '110px' }} />; + } + + renderLoadingVideoPlayer () { + return <div className='media-spoiler-video' style={{ height: '110px' }} />; + } + + render () { + const { + parseClick, + setExpansion, + } = this; + const { router } = this.context; + const { + status, + account, + settings, + collapsed, + muted, + prepend, + intersectionObserverWrapper, + onOpenVideo, + onOpenMedia, + notification, + hidden, + ...other + } = this.props; + const { isExpanded } = this.state; + let background = null; + let attachments = null; + let media = null; + let mediaIcon = null; + + if (status === null) { + return null; + } + + if (hidden) { + return ( + <div + ref={this.handleRef} + data-id={status.get('id')} + style={{ + height: `${this.height}px`, + opacity: 0, + overflow: 'hidden', + }} + > + {status.getIn(['account', 'display_name']) || status.getIn(['account', 'username'])} + {' '} + {status.get('content')} + </div> + ); + } + + // If user backgrounds for collapsed statuses are enabled, then we + // initialize our background accordingly. This will only be rendered if + // the status is collapsed. + if (settings.getIn(['collapsed', 'backgrounds', 'user_backgrounds'])) { + background = status.getIn(['account', 'header']); + } + + // This handles our media attachments. Note that we don't show media on + // muted (notification) statuses. If the media type is unknown, then we + // simply ignore it. + + // After we have generated our appropriate media element and stored it in + // `media`, we snatch the thumbnail to use as our `background` if media + // backgrounds for collapsed statuses are enabled. + attachments = status.get('media_attachments'); + if (attachments.size > 0 && !muted) { + if (attachments.some(item => item.get('type') === 'unknown')) { // Media type is 'unknown' + /* Do nothing */ + } else if (attachments.getIn([0, 'type']) === 'video') { // Media type is 'video' + const video = status.getIn(['media_attachments', 0]); + + media = ( + <Bundle fetchComponent={Video} loading={this.renderLoadingVideoPlayer} > + {Component => <Component + preview={video.get('preview_url')} + src={video.get('url')} + sensitive={status.get('sensitive')} + letterbox={settings.getIn(['media', 'letterbox'])} + fullwidth={settings.getIn(['media', 'fullwidth'])} + onOpenVideo={this.handleOpenVideo} + />} + </Bundle> + ); + mediaIcon = 'video-camera'; + } else { // Media type is 'image' or 'gifv' + media = ( + <Bundle fetchComponent={MediaGallery} loading={this.renderLoadingMediaGallery} > + {Component => ( + <Component + media={attachments} + sensitive={status.get('sensitive')} + letterbox={settings.getIn(['media', 'letterbox'])} + fullwidth={settings.getIn(['media', 'fullwidth'])} + onOpenMedia={this.props.onOpenMedia} + /> + )} + </Bundle> + ); + mediaIcon = 'picture-o'; + } + + if (!status.get('sensitive') && !(status.get('spoiler_text').length > 0) && settings.getIn(['collapsed', 'backgrounds', 'preview_images'])) { + background = attachments.getIn([0, 'preview_url']); + } + } + + // Here we prepare extra data-* attributes for CSS selectors. + // Users can use those for theming, hiding avatars etc via UserStyle + const selectorAttribs = { + 'data-status-by': `@${status.getIn(['account', 'acct'])}`, + }; + + if (prepend && account) { + const notifKind = { + favourite: 'favourited', + reblog: 'boosted', + reblogged_by: 'boosted', + }[prepend]; + + selectorAttribs[`data-${notifKind}-by`] = `@${account.get('acct')}`; + } + + const handlers = { + reply: this.handleHotkeyReply, + favourite: this.handleHotkeyFavourite, + boost: this.handleHotkeyBoost, + mention: this.handleHotkeyMention, + open: this.handleHotkeyOpen, + openProfile: this.handleHotkeyOpenProfile, + moveUp: this.handleHotkeyMoveUp, + moveDown: this.handleHotkeyMoveDown, + }; + + return ( + <HotKeys handlers={handlers}> + <div + className={ + `status${ + muted ? ' muted' : '' + } status-${status.get('visibility')}${ + isExpanded === false ? ' collapsed' : '' + }${ + isExpanded === false && background ? ' has-background' : '' + }${ + this.state.markedForDelete ? ' marked-for-delete' : '' + }` + } + style={{ + backgroundImage: ( + isExpanded === false && background ? + `url(${background})` : + 'none' + ), + }} + {...selectorAttribs} + > + {prepend && account ? ( + <StatusPrepend + type={prepend} + account={account} + parseClick={parseClick} + notificationId={this.props.notificationId} + /> + ) : null} + <StatusHeader + status={status} + friend={account} + mediaIcon={mediaIcon} + collapsible={settings.getIn(['collapsed', 'enabled'])} + collapsed={isExpanded === false} + parseClick={parseClick} + setExpansion={setExpansion} + /> + <StatusContent + status={status} + media={media} + mediaIcon={mediaIcon} + expanded={isExpanded} + setExpansion={setExpansion} + parseClick={parseClick} + disabled={!router} + /> + {isExpanded !== false ? ( + <StatusActionBar + {...other} + status={status} + account={status.get('account')} + /> + ) : null} + {notification ? ( + <NotificationOverlayContainer + notification={notification} + /> + ) : null} + </div> + </HotKeys> + ); + } + +} diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/themes/glitch/components/status_action_bar.js index 35daf70b9..9d615ed7c 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/themes/glitch/components/status_action_bar.js @@ -5,10 +5,11 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import IconButton from './icon_button'; -import DropdownMenuContainer from '../containers/dropdown_menu_container'; +import DropdownMenuContainer from 'themes/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me } from '../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; +import RelativeTimestamp from './relative_timestamp'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, @@ -156,12 +157,6 @@ export default class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.report, { name: status.getIn(['account', 'username']) }), action: this.handleReport }); } - if (status.get('visibility') === 'direct') { - reblogIcon = 'envelope'; - } else if (status.get('visibility') === 'private') { - reblogIcon = 'lock'; - } - if (status.get('in_reply_to_id', null) === null) { replyIcon = 'reply'; replyTitle = intl.formatMessage(messages.reply); @@ -184,6 +179,8 @@ export default class StatusActionBar extends ImmutablePureComponent { <div className='status__action-bar-dropdown'> <DropdownMenuContainer disabled={anonymousAccess} status={status} items={menu} icon='ellipsis-h' size={18} direction='right' ariaLabel={intl.formatMessage(messages.more)} /> </div> + + <a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a> </div> ); } diff --git a/app/javascript/glitch/components/status/content.js b/app/javascript/themes/glitch/components/status_content.js index 06015619b..3eba6eaa0 100644 --- a/app/javascript/glitch/components/status/content.js +++ b/app/javascript/themes/glitch/components/status_content.js @@ -1,21 +1,17 @@ -// Package imports // import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; +import { isRtl } from 'themes/glitch/util/rtl'; import { FormattedMessage } from 'react-intl'; +import Permalink from './permalink'; import classnames from 'classnames'; -// Mastodon imports // -import { isRtl } from '../../../mastodon/rtl'; -import Permalink from '../../../mastodon/components/permalink'; - export default class StatusContent extends React.PureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, - expanded: PropTypes.oneOf([true, false, null]), + expanded: PropTypes.bool, setExpansion: PropTypes.func, - onHeightUpdate: PropTypes.func, media: PropTypes.element, mediaIcon: PropTypes.string, parseClick: PropTypes.func, @@ -26,12 +22,17 @@ export default class StatusContent extends React.PureComponent { hidden: true, }; - componentDidMount () { + _updateStatusLinks () { const node = this.node; const links = node.querySelectorAll('a'); - for (let i = 0; i < links.length; ++i) { - let link = links[i]; + for (var i = 0; i < links.length; ++i) { + let link = links[i]; + if (link.classList.contains('status-link')) { + continue; + } + link.classList.add('status-link'); + let mention = this.props.status.get('mentions').find(item => link.href === item.get('url')); if (mention) { @@ -49,10 +50,12 @@ export default class StatusContent extends React.PureComponent { } } + componentDidMount () { + this._updateStatusLinks(); + } + componentDidUpdate () { - if (this.props.onHeightUpdate) { - this.props.onHeightUpdate(); - } + this._updateStatusLinks(); } onLinkClick = (e) => { @@ -123,17 +126,14 @@ export default class StatusContent extends React.PureComponent { disabled, } = this.props; - const hidden = ( - this.props.setExpansion ? - !this.props.expanded : - this.state.hidden - ); + const hidden = this.props.setExpansion ? !this.props.expanded : this.state.hidden; const content = { __html: status.get('contentHtml') }; const spoilerContent = { __html: status.get('spoilerHtml') }; const directionStyle = { direction: 'ltr' }; const classNames = classnames('status__content', { 'status__content--with-action': parseClick && !disabled, + 'status__content--with-spoiler': status.get('spoiler_text').length > 0, }); if (isRtl(status.get('search_index'))) { @@ -182,7 +182,7 @@ export default class StatusContent extends React.PureComponent { } return ( - <div className={classNames}> + <div className={classNames} tabIndex='0'> <p style={{ marginBottom: hidden && status.get('mentions').isEmpty() ? '0px' : null }} onMouseDown={this.handleMouseDown} @@ -201,6 +201,7 @@ export default class StatusContent extends React.PureComponent { <div ref={this.setRef} style={directionStyle} + tabIndex={!hidden ? 0 : null} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} dangerouslySetInnerHTML={content} @@ -215,12 +216,14 @@ export default class StatusContent extends React.PureComponent { <div className={classNames} style={directionStyle} + tabIndex='0' > <div ref={this.setRef} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp} dangerouslySetInnerHTML={content} + tabIndex='0' /> {media} </div> @@ -230,8 +233,9 @@ export default class StatusContent extends React.PureComponent { <div className='status__content' style={directionStyle} + tabIndex='0' > - <div ref={this.setRef} dangerouslySetInnerHTML={content} /> + <div ref={this.setRef} dangerouslySetInnerHTML={content} tabIndex='0' /> {media} </div> ); diff --git a/app/javascript/glitch/components/status/header.js b/app/javascript/themes/glitch/components/status_header.js index f741950b1..bfa996cd5 100644 --- a/app/javascript/glitch/components/status/header.js +++ b/app/javascript/themes/glitch/components/status_header.js @@ -1,19 +1,3 @@ -/* - -`<StatusHeader>` -================ - -Originally a part of `<Status>`, but extracted into a separate -component for better documentation and maintainance by -@kibi@glitch.social as a part of glitch-soc/mastodon. - -*/ - -// * * * * * * * // - -// Imports -// ------- - // Package imports. import React from 'react'; import PropTypes from 'prop-types'; @@ -21,16 +5,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl } from 'react-intl'; // Mastodon imports. -import Avatar from '../../../mastodon/components/avatar'; -import AvatarOverlay from '../../../mastodon/components/avatar_overlay'; -import DisplayName from '../../../mastodon/components/display_name'; -import IconButton from '../../../mastodon/components/icon_button'; -import VisibilityIcon from './visibility_icon'; - -// * * * * * * * // - -// Initial setup -// ------------- +import Avatar from './avatar'; +import AvatarOverlay from './avatar_overlay'; +import DisplayName from './display_name'; +import IconButton from './icon_button'; +import VisibilityIcon from './status_visibility_icon'; // Messages for use with internationalization stuff. const messages = defineMessages({ @@ -42,11 +21,6 @@ const messages = defineMessages({ direct: { id: 'privacy.direct.short', defaultMessage: 'Direct' }, }); -// * * * * * * * // - -// The component -// ------------- - @injectIntl export default class StatusHeader extends React.PureComponent { diff --git a/app/javascript/mastodon/components/status_list.js b/app/javascript/themes/glitch/components/status_list.js index 214955591..ddb1354c6 100644 --- a/app/javascript/mastodon/components/status_list.js +++ b/app/javascript/themes/glitch/components/status_list.js @@ -1,7 +1,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import StatusContainer from '../../glitch/components/status/container'; +import StatusContainer from 'themes/glitch/containers/status_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ScrollableList from './scrollable_list'; diff --git a/app/javascript/glitch/components/status/prepend.js b/app/javascript/themes/glitch/components/status_prepend.js index 8c0aed0f4..bd2559e46 100644 --- a/app/javascript/glitch/components/status/prepend.js +++ b/app/javascript/themes/glitch/components/status_prepend.js @@ -1,54 +1,9 @@ -/* - -`<StatusPrepend>` -================= - -Originally a part of `<Status>`, but extracted into a separate -component for better documentation and maintainance by -@kibi@glitch.social as a part of glitch-soc/mastodon. - -*/ - - /* * * * */ - -/* - -Imports: --------- - -*/ - // Package imports // import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; - /* * * * */ - -/* - -The `<StatusPrepend>` component: --------------------------------- - -The `<StatusPrepend>` component holds a status's prepend, ie the text -that says “X reblogged this,” etc. It is represented by an `<aside>` -element. - -### Props - - - __`type` (`PropTypes.string`) :__ - The type of prepend. One of `'reblogged_by'`, `'reblog'`, - `'favourite'`. - - - __`account` (`ImmutablePropTypes.map`) :__ - The account associated with the prepend. - - - __`parseClick` (`PropTypes.func.isRequired`) :__ - Our click parsing function. - -*/ - export default class StatusPrepend extends React.PureComponent { static propTypes = { @@ -58,33 +13,11 @@ export default class StatusPrepend extends React.PureComponent { notificationId: PropTypes.number, }; -/* - -### Implementation - -#### `handleClick()`. - -This is just a small wrapper for `parseClick()` that gets fired when -an account link is clicked. - -*/ - handleClick = (e) => { const { account, parseClick } = this.props; parseClick(e, `/accounts/${+account.get('id')}`); } -/* - -#### `<Message>`. - -`<Message>` is a quick functional React component which renders the -actual prepend message based on our provided `type`. First we create a -`link` for the account's name, and then use `<FormattedMessage>` to -generate the message. - -*/ - Message = () => { const { type, account } = this.props; let link = ( @@ -129,15 +62,6 @@ generate the message. return null; } -/* - -#### `render()`. - -Our `render()` is incredibly simple; we just render the icon and then -the `<Message>` inside of an <aside>. - -*/ - render () { const { Message } = this; const { type } = this.props; diff --git a/app/javascript/glitch/components/status/visibility_icon.js b/app/javascript/themes/glitch/components/status_visibility_icon.js index 017b69cbb..017b69cbb 100644 --- a/app/javascript/glitch/components/status/visibility_icon.js +++ b/app/javascript/themes/glitch/components/status_visibility_icon.js diff --git a/app/javascript/mastodon/containers/account_container.js b/app/javascript/themes/glitch/containers/account_container.js index 5a5136dd1..c1ce49987 100644 --- a/app/javascript/mastodon/containers/account_container.js +++ b/app/javascript/themes/glitch/containers/account_container.js @@ -1,8 +1,8 @@ import React from 'react'; import { connect } from 'react-redux'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { makeGetAccount } from '../selectors'; -import Account from '../components/account'; +import { makeGetAccount } from 'themes/glitch/selectors'; +import Account from 'themes/glitch/components/account'; import { followAccount, unfollowAccount, @@ -10,10 +10,10 @@ import { unblockAccount, muteAccount, unmuteAccount, -} from '../actions/accounts'; -import { openModal } from '../actions/modal'; -import { initMuteModal } from '../actions/mutes'; -import { unfollowModal } from '../initial_state'; +} from 'themes/glitch/actions/accounts'; +import { openModal } from 'themes/glitch/actions/modal'; +import { initMuteModal } from 'themes/glitch/actions/mutes'; +import { unfollowModal } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, diff --git a/app/javascript/mastodon/containers/card_container.js b/app/javascript/themes/glitch/containers/card_container.js index 11b9f88d4..8285437bb 100644 --- a/app/javascript/mastodon/containers/card_container.js +++ b/app/javascript/themes/glitch/containers/card_container.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Card from '../features/status/components/card'; +import Card from 'themes/glitch/features/status/components/card'; import { fromJS } from 'immutable'; export default class CardContainer extends React.PureComponent { diff --git a/app/javascript/mastodon/containers/compose_container.js b/app/javascript/themes/glitch/containers/compose_container.js index 5ee1d2f14..82980ee36 100644 --- a/app/javascript/mastodon/containers/compose_container.js +++ b/app/javascript/themes/glitch/containers/compose_container.js @@ -1,12 +1,12 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import configureStore from '../store/configureStore'; -import { hydrateStore } from '../actions/store'; +import configureStore from 'themes/glitch/store/configureStore'; +import { hydrateStore } from 'themes/glitch/actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import Compose from '../features/standalone/compose'; -import initialState from '../initial_state'; +import { getLocale } from 'mastodon/locales'; +import Compose from 'themes/glitch/features/standalone/compose'; +import initialState from 'themes/glitch/util/initial_state'; const { localeData, messages } = getLocale(); addLocaleData(localeData); diff --git a/app/javascript/mastodon/containers/dropdown_menu_container.js b/app/javascript/themes/glitch/containers/dropdown_menu_container.js index 151f25390..15e8da2e3 100644 --- a/app/javascript/mastodon/containers/dropdown_menu_container.js +++ b/app/javascript/themes/glitch/containers/dropdown_menu_container.js @@ -1,7 +1,7 @@ -import { openModal, closeModal } from '../actions/modal'; +import { openModal, closeModal } from 'themes/glitch/actions/modal'; import { connect } from 'react-redux'; -import DropdownMenu from '../components/dropdown_menu'; -import { isUserTouching } from '../is_mobile'; +import DropdownMenu from 'themes/glitch/components/dropdown_menu'; +import { isUserTouching } from 'themes/glitch/util/is_mobile'; const mapStateToProps = state => ({ isModalOpen: state.get('modal').modalType === 'ACTIONS', diff --git a/app/javascript/mastodon/containers/intersection_observer_article_container.js b/app/javascript/themes/glitch/containers/intersection_observer_article_container.js index b6f162199..6ede64738 100644 --- a/app/javascript/mastodon/containers/intersection_observer_article_container.js +++ b/app/javascript/themes/glitch/containers/intersection_observer_article_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import IntersectionObserverArticle from '../components/intersection_observer_article'; -import { setHeight } from '../actions/height_cache'; +import IntersectionObserverArticle from 'themes/glitch/components/intersection_observer_article'; +import { setHeight } from 'themes/glitch/actions/height_cache'; const makeMapStateToProps = (state, props) => ({ cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]), diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/themes/glitch/containers/mastodon.js index d1710445b..348470637 100644 --- a/app/javascript/mastodon/containers/mastodon.js +++ b/app/javascript/themes/glitch/containers/mastodon.js @@ -1,16 +1,16 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import configureStore from '../store/configureStore'; -import { showOnboardingOnce } from '../actions/onboarding'; +import configureStore from 'themes/glitch/store/configureStore'; +import { showOnboardingOnce } from 'themes/glitch/actions/onboarding'; import { BrowserRouter, Route } from 'react-router-dom'; import { ScrollContext } from 'react-router-scroll-4'; -import UI from '../features/ui'; -import { hydrateStore } from '../actions/store'; -import { connectUserStream } from '../actions/streaming'; +import UI from 'themes/glitch/features/ui'; +import { hydrateStore } from 'themes/glitch/actions/store'; +import { connectUserStream } from 'themes/glitch/actions/streaming'; import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import initialState from '../initial_state'; +import { getLocale } from 'mastodon/locales'; +import initialState from 'themes/glitch/util/initial_state'; const { localeData, messages } = getLocale(); addLocaleData(localeData); diff --git a/app/javascript/mastodon/containers/media_gallery_container.js b/app/javascript/themes/glitch/containers/media_gallery_container.js index 812c3d4e5..86965f73b 100644 --- a/app/javascript/mastodon/containers/media_gallery_container.js +++ b/app/javascript/themes/glitch/containers/media_gallery_container.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import MediaGallery from '../components/media_gallery'; +import { getLocale } from 'mastodon/locales'; +import MediaGallery from 'themes/glitch/components/media_gallery'; import { fromJS } from 'immutable'; const { localeData, messages } = getLocale(); diff --git a/app/javascript/glitch/components/column/notif_cleaning_widget/container.js b/app/javascript/themes/glitch/containers/notification_purge_buttons_container.js index d3507d752..ee4cb84cd 100644 --- a/app/javascript/glitch/components/column/notif_cleaning_widget/container.js +++ b/app/javascript/themes/glitch/containers/notification_purge_buttons_container.js @@ -1,46 +1,15 @@ -/* - -`<NotificationPurgeButtonsContainer>` -========================= - -This container connects `<NotificationPurgeButtons>`s to the Redux store. - -*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Imports: --------- - -*/ - -// Package imports // +// Package imports. import { connect } from 'react-redux'; +import { defineMessages, injectIntl } from 'react-intl'; -// Our imports // -import NotificationPurgeButtons from './notification_purge_buttons'; +// Our imports. +import NotificationPurgeButtons from 'themes/glitch/components/notification_purge_buttons'; import { deleteMarkedNotifications, enterNotificationClearingMode, markAllNotifications, -} from '../../../../mastodon/actions/notifications'; -import { defineMessages, injectIntl } from 'react-intl'; -import { openModal } from '../../../../mastodon/actions/modal'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -/* - -Dispatch mapping: ------------------ - -The `mapDispatchToProps()` function maps dispatches to our store to the -various props of our component. We only need to provide a dispatch for -deleting notifications. - -*/ +} from 'themes/glitch/actions/notifications'; +import { openModal } from 'themes/glitch/actions/modal'; const messages = defineMessages({ clearMessage: { id: 'notifications.marked_clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all selected notifications?' }, diff --git a/app/javascript/mastodon/containers/status_container.js b/app/javascript/themes/glitch/containers/status_container.js index b9c461f31..14906723a 100644 --- a/app/javascript/mastodon/containers/status_container.js +++ b/app/javascript/themes/glitch/containers/status_container.js @@ -1,14 +1,11 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/status/container - import React from 'react'; import { connect } from 'react-redux'; -import Status from '../components/status'; -import { makeGetStatus } from '../selectors'; +import Status from 'themes/glitch/components/status'; +import { makeGetStatus } from 'themes/glitch/selectors'; import { replyCompose, mentionCompose, -} from '../actions/compose'; +} from 'themes/glitch/actions/compose'; import { reblog, favourite, @@ -16,14 +13,14 @@ import { unfavourite, pin, unpin, -} from '../actions/interactions'; -import { blockAccount } from '../actions/accounts'; -import { muteStatus, unmuteStatus, deleteStatus } from '../actions/statuses'; -import { initMuteModal } from '../actions/mutes'; -import { initReport } from '../actions/reports'; -import { openModal } from '../actions/modal'; +} from 'themes/glitch/actions/interactions'; +import { blockAccount } from 'themes/glitch/actions/accounts'; +import { muteStatus, unmuteStatus, deleteStatus } from 'themes/glitch/actions/statuses'; +import { initMuteModal } from 'themes/glitch/actions/mutes'; +import { initReport } from 'themes/glitch/actions/reports'; +import { openModal } from 'themes/glitch/actions/modal'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { boostModal, deleteModal } from '../initial_state'; +import { boostModal, deleteModal } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, @@ -34,9 +31,26 @@ const messages = defineMessages({ const makeMapStateToProps = () => { const getStatus = makeGetStatus(); - const mapStateToProps = (state, props) => ({ - status: getStatus(state, props.id), - }); + const mapStateToProps = (state, props) => { + + let status = getStatus(state, props.id); + let reblogStatus = status ? status.get('reblog', null) : null; + let account = undefined; + let prepend = undefined; + + if (reblogStatus !== null && typeof reblogStatus === 'object') { + account = status.get('account'); + status = reblogStatus; + prepend = 'reblogged_by'; + } + + return { + status : status, + account : account || props.account, + settings : state.get('local_settings'), + prepend : prepend || props.prepend, + }; + }; return mapStateToProps; }; diff --git a/app/javascript/mastodon/containers/timeline_container.js b/app/javascript/themes/glitch/containers/timeline_container.js index e84c921ee..a75f8808d 100644 --- a/app/javascript/mastodon/containers/timeline_container.js +++ b/app/javascript/themes/glitch/containers/timeline_container.js @@ -1,13 +1,13 @@ import React from 'react'; import { Provider } from 'react-redux'; import PropTypes from 'prop-types'; -import configureStore from '../store/configureStore'; -import { hydrateStore } from '../actions/store'; +import configureStore from 'themes/glitch/store/configureStore'; +import { hydrateStore } from 'themes/glitch/actions/store'; import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import PublicTimeline from '../features/standalone/public_timeline'; -import HashtagTimeline from '../features/standalone/hashtag_timeline'; -import initialState from '../initial_state'; +import { getLocale } from 'mastodon/locales'; +import PublicTimeline from 'themes/glitch/features/standalone/public_timeline'; +import HashtagTimeline from 'themes/glitch/features/standalone/hashtag_timeline'; +import initialState from 'themes/glitch/util/initial_state'; const { localeData, messages } = getLocale(); addLocaleData(localeData); diff --git a/app/javascript/mastodon/containers/video_container.js b/app/javascript/themes/glitch/containers/video_container.js index 2fd353096..2b0e98666 100644 --- a/app/javascript/mastodon/containers/video_container.js +++ b/app/javascript/themes/glitch/containers/video_container.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from '../locales'; -import Video from '../features/video'; +import { getLocale } from 'mastodon/locales'; +import Video from 'themes/glitch/features/video'; const { localeData, messages } = getLocale(); addLocaleData(localeData); diff --git a/app/javascript/mastodon/features/account/components/action_bar.js b/app/javascript/themes/glitch/features/account/components/action_bar.js index 389296c42..0edd5c848 100644 --- a/app/javascript/mastodon/features/account/components/action_bar.js +++ b/app/javascript/themes/glitch/features/account/components/action_bar.js @@ -1,10 +1,10 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; +import DropdownMenuContainer from 'themes/glitch/containers/dropdown_menu_container'; import { Link } from 'react-router-dom'; import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ mention: { id: 'account.mention', defaultMessage: 'Mention @{name}' }, diff --git a/app/javascript/themes/glitch/features/account/components/header.js b/app/javascript/themes/glitch/features/account/components/header.js new file mode 100644 index 000000000..696bb1991 --- /dev/null +++ b/app/javascript/themes/glitch/features/account/components/header.js @@ -0,0 +1,99 @@ +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +import Avatar from 'themes/glitch/components/avatar'; +import IconButton from 'themes/glitch/components/icon_button'; + +import emojify from 'themes/glitch/util/emoji'; +import { me } from 'themes/glitch/util/initial_state'; +import { processBio } from 'themes/glitch/util/bio_metadata'; + +const messages = defineMessages({ + unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, + follow: { id: 'account.follow', defaultMessage: 'Follow' }, + requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, +}); + +@injectIntl +export default class Header extends ImmutablePureComponent { + + static propTypes = { + account: ImmutablePropTypes.map, + onFollow: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + }; + + render () { + const { account, intl } = this.props; + + if (!account) { + return null; + } + + let displayName = account.get('display_name_html'); + let info = ''; + let actionBtn = ''; + + if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { + info = <span className='account--follows-info'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>; + } + + if (me !== account.get('id')) { + if (account.getIn(['relationship', 'requested'])) { + actionBtn = ( + <div className='account--action-button'> + <IconButton size={26} active icon='hourglass' title={intl.formatMessage(messages.requested)} onClick={this.props.onFollow} /> + </div> + ); + } else if (!account.getIn(['relationship', 'blocking'])) { + actionBtn = ( + <div className='account--action-button'> + <IconButton size={26} icon={account.getIn(['relationship', 'following']) ? 'user-times' : 'user-plus'} active={account.getIn(['relationship', 'following'])} title={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.props.onFollow} /> + </div> + ); + } + } + + const { text, metadata } = processBio(account.get('note')); + + return ( + <div className='account__header__wrapper'> + <div className='account__header' style={{ backgroundImage: `url(${account.get('header')})` }}> + <div> + <Avatar account={account} size={90} /> + + <span className='account__header__display-name' dangerouslySetInnerHTML={{ __html: displayName }} /> + <span className='account__header__username'>@{account.get('acct')} {account.get('locked') ? <i className='fa fa-lock' /> : null}</span> + <div className='account__header__content' dangerouslySetInnerHTML={{ __html: emojify(text) }} /> + + {info} + {actionBtn} + </div> + </div> + + {metadata.length && ( + <table className='account__metadata'> + <tbody> + {(() => { + let data = []; + for (let i = 0; i < metadata.length; i++) { + data.push( + <tr key={i}> + <th scope='row'><div dangerouslySetInnerHTML={{ __html: emojify(metadata[i][0]) }} /></th> + <td><div dangerouslySetInnerHTML={{ __html: emojify(metadata[i][1]) }} /></td> + </tr> + ); + } + return data; + })()} + </tbody> + </table> + ) || null} + </div> + ); + } + +} diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/themes/glitch/features/account_gallery/components/media_item.js index dda3d4e37..88c9156b5 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.js +++ b/app/javascript/themes/glitch/features/account_gallery/components/media_item.js @@ -1,7 +1,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Permalink from '../../../components/permalink'; +import Permalink from 'themes/glitch/components/permalink'; export default class MediaItem extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/themes/glitch/features/account_gallery/index.js index a40722417..a21c089da 100644 --- a/app/javascript/mastodon/features/account_gallery/index.js +++ b/app/javascript/themes/glitch/features/account_gallery/index.js @@ -2,18 +2,18 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { fetchAccount } from '../../actions/accounts'; -import { refreshAccountMediaTimeline, expandAccountMediaTimeline } from '../../actions/timelines'; -import LoadingIndicator from '../../components/loading_indicator'; -import Column from '../ui/components/column'; -import ColumnBackButton from '../../components/column_back_button'; +import { fetchAccount } from 'themes/glitch/actions/accounts'; +import { refreshAccountMediaTimeline, expandAccountMediaTimeline } from 'themes/glitch/actions/timelines'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { getAccountGallery } from '../../selectors'; +import { getAccountGallery } from 'themes/glitch/selectors'; import MediaItem from './components/media_item'; -import HeaderContainer from '../account_timeline/containers/header_container'; +import HeaderContainer from 'themes/glitch/features/account_timeline/containers/header_container'; import { FormattedMessage } from 'react-intl'; import { ScrollContainer } from 'react-router-scroll-4'; -import LoadMore from '../../components/load_more'; +import LoadMore from 'themes/glitch/components/load_more'; const mapStateToProps = (state, props) => ({ medias: getAccountGallery(state, props.params.accountId), diff --git a/app/javascript/mastodon/features/account_timeline/components/header.js b/app/javascript/themes/glitch/features/account_timeline/components/header.js index 9a087e922..c719a7bcb 100644 --- a/app/javascript/mastodon/features/account_timeline/components/header.js +++ b/app/javascript/themes/glitch/features/account_timeline/components/header.js @@ -1,9 +1,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import InnerHeader from '../../../../glitch/components/account/header'; -import ActionBar from '../../account/components/action_bar'; -import MissingIndicator from '../../../components/missing_indicator'; +import InnerHeader from 'themes/glitch/features/account/components/header'; +import ActionBar from 'themes/glitch/features/account/components/action_bar'; +import MissingIndicator from 'themes/glitch/components/missing_indicator'; import ImmutablePureComponent from 'react-immutable-pure-component'; export default class Header extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.js b/app/javascript/themes/glitch/features/account_timeline/containers/header_container.js index b41eb19d4..766b57b56 100644 --- a/app/javascript/mastodon/features/account_timeline/containers/header_container.js +++ b/app/javascript/themes/glitch/features/account_timeline/containers/header_container.js @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; -import { makeGetAccount } from '../../../selectors'; +import { makeGetAccount } from 'themes/glitch/selectors'; import Header from '../components/header'; import { followAccount, @@ -8,14 +8,14 @@ import { blockAccount, unblockAccount, unmuteAccount, -} from '../../../actions/accounts'; -import { mentionCompose } from '../../../actions/compose'; -import { initMuteModal } from '../../../actions/mutes'; -import { initReport } from '../../../actions/reports'; -import { openModal } from '../../../actions/modal'; -import { blockDomain, unblockDomain } from '../../../actions/domain_blocks'; +} from 'themes/glitch/actions/accounts'; +import { mentionCompose } from 'themes/glitch/actions/compose'; +import { initMuteModal } from 'themes/glitch/actions/mutes'; +import { initReport } from 'themes/glitch/actions/reports'; +import { openModal } from 'themes/glitch/actions/modal'; +import { blockDomain, unblockDomain } from 'themes/glitch/actions/domain_blocks'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import { unfollowModal } from '../../../initial_state'; +import { unfollowModal } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, diff --git a/app/javascript/mastodon/features/account_timeline/index.js b/app/javascript/themes/glitch/features/account_timeline/index.js index 3ad370e32..81336ef3a 100644 --- a/app/javascript/mastodon/features/account_timeline/index.js +++ b/app/javascript/themes/glitch/features/account_timeline/index.js @@ -2,8 +2,8 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import { fetchAccount } from '../../actions/accounts'; -import { refreshAccountTimeline, expandAccountTimeline } from '../../actions/timelines'; +import { fetchAccount } from 'themes/glitch/actions/accounts'; +import { refreshAccountTimeline, expandAccountTimeline } from 'themes/glitch/actions/timelines'; import StatusList from '../../components/status_list'; import LoadingIndicator from '../../components/loading_indicator'; import Column from '../ui/components/column'; diff --git a/app/javascript/mastodon/features/blocks/index.js b/app/javascript/themes/glitch/features/blocks/index.js index 9199529dd..70630818c 100644 --- a/app/javascript/mastodon/features/blocks/index.js +++ b/app/javascript/themes/glitch/features/blocks/index.js @@ -2,12 +2,12 @@ import React from 'react'; import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import LoadingIndicator from '../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; import { ScrollContainer } from 'react-router-scroll-4'; -import Column from '../ui/components/column'; -import ColumnBackButtonSlim from '../../components/column_back_button_slim'; -import AccountContainer from '../../containers/account_container'; -import { fetchBlocks, expandBlocks } from '../../actions/blocks'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButtonSlim from 'themes/glitch/components/column_back_button_slim'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import { fetchBlocks, expandBlocks } from 'themes/glitch/actions/blocks'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/community_timeline/components/column_settings.js b/app/javascript/themes/glitch/features/community_timeline/components/column_settings.js index a992b27bb..988e36308 100644 --- a/app/javascript/mastodon/features/community_timeline/components/column_settings.js +++ b/app/javascript/themes/glitch/features/community_timeline/components/column_settings.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import SettingText from '../../../components/setting_text'; +import SettingText from 'themes/glitch/components/setting_text'; const messages = defineMessages({ filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, diff --git a/app/javascript/mastodon/features/community_timeline/containers/column_settings_container.js b/app/javascript/themes/glitch/features/community_timeline/containers/column_settings_container.js index f3489b409..cd9c34365 100644 --- a/app/javascript/mastodon/features/community_timeline/containers/column_settings_container.js +++ b/app/javascript/themes/glitch/features/community_timeline/containers/column_settings_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import ColumnSettings from '../components/column_settings'; -import { changeSetting } from '../../../actions/settings'; +import { changeSetting } from 'themes/glitch/actions/settings'; const mapStateToProps = state => ({ settings: state.getIn(['settings', 'community']), diff --git a/app/javascript/mastodon/features/community_timeline/index.js b/app/javascript/themes/glitch/features/community_timeline/index.js index 62b1c8ee9..9d255bd01 100644 --- a/app/javascript/mastodon/features/community_timeline/index.js +++ b/app/javascript/themes/glitch/features/community_timeline/index.js @@ -1,17 +1,17 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../ui/containers/status_list_container'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { refreshCommunityTimeline, expandCommunityTimeline, -} from '../../actions/timelines'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; +} from 'themes/glitch/actions/timelines'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; -import { connectCommunityStream } from '../../actions/streaming'; +import { connectCommunityStream } from 'themes/glitch/actions/streaming'; const messages = defineMessages({ title: { id: 'column.community', defaultMessage: 'Local timeline' }, diff --git a/app/javascript/themes/glitch/features/compose/components/advanced_options.js b/app/javascript/themes/glitch/features/compose/components/advanced_options.js new file mode 100644 index 000000000..045bad2e5 --- /dev/null +++ b/app/javascript/themes/glitch/features/compose/components/advanced_options.js @@ -0,0 +1,62 @@ +// Package imports. +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { injectIntl, defineMessages } from 'react-intl'; + +// Our imports. +import ComposeAdvancedOptionsToggle from './advanced_options_toggle'; +import ComposeDropdown from './dropdown'; + +const messages = defineMessages({ + local_only_short : + { id: 'advanced-options.local-only.short', defaultMessage: 'Local-only' }, + local_only_long : + { id: 'advanced-options.local-only.long', defaultMessage: 'Do not post to other instances' }, + advanced_options_icon_title : + { id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' }, +}); + +@injectIntl +export default class ComposeAdvancedOptions extends React.PureComponent { + + static propTypes = { + values : ImmutablePropTypes.contains({ + do_not_federate : PropTypes.bool.isRequired, + }).isRequired, + onChange : PropTypes.func.isRequired, + intl : PropTypes.object.isRequired, + }; + + render () { + const { intl, values } = this.props; + const options = [ + { icon: 'wifi', shortText: messages.local_only_short, longText: messages.local_only_long, name: 'do_not_federate' }, + ]; + const anyEnabled = values.some((enabled) => enabled); + + const optionElems = options.map((option) => { + return ( + <ComposeAdvancedOptionsToggle + onChange={this.props.onChange} + active={values.get(option.name)} + key={option.name} + name={option.name} + shortText={intl.formatMessage(option.shortText)} + longText={intl.formatMessage(option.longText)} + /> + ); + }); + + return ( + <ComposeDropdown + title={intl.formatMessage(messages.advanced_options_icon_title)} + icon='home' + highlight={anyEnabled} + > + {optionElems} + </ComposeDropdown> + ); + } + +} diff --git a/app/javascript/themes/glitch/features/compose/components/advanced_options_toggle.js b/app/javascript/themes/glitch/features/compose/components/advanced_options_toggle.js new file mode 100644 index 000000000..98b3b6a44 --- /dev/null +++ b/app/javascript/themes/glitch/features/compose/components/advanced_options_toggle.js @@ -0,0 +1,35 @@ +// Package imports. +import React from 'react'; +import PropTypes from 'prop-types'; +import Toggle from 'react-toggle'; + +export default class ComposeAdvancedOptionsToggle extends React.PureComponent { + + static propTypes = { + onChange: PropTypes.func.isRequired, + active: PropTypes.bool.isRequired, + name: PropTypes.string.isRequired, + shortText: PropTypes.string.isRequired, + longText: PropTypes.string.isRequired, + } + + onToggle = () => { + this.props.onChange(this.props.name); + } + + render() { + const { active, shortText, longText } = this.props; + return ( + <div role='button' tabIndex='0' className='advanced-options-dropdown__option' onClick={this.onToggle}> + <div className='advanced-options-dropdown__option__toggle'> + <Toggle checked={active} onChange={this.onToggle} /> + </div> + <div className='advanced-options-dropdown__option__content'> + <strong>{shortText}</strong> + {longText} + </div> + </div> + ); + } + +} diff --git a/app/javascript/glitch/components/compose/attach_options/index.js b/app/javascript/themes/glitch/features/compose/components/attach_options.js index 4340972f0..c396714f3 100644 --- a/app/javascript/glitch/components/compose/attach_options/index.js +++ b/app/javascript/themes/glitch/features/compose/components/attach_options.js @@ -5,13 +5,11 @@ import { connect } from 'react-redux'; import { injectIntl, defineMessages } from 'react-intl'; // Our imports // -import ComposeDropdown from '../dropdown/index'; -import { uploadCompose } from '../../../../mastodon/actions/compose'; +import ComposeDropdown from './dropdown'; +import { uploadCompose } from 'themes/glitch/actions/compose'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { openModal } from '../../../../mastodon/actions/modal'; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +import { openModal } from 'themes/glitch/actions/modal'; const messages = defineMessages({ upload : diff --git a/app/javascript/mastodon/features/compose/components/autosuggest_account.js b/app/javascript/themes/glitch/features/compose/components/autosuggest_account.js index e7de3716b..4a98d89fe 100644 --- a/app/javascript/mastodon/features/compose/components/autosuggest_account.js +++ b/app/javascript/themes/glitch/features/compose/components/autosuggest_account.js @@ -1,6 +1,6 @@ import React from 'react'; -import Avatar from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; +import Avatar from 'themes/glitch/components/avatar'; +import DisplayName from 'themes/glitch/components/display_name'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/character_counter.js b/app/javascript/themes/glitch/features/compose/components/character_counter.js index 0ecfc9141..0ecfc9141 100644 --- a/app/javascript/mastodon/features/compose/components/character_counter.js +++ b/app/javascript/themes/glitch/features/compose/components/character_counter.js diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/themes/glitch/features/compose/components/compose_form.js index aaca45493..54b1944a4 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/themes/glitch/features/compose/components/compose_form.js @@ -1,25 +1,25 @@ import React from 'react'; import CharacterCounter from './character_counter'; -import Button from '../../../components/button'; +import Button from 'themes/glitch/components/button'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ReplyIndicatorContainer from '../containers/reply_indicator_container'; -import AutosuggestTextarea from '../../../components/autosuggest_textarea'; +import AutosuggestTextarea from 'themes/glitch/components/autosuggest_textarea'; import { defineMessages, injectIntl } from 'react-intl'; -import Collapsable from '../../../components/collapsable'; +import Collapsable from 'themes/glitch/components/collapsable'; import SpoilerButtonContainer from '../containers/spoiler_button_container'; import PrivacyDropdownContainer from '../containers/privacy_dropdown_container'; -import ComposeAdvancedOptionsContainer from '../../../../glitch/components/compose/advanced_options/container'; +import ComposeAdvancedOptionsContainer from '../containers/advanced_options_container'; import SensitiveButtonContainer from '../containers/sensitive_button_container'; import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container'; import UploadFormContainer from '../containers/upload_form_container'; import WarningContainer from '../containers/warning_container'; -import { isMobile } from '../../../is_mobile'; +import { isMobile } from 'themes/glitch/util/is_mobile'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { length } from 'stringz'; -import { countableText } from '../util/counter'; -import ComposeAttachOptions from '../../../../glitch/components/compose/attach_options/index'; -import initialState from '../../../initial_state'; +import { countableText } from 'themes/glitch/util/counter'; +import ComposeAttachOptions from './attach_options'; +import initialState from 'themes/glitch/util/initial_state'; const maxChars = initialState.max_toot_chars; diff --git a/app/javascript/glitch/components/compose/dropdown/index.js b/app/javascript/themes/glitch/features/compose/components/dropdown.js index 5f6467155..f3d9f094e 100644 --- a/app/javascript/glitch/components/compose/dropdown/index.js +++ b/app/javascript/themes/glitch/features/compose/components/dropdown.js @@ -1,9 +1,9 @@ -// Package imports // +// Package imports. import React from 'react'; import PropTypes from 'prop-types'; -// Mastodon imports // -import IconButton from '../../../../mastodon/components/icon_button'; +// Our imports. +import IconButton from 'themes/glitch/components/icon_button'; const iconStyle = { height : null, diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/themes/glitch/features/compose/components/emoji_picker_dropdown.js index dc8fc02ba..fd59efb85 100644 --- a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js +++ b/app/javascript/themes/glitch/features/compose/components/emoji_picker_dropdown.js @@ -1,12 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components'; +import { EmojiPicker as EmojiPickerAsync } from 'themes/glitch/util/async-components'; import Overlay from 'react-overlays/lib/Overlay'; import classNames from 'classnames'; import ImmutablePropTypes from 'react-immutable-proptypes'; import detectPassiveEvents from 'detect-passive-events'; -import { buildCustomEmojis } from '../../emoji/emoji'; +import { buildCustomEmojis } from 'themes/glitch/util/emoji'; const messages = defineMessages({ emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' }, diff --git a/app/javascript/mastodon/features/compose/components/navigation_bar.js b/app/javascript/themes/glitch/features/compose/components/navigation_bar.js index 7f346854c..24a70949b 100644 --- a/app/javascript/mastodon/features/compose/components/navigation_bar.js +++ b/app/javascript/themes/glitch/features/compose/components/navigation_bar.js @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; -import IconButton from '../../../components/icon_button'; -import Permalink from '../../../components/permalink'; +import Avatar from 'themes/glitch/components/avatar'; +import IconButton from 'themes/glitch/components/icon_button'; +import Permalink from 'themes/glitch/components/permalink'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js b/app/javascript/themes/glitch/features/compose/components/privacy_dropdown.js index c1e85aee3..0cd92d174 100644 --- a/app/javascript/mastodon/features/compose/components/privacy_dropdown.js +++ b/app/javascript/themes/glitch/features/compose/components/privacy_dropdown.js @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, defineMessages } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import IconButton from 'themes/glitch/components/icon_button'; import Overlay from 'react-overlays/lib/Overlay'; -import Motion from '../../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import detectPassiveEvents from 'detect-passive-events'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/compose/components/reply_indicator.js b/app/javascript/themes/glitch/features/compose/components/reply_indicator.js index 7672440b4..9a8d10ceb 100644 --- a/app/javascript/mastodon/features/compose/components/reply_indicator.js +++ b/app/javascript/themes/glitch/features/compose/components/reply_indicator.js @@ -1,9 +1,9 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Avatar from '../../../components/avatar'; -import IconButton from '../../../components/icon_button'; -import DisplayName from '../../../components/display_name'; +import Avatar from 'themes/glitch/components/avatar'; +import IconButton from 'themes/glitch/components/icon_button'; +import DisplayName from 'themes/glitch/components/display_name'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/search.js b/app/javascript/themes/glitch/features/compose/components/search.js index 398fc44ce..c3218137f 100644 --- a/app/javascript/mastodon/features/compose/components/search.js +++ b/app/javascript/themes/glitch/features/compose/components/search.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Overlay from 'react-overlays/lib/Overlay'; -import Motion from '../../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/compose/components/search_results.js b/app/javascript/themes/glitch/features/compose/components/search_results.js index a3e68643f..3fdafa5f3 100644 --- a/app/javascript/mastodon/features/compose/components/search_results.js +++ b/app/javascript/themes/glitch/features/compose/components/search_results.js @@ -1,8 +1,8 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; -import AccountContainer from '../../../containers/account_container'; -import StatusContainer from '../../../../glitch/components/status/container'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import StatusContainer from 'themes/glitch/containers/status_container'; import { Link } from 'react-router-dom'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/compose/components/text_icon_button.js b/app/javascript/themes/glitch/features/compose/components/text_icon_button.js index 9c8ffab1f..9c8ffab1f 100644 --- a/app/javascript/mastodon/features/compose/components/text_icon_button.js +++ b/app/javascript/themes/glitch/features/compose/components/text_icon_button.js diff --git a/app/javascript/mastodon/features/compose/components/upload.js b/app/javascript/themes/glitch/features/compose/components/upload.js index 6ab76492a..ded376ada 100644 --- a/app/javascript/mastodon/features/compose/components/upload.js +++ b/app/javascript/themes/glitch/features/compose/components/upload.js @@ -1,8 +1,8 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import IconButton from '../../../components/icon_button'; -import Motion from '../../ui/util/optional_motion'; +import IconButton from 'themes/glitch/components/icon_button'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/components/upload_button.js b/app/javascript/themes/glitch/features/compose/components/upload_button.js index 70b28a2ba..d7742adfe 100644 --- a/app/javascript/mastodon/features/compose/components/upload_button.js +++ b/app/javascript/themes/glitch/features/compose/components/upload_button.js @@ -1,5 +1,5 @@ import React from 'react'; -import IconButton from '../../../components/icon_button'; +import IconButton from 'themes/glitch/components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; diff --git a/app/javascript/mastodon/features/compose/components/upload_form.js b/app/javascript/themes/glitch/features/compose/components/upload_form.js index b7f112205..b7f112205 100644 --- a/app/javascript/mastodon/features/compose/components/upload_form.js +++ b/app/javascript/themes/glitch/features/compose/components/upload_form.js diff --git a/app/javascript/mastodon/features/compose/components/upload_progress.js b/app/javascript/themes/glitch/features/compose/components/upload_progress.js index d5e6f19cd..b923d0a22 100644 --- a/app/javascript/mastodon/features/compose/components/upload_progress.js +++ b/app/javascript/themes/glitch/features/compose/components/upload_progress.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Motion from '../../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/components/warning.js b/app/javascript/themes/glitch/features/compose/components/warning.js index 803b7f86a..82df55a31 100644 --- a/app/javascript/mastodon/features/compose/components/warning.js +++ b/app/javascript/themes/glitch/features/compose/components/warning.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Motion from '../../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; export default class Warning extends React.PureComponent { diff --git a/app/javascript/themes/glitch/features/compose/containers/advanced_options_container.js b/app/javascript/themes/glitch/features/compose/containers/advanced_options_container.js new file mode 100644 index 000000000..9f168942a --- /dev/null +++ b/app/javascript/themes/glitch/features/compose/containers/advanced_options_container.js @@ -0,0 +1,20 @@ +// Package imports. +import { connect } from 'react-redux'; + +// Our imports. +import { toggleComposeAdvancedOption } from 'themes/glitch/actions/compose'; +import ComposeAdvancedOptions from '../components/advanced_options'; + +const mapStateToProps = state => ({ + values: state.getIn(['compose', 'advanced_options']), +}); + +const mapDispatchToProps = dispatch => ({ + + onChange (option) { + dispatch(toggleComposeAdvancedOption(option)); + }, + +}); + +export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions); diff --git a/app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js b/app/javascript/themes/glitch/features/compose/containers/autosuggest_account_container.js index 4190e54ca..96eb70c18 100644 --- a/app/javascript/mastodon/features/compose/containers/autosuggest_account_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/autosuggest_account_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import AutosuggestAccount from '../components/autosuggest_account'; -import { makeGetAccount } from '../../../selectors'; +import { makeGetAccount } from 'themes/glitch/selectors'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/themes/glitch/features/compose/containers/compose_form_container.js index dfe8241c6..7afa988f1 100644 --- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/compose_form_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import ComposeForm from '../components/compose_form'; -import { changeComposeVisibility, uploadCompose } from '../../../actions/compose'; +import { changeComposeVisibility, uploadCompose } from 'themes/glitch/actions/compose'; import { changeCompose, submitCompose, @@ -9,7 +9,7 @@ import { selectComposeSuggestion, changeComposeSpoilerText, insertEmojiCompose, -} from '../../../actions/compose'; +} from 'themes/glitch/actions/compose'; const mapStateToProps = state => ({ text: state.getIn(['compose', 'text']), diff --git a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js b/app/javascript/themes/glitch/features/compose/containers/emoji_picker_dropdown_container.js index e6a535a5d..55a13bd65 100644 --- a/app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/emoji_picker_dropdown_container.js @@ -1,9 +1,9 @@ import { connect } from 'react-redux'; import EmojiPickerDropdown from '../components/emoji_picker_dropdown'; -import { changeSetting } from '../../../actions/settings'; +import { changeSetting } from 'themes/glitch/actions/settings'; import { createSelector } from 'reselect'; import { Map as ImmutableMap } from 'immutable'; -import { useEmoji } from '../../../actions/emojis'; +import { useEmoji } from 'themes/glitch/actions/emojis'; const perLine = 8; const lines = 2; diff --git a/app/javascript/mastodon/features/compose/containers/navigation_container.js b/app/javascript/themes/glitch/features/compose/containers/navigation_container.js index eb9f3ea45..b6d737b46 100644 --- a/app/javascript/mastodon/features/compose/containers/navigation_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/navigation_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import NavigationBar from '../components/navigation_bar'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const mapStateToProps = state => { return { diff --git a/app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js b/app/javascript/themes/glitch/features/compose/containers/privacy_dropdown_container.js index 0ddf531d3..9636ceab2 100644 --- a/app/javascript/mastodon/features/compose/containers/privacy_dropdown_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/privacy_dropdown_container.js @@ -1,8 +1,8 @@ import { connect } from 'react-redux'; import PrivacyDropdown from '../components/privacy_dropdown'; -import { changeComposeVisibility } from '../../../actions/compose'; -import { openModal, closeModal } from '../../../actions/modal'; -import { isUserTouching } from '../../../is_mobile'; +import { changeComposeVisibility } from 'themes/glitch/actions/compose'; +import { openModal, closeModal } from 'themes/glitch/actions/modal'; +import { isUserTouching } from 'themes/glitch/util/is_mobile'; const mapStateToProps = state => ({ isModalOpen: state.get('modal').modalType === 'ACTIONS', diff --git a/app/javascript/mastodon/features/compose/containers/reply_indicator_container.js b/app/javascript/themes/glitch/features/compose/containers/reply_indicator_container.js index 73f394c1a..6dcabb3cd 100644 --- a/app/javascript/mastodon/features/compose/containers/reply_indicator_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/reply_indicator_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import { cancelReplyCompose } from '../../../actions/compose'; -import { makeGetStatus } from '../../../selectors'; +import { cancelReplyCompose } from 'themes/glitch/actions/compose'; +import { makeGetStatus } from 'themes/glitch/selectors'; import ReplyIndicator from '../components/reply_indicator'; const makeMapStateToProps = () => { diff --git a/app/javascript/mastodon/features/compose/containers/search_container.js b/app/javascript/themes/glitch/features/compose/containers/search_container.js index 392bd0f56..a450d27e7 100644 --- a/app/javascript/mastodon/features/compose/containers/search_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/search_container.js @@ -4,7 +4,7 @@ import { clearSearch, submitSearch, showSearch, -} from '../../../actions/search'; +} from 'themes/glitch/actions/search'; import Search from '../components/search'; const mapStateToProps = state => ({ diff --git a/app/javascript/mastodon/features/compose/containers/search_results_container.js b/app/javascript/themes/glitch/features/compose/containers/search_results_container.js index 16d95d417..16d95d417 100644 --- a/app/javascript/mastodon/features/compose/containers/search_results_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/search_results_container.js diff --git a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js b/app/javascript/themes/glitch/features/compose/containers/sensitive_button_container.js index c8e74f5a1..a710dd104 100644 --- a/app/javascript/mastodon/features/compose/containers/sensitive_button_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/sensitive_button_container.js @@ -2,9 +2,9 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import IconButton from '../../../components/icon_button'; -import { changeComposeSensitivity } from '../../../actions/compose'; -import Motion from '../../ui/util/optional_motion'; +import IconButton from 'themes/glitch/components/icon_button'; +import { changeComposeSensitivity } from 'themes/glitch/actions/compose'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import { injectIntl, defineMessages } from 'react-intl'; diff --git a/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js b/app/javascript/themes/glitch/features/compose/containers/spoiler_button_container.js index 4179b9706..160e71ba9 100644 --- a/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/spoiler_button_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import TextIconButton from '../components/text_icon_button'; -import { changeComposeSpoilerness } from '../../../actions/compose'; +import { changeComposeSpoilerness } from 'themes/glitch/actions/compose'; import { injectIntl, defineMessages } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/compose/containers/upload_button_container.js b/app/javascript/themes/glitch/features/compose/containers/upload_button_container.js index 1f1d915bc..f332eae1a 100644 --- a/app/javascript/mastodon/features/compose/containers/upload_button_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/upload_button_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import UploadButton from '../components/upload_button'; -import { uploadCompose } from '../../../actions/compose'; +import { uploadCompose } from 'themes/glitch/actions/compose'; const mapStateToProps = state => ({ disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')), diff --git a/app/javascript/mastodon/features/compose/containers/upload_container.js b/app/javascript/themes/glitch/features/compose/containers/upload_container.js index ca9c3b704..eea514bf5 100644 --- a/app/javascript/mastodon/features/compose/containers/upload_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/upload_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import Upload from '../components/upload'; -import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose'; +import { undoUploadCompose, changeUploadCompose } from 'themes/glitch/actions/compose'; const mapStateToProps = (state, { id }) => ({ media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id), diff --git a/app/javascript/mastodon/features/compose/containers/upload_form_container.js b/app/javascript/themes/glitch/features/compose/containers/upload_form_container.js index a6798bf51..a6798bf51 100644 --- a/app/javascript/mastodon/features/compose/containers/upload_form_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/upload_form_container.js diff --git a/app/javascript/mastodon/features/compose/containers/upload_progress_container.js b/app/javascript/themes/glitch/features/compose/containers/upload_progress_container.js index 0cfee96da..0cfee96da 100644 --- a/app/javascript/mastodon/features/compose/containers/upload_progress_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/upload_progress_container.js diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/themes/glitch/features/compose/containers/warning_container.js index d34471a3e..225d6a1dd 100644 --- a/app/javascript/mastodon/features/compose/containers/warning_container.js +++ b/app/javascript/themes/glitch/features/compose/containers/warning_container.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import Warning from '../components/warning'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const mapStateToProps = state => ({ needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']), diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/themes/glitch/features/compose/index.js index a487f2c89..3fcaf416f 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/themes/glitch/features/compose/index.js @@ -4,16 +4,16 @@ import NavigationContainer from './containers/navigation_container'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; -import { mountCompose, unmountCompose } from '../../actions/compose'; -import { openModal } from '../../actions/modal'; -import { changeLocalSetting } from '../../../glitch/actions/local_settings'; +import { mountCompose, unmountCompose } from 'themes/glitch/actions/compose'; +import { openModal } from 'themes/glitch/actions/modal'; +import { changeLocalSetting } from 'themes/glitch/actions/local_settings'; import { Link } from 'react-router-dom'; import { injectIntl, defineMessages } from 'react-intl'; import SearchContainer from './containers/search_container'; -import Motion from '../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import SearchResultsContainer from './containers/search_results_container'; -import { changeComposing } from '../../actions/compose'; +import { changeComposing } from 'themes/glitch/actions/compose'; const messages = defineMessages({ start: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, diff --git a/app/javascript/mastodon/features/direct_timeline/containers/column_settings_container.js b/app/javascript/themes/glitch/features/direct_timeline/containers/column_settings_container.js index 1833f69e5..2a40c65a5 100644 --- a/app/javascript/mastodon/features/direct_timeline/containers/column_settings_container.js +++ b/app/javascript/themes/glitch/features/direct_timeline/containers/column_settings_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../../community_timeline/components/column_settings'; -import { changeSetting } from '../../../actions/settings'; +import ColumnSettings from 'themes/glitch/features/community_timeline/components/column_settings'; +import { changeSetting } from 'themes/glitch/actions/settings'; const mapStateToProps = state => ({ settings: state.getIn(['settings', 'direct']), diff --git a/app/javascript/mastodon/features/direct_timeline/index.js b/app/javascript/themes/glitch/features/direct_timeline/index.js index 05e092ee0..6b29cf94d 100644 --- a/app/javascript/mastodon/features/direct_timeline/index.js +++ b/app/javascript/themes/glitch/features/direct_timeline/index.js @@ -1,17 +1,17 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../ui/containers/status_list_container'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { refreshDirectTimeline, expandDirectTimeline, -} from '../../actions/timelines'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; +} from 'themes/glitch/actions/timelines'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; -import { connectDirectStream } from '../../actions/streaming'; +import { connectDirectStream } from 'themes/glitch/actions/streaming'; const messages = defineMessages({ title: { id: 'column.direct', defaultMessage: 'Direct messages' }, diff --git a/app/javascript/mastodon/features/favourited_statuses/index.js b/app/javascript/themes/glitch/features/favourited_statuses/index.js index 8135527c9..80345e0e2 100644 --- a/app/javascript/mastodon/features/favourited_statuses/index.js +++ b/app/javascript/themes/glitch/features/favourited_statuses/index.js @@ -2,11 +2,11 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { fetchFavouritedStatuses, expandFavouritedStatuses } from '../../actions/favourites'; -import Column from '../ui/components/column'; -import ColumnHeader from '../../components/column_header'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; -import StatusList from '../../components/status_list'; +import { fetchFavouritedStatuses, expandFavouritedStatuses } from 'themes/glitch/actions/favourites'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; +import StatusList from 'themes/glitch/components/status_list'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/favourites/index.js b/app/javascript/themes/glitch/features/favourites/index.js index 6f113beb4..d7b8ac3b1 100644 --- a/app/javascript/mastodon/features/favourites/index.js +++ b/app/javascript/themes/glitch/features/favourites/index.js @@ -2,12 +2,12 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; -import { fetchFavourites } from '../../actions/interactions'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; +import { fetchFavourites } from 'themes/glitch/actions/interactions'; import { ScrollContainer } from 'react-router-scroll-4'; -import AccountContainer from '../../containers/account_container'; -import Column from '../ui/components/column'; -import ColumnBackButton from '../../components/column_back_button'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ diff --git a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js b/app/javascript/themes/glitch/features/follow_requests/components/account_authorize.js index 4fc5638d9..ce386d888 100644 --- a/app/javascript/mastodon/features/follow_requests/components/account_authorize.js +++ b/app/javascript/themes/glitch/features/follow_requests/components/account_authorize.js @@ -1,10 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Permalink from '../../../components/permalink'; -import Avatar from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import Permalink from 'themes/glitch/components/permalink'; +import Avatar from 'themes/glitch/components/avatar'; +import DisplayName from 'themes/glitch/components/display_name'; +import IconButton from 'themes/glitch/components/icon_button'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js b/app/javascript/themes/glitch/features/follow_requests/containers/account_authorize_container.js index 8db471f73..78ae77eee 100644 --- a/app/javascript/mastodon/features/follow_requests/containers/account_authorize_container.js +++ b/app/javascript/themes/glitch/features/follow_requests/containers/account_authorize_container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux'; -import { makeGetAccount } from '../../../selectors'; +import { makeGetAccount } from 'themes/glitch/selectors'; import AccountAuthorize from '../components/account_authorize'; -import { authorizeFollowRequest, rejectFollowRequest } from '../../../actions/accounts'; +import { authorizeFollowRequest, rejectFollowRequest } from 'themes/glitch/actions/accounts'; const makeMapStateToProps = () => { const getAccount = makeGetAccount(); diff --git a/app/javascript/mastodon/features/follow_requests/index.js b/app/javascript/themes/glitch/features/follow_requests/index.js index 1fa52d511..3f44f518a 100644 --- a/app/javascript/mastodon/features/follow_requests/index.js +++ b/app/javascript/themes/glitch/features/follow_requests/index.js @@ -2,12 +2,12 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; import { ScrollContainer } from 'react-router-scroll-4'; -import Column from '../ui/components/column'; -import ColumnBackButtonSlim from '../../components/column_back_button_slim'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButtonSlim from 'themes/glitch/components/column_back_button_slim'; import AccountAuthorizeContainer from './containers/account_authorize_container'; -import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts'; +import { fetchFollowRequests, expandFollowRequests } from 'themes/glitch/actions/accounts'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/followers/index.js b/app/javascript/themes/glitch/features/followers/index.js index f64ed7948..d586bf41d 100644 --- a/app/javascript/mastodon/features/followers/index.js +++ b/app/javascript/themes/glitch/features/followers/index.js @@ -2,18 +2,18 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; import { fetchAccount, fetchFollowers, expandFollowers, -} from '../../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { ScrollContainer } from 'react-router-scroll-4'; -import AccountContainer from '../../containers/account_container'; -import Column from '../ui/components/column'; -import HeaderContainer from '../account_timeline/containers/header_container'; -import LoadMore from '../../components/load_more'; -import ColumnBackButton from '../../components/column_back_button'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import Column from 'themes/glitch/features/ui/components/column'; +import HeaderContainer from 'themes/glitch/features/account_timeline/containers/header_container'; +import LoadMore from 'themes/glitch/components/load_more'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ diff --git a/app/javascript/mastodon/features/following/index.js b/app/javascript/themes/glitch/features/following/index.js index a0c0fac05..c306faf21 100644 --- a/app/javascript/mastodon/features/following/index.js +++ b/app/javascript/themes/glitch/features/following/index.js @@ -2,18 +2,18 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; import { fetchAccount, fetchFollowing, expandFollowing, -} from '../../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { ScrollContainer } from 'react-router-scroll-4'; -import AccountContainer from '../../containers/account_container'; -import Column from '../ui/components/column'; -import HeaderContainer from '../account_timeline/containers/header_container'; -import LoadMore from '../../components/load_more'; -import ColumnBackButton from '../../components/column_back_button'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import Column from 'themes/glitch/features/ui/components/column'; +import HeaderContainer from 'themes/glitch/features/account_timeline/containers/header_container'; +import LoadMore from 'themes/glitch/components/load_more'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ diff --git a/app/javascript/mastodon/features/generic_not_found/index.js b/app/javascript/themes/glitch/features/generic_not_found/index.js index 0290be47f..ccd2b87b2 100644 --- a/app/javascript/mastodon/features/generic_not_found/index.js +++ b/app/javascript/themes/glitch/features/generic_not_found/index.js @@ -1,6 +1,6 @@ import React from 'react'; -import Column from '../ui/components/column'; -import MissingIndicator from '../../components/missing_indicator'; +import Column from 'themes/glitch/features/ui/components/column'; +import MissingIndicator from 'themes/glitch/components/missing_indicator'; const GenericNotFound = () => ( <Column> diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/themes/glitch/features/getting_started/index.js index 2f7d9281e..74b019cf1 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/themes/glitch/features/getting_started/index.js @@ -1,14 +1,14 @@ import React from 'react'; -import Column from '../ui/components/column'; -import ColumnLink from '../ui/components/column_link'; -import ColumnSubheading from '../ui/components/column_subheading'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnLink from 'themes/glitch/features/ui/components/column_link'; +import ColumnSubheading from 'themes/glitch/features/ui/components/column_subheading'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; -import { openModal } from '../../actions/modal'; +import { openModal } from 'themes/glitch/actions/modal'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me } from '../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' }, diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.js b/app/javascript/themes/glitch/features/hashtag_timeline/index.js index 2077b7cdf..a878931b3 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/index.js +++ b/app/javascript/themes/glitch/features/hashtag_timeline/index.js @@ -1,16 +1,16 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../ui/containers/status_list_container'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { refreshHashtagTimeline, expandHashtagTimeline, -} from '../../actions/timelines'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; +} from 'themes/glitch/actions/timelines'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; import { FormattedMessage } from 'react-intl'; -import { connectHashtagStream } from '../../actions/streaming'; +import { connectHashtagStream } from 'themes/glitch/actions/streaming'; const mapStateToProps = (state, props) => ({ hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0, diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.js b/app/javascript/themes/glitch/features/home_timeline/components/column_settings.js index 43172bd25..533da6c36 100644 --- a/app/javascript/mastodon/features/home_timeline/components/column_settings.js +++ b/app/javascript/themes/glitch/features/home_timeline/components/column_settings.js @@ -2,8 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import SettingToggle from '../../notifications/components/setting_toggle'; -import SettingText from '../../../components/setting_text'; +import SettingToggle from 'themes/glitch/features/notifications/components/setting_toggle'; +import SettingText from 'themes/glitch/components/setting_text'; const messages = defineMessages({ filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, diff --git a/app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js b/app/javascript/themes/glitch/features/home_timeline/containers/column_settings_container.js index fd8a39298..a0062f564 100644 --- a/app/javascript/mastodon/features/home_timeline/containers/column_settings_container.js +++ b/app/javascript/themes/glitch/features/home_timeline/containers/column_settings_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import ColumnSettings from '../components/column_settings'; -import { changeSetting, saveSettings } from '../../../actions/settings'; +import { changeSetting, saveSettings } from 'themes/glitch/actions/settings'; const mapStateToProps = state => ({ settings: state.getIn(['settings', 'home']), diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/themes/glitch/features/home_timeline/index.js index b35347ba6..8a65891cd 100644 --- a/app/javascript/mastodon/features/home_timeline/index.js +++ b/app/javascript/themes/glitch/features/home_timeline/index.js @@ -1,11 +1,11 @@ import React from 'react'; import { connect } from 'react-redux'; -import { expandHomeTimeline } from '../../actions/timelines'; +import { expandHomeTimeline } from 'themes/glitch/actions/timelines'; import PropTypes from 'prop-types'; -import StatusListContainer from '../ui/containers/status_list_container'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; import { Link } from 'react-router-dom'; diff --git a/app/javascript/glitch/components/local_settings/index.js b/app/javascript/themes/glitch/features/local_settings/index.js index ef711229a..6c5d51413 100644 --- a/app/javascript/glitch/components/local_settings/index.js +++ b/app/javascript/themes/glitch/features/local_settings/index.js @@ -1,16 +1,32 @@ -// Package imports +// Package imports. import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { connect } from 'react-redux'; // Our imports import LocalSettingsPage from './page'; import LocalSettingsNavigation from './navigation'; +import { closeModal } from 'themes/glitch/actions/modal'; +import { changeLocalSetting } from 'themes/glitch/actions/local_settings'; // Stylesheet imports import './style.scss'; -export default class LocalSettings extends React.PureComponent { +const mapStateToProps = state => ({ + settings: state.get('local_settings'), +}); + +const mapDispatchToProps = dispatch => ({ + onChange (setting, value) { + dispatch(changeLocalSetting(setting, value)); + }, + onClose () { + dispatch(closeModal()); + }, +}); + +class LocalSettings extends React.PureComponent { static propTypes = { onChange: PropTypes.func.isRequired, @@ -48,3 +64,5 @@ export default class LocalSettings extends React.PureComponent { } } + +export default connect(mapStateToProps, mapDispatchToProps)(LocalSettings); diff --git a/app/javascript/glitch/components/local_settings/navigation/index.js b/app/javascript/themes/glitch/features/local_settings/navigation/index.js index fa35e83c7..fa35e83c7 100644 --- a/app/javascript/glitch/components/local_settings/navigation/index.js +++ b/app/javascript/themes/glitch/features/local_settings/navigation/index.js diff --git a/app/javascript/glitch/components/local_settings/navigation/item/index.js b/app/javascript/themes/glitch/features/local_settings/navigation/item/index.js index a352d5fb2..a352d5fb2 100644 --- a/app/javascript/glitch/components/local_settings/navigation/item/index.js +++ b/app/javascript/themes/glitch/features/local_settings/navigation/item/index.js diff --git a/app/javascript/glitch/components/local_settings/navigation/item/style.scss b/app/javascript/themes/glitch/features/local_settings/navigation/item/style.scss index 7f7371993..7f7371993 100644 --- a/app/javascript/glitch/components/local_settings/navigation/item/style.scss +++ b/app/javascript/themes/glitch/features/local_settings/navigation/item/style.scss diff --git a/app/javascript/glitch/components/local_settings/navigation/style.scss b/app/javascript/themes/glitch/features/local_settings/navigation/style.scss index 0336f943b..0336f943b 100644 --- a/app/javascript/glitch/components/local_settings/navigation/style.scss +++ b/app/javascript/themes/glitch/features/local_settings/navigation/style.scss diff --git a/app/javascript/glitch/components/local_settings/page/index.js b/app/javascript/themes/glitch/features/local_settings/page/index.js index 498230f7b..498230f7b 100644 --- a/app/javascript/glitch/components/local_settings/page/index.js +++ b/app/javascript/themes/glitch/features/local_settings/page/index.js diff --git a/app/javascript/glitch/components/local_settings/page/item/index.js b/app/javascript/themes/glitch/features/local_settings/page/item/index.js index 37e28c084..37e28c084 100644 --- a/app/javascript/glitch/components/local_settings/page/item/index.js +++ b/app/javascript/themes/glitch/features/local_settings/page/item/index.js diff --git a/app/javascript/glitch/components/local_settings/page/item/style.scss b/app/javascript/themes/glitch/features/local_settings/page/item/style.scss index b2d8f7185..b2d8f7185 100644 --- a/app/javascript/glitch/components/local_settings/page/item/style.scss +++ b/app/javascript/themes/glitch/features/local_settings/page/item/style.scss diff --git a/app/javascript/glitch/components/local_settings/page/style.scss b/app/javascript/themes/glitch/features/local_settings/page/style.scss index e9eedcad0..e9eedcad0 100644 --- a/app/javascript/glitch/components/local_settings/page/style.scss +++ b/app/javascript/themes/glitch/features/local_settings/page/style.scss diff --git a/app/javascript/glitch/components/local_settings/style.scss b/app/javascript/themes/glitch/features/local_settings/style.scss index 765294607..765294607 100644 --- a/app/javascript/glitch/components/local_settings/style.scss +++ b/app/javascript/themes/glitch/features/local_settings/style.scss diff --git a/app/javascript/mastodon/features/mutes/index.js b/app/javascript/themes/glitch/features/mutes/index.js index ae6ec343f..1158b8262 100644 --- a/app/javascript/mastodon/features/mutes/index.js +++ b/app/javascript/themes/glitch/features/mutes/index.js @@ -2,12 +2,12 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; import { ScrollContainer } from 'react-router-scroll-4'; -import Column from '../ui/components/column'; -import ColumnBackButtonSlim from '../../components/column_back_button_slim'; -import AccountContainer from '../../containers/account_container'; -import { fetchMutes, expandMutes } from '../../actions/mutes'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButtonSlim from 'themes/glitch/components/column_back_button_slim'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import { fetchMutes, expandMutes } from 'themes/glitch/actions/mutes'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.js b/app/javascript/themes/glitch/features/notifications/components/clear_column_button.js index 22a10753f..22a10753f 100644 --- a/app/javascript/mastodon/features/notifications/components/clear_column_button.js +++ b/app/javascript/themes/glitch/features/notifications/components/clear_column_button.js diff --git a/app/javascript/mastodon/features/notifications/components/column_settings.js b/app/javascript/themes/glitch/features/notifications/components/column_settings.js index 88a29d4d3..88a29d4d3 100644 --- a/app/javascript/mastodon/features/notifications/components/column_settings.js +++ b/app/javascript/themes/glitch/features/notifications/components/column_settings.js diff --git a/app/javascript/themes/glitch/features/notifications/components/follow.js b/app/javascript/themes/glitch/features/notifications/components/follow.js new file mode 100644 index 000000000..8a0f01736 --- /dev/null +++ b/app/javascript/themes/glitch/features/notifications/components/follow.js @@ -0,0 +1,97 @@ +// Package imports. +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { HotKeys } from 'react-hotkeys'; + +// Our imports. +import Permalink from 'themes/glitch/components/permalink'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import NotificationOverlayContainer from '../containers/overlay_container'; + +export default class NotificationFollow extends ImmutablePureComponent { + + static propTypes = { + id: PropTypes.string.isRequired, + account: ImmutablePropTypes.map.isRequired, + notification: ImmutablePropTypes.map.isRequired, + }; + + handleMoveUp = () => { + const { notification, onMoveUp } = this.props; + onMoveUp(notification.get('id')); + } + + handleMoveDown = () => { + const { notification, onMoveDown } = this.props; + onMoveDown(notification.get('id')); + } + + handleOpen = () => { + this.handleOpenProfile(); + } + + handleOpenProfile = () => { + const { notification } = this.props; + this.context.router.history.push(`/accounts/${notification.getIn(['account', 'id'])}`); + } + + handleMention = e => { + e.preventDefault(); + + const { notification, onMention } = this.props; + onMention(notification.get('account'), this.context.router.history); + } + + getHandlers () { + return { + moveUp: this.handleMoveUp, + moveDown: this.handleMoveDown, + open: this.handleOpen, + openProfile: this.handleOpenProfile, + mention: this.handleMention, + reply: this.handleMention, + }; + } + + render () { + const { account, notification } = this.props; + + // Links to the display name. + const displayName = account.get('display_name_html') || account.get('username'); + const link = ( + <Permalink + className='notification__display-name' + href={account.get('url')} + title={account.get('acct')} + to={`/accounts/${account.get('id')}`} + dangerouslySetInnerHTML={{ __html: displayName }} + /> + ); + + // Renders. + return ( + <HotKeys handlers={this.getHandlers()}> + <div className='notification notification-follow focusable' tabIndex='0'> + <div className='notification__message'> + <div className='notification__favourite-icon-wrapper'> + <i className='fa fa-fw fa-user-plus' /> + </div> + + <FormattedMessage + id='notification.follow' + defaultMessage='{name} followed you' + values={{ name: link }} + /> + </div> + + <AccountContainer id={account.get('id')} withNote={false} /> + <NotificationOverlayContainer notification={notification} /> + </div> + </HotKeys> + ); + } + +} diff --git a/app/javascript/glitch/components/notification/index.js b/app/javascript/themes/glitch/features/notifications/components/notification.js index b2e55aad5..a309d3a42 100644 --- a/app/javascript/glitch/components/notification/index.js +++ b/app/javascript/themes/glitch/features/notifications/components/notification.js @@ -1,22 +1,26 @@ -// Package imports // +// Package imports. import React from 'react'; +import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -// Mastodon imports // - -// Our imports // -import StatusContainer from '../status/container'; +// Our imports, +import StatusContainer from 'themes/glitch/containers/status_container'; import NotificationFollow from './follow'; export default class Notification extends ImmutablePureComponent { static propTypes = { notification: ImmutablePropTypes.map.isRequired, + hidden: PropTypes.bool, + onMoveUp: PropTypes.func.isRequired, + onMoveDown: PropTypes.func.isRequired, + onMention: PropTypes.func.isRequired, settings: ImmutablePropTypes.map.isRequired, }; - renderFollow (notification) { + renderFollow () { + const { notification } = this.props; return ( <NotificationFollow id={notification.get('id')} @@ -26,7 +30,8 @@ export default class Notification extends ImmutablePureComponent { ); } - renderMention (notification) { + renderMention () { + const { notification } = this.props; return ( <StatusContainer id={notification.get('status')} @@ -36,7 +41,8 @@ export default class Notification extends ImmutablePureComponent { ); } - renderFavourite (notification) { + renderFavourite () { + const { notification } = this.props; return ( <StatusContainer id={notification.get('status')} @@ -49,7 +55,8 @@ export default class Notification extends ImmutablePureComponent { ); } - renderReblog (notification) { + renderReblog () { + const { notification } = this.props; return ( <StatusContainer id={notification.get('status')} @@ -64,19 +71,18 @@ export default class Notification extends ImmutablePureComponent { render () { const { notification } = this.props; - switch(notification.get('type')) { case 'follow': - return this.renderFollow(notification); + return this.renderFollow(); case 'mention': - return this.renderMention(notification); + return this.renderMention(); case 'favourite': - return this.renderFavourite(notification); + return this.renderFavourite(); case 'reblog': - return this.renderReblog(notification); + return this.renderReblog(); + default: + return null; } - - return null; } } diff --git a/app/javascript/glitch/components/notification/overlay/notification_overlay.js b/app/javascript/themes/glitch/features/notifications/components/overlay.js index aaca95cac..e56f9c628 100644 --- a/app/javascript/glitch/components/notification/overlay/notification_overlay.js +++ b/app/javascript/themes/glitch/features/notifications/components/overlay.js @@ -3,17 +3,13 @@ */ -// Package imports // +// Package imports. import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl } from 'react-intl'; -// Mastodon imports // - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - const messages = defineMessages({ markForDeletion: { id: 'notification.markForDeletion', defaultMessage: 'Mark for deletion' }, }); diff --git a/app/javascript/mastodon/features/notifications/components/setting_toggle.js b/app/javascript/themes/glitch/features/notifications/components/setting_toggle.js index 281359d2a..281359d2a 100644 --- a/app/javascript/mastodon/features/notifications/components/setting_toggle.js +++ b/app/javascript/themes/glitch/features/notifications/components/setting_toggle.js diff --git a/app/javascript/mastodon/features/notifications/containers/column_settings_container.js b/app/javascript/themes/glitch/features/notifications/containers/column_settings_container.js index d4ead7881..ddc8495f4 100644 --- a/app/javascript/mastodon/features/notifications/containers/column_settings_container.js +++ b/app/javascript/themes/glitch/features/notifications/containers/column_settings_container.js @@ -1,10 +1,10 @@ import { connect } from 'react-redux'; import { defineMessages, injectIntl } from 'react-intl'; import ColumnSettings from '../components/column_settings'; -import { changeSetting, saveSettings } from '../../../actions/settings'; -import { clearNotifications } from '../../../actions/notifications'; -import { changeAlerts as changePushNotifications, saveSettings as savePushNotificationSettings } from '../../../actions/push_notifications'; -import { openModal } from '../../../actions/modal'; +import { changeSetting, saveSettings } from 'themes/glitch/actions/settings'; +import { clearNotifications } from 'themes/glitch/actions/notifications'; +import { changeAlerts as changePushNotifications, saveSettings as savePushNotificationSettings } from 'themes/glitch/actions/push_notifications'; +import { openModal } from 'themes/glitch/actions/modal'; const messages = defineMessages({ clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' }, diff --git a/app/javascript/mastodon/features/notifications/containers/notification_container.js b/app/javascript/themes/glitch/features/notifications/containers/notification_container.js index fd16c4331..b61aaa21c 100644 --- a/app/javascript/mastodon/features/notifications/containers/notification_container.js +++ b/app/javascript/themes/glitch/features/notifications/containers/notification_container.js @@ -1,16 +1,18 @@ -// THIS FILE EXISTS FOR UPSTREAM COMPATIBILITY & SHOULDN'T BE USED !! -// SEE INSTEAD : glitch/components/notification/container - +// Package imports. import { connect } from 'react-redux'; -import { makeGetNotification } from '../../../selectors'; + +// Our imports. +import { makeGetNotification } from 'themes/glitch/selectors'; import Notification from '../components/notification'; -import { mentionCompose } from '../../../actions/compose'; +import { mentionCompose } from 'themes/glitch/actions/compose'; const makeMapStateToProps = () => { const getNotification = makeGetNotification(); const mapStateToProps = (state, props) => ({ notification: getNotification(state, props.notification, props.accountId), + settings: state.get('local_settings'), + notifCleaning: state.getIn(['notifications', 'cleaningMode']), }); return mapStateToProps; diff --git a/app/javascript/themes/glitch/features/notifications/containers/overlay_container.js b/app/javascript/themes/glitch/features/notifications/containers/overlay_container.js new file mode 100644 index 000000000..52649cdd7 --- /dev/null +++ b/app/javascript/themes/glitch/features/notifications/containers/overlay_container.js @@ -0,0 +1,18 @@ +// Package imports. +import { connect } from 'react-redux'; + +// Our imports. +import NotificationOverlay from '../components/overlay'; +import { markNotificationForDelete } from 'themes/glitch/actions/notifications'; + +const mapDispatchToProps = dispatch => ({ + onMarkForDelete(id, yes) { + dispatch(markNotificationForDelete(id, yes)); + }, +}); + +const mapStateToProps = state => ({ + show: state.getIn(['notifications', 'cleaningMode']), +}); + +export default connect(mapStateToProps, mapDispatchToProps)(NotificationOverlay); diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/themes/glitch/features/notifications/index.js index 9c6802482..1ecde660a 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/themes/glitch/features/notifications/index.js @@ -2,21 +2,21 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { enterNotificationClearingMode, expandNotifications, scrollTopNotifications, -} from '../../actions/notifications'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; -import NotificationContainer from '../../../glitch/components/notification/container'; +} from 'themes/glitch/actions/notifications'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; +import NotificationContainer from './containers/notification_container'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; import { createSelector } from 'reselect'; import { List as ImmutableList } from 'immutable'; import { debounce } from 'lodash'; -import ScrollableList from '../../components/scrollable_list'; +import ScrollableList from 'themes/glitch/components/scrollable_list'; const messages = defineMessages({ title: { id: 'column.notifications', defaultMessage: 'Notifications' }, diff --git a/app/javascript/mastodon/features/pinned_statuses/index.js b/app/javascript/themes/glitch/features/pinned_statuses/index.js index b4a6c1e52..0a3997850 100644 --- a/app/javascript/mastodon/features/pinned_statuses/index.js +++ b/app/javascript/themes/glitch/features/pinned_statuses/index.js @@ -2,10 +2,10 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { fetchPinnedStatuses } from '../../actions/pin_statuses'; -import Column from '../ui/components/column'; -import ColumnBackButtonSlim from '../../components/column_back_button_slim'; -import StatusList from '../../components/status_list'; +import { fetchPinnedStatuses } from 'themes/glitch/actions/pin_statuses'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButtonSlim from 'themes/glitch/components/column_back_button_slim'; +import StatusList from 'themes/glitch/components/status_list'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; diff --git a/app/javascript/mastodon/features/public_timeline/containers/column_settings_container.js b/app/javascript/themes/glitch/features/public_timeline/containers/column_settings_container.js index 203e1da92..0185a7724 100644 --- a/app/javascript/mastodon/features/public_timeline/containers/column_settings_container.js +++ b/app/javascript/themes/glitch/features/public_timeline/containers/column_settings_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; -import ColumnSettings from '../../community_timeline/components/column_settings'; -import { changeSetting } from '../../../actions/settings'; +import ColumnSettings from 'themes/glitch/features/community_timeline/components/column_settings'; +import { changeSetting } from 'themes/glitch/actions/settings'; const mapStateToProps = state => ({ settings: state.getIn(['settings', 'public']), diff --git a/app/javascript/mastodon/features/public_timeline/index.js b/app/javascript/themes/glitch/features/public_timeline/index.js index 1821bc448..f5b3865af 100644 --- a/app/javascript/mastodon/features/public_timeline/index.js +++ b/app/javascript/themes/glitch/features/public_timeline/index.js @@ -1,17 +1,17 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../ui/containers/status_list_container'; -import Column from '../../components/column'; -import ColumnHeader from '../../components/column_header'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { refreshPublicTimeline, expandPublicTimeline, -} from '../../actions/timelines'; -import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; +} from 'themes/glitch/actions/timelines'; +import { addColumn, removeColumn, moveColumn } from 'themes/glitch/actions/columns'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; -import { connectPublicStream } from '../../actions/streaming'; +import { connectPublicStream } from 'themes/glitch/actions/streaming'; const messages = defineMessages({ title: { id: 'column.public', defaultMessage: 'Federated timeline' }, diff --git a/app/javascript/mastodon/features/reblogs/index.js b/app/javascript/themes/glitch/features/reblogs/index.js index 579d6aaa0..8723f7c7c 100644 --- a/app/javascript/mastodon/features/reblogs/index.js +++ b/app/javascript/themes/glitch/features/reblogs/index.js @@ -2,12 +2,12 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import LoadingIndicator from '../../components/loading_indicator'; -import { fetchReblogs } from '../../actions/interactions'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; +import { fetchReblogs } from 'themes/glitch/actions/interactions'; import { ScrollContainer } from 'react-router-scroll-4'; -import AccountContainer from '../../containers/account_container'; -import Column from '../ui/components/column'; -import ColumnBackButton from '../../components/column_back_button'; +import AccountContainer from 'themes/glitch/containers/account_container'; +import Column from 'themes/glitch/features/ui/components/column'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; const mapStateToProps = (state, props) => ({ diff --git a/app/javascript/mastodon/features/report/components/status_check_box.js b/app/javascript/themes/glitch/features/report/components/status_check_box.js index cc9232201..cc9232201 100644 --- a/app/javascript/mastodon/features/report/components/status_check_box.js +++ b/app/javascript/themes/glitch/features/report/components/status_check_box.js diff --git a/app/javascript/mastodon/features/report/containers/status_check_box_container.js b/app/javascript/themes/glitch/features/report/containers/status_check_box_container.js index 48cd0319b..40d55fb3c 100644 --- a/app/javascript/mastodon/features/report/containers/status_check_box_container.js +++ b/app/javascript/themes/glitch/features/report/containers/status_check_box_container.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import StatusCheckBox from '../components/status_check_box'; -import { toggleStatusReport } from '../../../actions/reports'; +import { toggleStatusReport } from 'themes/glitch/actions/reports'; import { Set as ImmutableSet } from 'immutable'; const mapStateToProps = (state, { id }) => ({ diff --git a/app/javascript/themes/glitch/features/standalone/compose/index.js b/app/javascript/themes/glitch/features/standalone/compose/index.js new file mode 100644 index 000000000..8a8118178 --- /dev/null +++ b/app/javascript/themes/glitch/features/standalone/compose/index.js @@ -0,0 +1,20 @@ +import React from 'react'; +import ComposeFormContainer from 'themes/glitch/features/compose/containers/compose_form_container'; +import NotificationsContainer from 'themes/glitch/features/ui/containers/notifications_container'; +import LoadingBarContainer from 'themes/glitch/features/ui/containers/loading_bar_container'; +import ModalContainer from 'themes/glitch/features/ui/containers/modal_container'; + +export default class Compose extends React.PureComponent { + + render () { + return ( + <div> + <ComposeFormContainer /> + <NotificationsContainer /> + <ModalContainer /> + <LoadingBarContainer className='loading-bar' /> + </div> + ); + } + +} diff --git a/app/javascript/mastodon/features/standalone/hashtag_timeline/index.js b/app/javascript/themes/glitch/features/standalone/hashtag_timeline/index.js index f15fbb2f4..7c56f264f 100644 --- a/app/javascript/mastodon/features/standalone/hashtag_timeline/index.js +++ b/app/javascript/themes/glitch/features/standalone/hashtag_timeline/index.js @@ -1,13 +1,13 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../../ui/containers/status_list_container'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; import { refreshHashtagTimeline, expandHashtagTimeline, -} from '../../../actions/timelines'; -import Column from '../../../components/column'; -import ColumnHeader from '../../../components/column_header'; +} from 'themes/glitch/actions/timelines'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; @connect() export default class HashtagTimeline extends React.PureComponent { diff --git a/app/javascript/mastodon/features/standalone/public_timeline/index.js b/app/javascript/themes/glitch/features/standalone/public_timeline/index.js index de4b5320a..b3fb55288 100644 --- a/app/javascript/mastodon/features/standalone/public_timeline/index.js +++ b/app/javascript/themes/glitch/features/standalone/public_timeline/index.js @@ -1,13 +1,13 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import StatusListContainer from '../../ui/containers/status_list_container'; +import StatusListContainer from 'themes/glitch/features/ui/containers/status_list_container'; import { refreshPublicTimeline, expandPublicTimeline, -} from '../../../actions/timelines'; -import Column from '../../../components/column'; -import ColumnHeader from '../../../components/column_header'; +} from 'themes/glitch/actions/timelines'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import { defineMessages, injectIntl } from 'react-intl'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/themes/glitch/features/status/components/action_bar.js index 8c6994a07..6cda988d1 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.js +++ b/app/javascript/themes/glitch/features/status/components/action_bar.js @@ -1,10 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import IconButton from '../../../components/icon_button'; +import IconButton from 'themes/glitch/components/icon_button'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import DropdownMenuContainer from '../../../containers/dropdown_menu_container'; +import DropdownMenuContainer from 'themes/glitch/containers/dropdown_menu_container'; import { defineMessages, injectIntl } from 'react-intl'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const messages = defineMessages({ delete: { id: 'status.delete', defaultMessage: 'Delete' }, diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/themes/glitch/features/status/components/card.js index bb83374b9..bb83374b9 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/themes/glitch/features/status/components/card.js diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/themes/glitch/features/status/components/detailed_status.js index 85a030ea8..7606bfbf3 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/themes/glitch/features/status/components/detailed_status.js @@ -1,18 +1,17 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import Avatar from '../../../components/avatar'; -import DisplayName from '../../../components/display_name'; -import StatusContent from '../../../../glitch/components/status/content'; -import StatusGallery from '../../../../glitch/components/status/gallery'; -import StatusPlayer from '../../../../glitch/components/status/player'; -import AttachmentList from '../../../components/attachment_list'; +import Avatar from 'themes/glitch/components/avatar'; +import DisplayName from 'themes/glitch/components/display_name'; +import StatusContent from 'themes/glitch/components/status_content'; +import StatusGallery from 'themes/glitch/components/media_gallery'; +import AttachmentList from 'themes/glitch/components/attachment_list'; import { Link } from 'react-router-dom'; import { FormattedDate, FormattedNumber } from 'react-intl'; import CardContainer from '../containers/card_container'; import ImmutablePureComponent from 'react-immutable-pure-component'; -// import Video from '../../video'; -import VisibilityIcon from '../../../../glitch/components/status/visibility_icon'; +import Video from 'themes/glitch/features/video'; +import VisibilityIcon from 'themes/glitch/components/status_visibility_icon'; export default class DetailedStatus extends ImmutablePureComponent { @@ -55,12 +54,11 @@ export default class DetailedStatus extends ImmutablePureComponent { media = <AttachmentList media={status.get('media_attachments')} />; } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { media = ( - <StatusPlayer + <Video sensitive={status.get('sensitive')} media={status.getIn(['media_attachments', 0])} letterbox={settings.getIn(['media', 'letterbox'])} fullwidth={settings.getIn(['media', 'fullwidth'])} - height={250} onOpenVideo={this.props.onOpenVideo} autoplay /> @@ -72,8 +70,6 @@ export default class DetailedStatus extends ImmutablePureComponent { sensitive={status.get('sensitive')} media={status.get('media_attachments')} letterbox={settings.getIn(['media', 'letterbox'])} - fullwidth={settings.getIn(['media', 'fullwidth'])} - height={250} onOpenMedia={this.props.onOpenMedia} /> ); diff --git a/app/javascript/mastodon/features/status/containers/card_container.js b/app/javascript/themes/glitch/features/status/containers/card_container.js index a97404de1..a97404de1 100644 --- a/app/javascript/mastodon/features/status/containers/card_container.js +++ b/app/javascript/themes/glitch/features/status/containers/card_container.js diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/themes/glitch/features/status/index.js index e7ea046dd..57af94a9a 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/themes/glitch/features/status/index.js @@ -3,11 +3,11 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { fetchStatus } from '../../actions/statuses'; -import MissingIndicator from '../../components/missing_indicator'; +import { fetchStatus } from 'themes/glitch/actions/statuses'; +import MissingIndicator from 'themes/glitch/components/missing_indicator'; import DetailedStatus from './components/detailed_status'; import ActionBar from './components/action_bar'; -import Column from '../ui/components/column'; +import Column from 'themes/glitch/features/ui/components/column'; import { favourite, unfavourite, @@ -15,23 +15,23 @@ import { unreblog, pin, unpin, -} from '../../actions/interactions'; +} from 'themes/glitch/actions/interactions'; import { replyCompose, mentionCompose, -} from '../../actions/compose'; -import { deleteStatus } from '../../actions/statuses'; -import { initReport } from '../../actions/reports'; -import { makeGetStatus } from '../../selectors'; +} from 'themes/glitch/actions/compose'; +import { deleteStatus } from 'themes/glitch/actions/statuses'; +import { initReport } from 'themes/glitch/actions/reports'; +import { makeGetStatus } from 'themes/glitch/selectors'; import { ScrollContainer } from 'react-router-scroll-4'; -import ColumnBackButton from '../../components/column_back_button'; -import StatusContainer from '../../../glitch/components/status/container'; -import { openModal } from '../../actions/modal'; +import ColumnBackButton from 'themes/glitch/components/column_back_button'; +import StatusContainer from 'themes/glitch/containers/status_container'; +import { openModal } from 'themes/glitch/actions/modal'; import { defineMessages, injectIntl } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { HotKeys } from 'react-hotkeys'; -import { boostModal, deleteModal } from '../../initial_state'; -import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from '../../features/ui/util/fullscreen'; +import { boostModal, deleteModal } from 'themes/glitch/util/initial_state'; +import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'themes/glitch/util/fullscreen'; const messages = defineMessages({ deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' }, diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js b/app/javascript/themes/glitch/features/ui/components/__tests__/column-test.js index 1e5e1d8dc..1e5e1d8dc 100644 --- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.js +++ b/app/javascript/themes/glitch/features/ui/components/__tests__/column-test.js diff --git a/app/javascript/mastodon/features/ui/components/actions_modal.js b/app/javascript/themes/glitch/features/ui/components/actions_modal.js index 79a5a20ef..7a2b78b63 100644 --- a/app/javascript/mastodon/features/ui/components/actions_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/actions_modal.js @@ -2,11 +2,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import StatusContent from '../../../components/status_content'; -import Avatar from '../../../components/avatar'; -import RelativeTimestamp from '../../../components/relative_timestamp'; -import DisplayName from '../../../components/display_name'; -import IconButton from '../../../components/icon_button'; +import StatusContent from 'themes/glitch/components/status_content'; +import Avatar from 'themes/glitch/components/avatar'; +import RelativeTimestamp from 'themes/glitch/components/relative_timestamp'; +import DisplayName from 'themes/glitch/components/display_name'; +import IconButton from 'themes/glitch/components/icon_button'; import classNames from 'classnames'; export default class ActionsModal extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/themes/glitch/features/ui/components/boost_modal.js index dfd1284e9..49781db10 100644 --- a/app/javascript/mastodon/features/ui/components/boost_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/boost_modal.js @@ -2,11 +2,11 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Button from '../../../components/button'; -import StatusContent from '../../../../glitch/components/status/content'; -import Avatar from '../../../components/avatar'; -import RelativeTimestamp from '../../../components/relative_timestamp'; -import DisplayName from '../../../components/display_name'; +import Button from 'themes/glitch/components/button'; +import StatusContent from 'themes/glitch/components/status_content'; +import Avatar from 'themes/glitch/components/avatar'; +import RelativeTimestamp from 'themes/glitch/components/relative_timestamp'; +import DisplayName from 'themes/glitch/components/display_name'; import ImmutablePureComponent from 'react-immutable-pure-component'; const messages = defineMessages({ diff --git a/app/javascript/mastodon/features/ui/components/bundle.js b/app/javascript/themes/glitch/features/ui/components/bundle.js index fc88e0c70..fc88e0c70 100644 --- a/app/javascript/mastodon/features/ui/components/bundle.js +++ b/app/javascript/themes/glitch/features/ui/components/bundle.js diff --git a/app/javascript/mastodon/features/ui/components/bundle_column_error.js b/app/javascript/themes/glitch/features/ui/components/bundle_column_error.js index cd124746a..daedc6299 100644 --- a/app/javascript/mastodon/features/ui/components/bundle_column_error.js +++ b/app/javascript/themes/glitch/features/ui/components/bundle_column_error.js @@ -4,8 +4,8 @@ import { defineMessages, injectIntl } from 'react-intl'; import Column from './column'; import ColumnHeader from './column_header'; -import ColumnBackButtonSlim from '../../../components/column_back_button_slim'; -import IconButton from '../../../components/icon_button'; +import ColumnBackButtonSlim from 'themes/glitch/components/column_back_button_slim'; +import IconButton from 'themes/glitch/components/icon_button'; const messages = defineMessages({ title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' }, diff --git a/app/javascript/mastodon/features/ui/components/bundle_modal_error.js b/app/javascript/themes/glitch/features/ui/components/bundle_modal_error.js index 928bfe1f7..8cca32ae9 100644 --- a/app/javascript/mastodon/features/ui/components/bundle_modal_error.js +++ b/app/javascript/themes/glitch/features/ui/components/bundle_modal_error.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import IconButton from 'themes/glitch/components/icon_button'; const messages = defineMessages({ error: { id: 'bundle_modal_error.message', defaultMessage: 'Something went wrong while loading this component.' }, diff --git a/app/javascript/mastodon/features/ui/components/column.js b/app/javascript/themes/glitch/features/ui/components/column.js index c1700f86e..73a5bc15e 100644 --- a/app/javascript/mastodon/features/ui/components/column.js +++ b/app/javascript/themes/glitch/features/ui/components/column.js @@ -2,8 +2,8 @@ import React from 'react'; import ColumnHeader from './column_header'; import PropTypes from 'prop-types'; import { debounce } from 'lodash'; -import { scrollTop } from '../../../scroll'; -import { isMobile } from '../../../is_mobile'; +import { scrollTop } from 'themes/glitch/util/scroll'; +import { isMobile } from 'themes/glitch/util/is_mobile'; export default class Column extends React.PureComponent { diff --git a/app/javascript/mastodon/features/ui/components/column_header.js b/app/javascript/themes/glitch/features/ui/components/column_header.js index af195ea9c..af195ea9c 100644 --- a/app/javascript/mastodon/features/ui/components/column_header.js +++ b/app/javascript/themes/glitch/features/ui/components/column_header.js diff --git a/app/javascript/mastodon/features/ui/components/column_link.js b/app/javascript/themes/glitch/features/ui/components/column_link.js index b845d1895..b845d1895 100644 --- a/app/javascript/mastodon/features/ui/components/column_link.js +++ b/app/javascript/themes/glitch/features/ui/components/column_link.js diff --git a/app/javascript/mastodon/features/ui/components/column_loading.js b/app/javascript/themes/glitch/features/ui/components/column_loading.js index 9503a7a1a..75f26218a 100644 --- a/app/javascript/mastodon/features/ui/components/column_loading.js +++ b/app/javascript/themes/glitch/features/ui/components/column_loading.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Column from '../../../components/column'; -import ColumnHeader from '../../../components/column_header'; +import Column from 'themes/glitch/components/column'; +import ColumnHeader from 'themes/glitch/components/column_header'; import ImmutablePureComponent from 'react-immutable-pure-component'; export default class ColumnLoading extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/components/column_subheading.js b/app/javascript/themes/glitch/features/ui/components/column_subheading.js index 8160c4aa3..8160c4aa3 100644 --- a/app/javascript/mastodon/features/ui/components/column_subheading.js +++ b/app/javascript/themes/glitch/features/ui/components/column_subheading.js diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/themes/glitch/features/ui/components/columns_area.js index ee1064229..452950363 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/themes/glitch/features/ui/components/columns_area.js @@ -11,10 +11,10 @@ import BundleContainer from '../containers/bundle_container'; import ColumnLoading from './column_loading'; import DrawerLoading from './drawer_loading'; import BundleColumnError from './bundle_column_error'; -import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses } from '../../ui/util/async-components'; +import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses } from 'themes/glitch/util/async-components'; import detectPassiveEvents from 'detect-passive-events'; -import { scrollRight } from '../../../scroll'; +import { scrollRight } from 'themes/glitch/util/scroll'; const componentMap = { 'COMPOSE': Compose, diff --git a/app/javascript/mastodon/features/ui/components/confirmation_modal.js b/app/javascript/themes/glitch/features/ui/components/confirmation_modal.js index 86588c46a..3d568aec3 100644 --- a/app/javascript/mastodon/features/ui/components/confirmation_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/confirmation_modal.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { injectIntl, FormattedMessage } from 'react-intl'; -import Button from '../../../components/button'; +import Button from 'themes/glitch/components/button'; @injectIntl export default class ConfirmationModal extends React.PureComponent { diff --git a/app/javascript/mastodon/features/ui/components/doodle_modal.js b/app/javascript/themes/glitch/features/ui/components/doodle_modal.js index 4efc9d2e6..819656dbf 100644 --- a/app/javascript/mastodon/features/ui/components/doodle_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/doodle_modal.js @@ -1,12 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Button from '../../../components/button'; +import Button from 'themes/glitch/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Atrament from 'atrament'; // the doodling library import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { doodleSet, uploadCompose } from '../../../actions/compose'; -import IconButton from '../../../components/icon_button'; +import { doodleSet, uploadCompose } from 'themes/glitch/actions/compose'; +import IconButton from 'themes/glitch/components/icon_button'; import { debounce, mapValues } from 'lodash'; import classNames from 'classnames'; diff --git a/app/javascript/mastodon/features/ui/components/drawer_loading.js b/app/javascript/themes/glitch/features/ui/components/drawer_loading.js index 08b0d2347..08b0d2347 100644 --- a/app/javascript/mastodon/features/ui/components/drawer_loading.js +++ b/app/javascript/themes/glitch/features/ui/components/drawer_loading.js diff --git a/app/javascript/mastodon/features/ui/components/embed_modal.js b/app/javascript/themes/glitch/features/ui/components/embed_modal.js index 1afffb51b..1afffb51b 100644 --- a/app/javascript/mastodon/features/ui/components/embed_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/embed_modal.js diff --git a/app/javascript/mastodon/features/ui/components/image_loader.js b/app/javascript/themes/glitch/features/ui/components/image_loader.js index aad594380..aad594380 100644 --- a/app/javascript/mastodon/features/ui/components/image_loader.js +++ b/app/javascript/themes/glitch/features/ui/components/image_loader.js diff --git a/app/javascript/mastodon/features/ui/components/media_modal.js b/app/javascript/themes/glitch/features/ui/components/media_modal.js index f41a83089..1dad972b2 100644 --- a/app/javascript/mastodon/features/ui/components/media_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/media_modal.js @@ -2,9 +2,9 @@ import React from 'react'; import ReactSwipeableViews from 'react-swipeable-views'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import ExtendedVideoPlayer from '../../../components/extended_video_player'; +import ExtendedVideoPlayer from 'themes/glitch/components/extended_video_player'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import IconButton from 'themes/glitch/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import ImageLoader from './image_loader'; diff --git a/app/javascript/mastodon/features/ui/components/modal_loading.js b/app/javascript/themes/glitch/features/ui/components/modal_loading.js index f403ca4c9..e14d20fbb 100644 --- a/app/javascript/mastodon/features/ui/components/modal_loading.js +++ b/app/javascript/themes/glitch/features/ui/components/modal_loading.js @@ -1,6 +1,6 @@ import React from 'react'; -import LoadingIndicator from '../../../components/loading_indicator'; +import LoadingIndicator from 'themes/glitch/components/loading_indicator'; // Keep the markup in sync with <BundleModalError /> // (make sure they have the same dimensions) diff --git a/app/javascript/mastodon/features/ui/components/modal_root.js b/app/javascript/themes/glitch/features/ui/components/modal_root.js index 3e56fbf8e..fbe794170 100644 --- a/app/javascript/mastodon/features/ui/components/modal_root.js +++ b/app/javascript/themes/glitch/features/ui/components/modal_root.js @@ -15,7 +15,7 @@ import { ReportModal, SettingsModal, EmbedModal, -} from '../../../features/ui/util/async-components'; +} from 'themes/glitch/util/async-components'; const MODAL_COMPONENTS = { 'MEDIA': () => Promise.resolve({ default: MediaModal }), diff --git a/app/javascript/mastodon/features/ui/components/mute_modal.js b/app/javascript/themes/glitch/features/ui/components/mute_modal.js index 73e48cf09..ffccdc84d 100644 --- a/app/javascript/mastodon/features/ui/components/mute_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/mute_modal.js @@ -3,10 +3,10 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { injectIntl, FormattedMessage } from 'react-intl'; import Toggle from 'react-toggle'; -import Button from '../../../components/button'; -import { closeModal } from '../../../actions/modal'; -import { muteAccount } from '../../../actions/accounts'; -import { toggleHideNotifications } from '../../../actions/mutes'; +import Button from 'themes/glitch/components/button'; +import { closeModal } from 'themes/glitch/actions/modal'; +import { muteAccount } from 'themes/glitch/actions/accounts'; +import { toggleHideNotifications } from 'themes/glitch/actions/mutes'; const mapStateToProps = state => { diff --git a/app/javascript/mastodon/features/ui/components/onboarding_modal.js b/app/javascript/themes/glitch/features/ui/components/onboarding_modal.js index 1f9f0cd03..58875262e 100644 --- a/app/javascript/mastodon/features/ui/components/onboarding_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/onboarding_modal.js @@ -5,16 +5,16 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ReactSwipeableViews from 'react-swipeable-views'; import classNames from 'classnames'; -import Permalink from '../../../components/permalink'; -import ComposeForm from '../../compose/components/compose_form'; -import Search from '../../compose/components/search'; -import NavigationBar from '../../compose/components/navigation_bar'; +import Permalink from 'themes/glitch/components/permalink'; +import ComposeForm from 'themes/glitch/features/compose/components/compose_form'; +import Search from 'themes/glitch/features/compose/components/search'; +import NavigationBar from 'themes/glitch/features/compose/components/navigation_bar'; import ColumnHeader from './column_header'; import { List as ImmutableList, Map as ImmutableMap, } from 'immutable'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const noop = () => { }; diff --git a/app/javascript/mastodon/features/ui/components/report_modal.js b/app/javascript/themes/glitch/features/ui/components/report_modal.js index b5dfa422e..e6153948e 100644 --- a/app/javascript/mastodon/features/ui/components/report_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/report_modal.js @@ -1,15 +1,15 @@ import React from 'react'; import { connect } from 'react-redux'; -import { changeReportComment, submitReport } from '../../../actions/reports'; -import { refreshAccountTimeline } from '../../../actions/timelines'; +import { changeReportComment, submitReport } from 'themes/glitch/actions/reports'; +import { refreshAccountTimeline } from 'themes/glitch/actions/timelines'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { makeGetAccount } from '../../../selectors'; +import { makeGetAccount } from 'themes/glitch/selectors'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl'; -import StatusCheckBox from '../../report/containers/status_check_box_container'; +import StatusCheckBox from 'themes/glitch/features/report/containers/status_check_box_container'; import { OrderedSet } from 'immutable'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import Button from '../../../components/button'; +import Button from 'themes/glitch/components/button'; const messages = defineMessages({ placeholder: { id: 'report.placeholder', defaultMessage: 'Additional comments' }, diff --git a/app/javascript/mastodon/features/ui/components/tabs_bar.js b/app/javascript/themes/glitch/features/ui/components/tabs_bar.js index 7694e5ab3..ef5deae99 100644 --- a/app/javascript/mastodon/features/ui/components/tabs_bar.js +++ b/app/javascript/themes/glitch/features/ui/components/tabs_bar.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { NavLink } from 'react-router-dom'; import { FormattedMessage, injectIntl } from 'react-intl'; import { debounce } from 'lodash'; -import { isUserTouching } from '../../../is_mobile'; +import { isUserTouching } from 'themes/glitch/util/is_mobile'; export const links = [ <NavLink className='tabs-bar__link primary' to='/statuses/new' data-preview-title-id='tabs_bar.compose' data-preview-icon='pencil' ><i className='fa fa-fw fa-pencil' /><FormattedMessage id='tabs_bar.compose' defaultMessage='Compose' /></NavLink>, diff --git a/app/javascript/mastodon/features/ui/components/upload_area.js b/app/javascript/themes/glitch/features/ui/components/upload_area.js index 8b9a26270..72a450215 100644 --- a/app/javascript/mastodon/features/ui/components/upload_area.js +++ b/app/javascript/themes/glitch/features/ui/components/upload_area.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Motion from '../../ui/util/optional_motion'; +import Motion from 'themes/glitch/util/optional_motion'; import spring from 'react-motion/lib/spring'; import { FormattedMessage } from 'react-intl'; diff --git a/app/javascript/mastodon/features/ui/components/video_modal.js b/app/javascript/themes/glitch/features/ui/components/video_modal.js index 1437deeb0..91168c790 100644 --- a/app/javascript/mastodon/features/ui/components/video_modal.js +++ b/app/javascript/themes/glitch/features/ui/components/video_modal.js @@ -1,7 +1,7 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; -import Video from '../../video'; +import Video from 'themes/glitch/features/video'; import ImmutablePureComponent from 'react-immutable-pure-component'; export default class VideoModal extends ImmutablePureComponent { diff --git a/app/javascript/mastodon/features/ui/containers/bundle_container.js b/app/javascript/themes/glitch/features/ui/containers/bundle_container.js index 7e3f0c3a6..e6f9afcf7 100644 --- a/app/javascript/mastodon/features/ui/containers/bundle_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/bundle_container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import Bundle from '../components/bundle'; -import { fetchBundleRequest, fetchBundleSuccess, fetchBundleFail } from '../../../actions/bundles'; +import { fetchBundleRequest, fetchBundleSuccess, fetchBundleFail } from 'themes/glitch/actions/bundles'; const mapDispatchToProps = dispatch => ({ onFetch () { diff --git a/app/javascript/mastodon/features/ui/containers/columns_area_container.js b/app/javascript/themes/glitch/features/ui/containers/columns_area_container.js index 95f95618b..95f95618b 100644 --- a/app/javascript/mastodon/features/ui/containers/columns_area_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/columns_area_container.js diff --git a/app/javascript/mastodon/features/ui/containers/loading_bar_container.js b/app/javascript/themes/glitch/features/ui/containers/loading_bar_container.js index 4bb90fb68..4bb90fb68 100644 --- a/app/javascript/mastodon/features/ui/containers/loading_bar_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/loading_bar_container.js diff --git a/app/javascript/mastodon/features/ui/containers/modal_container.js b/app/javascript/themes/glitch/features/ui/containers/modal_container.js index 2d27180f7..c26f19886 100644 --- a/app/javascript/mastodon/features/ui/containers/modal_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/modal_container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { closeModal } from '../../../actions/modal'; +import { closeModal } from 'themes/glitch/actions/modal'; import ModalRoot from '../components/modal_root'; const mapStateToProps = state => ({ diff --git a/app/javascript/mastodon/features/ui/containers/notifications_container.js b/app/javascript/themes/glitch/features/ui/containers/notifications_container.js index 5924197f1..5bd4017f5 100644 --- a/app/javascript/mastodon/features/ui/containers/notifications_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/notifications_container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux'; import { NotificationStack } from 'react-notification'; -import { dismissAlert } from '../../../actions/alerts'; -import { getAlerts } from '../../../selectors'; +import { dismissAlert } from 'themes/glitch/actions/alerts'; +import { getAlerts } from 'themes/glitch/selectors'; const mapStateToProps = state => ({ notifications: getAlerts(state), diff --git a/app/javascript/mastodon/features/ui/containers/status_list_container.js b/app/javascript/themes/glitch/features/ui/containers/status_list_container.js index a0aec4403..807c82e16 100644 --- a/app/javascript/mastodon/features/ui/containers/status_list_container.js +++ b/app/javascript/themes/glitch/features/ui/containers/status_list_container.js @@ -1,10 +1,10 @@ import { connect } from 'react-redux'; -import StatusList from '../../../components/status_list'; -import { scrollTopTimeline } from '../../../actions/timelines'; +import StatusList from 'themes/glitch/components/status_list'; +import { scrollTopTimeline } from 'themes/glitch/actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { createSelector } from 'reselect'; import { debounce } from 'lodash'; -import { me } from '../../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; const makeGetStatusIds = () => createSelector([ (state, { type }) => state.getIn(['settings', type], ImmutableMap()), diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/themes/glitch/features/ui/index.js index 69eb1bbf7..b59a2e637 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/themes/glitch/features/ui/index.js @@ -6,13 +6,13 @@ import TabsBar from './components/tabs_bar'; import ModalContainer from './containers/modal_container'; import { connect } from 'react-redux'; import { Redirect, withRouter } from 'react-router-dom'; -import { isMobile } from '../../is_mobile'; +import { isMobile } from 'themes/glitch/util/is_mobile'; import { debounce } from 'lodash'; -import { uploadCompose, resetCompose } from '../../actions/compose'; -import { refreshHomeTimeline } from '../../actions/timelines'; -import { refreshNotifications } from '../../actions/notifications'; -import { clearHeight } from '../../actions/height_cache'; -import { WrappedSwitch, WrappedRoute } from './util/react_router_helpers'; +import { uploadCompose, resetCompose } from 'themes/glitch/actions/compose'; +import { refreshHomeTimeline } from 'themes/glitch/actions/timelines'; +import { refreshNotifications } from 'themes/glitch/actions/notifications'; +import { clearHeight } from 'themes/glitch/actions/height_cache'; +import { WrappedSwitch, WrappedRoute } from 'themes/glitch/util/react_router_helpers'; import UploadArea from './components/upload_area'; import ColumnsAreaContainer from './containers/columns_area_container'; import classNames from 'classnames'; @@ -38,9 +38,9 @@ import { Blocks, Mutes, PinnedStatuses, -} from './util/async-components'; +} from 'themes/glitch/util/async-components'; import { HotKeys } from 'react-hotkeys'; -import { me } from '../../initial_state'; +import { me } from 'themes/glitch/util/initial_state'; import { defineMessages, injectIntl } from 'react-intl'; // Dummy import, to make sure that <Status /> ends up in the application bundle. diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/themes/glitch/features/video/index.js index 003bf23a8..0ecbe37c9 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/themes/glitch/features/video/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { throttle } from 'lodash'; import classNames from 'classnames'; -import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; +import { isFullscreen, requestFullscreen, exitFullscreen } from 'themes/glitch/util/fullscreen'; const messages = defineMessages({ play: { id: 'video.play', defaultMessage: 'Play' }, @@ -83,6 +83,8 @@ export default class Video extends React.PureComponent { startTime: PropTypes.number, onOpenVideo: PropTypes.func, onCloseVideo: PropTypes.func, + letterbox: PropTypes.bool, + fullwidth: PropTypes.bool, intl: PropTypes.object.isRequired, }; @@ -226,11 +228,11 @@ export default class Video extends React.PureComponent { } render () { - const { preview, src, width, height, startTime, onOpenVideo, onCloseVideo, intl, alt } = this.props; + const { preview, src, width, height, startTime, onOpenVideo, onCloseVideo, intl, alt, letterbox, fullwidth } = this.props; const { progress, buffer, dragging, paused, fullscreen, hovered, muted, revealed } = this.state; return ( - <div className={classNames('video-player', { inactive: !revealed, inline: width && height && !fullscreen, fullscreen })} style={{ width, height }} ref={this.setPlayerRef} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}> + <div className={classNames('video-player', { inactive: !revealed, inline: !fullscreen, fullscreen, letterbox, 'full-width': fullwidth })} ref={this.setPlayerRef} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}> <video ref={this.setVideoRef} src={src} diff --git a/app/javascript/themes/glitch/index.js b/app/javascript/themes/glitch/index.js new file mode 100644 index 000000000..407e1f767 --- /dev/null +++ b/app/javascript/themes/glitch/index.js @@ -0,0 +1,14 @@ +import loadPolyfills from './util/load_polyfills'; + +// import default stylesheet with variables +require('font-awesome/css/font-awesome.css'); + +import './styles/index.scss'; + +require.context('../../images/', true); + +loadPolyfills().then(() => { + require('./util/main').default(); +}).catch(e => { + console.error(e); +}); diff --git a/app/javascript/mastodon/middleware/errors.js b/app/javascript/themes/glitch/middleware/errors.js index b2c5f0898..c54e7b0a2 100644 --- a/app/javascript/mastodon/middleware/errors.js +++ b/app/javascript/themes/glitch/middleware/errors.js @@ -1,4 +1,4 @@ -import { showAlert } from '../actions/alerts'; +import { showAlert } from 'themes/glitch/actions/alerts'; const defaultFailSuffix = 'FAIL'; diff --git a/app/javascript/mastodon/middleware/loading_bar.js b/app/javascript/themes/glitch/middleware/loading_bar.js index a98f1bb2b..a98f1bb2b 100644 --- a/app/javascript/mastodon/middleware/loading_bar.js +++ b/app/javascript/themes/glitch/middleware/loading_bar.js diff --git a/app/javascript/mastodon/middleware/sounds.js b/app/javascript/themes/glitch/middleware/sounds.js index 3d1e3eaba..3d1e3eaba 100644 --- a/app/javascript/mastodon/middleware/sounds.js +++ b/app/javascript/themes/glitch/middleware/sounds.js diff --git a/app/javascript/mastodon/reducers/accounts.js b/app/javascript/themes/glitch/reducers/accounts.js index 8a4d69f26..0a65d3723 100644 --- a/app/javascript/mastodon/reducers/accounts.js +++ b/app/javascript/themes/glitch/reducers/accounts.js @@ -6,16 +6,16 @@ import { FOLLOWING_EXPAND_SUCCESS, FOLLOW_REQUESTS_FETCH_SUCCESS, FOLLOW_REQUESTS_EXPAND_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { BLOCKS_FETCH_SUCCESS, BLOCKS_EXPAND_SUCCESS, -} from '../actions/blocks'; +} from 'themes/glitch/actions/blocks'; import { MUTES_FETCH_SUCCESS, MUTES_EXPAND_SUCCESS, -} from '../actions/mutes'; -import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; +} from 'themes/glitch/actions/mutes'; +import { COMPOSE_SUGGESTIONS_READY } from 'themes/glitch/actions/compose'; import { REBLOG_SUCCESS, UNREBLOG_SUCCESS, @@ -23,28 +23,28 @@ import { UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, FAVOURITES_FETCH_SUCCESS, -} from '../actions/interactions'; +} from 'themes/glitch/actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, TIMELINE_EXPAND_SUCCESS, -} from '../actions/timelines'; +} from 'themes/glitch/actions/timelines'; import { STATUS_FETCH_SUCCESS, CONTEXT_FETCH_SUCCESS, -} from '../actions/statuses'; -import { SEARCH_FETCH_SUCCESS } from '../actions/search'; +} from 'themes/glitch/actions/statuses'; +import { SEARCH_FETCH_SUCCESS } from 'themes/glitch/actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, NOTIFICATIONS_EXPAND_SUCCESS, -} from '../actions/notifications'; +} from 'themes/glitch/actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, FAVOURITED_STATUSES_EXPAND_SUCCESS, -} from '../actions/favourites'; -import { STORE_HYDRATE } from '../actions/store'; -import emojify from '../features/emoji/emoji'; +} from 'themes/glitch/actions/favourites'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; +import emojify from 'themes/glitch/util/emoji'; import { Map as ImmutableMap, fromJS } from 'immutable'; import escapeTextContentForBrowser from 'escape-html'; diff --git a/app/javascript/mastodon/reducers/accounts_counters.js b/app/javascript/themes/glitch/reducers/accounts_counters.js index 1f795199b..e3728ecd7 100644 --- a/app/javascript/mastodon/reducers/accounts_counters.js +++ b/app/javascript/themes/glitch/reducers/accounts_counters.js @@ -8,16 +8,16 @@ import { FOLLOW_REQUESTS_EXPAND_SUCCESS, ACCOUNT_FOLLOW_SUCCESS, ACCOUNT_UNFOLLOW_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { BLOCKS_FETCH_SUCCESS, BLOCKS_EXPAND_SUCCESS, -} from '../actions/blocks'; +} from 'themes/glitch/actions/blocks'; import { MUTES_FETCH_SUCCESS, MUTES_EXPAND_SUCCESS, -} from '../actions/mutes'; -import { COMPOSE_SUGGESTIONS_READY } from '../actions/compose'; +} from 'themes/glitch/actions/mutes'; +import { COMPOSE_SUGGESTIONS_READY } from 'themes/glitch/actions/compose'; import { REBLOG_SUCCESS, UNREBLOG_SUCCESS, @@ -25,27 +25,27 @@ import { UNFAVOURITE_SUCCESS, REBLOGS_FETCH_SUCCESS, FAVOURITES_FETCH_SUCCESS, -} from '../actions/interactions'; +} from 'themes/glitch/actions/interactions'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, TIMELINE_EXPAND_SUCCESS, -} from '../actions/timelines'; +} from 'themes/glitch/actions/timelines'; import { STATUS_FETCH_SUCCESS, CONTEXT_FETCH_SUCCESS, -} from '../actions/statuses'; -import { SEARCH_FETCH_SUCCESS } from '../actions/search'; +} from 'themes/glitch/actions/statuses'; +import { SEARCH_FETCH_SUCCESS } from 'themes/glitch/actions/search'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, NOTIFICATIONS_EXPAND_SUCCESS, -} from '../actions/notifications'; +} from 'themes/glitch/actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, FAVOURITED_STATUSES_EXPAND_SUCCESS, -} from '../actions/favourites'; -import { STORE_HYDRATE } from '../actions/store'; +} from 'themes/glitch/actions/favourites'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; import { Map as ImmutableMap, fromJS } from 'immutable'; const normalizeAccount = (state, account) => state.set(account.id, fromJS({ @@ -126,7 +126,9 @@ export default function accountsCounters(state = initialState, action) { case STATUS_FETCH_SUCCESS: return normalizeAccountFromStatus(state, action.status); case ACCOUNT_FOLLOW_SUCCESS: - if (action.alreadyFollowing) { return state; } + if (action.alreadyFollowing) { + return state; + } return state.updateIn([action.relationship.id, 'followers_count'], num => num + 1); case ACCOUNT_UNFOLLOW_SUCCESS: return state.updateIn([action.relationship.id, 'followers_count'], num => Math.max(0, num - 1)); diff --git a/app/javascript/mastodon/reducers/alerts.js b/app/javascript/themes/glitch/reducers/alerts.js index 089d920c3..ad66b63f6 100644 --- a/app/javascript/mastodon/reducers/alerts.js +++ b/app/javascript/themes/glitch/reducers/alerts.js @@ -2,7 +2,7 @@ import { ALERT_SHOW, ALERT_DISMISS, ALERT_CLEAR, -} from '../actions/alerts'; +} from 'themes/glitch/actions/alerts'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; const initialState = ImmutableList([]); diff --git a/app/javascript/mastodon/reducers/cards.js b/app/javascript/themes/glitch/reducers/cards.js index 4d86b0d7e..35be30444 100644 --- a/app/javascript/mastodon/reducers/cards.js +++ b/app/javascript/themes/glitch/reducers/cards.js @@ -1,4 +1,4 @@ -import { STATUS_CARD_FETCH_SUCCESS } from '../actions/cards'; +import { STATUS_CARD_FETCH_SUCCESS } from 'themes/glitch/actions/cards'; import { Map as ImmutableMap, fromJS } from 'immutable'; diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/themes/glitch/reducers/compose.js index 5d0acbd60..be359fcb4 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/themes/glitch/reducers/compose.js @@ -28,12 +28,12 @@ import { COMPOSE_UPLOAD_CHANGE_FAIL, COMPOSE_DOODLE_SET, COMPOSE_RESET, -} from '../actions/compose'; -import { TIMELINE_DELETE } from '../actions/timelines'; -import { STORE_HYDRATE } from '../actions/store'; +} from 'themes/glitch/actions/compose'; +import { TIMELINE_DELETE } from 'themes/glitch/actions/timelines'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; -import uuid from '../uuid'; -import { me } from '../initial_state'; +import uuid from 'themes/glitch/util/uuid'; +import { me } from 'themes/glitch/util/initial_state'; const initialState = ImmutableMap({ mounted: false, diff --git a/app/javascript/mastodon/reducers/contexts.js b/app/javascript/themes/glitch/reducers/contexts.js index 64d584a01..56c930bd5 100644 --- a/app/javascript/mastodon/reducers/contexts.js +++ b/app/javascript/themes/glitch/reducers/contexts.js @@ -1,5 +1,5 @@ -import { CONTEXT_FETCH_SUCCESS } from '../actions/statuses'; -import { TIMELINE_DELETE, TIMELINE_CONTEXT_UPDATE } from '../actions/timelines'; +import { CONTEXT_FETCH_SUCCESS } from 'themes/glitch/actions/statuses'; +import { TIMELINE_DELETE, TIMELINE_CONTEXT_UPDATE } from 'themes/glitch/actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/custom_emojis.js b/app/javascript/themes/glitch/reducers/custom_emojis.js index 307bcc7dc..e3f1e0018 100644 --- a/app/javascript/mastodon/reducers/custom_emojis.js +++ b/app/javascript/themes/glitch/reducers/custom_emojis.js @@ -1,7 +1,7 @@ import { List as ImmutableList } from 'immutable'; -import { STORE_HYDRATE } from '../actions/store'; -import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light'; -import { buildCustomEmojis } from '../features/emoji/emoji'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; +import { search as emojiSearch } from 'themes/glitch/util/emoji/emoji_mart_search_light'; +import { buildCustomEmojis } from 'themes/glitch/util/emoji'; const initialState = ImmutableList(); diff --git a/app/javascript/mastodon/reducers/height_cache.js b/app/javascript/themes/glitch/reducers/height_cache.js index 2f5716fae..93c31b42c 100644 --- a/app/javascript/mastodon/reducers/height_cache.js +++ b/app/javascript/themes/glitch/reducers/height_cache.js @@ -1,5 +1,5 @@ import { Map as ImmutableMap } from 'immutable'; -import { HEIGHT_CACHE_SET, HEIGHT_CACHE_CLEAR } from '../actions/height_cache'; +import { HEIGHT_CACHE_SET, HEIGHT_CACHE_CLEAR } from 'themes/glitch/actions/height_cache'; const initialState = ImmutableMap(); diff --git a/app/javascript/mastodon/reducers/index.js b/app/javascript/themes/glitch/reducers/index.js index 593d0efa4..aa748421a 100644 --- a/app/javascript/mastodon/reducers/index.js +++ b/app/javascript/themes/glitch/reducers/index.js @@ -10,7 +10,7 @@ import accounts_counters from './accounts_counters'; import statuses from './statuses'; import relationships from './relationships'; import settings from './settings'; -import local_settings from '../../glitch/reducers/local_settings'; +import local_settings from './local_settings'; import push_notifications from './push_notifications'; import status_lists from './status_lists'; import cards from './cards'; diff --git a/app/javascript/themes/glitch/reducers/local_settings.js b/app/javascript/themes/glitch/reducers/local_settings.js new file mode 100644 index 000000000..b1ffa047e --- /dev/null +++ b/app/javascript/themes/glitch/reducers/local_settings.js @@ -0,0 +1,45 @@ +// Package imports. +import { Map as ImmutableMap } from 'immutable'; + +// Our imports. +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; +import { LOCAL_SETTING_CHANGE } from 'themes/glitch/actions/local_settings'; + +const initialState = ImmutableMap({ + layout : 'auto', + stretch : true, + navbar_under : false, + side_arm : 'none', + collapsed : ImmutableMap({ + enabled : true, + auto : ImmutableMap({ + all : false, + notifications : true, + lengthy : true, + reblogs : false, + replies : false, + media : false, + }), + backgrounds : ImmutableMap({ + user_backgrounds : false, + preview_images : false, + }), + }), + media : ImmutableMap({ + letterbox : true, + fullwidth : true, + }), +}); + +const hydrate = (state, localSettings) => state.mergeDeep(localSettings); + +export default function localSettings(state = initialState, action) { + switch(action.type) { + case STORE_HYDRATE: + return hydrate(state, action.state.get('local_settings')); + case LOCAL_SETTING_CHANGE: + return state.setIn(action.key, action.value); + default: + return state; + } +}; diff --git a/app/javascript/mastodon/reducers/media_attachments.js b/app/javascript/themes/glitch/reducers/media_attachments.js index 24119f628..69a44639c 100644 --- a/app/javascript/mastodon/reducers/media_attachments.js +++ b/app/javascript/themes/glitch/reducers/media_attachments.js @@ -1,4 +1,4 @@ -import { STORE_HYDRATE } from '../actions/store'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; import { Map as ImmutableMap } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/meta.js b/app/javascript/themes/glitch/reducers/meta.js index 36a5a1c35..2249f1d78 100644 --- a/app/javascript/mastodon/reducers/meta.js +++ b/app/javascript/themes/glitch/reducers/meta.js @@ -1,4 +1,4 @@ -import { STORE_HYDRATE } from '../actions/store'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; import { Map as ImmutableMap } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/modal.js b/app/javascript/themes/glitch/reducers/modal.js index 599a2443e..97fb31203 100644 --- a/app/javascript/mastodon/reducers/modal.js +++ b/app/javascript/themes/glitch/reducers/modal.js @@ -1,4 +1,4 @@ -import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal'; +import { MODAL_OPEN, MODAL_CLOSE } from 'themes/glitch/actions/modal'; const initialState = { modalType: null, diff --git a/app/javascript/mastodon/reducers/mutes.js b/app/javascript/themes/glitch/reducers/mutes.js index a96232dbd..8fe4ae0c3 100644 --- a/app/javascript/mastodon/reducers/mutes.js +++ b/app/javascript/themes/glitch/reducers/mutes.js @@ -3,7 +3,7 @@ import Immutable from 'immutable'; import { MUTES_INIT_MODAL, MUTES_TOGGLE_HIDE_NOTIFICATIONS, -} from '../actions/mutes'; +} from 'themes/glitch/actions/mutes'; const initialState = Immutable.Map({ new: Immutable.Map({ diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/themes/glitch/reducers/notifications.js index 48850ab01..c4f505053 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/themes/glitch/reducers/notifications.js @@ -14,12 +14,12 @@ import { NOTIFICATIONS_DELETE_MARKED_FAIL, NOTIFICATIONS_ENTER_CLEARING_MODE, NOTIFICATIONS_MARK_ALL_FOR_DELETE, -} from '../actions/notifications'; +} from 'themes/glitch/actions/notifications'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, -} from '../actions/accounts'; -import { TIMELINE_DELETE } from '../actions/timelines'; +} from 'themes/glitch/actions/accounts'; +import { TIMELINE_DELETE } from 'themes/glitch/actions/timelines'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/push_notifications.js b/app/javascript/themes/glitch/reducers/push_notifications.js index 31a40d246..744e4a0eb 100644 --- a/app/javascript/mastodon/reducers/push_notifications.js +++ b/app/javascript/themes/glitch/reducers/push_notifications.js @@ -1,5 +1,5 @@ -import { STORE_HYDRATE } from '../actions/store'; -import { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, ALERTS_CHANGE } from '../actions/push_notifications'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; +import { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, ALERTS_CHANGE } from 'themes/glitch/actions/push_notifications'; import Immutable from 'immutable'; const initialState = Immutable.Map({ diff --git a/app/javascript/mastodon/reducers/relationships.js b/app/javascript/themes/glitch/reducers/relationships.js index c7b04a668..d9135d6da 100644 --- a/app/javascript/mastodon/reducers/relationships.js +++ b/app/javascript/themes/glitch/reducers/relationships.js @@ -6,11 +6,11 @@ import { ACCOUNT_MUTE_SUCCESS, ACCOUNT_UNMUTE_SUCCESS, RELATIONSHIPS_FETCH_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { DOMAIN_BLOCK_SUCCESS, DOMAIN_UNBLOCK_SUCCESS, -} from '../actions/domain_blocks'; +} from 'themes/glitch/actions/domain_blocks'; import { Map as ImmutableMap, fromJS } from 'immutable'; const normalizeRelationship = (state, relationship) => state.set(relationship.id, fromJS(relationship)); diff --git a/app/javascript/mastodon/reducers/reports.js b/app/javascript/themes/glitch/reducers/reports.js index a08bbec38..b714374ea 100644 --- a/app/javascript/mastodon/reducers/reports.js +++ b/app/javascript/themes/glitch/reducers/reports.js @@ -6,7 +6,7 @@ import { REPORT_CANCEL, REPORT_STATUS_TOGGLE, REPORT_COMMENT_CHANGE, -} from '../actions/reports'; +} from 'themes/glitch/actions/reports'; import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/search.js b/app/javascript/themes/glitch/reducers/search.js index 08d90e4e8..aec9e2efb 100644 --- a/app/javascript/mastodon/reducers/search.js +++ b/app/javascript/themes/glitch/reducers/search.js @@ -3,8 +3,8 @@ import { SEARCH_CLEAR, SEARCH_FETCH_SUCCESS, SEARCH_SHOW, -} from '../actions/search'; -import { COMPOSE_MENTION, COMPOSE_REPLY } from '../actions/compose'; +} from 'themes/glitch/actions/search'; +import { COMPOSE_MENTION, COMPOSE_REPLY } from 'themes/glitch/actions/compose'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/settings.js b/app/javascript/themes/glitch/reducers/settings.js index 4b8a652d1..c22bbbd8d 100644 --- a/app/javascript/mastodon/reducers/settings.js +++ b/app/javascript/themes/glitch/reducers/settings.js @@ -1,9 +1,9 @@ -import { SETTING_CHANGE, SETTING_SAVE } from '../actions/settings'; -import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE } from '../actions/columns'; -import { STORE_HYDRATE } from '../actions/store'; -import { EMOJI_USE } from '../actions/emojis'; +import { SETTING_CHANGE, SETTING_SAVE } from 'themes/glitch/actions/settings'; +import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE } from 'themes/glitch/actions/columns'; +import { STORE_HYDRATE } from 'themes/glitch/actions/store'; +import { EMOJI_USE } from 'themes/glitch/actions/emojis'; import { Map as ImmutableMap, fromJS } from 'immutable'; -import uuid from '../uuid'; +import uuid from 'themes/glitch/util/uuid'; const initialState = ImmutableMap({ saved: true, diff --git a/app/javascript/mastodon/reducers/status_lists.js b/app/javascript/themes/glitch/reducers/status_lists.js index c4aeb338f..8dc7d374e 100644 --- a/app/javascript/mastodon/reducers/status_lists.js +++ b/app/javascript/themes/glitch/reducers/status_lists.js @@ -1,17 +1,17 @@ import { FAVOURITED_STATUSES_FETCH_SUCCESS, FAVOURITED_STATUSES_EXPAND_SUCCESS, -} from '../actions/favourites'; +} from 'themes/glitch/actions/favourites'; import { PINNED_STATUSES_FETCH_SUCCESS, -} from '../actions/pin_statuses'; +} from 'themes/glitch/actions/pin_statuses'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { FAVOURITE_SUCCESS, UNFAVOURITE_SUCCESS, PIN_SUCCESS, UNPIN_SUCCESS, -} from '../actions/interactions'; +} from 'themes/glitch/actions/interactions'; const initialState = ImmutableMap({ favourites: ImmutableMap({ diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/themes/glitch/reducers/statuses.js index b1fb4c5da..ef8086865 100644 --- a/app/javascript/mastodon/reducers/statuses.js +++ b/app/javascript/themes/glitch/reducers/statuses.js @@ -9,37 +9,37 @@ import { UNFAVOURITE_SUCCESS, PIN_SUCCESS, UNPIN_SUCCESS, -} from '../actions/interactions'; +} from 'themes/glitch/actions/interactions'; import { STATUS_FETCH_SUCCESS, CONTEXT_FETCH_SUCCESS, STATUS_MUTE_SUCCESS, STATUS_UNMUTE_SUCCESS, -} from '../actions/statuses'; +} from 'themes/glitch/actions/statuses'; import { TIMELINE_REFRESH_SUCCESS, TIMELINE_UPDATE, TIMELINE_DELETE, TIMELINE_EXPAND_SUCCESS, -} from '../actions/timelines'; +} from 'themes/glitch/actions/timelines'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { NOTIFICATIONS_UPDATE, NOTIFICATIONS_REFRESH_SUCCESS, NOTIFICATIONS_EXPAND_SUCCESS, -} from '../actions/notifications'; +} from 'themes/glitch/actions/notifications'; import { FAVOURITED_STATUSES_FETCH_SUCCESS, FAVOURITED_STATUSES_EXPAND_SUCCESS, -} from '../actions/favourites'; +} from 'themes/glitch/actions/favourites'; import { PINNED_STATUSES_FETCH_SUCCESS, -} from '../actions/pin_statuses'; -import { SEARCH_FETCH_SUCCESS } from '../actions/search'; -import emojify from '../features/emoji/emoji'; +} from 'themes/glitch/actions/pin_statuses'; +import { SEARCH_FETCH_SUCCESS } from 'themes/glitch/actions/search'; +import emojify from 'themes/glitch/util/emoji'; import { Map as ImmutableMap, fromJS } from 'immutable'; import escapeTextContentForBrowser from 'escape-html'; diff --git a/app/javascript/mastodon/reducers/timelines.js b/app/javascript/themes/glitch/reducers/timelines.js index bee4c4ef9..7f19a1897 100644 --- a/app/javascript/mastodon/reducers/timelines.js +++ b/app/javascript/themes/glitch/reducers/timelines.js @@ -10,12 +10,12 @@ import { TIMELINE_SCROLL_TOP, TIMELINE_CONNECT, TIMELINE_DISCONNECT, -} from '../actions/timelines'; +} from 'themes/glitch/actions/timelines'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS, ACCOUNT_UNFOLLOW_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'; const initialState = ImmutableMap(); diff --git a/app/javascript/mastodon/reducers/user_lists.js b/app/javascript/themes/glitch/reducers/user_lists.js index 8db18c5dc..8c3a7d748 100644 --- a/app/javascript/mastodon/reducers/user_lists.js +++ b/app/javascript/themes/glitch/reducers/user_lists.js @@ -7,19 +7,19 @@ import { FOLLOW_REQUESTS_EXPAND_SUCCESS, FOLLOW_REQUEST_AUTHORIZE_SUCCESS, FOLLOW_REQUEST_REJECT_SUCCESS, -} from '../actions/accounts'; +} from 'themes/glitch/actions/accounts'; import { REBLOGS_FETCH_SUCCESS, FAVOURITES_FETCH_SUCCESS, -} from '../actions/interactions'; +} from 'themes/glitch/actions/interactions'; import { BLOCKS_FETCH_SUCCESS, BLOCKS_EXPAND_SUCCESS, -} from '../actions/blocks'; +} from 'themes/glitch/actions/blocks'; import { MUTES_FETCH_SUCCESS, MUTES_EXPAND_SUCCESS, -} from '../actions/mutes'; +} from 'themes/glitch/actions/mutes'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; const initialState = ImmutableMap({ diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/themes/glitch/selectors/index.js index d26d1b727..d26d1b727 100644 --- a/app/javascript/mastodon/selectors/index.js +++ b/app/javascript/themes/glitch/selectors/index.js diff --git a/app/javascript/mastodon/service_worker/entry.js b/app/javascript/themes/glitch/service_worker/entry.js index eea4cfc3c..eea4cfc3c 100644 --- a/app/javascript/mastodon/service_worker/entry.js +++ b/app/javascript/themes/glitch/service_worker/entry.js diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/themes/glitch/service_worker/web_push_notifications.js index f63cff335..f63cff335 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/themes/glitch/service_worker/web_push_notifications.js diff --git a/app/javascript/mastodon/store/configureStore.js b/app/javascript/themes/glitch/store/configureStore.js index 1376d4cba..1376d4cba 100644 --- a/app/javascript/mastodon/store/configureStore.js +++ b/app/javascript/themes/glitch/store/configureStore.js diff --git a/app/javascript/styles/mastodon/_mixins.scss b/app/javascript/themes/glitch/styles/_mixins.scss index 7412991b8..7412991b8 100644 --- a/app/javascript/styles/mastodon/_mixins.scss +++ b/app/javascript/themes/glitch/styles/_mixins.scss diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/themes/glitch/styles/about.scss index 4ec689427..4ec689427 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/themes/glitch/styles/about.scss diff --git a/app/javascript/styles/mastodon/accounts.scss b/app/javascript/themes/glitch/styles/accounts.scss index 2cf98c642..2cf98c642 100644 --- a/app/javascript/styles/mastodon/accounts.scss +++ b/app/javascript/themes/glitch/styles/accounts.scss diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/themes/glitch/styles/admin.scss index 87bc710af..87bc710af 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/themes/glitch/styles/admin.scss diff --git a/app/javascript/styles/mastodon/basics.scss b/app/javascript/themes/glitch/styles/basics.scss index b5d77ff63..b5d77ff63 100644 --- a/app/javascript/styles/mastodon/basics.scss +++ b/app/javascript/themes/glitch/styles/basics.scss diff --git a/app/javascript/styles/mastodon/boost.scss b/app/javascript/themes/glitch/styles/boost.scss index b07b72f8e..b07b72f8e 100644 --- a/app/javascript/styles/mastodon/boost.scss +++ b/app/javascript/themes/glitch/styles/boost.scss diff --git a/app/javascript/styles/mastodon/compact_header.scss b/app/javascript/themes/glitch/styles/compact_header.scss index 90d98cc8c..90d98cc8c 100644 --- a/app/javascript/styles/mastodon/compact_header.scss +++ b/app/javascript/themes/glitch/styles/compact_header.scss diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/themes/glitch/styles/components.scss index 6a6d1bdca..fbee5610a 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/themes/glitch/styles/components.scss @@ -1,5 +1,4 @@ @import 'variables'; -@import 'variables-glitch'; @mixin fullwidth-gallery { &.full-width { diff --git a/app/javascript/styles/mastodon/containers.scss b/app/javascript/themes/glitch/styles/containers.scss index af2589e23..af2589e23 100644 --- a/app/javascript/styles/mastodon/containers.scss +++ b/app/javascript/themes/glitch/styles/containers.scss diff --git a/app/javascript/styles/doodle.scss b/app/javascript/themes/glitch/styles/doodle.scss index a4a1cfc84..a4a1cfc84 100644 --- a/app/javascript/styles/doodle.scss +++ b/app/javascript/themes/glitch/styles/doodle.scss diff --git a/app/javascript/styles/mastodon/emoji_picker.scss b/app/javascript/themes/glitch/styles/emoji_picker.scss index 2b46d30fc..2b46d30fc 100644 --- a/app/javascript/styles/mastodon/emoji_picker.scss +++ b/app/javascript/themes/glitch/styles/emoji_picker.scss diff --git a/app/javascript/styles/mastodon/footer.scss b/app/javascript/themes/glitch/styles/footer.scss index 2d953b34e..2d953b34e 100644 --- a/app/javascript/styles/mastodon/footer.scss +++ b/app/javascript/themes/glitch/styles/footer.scss diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/themes/glitch/styles/forms.scss index 61fcf286f..61fcf286f 100644 --- a/app/javascript/styles/mastodon/forms.scss +++ b/app/javascript/themes/glitch/styles/forms.scss diff --git a/app/javascript/themes/glitch/styles/index.scss b/app/javascript/themes/glitch/styles/index.scss new file mode 100644 index 000000000..0eb6ac6d8 --- /dev/null +++ b/app/javascript/themes/glitch/styles/index.scss @@ -0,0 +1,22 @@ +@import 'mixins'; +@import 'variables'; +@import 'fonts/roboto'; +@import 'fonts/roboto-mono'; +@import 'fonts/montserrat'; + +@import 'reset'; +@import 'basics'; +@import 'containers'; +@import 'lists'; +@import 'footer'; +@import 'compact_header'; +@import 'landing_strip'; +@import 'forms'; +@import 'accounts'; +@import 'stream_entries'; +@import 'components'; +@import 'emoji_picker'; +@import 'about'; +@import 'tables'; +@import 'admin'; +@import 'rtl'; diff --git a/app/javascript/styles/mastodon/landing_strip.scss b/app/javascript/themes/glitch/styles/landing_strip.scss index 0bf9daafd..0bf9daafd 100644 --- a/app/javascript/styles/mastodon/landing_strip.scss +++ b/app/javascript/themes/glitch/styles/landing_strip.scss diff --git a/app/javascript/styles/mastodon/lists.scss b/app/javascript/themes/glitch/styles/lists.scss index 6019cd800..6019cd800 100644 --- a/app/javascript/styles/mastodon/lists.scss +++ b/app/javascript/themes/glitch/styles/lists.scss diff --git a/app/javascript/styles/mastodon/reset.scss b/app/javascript/themes/glitch/styles/reset copy.scss index cc5ba9d7c..cc5ba9d7c 100644 --- a/app/javascript/styles/mastodon/reset.scss +++ b/app/javascript/themes/glitch/styles/reset copy.scss diff --git a/app/javascript/themes/glitch/styles/reset.scss b/app/javascript/themes/glitch/styles/reset.scss new file mode 100644 index 000000000..cc5ba9d7c --- /dev/null +++ b/app/javascript/themes/glitch/styles/reset.scss @@ -0,0 +1,91 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} + +body { + line-height: 1; +} + +ol, ul { + list-style: none; +} + +blockquote, q { + quotes: none; +} + +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +::-webkit-scrollbar-thumb { + background: lighten($ui-base-color, 4%); + border: 0px none $base-border-color; + border-radius: 50px; +} + +::-webkit-scrollbar-thumb:hover { + background: lighten($ui-base-color, 6%); +} + +::-webkit-scrollbar-thumb:active { + background: lighten($ui-base-color, 4%); +} + +::-webkit-scrollbar-track { + border: 0px none $base-border-color; + border-radius: 0; + background: rgba($base-overlay-background, 0.1); +} + +::-webkit-scrollbar-track:hover { + background: $ui-base-color; +} + +::-webkit-scrollbar-track:active { + background: $ui-base-color; +} + +::-webkit-scrollbar-corner { + background: transparent; +} diff --git a/app/javascript/styles/mastodon/rtl.scss b/app/javascript/themes/glitch/styles/rtl.scss index 67bfa8a38..67bfa8a38 100644 --- a/app/javascript/styles/mastodon/rtl.scss +++ b/app/javascript/themes/glitch/styles/rtl.scss diff --git a/app/javascript/styles/mastodon/stream_entries.scss b/app/javascript/themes/glitch/styles/stream_entries.scss index 453070b7c..453070b7c 100644 --- a/app/javascript/styles/mastodon/stream_entries.scss +++ b/app/javascript/themes/glitch/styles/stream_entries.scss diff --git a/app/javascript/styles/mastodon/tables.scss b/app/javascript/themes/glitch/styles/tables.scss index ad46f5f9f..ad46f5f9f 100644 --- a/app/javascript/styles/mastodon/tables.scss +++ b/app/javascript/themes/glitch/styles/tables.scss diff --git a/app/javascript/styles/mastodon/variables.scss b/app/javascript/themes/glitch/styles/variables.scss index 090706ff5..f42d9c8c5 100644 --- a/app/javascript/styles/mastodon/variables.scss +++ b/app/javascript/themes/glitch/styles/variables.scss @@ -30,3 +30,6 @@ $ui-highlight-color: $classic-highlight-color !default; // Vibrant // Avatar border size (8% default, 100% for rounded avatars) $ui-avatar-border-size: 8%; + +// More variables +$dismiss-overlay-width: 4rem; diff --git a/app/javascript/themes/glitch/theme.yml b/app/javascript/themes/glitch/theme.yml new file mode 100644 index 000000000..49fba8f40 --- /dev/null +++ b/app/javascript/themes/glitch/theme.yml @@ -0,0 +1,18 @@ +# (REQUIRED) The location of the pack file inside `pack_directory`. +pack: index.js + +# (OPTIONAL) The directory which contains the pack file. +# Defaults to the theme directory (`app/javascript/themes/[theme]`), +# but in the case of the vanilla Mastodon theme the pack file is +# somewhere else. +# pack_directory: app/javascript/packs + +# (OPTIONAL) Additional javascript resources to preload, for use with +# lazy-loaded components. It is **STRONGLY RECOMMENDED** that you +# derive these pathnames from `themes/[your-theme]` to ensure that +# they stay unique. (Of course, vanilla doesn't do this ^^;;) +preload: +- themes/glitch/async/getting_started +- themes/glitch/async/compose +- themes/glitch/async/home_timeline +- themes/glitch/async/notifications diff --git a/app/javascript/mastodon/api.js b/app/javascript/themes/glitch/util/api.js index ecc703c0a..ecc703c0a 100644 --- a/app/javascript/mastodon/api.js +++ b/app/javascript/themes/glitch/util/api.js diff --git a/app/javascript/themes/glitch/util/async-components.js b/app/javascript/themes/glitch/util/async-components.js new file mode 100644 index 000000000..91e85fed5 --- /dev/null +++ b/app/javascript/themes/glitch/util/async-components.js @@ -0,0 +1,115 @@ +export function EmojiPicker () { + return import(/* webpackChunkName: "themes/glitch/async/emoji_picker" */'themes/glitch/util/emoji/emoji_picker'); +} + +export function Compose () { + return import(/* webpackChunkName: "themes/glitch/async/compose" */'themes/glitch/features/compose'); +} + +export function Notifications () { + return import(/* webpackChunkName: "themes/glitch/async/notifications" */'themes/glitch/features/notifications'); +} + +export function HomeTimeline () { + return import(/* webpackChunkName: "themes/glitch/async/home_timeline" */'themes/glitch/features/home_timeline'); +} + +export function PublicTimeline () { + return import(/* webpackChunkName: "themes/glitch/async/public_timeline" */'themes/glitch/features/public_timeline'); +} + +export function CommunityTimeline () { + return import(/* webpackChunkName: "themes/glitch/async/community_timeline" */'themes/glitch/features/community_timeline'); +} + +export function HashtagTimeline () { + return import(/* webpackChunkName: "themes/glitch/async/hashtag_timeline" */'themes/glitch/features/hashtag_timeline'); +} + +export function DirectTimeline() { + return import(/* webpackChunkName: "themes/glitch/async/direct_timeline" */'themes/glitch/features/direct_timeline'); +} + +export function Status () { + return import(/* webpackChunkName: "themes/glitch/async/status" */'themes/glitch/features/status'); +} + +export function GettingStarted () { + return import(/* webpackChunkName: "themes/glitch/async/getting_started" */'themes/glitch/features/getting_started'); +} + +export function PinnedStatuses () { + return import(/* webpackChunkName: "themes/glitch/async/pinned_statuses" */'themes/glitch/features/pinned_statuses'); +} + +export function AccountTimeline () { + return import(/* webpackChunkName: "themes/glitch/async/account_timeline" */'themes/glitch/features/account_timeline'); +} + +export function AccountGallery () { + return import(/* webpackChunkName: "themes/glitch/async/account_gallery" */'themes/glitch/features/account_gallery'); +} + +export function Followers () { + return import(/* webpackChunkName: "themes/glitch/async/followers" */'themes/glitch/features/followers'); +} + +export function Following () { + return import(/* webpackChunkName: "themes/glitch/async/following" */'themes/glitch/features/following'); +} + +export function Reblogs () { + return import(/* webpackChunkName: "themes/glitch/async/reblogs" */'themes/glitch/features/reblogs'); +} + +export function Favourites () { + return import(/* webpackChunkName: "themes/glitch/async/favourites" */'themes/glitch/features/favourites'); +} + +export function FollowRequests () { + return import(/* webpackChunkName: "themes/glitch/async/follow_requests" */'themes/glitch/features/follow_requests'); +} + +export function GenericNotFound () { + return import(/* webpackChunkName: "themes/glitch/async/generic_not_found" */'themes/glitch/features/generic_not_found'); +} + +export function FavouritedStatuses () { + return import(/* webpackChunkName: "themes/glitch/async/favourited_statuses" */'themes/glitch/features/favourited_statuses'); +} + +export function Blocks () { + return import(/* webpackChunkName: "themes/glitch/async/blocks" */'themes/glitch/features/blocks'); +} + +export function Mutes () { + return import(/* webpackChunkName: "themes/glitch/async/mutes" */'themes/glitch/features/mutes'); +} + +export function OnboardingModal () { + return import(/* webpackChunkName: "themes/glitch/async/onboarding_modal" */'themes/glitch/features/ui/components/onboarding_modal'); +} + +export function MuteModal () { + return import(/* webpackChunkName: "themes/glitch/async/mute_modal" */'themes/glitch/features/ui/components/mute_modal'); +} + +export function ReportModal () { + return import(/* webpackChunkName: "themes/glitch/async/report_modal" */'themes/glitch/features/ui/components/report_modal'); +} + +export function SettingsModal () { + return import(/* webpackChunkName: "themes/glitch/async/settings_modal" */'themes/glitch/features/local_settings'); +} + +export function MediaGallery () { + return import(/* webpackChunkName: "themes/glitch/async/media_gallery" */'themes/glitch/components/media_gallery'); +} + +export function Video () { + return import(/* webpackChunkName: "themes/glitch/async/video" */'themes/glitch/features/video'); +} + +export function EmbedModal () { + return import(/* webpackChunkName: "themes/glitch/async/embed_modal" */'themes/glitch/features/ui/components/embed_modal'); +} diff --git a/app/javascript/mastodon/base_polyfills.js b/app/javascript/themes/glitch/util/base_polyfills.js index 7856b26f9..7856b26f9 100644 --- a/app/javascript/mastodon/base_polyfills.js +++ b/app/javascript/themes/glitch/util/base_polyfills.js diff --git a/app/javascript/glitch/util/bio_metadata.js b/app/javascript/themes/glitch/util/bio_metadata.js index 599ec20e2..599ec20e2 100644 --- a/app/javascript/glitch/util/bio_metadata.js +++ b/app/javascript/themes/glitch/util/bio_metadata.js diff --git a/app/javascript/mastodon/features/compose/util/counter.js b/app/javascript/themes/glitch/util/counter.js index 700ba2163..700ba2163 100644 --- a/app/javascript/mastodon/features/compose/util/counter.js +++ b/app/javascript/themes/glitch/util/counter.js diff --git a/app/javascript/mastodon/features/emoji/__tests__/emoji-test.js b/app/javascript/themes/glitch/util/emoji/__tests__/emoji-test.js index 372459c78..d43dd005c 100644 --- a/app/javascript/mastodon/features/emoji/__tests__/emoji-test.js +++ b/app/javascript/themes/glitch/util/emoji/__tests__/emoji-test.js @@ -1,4 +1,4 @@ -import emojify from '../emoji'; +import emojify from '..'; describe('emoji', () => { describe('.emojify', () => { diff --git a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js b/app/javascript/themes/glitch/util/emoji/__tests__/emoji_index-test.js index 53efa5743..53efa5743 100644 --- a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js +++ b/app/javascript/themes/glitch/util/emoji/__tests__/emoji_index-test.js diff --git a/app/javascript/mastodon/features/emoji/emoji_compressed.js b/app/javascript/themes/glitch/util/emoji/emoji_compressed.js index e5b834a74..e5b834a74 100644 --- a/app/javascript/mastodon/features/emoji/emoji_compressed.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_compressed.js diff --git a/app/javascript/mastodon/features/emoji/emoji_map.json b/app/javascript/themes/glitch/util/emoji/emoji_map.json index 13753ba84..13753ba84 100644 --- a/app/javascript/mastodon/features/emoji/emoji_map.json +++ b/app/javascript/themes/glitch/util/emoji/emoji_map.json diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js b/app/javascript/themes/glitch/util/emoji/emoji_mart_data_light.js index 45086fc4c..45086fc4c 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_data_light.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_mart_data_light.js diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js b/app/javascript/themes/glitch/util/emoji/emoji_mart_search_light.js index 5755bf1c4..5755bf1c4 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_mart_search_light.js diff --git a/app/javascript/mastodon/features/emoji/emoji_picker.js b/app/javascript/themes/glitch/util/emoji/emoji_picker.js index 7e145381e..7e145381e 100644 --- a/app/javascript/mastodon/features/emoji/emoji_picker.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_picker.js diff --git a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js b/app/javascript/themes/glitch/util/emoji/emoji_unicode_mapping_light.js index 918684c31..918684c31 100644 --- a/app/javascript/mastodon/features/emoji/emoji_unicode_mapping_light.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_unicode_mapping_light.js diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.js b/app/javascript/themes/glitch/util/emoji/emoji_utils.js index dbf725c1f..dbf725c1f 100644 --- a/app/javascript/mastodon/features/emoji/emoji_utils.js +++ b/app/javascript/themes/glitch/util/emoji/emoji_utils.js diff --git a/app/javascript/mastodon/features/emoji/emoji.js b/app/javascript/themes/glitch/util/emoji/index.js index 0f005dd50..8c45a58fe 100644 --- a/app/javascript/mastodon/features/emoji/emoji.js +++ b/app/javascript/themes/glitch/util/emoji/index.js @@ -1,4 +1,4 @@ -import { autoPlayGif } from '../../initial_state'; +import { autoPlayGif } from 'themes/glitch/util/initial_state'; import unicodeMapping from './emoji_unicode_mapping_light'; import Trie from 'substring-trie'; diff --git a/app/javascript/mastodon/features/emoji/unicode_to_filename.js b/app/javascript/themes/glitch/util/emoji/unicode_to_filename.js index c75c4cd7d..c75c4cd7d 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_filename.js +++ b/app/javascript/themes/glitch/util/emoji/unicode_to_filename.js diff --git a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js b/app/javascript/themes/glitch/util/emoji/unicode_to_unified_name.js index 808ac197e..808ac197e 100644 --- a/app/javascript/mastodon/features/emoji/unicode_to_unified_name.js +++ b/app/javascript/themes/glitch/util/emoji/unicode_to_unified_name.js diff --git a/app/javascript/mastodon/extra_polyfills.js b/app/javascript/themes/glitch/util/extra_polyfills.js index 3acc55abd..3acc55abd 100644 --- a/app/javascript/mastodon/extra_polyfills.js +++ b/app/javascript/themes/glitch/util/extra_polyfills.js diff --git a/app/javascript/mastodon/features/ui/util/fullscreen.js b/app/javascript/themes/glitch/util/fullscreen.js index cf5d0cf98..cf5d0cf98 100644 --- a/app/javascript/mastodon/features/ui/util/fullscreen.js +++ b/app/javascript/themes/glitch/util/fullscreen.js diff --git a/app/javascript/mastodon/features/ui/util/get_rect_from_entry.js b/app/javascript/themes/glitch/util/get_rect_from_entry.js index c266cd7dc..c266cd7dc 100644 --- a/app/javascript/mastodon/features/ui/util/get_rect_from_entry.js +++ b/app/javascript/themes/glitch/util/get_rect_from_entry.js diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/themes/glitch/util/initial_state.js index ef5d8b0ef..ef5d8b0ef 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/themes/glitch/util/initial_state.js diff --git a/app/javascript/mastodon/features/ui/util/intersection_observer_wrapper.js b/app/javascript/themes/glitch/util/intersection_observer_wrapper.js index 2b24c6583..2b24c6583 100644 --- a/app/javascript/mastodon/features/ui/util/intersection_observer_wrapper.js +++ b/app/javascript/themes/glitch/util/intersection_observer_wrapper.js diff --git a/app/javascript/mastodon/is_mobile.js b/app/javascript/themes/glitch/util/is_mobile.js index 80e8e0a8a..80e8e0a8a 100644 --- a/app/javascript/mastodon/is_mobile.js +++ b/app/javascript/themes/glitch/util/is_mobile.js diff --git a/app/javascript/mastodon/link_header.js b/app/javascript/themes/glitch/util/link_header.js index a3e7ccf1c..a3e7ccf1c 100644 --- a/app/javascript/mastodon/link_header.js +++ b/app/javascript/themes/glitch/util/link_header.js diff --git a/app/javascript/mastodon/load_polyfills.js b/app/javascript/themes/glitch/util/load_polyfills.js index 8927b7358..8927b7358 100644 --- a/app/javascript/mastodon/load_polyfills.js +++ b/app/javascript/themes/glitch/util/load_polyfills.js diff --git a/app/javascript/mastodon/main.js b/app/javascript/themes/glitch/util/main.js index 93d2eaf10..c10a64ded 100644 --- a/app/javascript/mastodon/main.js +++ b/app/javascript/themes/glitch/util/main.js @@ -1,5 +1,5 @@ import * as WebPushSubscription from './web_push_subscription'; -import Mastodon from './containers/mastodon'; +import Mastodon from 'themes/glitch/containers/mastodon'; import React from 'react'; import ReactDOM from 'react-dom'; import ready from './ready'; diff --git a/app/javascript/mastodon/features/ui/util/optional_motion.js b/app/javascript/themes/glitch/util/optional_motion.js index df3a8b54a..b8a57b22f 100644 --- a/app/javascript/mastodon/features/ui/util/optional_motion.js +++ b/app/javascript/themes/glitch/util/optional_motion.js @@ -1,4 +1,4 @@ -import { reduceMotion } from '../../../initial_state'; +import { reduceMotion } from 'themes/glitch/util/initial_state'; import ReducedMotion from './reduced_motion'; import Motion from 'react-motion/lib/Motion'; diff --git a/app/javascript/mastodon/performance.js b/app/javascript/themes/glitch/util/performance.js index 450a90626..450a90626 100644 --- a/app/javascript/mastodon/performance.js +++ b/app/javascript/themes/glitch/util/performance.js diff --git a/app/javascript/mastodon/features/ui/util/react_router_helpers.js b/app/javascript/themes/glitch/util/react_router_helpers.js index 43007ddc3..c02fb5247 100644 --- a/app/javascript/mastodon/features/ui/util/react_router_helpers.js +++ b/app/javascript/themes/glitch/util/react_router_helpers.js @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Switch, Route } from 'react-router-dom'; -import ColumnLoading from '../components/column_loading'; -import BundleColumnError from '../components/bundle_column_error'; -import BundleContainer from '../containers/bundle_container'; +import ColumnLoading from 'themes/glitch/features/ui/components/column_loading'; +import BundleColumnError from 'themes/glitch/features/ui/components/bundle_column_error'; +import BundleContainer from 'themes/glitch/features/ui/containers/bundle_container'; // Small wrapper to pass multiColumn to the route components export class WrappedSwitch extends React.PureComponent { diff --git a/app/javascript/mastodon/ready.js b/app/javascript/themes/glitch/util/ready.js index dd543910b..dd543910b 100644 --- a/app/javascript/mastodon/ready.js +++ b/app/javascript/themes/glitch/util/ready.js diff --git a/app/javascript/mastodon/features/ui/util/reduced_motion.js b/app/javascript/themes/glitch/util/reduced_motion.js index 95519042b..95519042b 100644 --- a/app/javascript/mastodon/features/ui/util/reduced_motion.js +++ b/app/javascript/themes/glitch/util/reduced_motion.js diff --git a/app/javascript/mastodon/rtl.js b/app/javascript/themes/glitch/util/rtl.js index 00870a15d..00870a15d 100644 --- a/app/javascript/mastodon/rtl.js +++ b/app/javascript/themes/glitch/util/rtl.js diff --git a/app/javascript/mastodon/features/ui/util/schedule_idle_task.js b/app/javascript/themes/glitch/util/schedule_idle_task.js index b04d4a8ee..b04d4a8ee 100644 --- a/app/javascript/mastodon/features/ui/util/schedule_idle_task.js +++ b/app/javascript/themes/glitch/util/schedule_idle_task.js diff --git a/app/javascript/mastodon/scroll.js b/app/javascript/themes/glitch/util/scroll.js index 2af07e0fb..2af07e0fb 100644 --- a/app/javascript/mastodon/scroll.js +++ b/app/javascript/themes/glitch/util/scroll.js diff --git a/app/javascript/mastodon/stream.js b/app/javascript/themes/glitch/util/stream.js index 36c68ffc5..36c68ffc5 100644 --- a/app/javascript/mastodon/stream.js +++ b/app/javascript/themes/glitch/util/stream.js diff --git a/app/javascript/mastodon/features/compose/util/url_regex.js b/app/javascript/themes/glitch/util/url_regex.js index e676d1879..e676d1879 100644 --- a/app/javascript/mastodon/features/compose/util/url_regex.js +++ b/app/javascript/themes/glitch/util/url_regex.js diff --git a/app/javascript/mastodon/uuid.js b/app/javascript/themes/glitch/util/uuid.js index be1899305..be1899305 100644 --- a/app/javascript/mastodon/uuid.js +++ b/app/javascript/themes/glitch/util/uuid.js diff --git a/app/javascript/mastodon/web_push_subscription.js b/app/javascript/themes/glitch/util/web_push_subscription.js index 3dbed09ea..70b26105b 100644 --- a/app/javascript/mastodon/web_push_subscription.js +++ b/app/javascript/themes/glitch/util/web_push_subscription.js @@ -1,6 +1,6 @@ import axios from 'axios'; -import { store } from './containers/mastodon'; -import { setBrowserSupport, setSubscription, clearSubscription } from './actions/push_notifications'; +import { store } from 'themes/glitch/containers/mastodon'; +import { setBrowserSupport, setSubscription, clearSubscription } from 'themes/glitch/actions/push_notifications'; // Taken from https://www.npmjs.com/package/web-push const urlBase64ToUint8Array = (base64String) => { diff --git a/app/javascript/themes/default/theme.yml b/app/javascript/themes/vanilla/theme.yml index 0b262cc82..120c4b669 100644 --- a/app/javascript/themes/default/theme.yml +++ b/app/javascript/themes/vanilla/theme.yml @@ -1,5 +1,5 @@ # (REQUIRED) The location of the pack file inside `pack_directory`. -pack: application.js +#pack: application.js # (OPTIONAL) The directory which contains the pack file. # Defaults to the theme directory (`app/javascript/themes/[theme]`), |