From 9c10aaa4d5bed500c074c1bef3caaa1e84949c00 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 25 Jan 2024 16:41:31 +0100 Subject: [PATCH] [Glitch] Change design of compose form in web UI Port 6936e5aa693ccc4aabd26ef18a65fbb8132f6f74 to glitch-soc Co-authored-by: Claire Signed-off-by: Claire --- .../flavours/glitch/components/account.jsx | 8 +- .../glitch/components/autosuggest_emoji.jsx | 2 +- .../glitch/components/autosuggest_hashtag.tsx | 39 +- .../glitch/components/autosuggest_input.jsx | 59 +- .../components/autosuggest_textarea.jsx | 67 +- .../glitch/components/dropdown_menu.jsx | 2 +- .../glitch/components/visibility_icon.tsx | 13 +- .../glitch/containers/compose_container.jsx | 38 +- .../compose/components/action_bar.jsx | 99 +- .../components/autosuggest_account.jsx | 2 +- .../compose/components/character_counter.jsx | 28 +- .../compose/components/compose_form.jsx | 160 +- .../compose/components/edit_indicator.jsx | 62 + .../components/emoji_picker_dropdown.jsx | 24 +- .../compose/components/language_dropdown.jsx | 35 +- .../compose/components/navigation_bar.jsx | 68 +- .../compose/components/poll_button.jsx | 12 +- .../features/compose/components/poll_form.jsx | 281 ++-- .../compose/components/privacy_dropdown.jsx | 76 +- .../compose/components/reply_indicator.jsx | 94 +- .../features/compose/components/upload.jsx | 28 +- .../compose/components/upload_button.jsx | 14 +- .../compose/components/upload_form.jsx | 19 +- .../compose/components/upload_progress.jsx | 4 +- .../containers/navigation_container.js | 36 - .../containers/poll_button_container.js | 2 +- .../compose/containers/poll_form_container.js | 53 - .../containers/reply_indicator_container.js | 36 - .../containers/sensitive_button_container.jsx | 73 - .../containers/spoiler_button_container.js | 10 +- .../containers/upload_button_container.js | 3 +- .../compose/containers/upload_container.js | 1 + .../glitch/features/compose/index.jsx | 4 - .../glitch/features/getting_started/index.jsx | 2 +- .../features/local_settings/page/index.jsx | 6 +- .../features/standalone/compose/index.jsx | 32 +- .../features/ui/components/compose_panel.jsx | 6 +- .../ui/components/focal_point_modal.jsx | 2 +- .../features/ui/components/mute_modal.jsx | 1 - .../flavours/glitch/locales/en.json | 20 - .../flavours/glitch/packs/share.jsx | 4 +- .../flavours/glitch/reducers/compose.js | 20 +- .../flavours/glitch/styles/_mixins.scss | 5 +- .../flavours/glitch/styles/admin.scss | 6 + .../flavours/glitch/styles/basics.scss | 2 +- .../flavours/glitch/styles/components.scss | 1342 +++++++++-------- .../flavours/glitch/styles/containers.scss | 21 +- .../flavours/glitch/styles/contrast/diff.scss | 37 +- .../flavours/glitch/styles/emoji_picker.scss | 30 +- .../glitch/styles/mastodon-light/diff.scss | 153 +- .../styles/mastodon-light/variables.scss | 7 +- .../flavours/glitch/styles/modal.scss | 2 +- .../flavours/glitch/styles/polls.scss | 127 +- 53 files changed, 1498 insertions(+), 1779 deletions(-) create mode 100644 app/javascript/flavours/glitch/features/compose/components/edit_indicator.jsx delete mode 100644 app/javascript/flavours/glitch/features/compose/containers/navigation_container.js delete mode 100644 app/javascript/flavours/glitch/features/compose/containers/poll_form_container.js delete mode 100644 app/javascript/flavours/glitch/features/compose/containers/reply_indicator_container.js delete mode 100644 app/javascript/flavours/glitch/features/compose/containers/sensitive_button_container.jsx diff --git a/app/javascript/flavours/glitch/components/account.jsx b/app/javascript/flavours/glitch/components/account.jsx index fd7caea6df..7e5209653e 100644 --- a/app/javascript/flavours/glitch/components/account.jsx +++ b/app/javascript/flavours/glitch/components/account.jsx @@ -37,10 +37,10 @@ class Account extends ImmutablePureComponent { static propTypes = { size: PropTypes.number, account: ImmutablePropTypes.record, - onFollow: PropTypes.func.isRequired, - onBlock: PropTypes.func.isRequired, - onMute: PropTypes.func.isRequired, - onMuteNotifications: PropTypes.func.isRequired, + onFollow: PropTypes.func, + onBlock: PropTypes.func, + onMute: PropTypes.func, + onMuteNotifications: PropTypes.func, intl: PropTypes.object.isRequired, hidden: PropTypes.bool, minimal: PropTypes.bool, diff --git a/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx b/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx index eb25f5a643..892d068b31 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_emoji.jsx @@ -35,7 +35,7 @@ export default class AutosuggestEmoji extends PureComponent { alt={emoji.native || emoji.colons} /> - {emoji.colons} +
{emoji.colons}
); } diff --git a/app/javascript/flavours/glitch/components/autosuggest_hashtag.tsx b/app/javascript/flavours/glitch/components/autosuggest_hashtag.tsx index 6da6200142..808f303754 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_hashtag.tsx +++ b/app/javascript/flavours/glitch/components/autosuggest_hashtag.tsx @@ -1,5 +1,3 @@ -import { FormattedMessage } from 'react-intl'; - import { ShortNumber } from 'flavours/glitch/components/short_number'; interface Props { @@ -16,27 +14,18 @@ interface Props { }; } -export const AutosuggestHashtag: React.FC = ({ tag }) => { - const weeklyUses = tag.history && ( - total + day.uses * 1, 0)} - /> - ); - - return ( -
-
- #{tag.name} -
- {tag.history !== undefined && ( -
- -
- )} +export const AutosuggestHashtag: React.FC = ({ tag }) => ( +
+
+ #{tag.name}
- ); -}; + + {tag.history !== undefined && ( +
+ total + day.uses * 1, 0)} + /> +
+ )} +
+); diff --git a/app/javascript/flavours/glitch/components/autosuggest_input.jsx b/app/javascript/flavours/glitch/components/autosuggest_input.jsx index 6d2474b442..97da532ebb 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_input.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_input.jsx @@ -5,6 +5,8 @@ import classNames from 'classnames'; import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; +import Overlay from 'react-overlays/Overlay'; + import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; import AutosuggestEmoji from './autosuggest_emoji'; @@ -195,34 +197,37 @@ export default class AutosuggestInput extends ImmutablePureComponent { return (
- - -
- {suggestions.map(this.renderSuggestion)} -
+ + {({ props }) => ( +
+
+ {suggestions.map(this.renderSuggestion)} +
+
+ )} +
); } diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx index 28384075c3..9fd199a21c 100644 --- a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx +++ b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx @@ -5,6 +5,7 @@ import classNames from 'classnames'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import Overlay from 'react-overlays/Overlay'; import Textarea from 'react-textarea-autosize'; import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container'; @@ -52,7 +53,6 @@ const AutosuggestTextarea = forwardRef(({ onFocus, autoFocus = true, lang, - children, }, textareaRef) => { const [suggestionsHidden, setSuggestionsHidden] = useState(true); @@ -183,40 +183,38 @@ const AutosuggestTextarea = forwardRef(({ ); }; - return [ -
-
-