From 3b9c02506d5046a66ff84b2c787098481a27bda7 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Mon, 27 May 2019 06:13:29 +0900 Subject: Fix poll visibility on public pages (#10817) * Fix poll visibility on public pages * Revert "Fix poll visibility on public pages" This reverts commit 54a9608add6f855bc6337fe3c65eaee7ba13db49. * Revert "Change poll options to alphabetic letters when status text is hidden" This reverts commit c53d67326201b2061990b1874a3547c3647f50d2. --- app/javascript/mastodon/components/poll.js | 14 ++++++-------- app/javascript/mastodon/components/status.js | 2 +- .../mastodon/features/status/components/detailed_status.js | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js index acab107a1..690f9ae5a 100644 --- a/app/javascript/mastodon/components/poll.js +++ b/app/javascript/mastodon/components/poll.js @@ -28,7 +28,6 @@ class Poll extends ImmutablePureComponent { intl: PropTypes.object.isRequired, dispatch: PropTypes.func, disabled: PropTypes.bool, - visible: PropTypes.bool, }; state = { @@ -70,14 +69,13 @@ class Poll extends ImmutablePureComponent { }; renderOption (option, optionIndex) { - const { poll, disabled, visible } = this.props; - const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100; - const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count')); - const active = !!this.state.selected[`${optionIndex}`]; - const showResults = poll.get('voted') || poll.get('expired'); + const { poll, disabled } = this.props; + const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100; + const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count')); + const active = !!this.state.selected[`${optionIndex}`]; + const showResults = poll.get('voted') || poll.get('expired'); let titleEmojified = option.get('title_emojified'); - if (!titleEmojified) { const emojiMap = makeEmojiMap(poll); titleEmojified = emojify(escapeTextContentForBrowser(option.get('title')), emojiMap); @@ -106,7 +104,7 @@ class Poll extends ImmutablePureComponent { {!showResults && } {showResults && {Math.round(percent)}%} - {visible ? : {String.fromCharCode(64 + optionIndex + 1)}} + ); diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index b67354b01..28738105a 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -317,7 +317,7 @@ class Status extends ImmutablePureComponent { } if (status.get('poll')) { - media = ; + media = ; } else if (status.get('media_attachments').size > 0) { if (this.props.muted) { media = ( diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index 22821af0c..9089eb303 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -108,7 +108,7 @@ export default class DetailedStatus extends ImmutablePureComponent { } if (status.get('poll')) { - media = ; + media = ; } else if (status.get('media_attachments').size > 0) { if (status.getIn(['media_attachments', 0, 'type']) === 'video') { const video = status.getIn(['media_attachments', 0]); -- cgit From 8d5dcc9301c422f131167574da550f8cdaedb73f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 27 May 2019 03:33:39 +0200 Subject: Use `` to render transparent SVG logo instead of inserting it (#10845) --- app/helpers/stream_entries_helper.rb | 12 +++++++---- app/javascript/images/logo_transparent.svg | 2 +- app/javascript/styles/mastodon-light/diff.scss | 2 +- app/javascript/styles/mastodon/containers.scss | 4 ---- app/javascript/styles/mastodon/footer.scss | 5 +---- app/javascript/styles/mastodon/stream_entries.scss | 25 +--------------------- app/views/layouts/application.html.haml | 3 +++ app/views/layouts/public.html.haml | 4 +--- 8 files changed, 16 insertions(+), 41 deletions(-) (limited to 'app/javascript') diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index d56efbfb9..a66fb83ea 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -16,24 +16,28 @@ module StreamEntriesHelper if user_signed_in? if account.id == current_user.account_id link_to settings_profile_url, class: 'button logo-button' do - safe_join([render(file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')), t('settings.edit_profile')]) + safe_join([svg_logo, t('settings.edit_profile')]) end elsif current_account.following?(account) || current_account.requested?(account) link_to account_unfollow_path(account), class: 'button logo-button button--destructive', data: { method: :post } do - safe_join([render(file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')), t('accounts.unfollow')]) + safe_join([svg_logo, t('accounts.unfollow')]) end elsif !(account.memorial? || account.moved?) link_to account_follow_path(account), class: "button logo-button#{account.blocking?(current_account) ? ' disabled' : ''}", data: { method: :post } do - safe_join([render(file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')), t('accounts.follow')]) + safe_join([svg_logo, t('accounts.follow')]) end end elsif !(account.memorial? || account.moved?) link_to account_remote_follow_path(account), class: 'button logo-button modal-button', target: '_new' do - safe_join([render(file: Rails.root.join('app', 'javascript', 'images', 'logo.svg')), t('accounts.follow')]) + safe_join([svg_logo, t('accounts.follow')]) end end end + def svg_logo + content_tag(:svg, tag(:use, 'xlink:href' => '#mastodon-svg-logo'), 'viewBox' => '0 0 216.4144 232.00976') + end + def account_badge(account, all: false) if account.bot? content_tag(:div, content_tag(:div, t('accounts.roles.bot'), class: 'account-role bot'), class: 'roles') diff --git a/app/javascript/images/logo_transparent.svg b/app/javascript/images/logo_transparent.svg index abd6d1f67..a1e7b403e 100644 --- a/app/javascript/images/logo_transparent.svg +++ b/app/javascript/images/logo_transparent.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index 48236a286..d35a59821 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -306,7 +306,7 @@ .button.logo-button { color: $white; - svg path:first-child { + svg { fill: $white; } } diff --git a/app/javascript/styles/mastodon/containers.scss b/app/javascript/styles/mastodon/containers.scss index 368c2304b..0eae4939f 100644 --- a/app/javascript/styles/mastodon/containers.scss +++ b/app/javascript/styles/mastodon/containers.scss @@ -359,10 +359,6 @@ .logo-button { background-color: $secondary-text-color; - - svg path:last-child { - fill: $secondary-text-color; - } } } diff --git a/app/javascript/styles/mastodon/footer.scss b/app/javascript/styles/mastodon/footer.scss index 4d75477e0..f74c004e9 100644 --- a/app/javascript/styles/mastodon/footer.scss +++ b/app/javascript/styles/mastodon/footer.scss @@ -122,10 +122,7 @@ height: 36px; width: auto; margin: 0 auto; - - path { - fill: lighten($ui-base-color, 34%); - } + fill: lighten($ui-base-color, 34%); } &:hover, diff --git a/app/javascript/styles/mastodon/stream_entries.scss b/app/javascript/styles/mastodon/stream_entries.scss index 63eeffe25..bfbb907e0 100644 --- a/app/javascript/styles/mastodon/stream_entries.scss +++ b/app/javascript/styles/mastodon/stream_entries.scss @@ -89,40 +89,21 @@ height: auto; vertical-align: middle; margin-right: 5px; - - path:first-child { - fill: $primary-text-color; - } - - path:last-child { - fill: $ui-highlight-color; - } + fill: $primary-text-color; } &:active, &:focus, &:hover { background: lighten($ui-highlight-color, 10%); - - svg path:last-child { - fill: lighten($ui-highlight-color, 10%); - } } &:disabled, &.disabled { - svg path:last-child { - fill: $ui-primary-color; - } - &:active, &:focus, &:hover { background: $ui-primary-color; - - svg path:last-child { - fill: $ui-primary-color; - } } } @@ -131,10 +112,6 @@ &:focus, &:hover { background: $error-red; - - svg path:last-child { - fill: $error-red; - } } } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3d63dc0f3..220a4ca9b 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -33,3 +33,6 @@ %body{ class: body_classes } = content_for?(:content) ? yield(:content) : yield + + %div{ style: 'display: none'} + = render file: Rails.root.join('app', 'javascript', 'images', 'logo_transparent.svg') diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index d30b2a3ea..ee34936d6 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -38,9 +38,7 @@ %li= link_to t('about.api'), 'https://docs.joinmastodon.org/api/guidelines/' .column-2 %h4= link_to t('about.what_is_mastodon'), 'https://joinmastodon.org/' - - = link_to root_url, class: 'brand' do - = render file: Rails.root.join('app', 'javascript', 'images', 'logo_transparent.svg') + = link_to svg_logo, root_url, class: 'brand' .column-3 %h4= site_hostname %ul -- cgit From 3593b854233da1dbb49e95c929019c60a53eca79 Mon Sep 17 00:00:00 2001 From: abcang Date: Tue, 28 May 2019 04:56:29 +0900 Subject: Display notifications count on a new single column (#10859) --- app/javascript/mastodon/reducers/notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/javascript') diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index c891f4a52..4d9604de9 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -18,7 +18,7 @@ import compareId from '../compare_id'; const initialState = ImmutableMap({ items: ImmutableList(), hasMore: true, - top: true, + top: false, unread: 0, isLoading: false, }); -- cgit From 451e5980b609eca5b20041963aca0098508475d7 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 27 May 2019 21:58:41 +0200 Subject: Refactor footers in web UI into a single component (#10846) --- .../mastodon/features/getting_started/index.js | 26 ++-------------- .../features/ui/components/compose_panel.js | 26 ++-------------- .../mastodon/features/ui/components/link_footer.js | 35 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 47 deletions(-) create mode 100644 app/javascript/mastodon/features/ui/components/link_footer.js (limited to 'app/javascript') diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index 129ce77f6..fc7840ec1 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -7,12 +7,12 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import { me, invitesEnabled, version, profile_directory, repository, source_url } from '../../initial_state'; +import { me, profile_directory } from '../../initial_state'; import { fetchFollowRequests } from 'mastodon/actions/accounts'; import { List as ImmutableList } from 'immutable'; -import { Link } from 'react-router-dom'; import NavigationBar from '../compose/components/navigation_bar'; import Icon from 'mastodon/components/icon'; +import LinkFooter from 'mastodon/features/ui/components/link_footer'; const messages = defineMessages({ home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' }, @@ -166,27 +166,7 @@ class GettingStarted extends ImmutablePureComponent { {!multiColumn &&
} -
-
    - {invitesEnabled &&
  • ·
  • } - {multiColumn &&
  • ·
  • } -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • -
- -

- {repository} (v{version}) }} - /> -

-
+
); diff --git a/app/javascript/mastodon/features/ui/components/compose_panel.js b/app/javascript/mastodon/features/ui/components/compose_panel.js index 7c1158e5d..c456a6400 100644 --- a/app/javascript/mastodon/features/ui/components/compose_panel.js +++ b/app/javascript/mastodon/features/ui/components/compose_panel.js @@ -2,9 +2,7 @@ import React from 'react'; import SearchContainer from 'mastodon/features/compose/containers/search_container'; import ComposeFormContainer from 'mastodon/features/compose/containers/compose_form_container'; import NavigationContainer from 'mastodon/features/compose/containers/navigation_container'; -import { invitesEnabled, version, repository, source_url } from 'mastodon/initial_state'; -import { Link } from 'react-router-dom'; -import { FormattedMessage } from 'react-intl'; +import LinkFooter from './link_footer'; const ComposePanel = () => (
@@ -14,27 +12,7 @@ const ComposePanel = () => (
-
-
    - {invitesEnabled &&
  • ·
  • } -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • ·
  • -
  • -
- -

- {repository} (v{version}) }} - /> -

-
+
); diff --git a/app/javascript/mastodon/features/ui/components/link_footer.js b/app/javascript/mastodon/features/ui/components/link_footer.js new file mode 100644 index 000000000..b481983dc --- /dev/null +++ b/app/javascript/mastodon/features/ui/components/link_footer.js @@ -0,0 +1,35 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; +import { Link } from 'react-router-dom'; +import { invitesEnabled, version, repository, source_url } from 'mastodon/initial_state'; + +const LinkFooter = ({ withHotkeys }) => ( +
+
    + {invitesEnabled &&
  • ·
  • } + {withHotkeys &&
  • ·
  • } +
  • ·
  • +
  • ·
  • +
  • ·
  • +
  • ·
  • +
  • ·
  • +
  • ·
  • +
  • +
+ +

+ {repository} (v{version}) }} + /> +

+
+); + +LinkFooter.propTypes = { + withHotkeys: PropTypes.bool, +}; + +export default LinkFooter; -- cgit