From 4b663d9252afe05e9490bd0dcd90a45c41d4d626 Mon Sep 17 00:00:00 2001 From: pinfort Date: Mon, 6 Feb 2023 02:15:07 +0900 Subject: [PATCH 01/11] dissmissable banner --- app/javascript/mastodon/features/area_timeline/index.js | 5 +++++ .../mastodon/features/area_timeline_redirect/index.js | 2 +- app/javascript/mastodon/locales/en.json | 1 + app/javascript/mastodon/locales/ja.json | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/area_timeline/index.js b/app/javascript/mastodon/features/area_timeline/index.js index d1522834fe15d7..7a4e764b0e3fc8 100644 --- a/app/javascript/mastodon/features/area_timeline/index.js +++ b/app/javascript/mastodon/features/area_timeline/index.js @@ -12,6 +12,7 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ColumnSettingsContainer from './containers/column_settings_container'; import { connectAreaStream } from '../../actions/streaming'; import { Helmet } from 'react-helmet'; +import DismissableBanner from 'mastodon/components/dismissable_banner'; const messages = defineMessages({ title: { id: 'column.area', defaultMessage: 'Area timeline' }, @@ -115,6 +116,10 @@ class AreaTimeline extends React.PureComponent { + + + + ({ area: state.getIn(['settings', 'area']).getIn(['area', 'body']), diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index b08ec8c6f607c0..888eb35ddbec6b 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -201,6 +201,7 @@ "dismissable_banner.explore_statuses": "These posts from this and other servers in the decentralized network are gaining traction on this server right now.", "dismissable_banner.explore_tags": "These hashtags are gaining traction among people on this and other servers of the decentralized network right now.", "dismissable_banner.public_timeline": "These are the most recent public posts from people on this and other servers of the decentralized network that this server knows about.", + "dismissable_banner.area_timeline": "These are the most recent public posts from people whose accounts are hosted by instances in apecified area.", "embed.instructions": "Embed this post on your website by copying the code below.", "embed.preview": "Here is what it will look like:", "emoji_button.activity": "Activity", diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index 92c895dff57753..7d41bdc11b0d50 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -202,6 +202,7 @@ "dismissable_banner.explore_statuses": "分散型ネットワーク内の他のサーバーのこれらの投稿は現在このサーバー上で注目されています。", "dismissable_banner.explore_tags": "これらのハッシュタグは現在分散型ネットワークの他のサーバーの人たちに話されています。", "dismissable_banner.public_timeline": "これらの投稿はこのサーバーが知っている分散型ネットワークの他のサーバーの人たちの最新の公開投稿です。", + "dismissable_banner.area_timeline": "これらの投稿は指定した地域の他のサーバーの人たちの最新の公開投稿です。", "embed.instructions": "下記のコードをコピーしてウェブサイトに埋め込みます。", "embed.preview": "表示例:", "emoji_button.activity": "活動", From cb239cfd1fb2b237e6717af7ffe83f180ce3f33a Mon Sep 17 00:00:00 2001 From: pinfort Date: Mon, 6 Feb 2023 02:24:39 +0900 Subject: [PATCH 02/11] fix redirect --- config/routes.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index d80f9696a77ee8..ee5604b856bfa7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,6 +28,8 @@ /domain_blocks /mutes /statuses/(*any) + /areas + /areas/(*any) ).freeze root 'home#index' From ff93917021fa243b1872484803cd2d9a6ab682d6 Mon Sep 17 00:00:00 2001 From: pinfort Date: Mon, 6 Feb 2023 02:43:45 +0900 Subject: [PATCH 03/11] add drawer --- app/javascript/mastodon/features/compose/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js index f744fc61155723..227d99dba47e44 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/mastodon/features/compose/index.js @@ -25,6 +25,7 @@ const messages = defineMessages({ notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' }, public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' }, community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, + area: { id: 'navigation_bar.area_timeline', defaultMessage: 'Area timeline' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new post' }, @@ -105,6 +106,9 @@ class Compose extends React.PureComponent { {!columns.some(column => column.get('id') === 'PUBLIC') && ( )} + {!columns.some(column => column.get('id') === 'AREA') && ( + + )} From 2949aa800a1640030ad03272b80f73dad18371ba Mon Sep 17 00:00:00 2001 From: pinfort Date: Mon, 6 Feb 2023 02:47:48 +0900 Subject: [PATCH 04/11] navigation panel --- .../mastodon/features/ui/components/navigation_panel.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/javascript/mastodon/features/ui/components/navigation_panel.js b/app/javascript/mastodon/features/ui/components/navigation_panel.js index 9a9309be059a61..7ad1056f9f28b6 100644 --- a/app/javascript/mastodon/features/ui/components/navigation_panel.js +++ b/app/javascript/mastodon/features/ui/components/navigation_panel.js @@ -18,6 +18,7 @@ const messages = defineMessages({ explore: { id: 'explore.title', defaultMessage: 'Explore' }, local: { id: 'tabs_bar.local_timeline', defaultMessage: 'Local' }, federated: { id: 'tabs_bar.federated_timeline', defaultMessage: 'Federated' }, + area: { id: 'tabs_bar.area_timeline', defaultMessage: 'Area' }, direct: { id: 'navigation_bar.direct', defaultMessage: 'Direct messages' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' }, @@ -69,6 +70,7 @@ class NavigationPanel extends React.Component { <> + )} From f5ae64e56027aa34986c4e3edb302362c8dd2852 Mon Sep 17 00:00:00 2001 From: pinfort Date: Mon, 6 Feb 2023 02:55:18 +0900 Subject: [PATCH 05/11] change redirect --- app/javascript/mastodon/components/setting_select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/components/setting_select.js b/app/javascript/mastodon/components/setting_select.js index 166b594230c1fc..6ca0cd9f1b17d1 100644 --- a/app/javascript/mastodon/components/setting_select.js +++ b/app/javascript/mastodon/components/setting_select.js @@ -20,7 +20,7 @@ class SettingSelect extends React.PureComponent { handleChange = (e) => { this.props.onChange(this.props.settingKey, e.target.value); if (this.props.settingKey.toString() === ['area', 'body'].toString()) { - this.context.router.history.push('/timelines/area'); + this.context.router.history.push('/'); } } From 9c2f9f6193f4995f63fa01cb5a77c1cc13977cb4 Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 01:03:30 +0900 Subject: [PATCH 06/11] add test --- spec/requests/area_redirect_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/requests/area_redirect_spec.rb diff --git a/spec/requests/area_redirect_spec.rb b/spec/requests/area_redirect_spec.rb new file mode 100644 index 00000000000000..ee0ed729ee5829 --- /dev/null +++ b/spec/requests/area_redirect_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +describe 'Area url redirect to top' do + describe 'with no area id' do + it 'areas redirect to top' do + get '/areas' + + expect(response).to redirect_to('/') + end + end + + describe 'aith area id' do + it 'areas redirect to top' do + get '/areas/foofoo' + + expect(response).to redirect_to('/') + end + end +end From 79f768b1500f740730a13c9b47056c9583e0582d Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 01:31:31 +0900 Subject: [PATCH 07/11] fix select --- .../area_timeline/components/column_settings.js | 13 +++++++++++-- .../containers/column_settings_container.js | 7 ++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/javascript/mastodon/features/area_timeline/components/column_settings.js b/app/javascript/mastodon/features/area_timeline/components/column_settings.js index 872408819446f6..73b8222d575b42 100644 --- a/app/javascript/mastodon/features/area_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/area_timeline/components/column_settings.js @@ -9,6 +9,7 @@ class ColumnSettings extends React.PureComponent { static propTypes = { settings: ImmutablePropTypes.map.isRequired, + pinned: PropTypes.bool.isRequired, onChange: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, }; @@ -24,15 +25,23 @@ class ColumnSettings extends React.PureComponent { } render () { - const { settings, onChange } = this.props; + const { settings, pinned, onChange } = this.props; var areas = this.readAreas(); + var settingKey = []; + if (pinned) { + // そのカラムが固定されていたら ['settings', 'columns', $UUID, 'params', 'id'] に地域名を格納 + settingKey = ['id']; + } else { + // 固定されていなければ、 ['settings', 'area', 'area', 'body'] に地域名を格納 + settingKey = ['area', 'body']; + } return (
- +
); diff --git a/app/javascript/mastodon/features/area_timeline/containers/column_settings_container.js b/app/javascript/mastodon/features/area_timeline/containers/column_settings_container.js index d80e225fcf27d3..50ae5b59d20a6a 100644 --- a/app/javascript/mastodon/features/area_timeline/containers/column_settings_container.js +++ b/app/javascript/mastodon/features/area_timeline/containers/column_settings_container.js @@ -10,16 +10,17 @@ const mapStateToProps = (state, { columnId }) => { return { settings: (uuid && index >= 0) ? columns.get(index).get('params') : state.getIn(['settings', 'area']), + pinned: !!columnId, }; }; const mapDispatchToProps = (dispatch, { columnId }) => { return { - onChange (key, checked) { + onChange (key, areaName) { if (columnId) { - dispatch(changeColumnParams(columnId, key, checked)); + dispatch(changeColumnParams(columnId, key, areaName)); } else { - dispatch(changeSetting(['area', ...key], checked)); + dispatch(changeSetting(['area', ...key], areaName)); } }, }; From 41d06dd74bba948321c098cb15ef1e7b0525b75a Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 01:51:21 +0900 Subject: [PATCH 08/11] fix code --- app/javascript/mastodon/components/setting_select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/components/setting_select.js b/app/javascript/mastodon/components/setting_select.js index 6ca0cd9f1b17d1..a09e19269bf434 100644 --- a/app/javascript/mastodon/components/setting_select.js +++ b/app/javascript/mastodon/components/setting_select.js @@ -20,7 +20,7 @@ class SettingSelect extends React.PureComponent { handleChange = (e) => { this.props.onChange(this.props.settingKey, e.target.value); if (this.props.settingKey.toString() === ['area', 'body'].toString()) { - this.context.router.history.push('/'); + this.context.router.history.push('/areas'); } } From c9de4337357345285ae657d1ac7cc4d4391573c5 Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 02:27:43 +0900 Subject: [PATCH 09/11] fix ui color --- app/javascript/styles/custom.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/styles/custom.scss b/app/javascript/styles/custom.scss index 4549e24e7ba352..8ecd844ad1703a 100644 --- a/app/javascript/styles/custom.scss +++ b/app/javascript/styles/custom.scss @@ -308,9 +308,9 @@ } .setting-select { - color: #9baec8; + color: $primary-text-color; border: none; - border-bottom: 2px solid #9baec8; + border-bottom: 2px solid $classic-primary-color; -webkit-box-sizing: border-box; box-sizing: border-box; display: block; @@ -318,5 +318,5 @@ margin-bottom: 10px; padding: 7px 0; width: 100%; - background: #393f4f; + background: lighten($ui-base-color, 8%); } From 8023282b9a7b91999cd1e573dd076fdb61a5f5db Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 02:32:35 +0900 Subject: [PATCH 10/11] fix typo --- spec/requests/area_redirect_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/area_redirect_spec.rb b/spec/requests/area_redirect_spec.rb index ee0ed729ee5829..55ddb1dd010368 100644 --- a/spec/requests/area_redirect_spec.rb +++ b/spec/requests/area_redirect_spec.rb @@ -9,7 +9,7 @@ end end - describe 'aith area id' do + describe 'with area id' do it 'areas redirect to top' do get '/areas/foofoo' From 1b8ddc0c889efafcb3a4c4120381f991676f1b94 Mon Sep 17 00:00:00 2001 From: pinfort Date: Tue, 7 Feb 2023 02:50:21 +0900 Subject: [PATCH 11/11] fix test --- spec/requests/area_pages_spec.rb | 19 +++++++++++++++++++ spec/requests/area_redirect_spec.rb | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 spec/requests/area_pages_spec.rb delete mode 100644 spec/requests/area_redirect_spec.rb diff --git a/spec/requests/area_pages_spec.rb b/spec/requests/area_pages_spec.rb new file mode 100644 index 00000000000000..aa7099dfe7d325 --- /dev/null +++ b/spec/requests/area_pages_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +describe 'Area url shown' do + describe 'with no area id' do + it 'shows page' do + get '/areas' + + expect(response).to have_http_status(200) + end + end + + describe 'with area id' do + it 'shows page' do + get '/areas/foofoo' + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/requests/area_redirect_spec.rb b/spec/requests/area_redirect_spec.rb deleted file mode 100644 index 55ddb1dd010368..00000000000000 --- a/spec/requests/area_redirect_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -describe 'Area url redirect to top' do - describe 'with no area id' do - it 'areas redirect to top' do - get '/areas' - - expect(response).to redirect_to('/') - end - end - - describe 'with area id' do - it 'areas redirect to top' do - get '/areas/foofoo' - - expect(response).to redirect_to('/') - end - end -end