diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index dddda92f..55991900 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -162,15 +162,14 @@ export function handleComposeSubmit(dispatch, getState, response, status) { } }; - if (response.data.visibility !== 'direct') { + if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { insertIfOnline('home'); - } else if (response.data.in_reply_to_id === null && response.data.visibility === 'public') { insertIfOnline('community'); insertIfOnline('public'); } } -export function submitCompose(routerHistory, group) { +export function submitCompose(group, replyToId=null) { return function (dispatch, getState) { if (!me) return; @@ -189,6 +188,8 @@ export function submitCompose(routerHistory, group) { // return hasProtocol ? match : `http://${match}` // }) + const inReplyToId = getState().getIn(['compose', 'in_reply_to'], null) || replyToId + console.log("markdown:", markdown) dispatch(submitComposeRequest()); @@ -208,7 +209,7 @@ export function submitCompose(routerHistory, group) { status, markdown, scheduled_at, - in_reply_to_id: getState().getIn(['compose', 'in_reply_to'], null), + in_reply_to_id: inReplyToId, quote_of_id: getState().getIn(['compose', 'quote_of_id'], null), media_ids: media.map(item => item.get('id')), sensitive: getState().getIn(['compose', 'sensitive']), @@ -221,9 +222,6 @@ export function submitCompose(routerHistory, group) { 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), }, }).then(function (response) { - if (response.data.visibility === 'direct' && getState().getIn(['conversations', 'mounted']) <= 0 && routerHistory) { - routerHistory.push('/messages'); - } handleComposeSubmit(dispatch, getState, response, status); }).catch(function (error) { dispatch(submitComposeFail(error)); diff --git a/app/javascript/gabsocial/assets/add_icon.js b/app/javascript/gabsocial/assets/add_icon.js index 42d373de..6a35151d 100644 --- a/app/javascript/gabsocial/assets/add_icon.js +++ b/app/javascript/gabsocial/assets/add_icon.js @@ -1,8 +1,6 @@ const AddIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Add', }) => ( diff --git a/app/javascript/gabsocial/assets/angle_right_icon.js b/app/javascript/gabsocial/assets/angle_right_icon.js index bbd4451f..e6311bba 100644 --- a/app/javascript/gabsocial/assets/angle_right_icon.js +++ b/app/javascript/gabsocial/assets/angle_right_icon.js @@ -1,8 +1,6 @@ const AngleRightIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = '', }) => ( diff --git a/app/javascript/gabsocial/assets/apps_icon.js b/app/javascript/gabsocial/assets/apps_icon.js index ebc9a79f..bc724a35 100644 --- a/app/javascript/gabsocial/assets/apps_icon.js +++ b/app/javascript/gabsocial/assets/apps_icon.js @@ -1,8 +1,6 @@ const AppsIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 80 80', + size = '16px', title = 'Apps', }) => ( diff --git a/app/javascript/gabsocial/assets/audio_icon.js b/app/javascript/gabsocial/assets/audio_icon.js index 99d3a58d..8efc45fe 100644 --- a/app/javascript/gabsocial/assets/audio_icon.js +++ b/app/javascript/gabsocial/assets/audio_icon.js @@ -1,8 +1,6 @@ const AudioIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = '', }) => ( diff --git a/app/javascript/gabsocial/assets/audio_mute_icon.js b/app/javascript/gabsocial/assets/audio_mute_icon.js index dadc103d..d3639571 100644 --- a/app/javascript/gabsocial/assets/audio_mute_icon.js +++ b/app/javascript/gabsocial/assets/audio_mute_icon.js @@ -1,9 +1,7 @@ const AudioMuteIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', - title = 'Error', + size = '24px', + title = '', }) => ( diff --git a/app/javascript/gabsocial/assets/back_icon.js b/app/javascript/gabsocial/assets/back_icon.js index 4cf5137c..ff0132ad 100644 --- a/app/javascript/gabsocial/assets/back_icon.js +++ b/app/javascript/gabsocial/assets/back_icon.js @@ -1,8 +1,6 @@ const BackIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 60 60', + size = '16px', title = 'Back', }) => ( diff --git a/app/javascript/gabsocial/assets/blockquote_icon.js b/app/javascript/gabsocial/assets/blockquote_icon.js index 54955705..20ce7c3b 100644 --- a/app/javascript/gabsocial/assets/blockquote_icon.js +++ b/app/javascript/gabsocial/assets/blockquote_icon.js @@ -1,8 +1,6 @@ const BlockQuoteIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Block Quote', }) => ( diff --git a/app/javascript/gabsocial/assets/bold_icon.js b/app/javascript/gabsocial/assets/bold_icon.js index ee39beda..a8f823e9 100644 --- a/app/javascript/gabsocial/assets/bold_icon.js +++ b/app/javascript/gabsocial/assets/bold_icon.js @@ -1,8 +1,6 @@ const BoldIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Strikethrough', }) => ( diff --git a/app/javascript/gabsocial/assets/calendar_icon.js b/app/javascript/gabsocial/assets/calendar_icon.js index cbc74f60..439b3d35 100644 --- a/app/javascript/gabsocial/assets/calendar_icon.js +++ b/app/javascript/gabsocial/assets/calendar_icon.js @@ -1,8 +1,6 @@ const CalendarIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Calendar', }) => ( diff --git a/app/javascript/gabsocial/assets/chat_icon.js b/app/javascript/gabsocial/assets/chat_icon.js index 8f7de4d8..4c75b526 100644 --- a/app/javascript/gabsocial/assets/chat_icon.js +++ b/app/javascript/gabsocial/assets/chat_icon.js @@ -1,8 +1,6 @@ const ChatIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Chat', }) => ( diff --git a/app/javascript/gabsocial/assets/circle_icon.js b/app/javascript/gabsocial/assets/circle_icon.js index a9d27e0c..8f0bd842 100644 --- a/app/javascript/gabsocial/assets/circle_icon.js +++ b/app/javascript/gabsocial/assets/circle_icon.js @@ -1,8 +1,6 @@ const CircleIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = '', }) => ( diff --git a/app/javascript/gabsocial/assets/close_icon.js b/app/javascript/gabsocial/assets/close_icon.js index 0b731314..a35183d4 100644 --- a/app/javascript/gabsocial/assets/close_icon.js +++ b/app/javascript/gabsocial/assets/close_icon.js @@ -1,8 +1,6 @@ const CloseIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 24 24', + size = '16px', title = 'Close', }) => ( diff --git a/app/javascript/gabsocial/assets/code_icon.js b/app/javascript/gabsocial/assets/code_icon.js index 2ac11ce6..086a8366 100644 --- a/app/javascript/gabsocial/assets/code_icon.js +++ b/app/javascript/gabsocial/assets/code_icon.js @@ -1,8 +1,6 @@ const CodeIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Code', }) => ( diff --git a/app/javascript/gabsocial/assets/comment_icon.js b/app/javascript/gabsocial/assets/comment_icon.js index 8d8aadd5..7ab8d1ff 100644 --- a/app/javascript/gabsocial/assets/comment_icon.js +++ b/app/javascript/gabsocial/assets/comment_icon.js @@ -1,8 +1,6 @@ const CommentIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Comment', }) => ( diff --git a/app/javascript/gabsocial/assets/copy_icon.js b/app/javascript/gabsocial/assets/copy_icon.js index 2b8e4e25..fb1947c7 100644 --- a/app/javascript/gabsocial/assets/copy_icon.js +++ b/app/javascript/gabsocial/assets/copy_icon.js @@ -1,8 +1,6 @@ const CopyIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Copy', }) => ( diff --git a/app/javascript/gabsocial/assets/dissenter_icon.js b/app/javascript/gabsocial/assets/dissenter_icon.js index 1176a4a5..bfa63524 100644 --- a/app/javascript/gabsocial/assets/dissenter_icon.js +++ b/app/javascript/gabsocial/assets/dissenter_icon.js @@ -1,8 +1,6 @@ const DissenterIcon = ({ className = '', - width = '32px', - height = '32px', - viewBox = '0 0 64 64', + size = '32px', title = 'Dissenter', }) => ( diff --git a/app/javascript/gabsocial/assets/donor_icon.js b/app/javascript/gabsocial/assets/donor_icon.js index de574f3e..4e9eb006 100644 --- a/app/javascript/gabsocial/assets/donor_icon.js +++ b/app/javascript/gabsocial/assets/donor_icon.js @@ -1,8 +1,6 @@ const DonorIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = 'Gab.com Donor', }) => ( diff --git a/app/javascript/gabsocial/assets/ellipsis_icon.js b/app/javascript/gabsocial/assets/ellipsis_icon.js index 5ffffe7d..c558466e 100644 --- a/app/javascript/gabsocial/assets/ellipsis_icon.js +++ b/app/javascript/gabsocial/assets/ellipsis_icon.js @@ -1,8 +1,6 @@ const EllipsisIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 24 24', + size = '16px', title = 'Ellipsis', }) => ( diff --git a/app/javascript/gabsocial/assets/email_icon.js b/app/javascript/gabsocial/assets/email_icon.js index 9860041d..efc4e3d3 100644 --- a/app/javascript/gabsocial/assets/email_icon.js +++ b/app/javascript/gabsocial/assets/email_icon.js @@ -1,8 +1,6 @@ const EmailIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Email', }) => ( diff --git a/app/javascript/gabsocial/assets/error_icon.js b/app/javascript/gabsocial/assets/error_icon.js index 54bb637b..d0ea7dc6 100644 --- a/app/javascript/gabsocial/assets/error_icon.js +++ b/app/javascript/gabsocial/assets/error_icon.js @@ -1,8 +1,6 @@ const ErrorIcon = ({ className = '', - width = '32px', - height = '32px', - viewBox = '0 0 64 64', + size = '32px', title = 'Error', }) => ( diff --git a/app/javascript/gabsocial/assets/fullscreen_icon.js b/app/javascript/gabsocial/assets/fullscreen_icon.js index d8253b73..ac0aff6b 100644 --- a/app/javascript/gabsocial/assets/fullscreen_icon.js +++ b/app/javascript/gabsocial/assets/fullscreen_icon.js @@ -1,8 +1,6 @@ const FullscreenIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 32 32', + size = '24px', title = 'Fullscreen', }) => ( diff --git a/app/javascript/gabsocial/assets/gab_logo.js b/app/javascript/gabsocial/assets/gab_logo.js index 293e70c7..db26a01a 100644 --- a/app/javascript/gabsocial/assets/gab_logo.js +++ b/app/javascript/gabsocial/assets/gab_logo.js @@ -1,8 +1,6 @@ const GabLogo = ({ className = _s.fillColorBrand, - width = '50px', - height = '30px', - viewBox = '0 0 50 30' + size = '50px', }) => ( diff --git a/app/javascript/gabsocial/assets/gif_icon.js b/app/javascript/gabsocial/assets/gif_icon.js index 4e7cd28c..c4c14801 100644 --- a/app/javascript/gabsocial/assets/gif_icon.js +++ b/app/javascript/gabsocial/assets/gif_icon.js @@ -1,8 +1,6 @@ const GifIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 64 64', + size = '26px', title = 'Gif', }) => ( diff --git a/app/javascript/gabsocial/assets/globe_icon.js b/app/javascript/gabsocial/assets/globe_icon.js index 5bb4905d..ee5f1d44 100644 --- a/app/javascript/gabsocial/assets/globe_icon.js +++ b/app/javascript/gabsocial/assets/globe_icon.js @@ -1,9 +1,7 @@ // : todo : fill, stroke colors const GlobeIcon = ({ className = '', - width = '12px', - height = '12px', - viewBox = '0 0 28 28', + size = '12px', title = 'Globe', }) => ( diff --git a/app/javascript/gabsocial/assets/group_add_icon.js b/app/javascript/gabsocial/assets/group_add_icon.js index 3614f360..8aafc69a 100644 --- a/app/javascript/gabsocial/assets/group_add_icon.js +++ b/app/javascript/gabsocial/assets/group_add_icon.js @@ -1,8 +1,6 @@ const GroupAddIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 64 64', + size = '24px', title = 'Group Add', }) => ( diff --git a/app/javascript/gabsocial/assets/group_icon.js b/app/javascript/gabsocial/assets/group_icon.js index a3800351..3d8c20bd 100644 --- a/app/javascript/gabsocial/assets/group_icon.js +++ b/app/javascript/gabsocial/assets/group_icon.js @@ -1,8 +1,6 @@ const GroupIcon = ({ - className = 'header-nav__item__icon', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + className = '', + size = '26px', title = 'Group', }) => ( diff --git a/app/javascript/gabsocial/assets/happy_icon.js b/app/javascript/gabsocial/assets/happy_icon.js index 5d42fa8b..db53c7ae 100644 --- a/app/javascript/gabsocial/assets/happy_icon.js +++ b/app/javascript/gabsocial/assets/happy_icon.js @@ -1,8 +1,6 @@ const HappyIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = '', }) => ( diff --git a/app/javascript/gabsocial/assets/hidden_icon.js b/app/javascript/gabsocial/assets/hidden_icon.js index 5e60d5da..f9a0a5ce 100644 --- a/app/javascript/gabsocial/assets/hidden_icon.js +++ b/app/javascript/gabsocial/assets/hidden_icon.js @@ -1,8 +1,6 @@ const HiddenIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Hidden', }) => ( diff --git a/app/javascript/gabsocial/assets/home_icon.js b/app/javascript/gabsocial/assets/home_icon.js index 773e2b48..46b0e9c6 100644 --- a/app/javascript/gabsocial/assets/home_icon.js +++ b/app/javascript/gabsocial/assets/home_icon.js @@ -1,8 +1,6 @@ const HomeIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Home', }) => ( diff --git a/app/javascript/gabsocial/assets/investor_icon.js b/app/javascript/gabsocial/assets/investor_icon.js index ed4da684..3f21174a 100644 --- a/app/javascript/gabsocial/assets/investor_icon.js +++ b/app/javascript/gabsocial/assets/investor_icon.js @@ -1,8 +1,6 @@ const InvestorIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = 'Gab.com Investor', }) => ( diff --git a/app/javascript/gabsocial/assets/italic_icon.js b/app/javascript/gabsocial/assets/italic_icon.js index 0f6c4e9e..c21c82b4 100644 --- a/app/javascript/gabsocial/assets/italic_icon.js +++ b/app/javascript/gabsocial/assets/italic_icon.js @@ -1,8 +1,6 @@ const ItalicIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Italic', }) => ( diff --git a/app/javascript/gabsocial/assets/like_icon.js b/app/javascript/gabsocial/assets/like_icon.js index 9fbb5c6d..bb773b94 100644 --- a/app/javascript/gabsocial/assets/like_icon.js +++ b/app/javascript/gabsocial/assets/like_icon.js @@ -1,8 +1,6 @@ const LikeIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Like', }) => ( diff --git a/app/javascript/gabsocial/assets/liked_icon.js b/app/javascript/gabsocial/assets/liked_icon.js index 8dbe6aea..bdef6471 100644 --- a/app/javascript/gabsocial/assets/liked_icon.js +++ b/app/javascript/gabsocial/assets/liked_icon.js @@ -1,8 +1,6 @@ const LikedIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Liked', }) => ( diff --git a/app/javascript/gabsocial/assets/link_icon.js b/app/javascript/gabsocial/assets/link_icon.js index 6fb2230f..14facba7 100644 --- a/app/javascript/gabsocial/assets/link_icon.js +++ b/app/javascript/gabsocial/assets/link_icon.js @@ -1,8 +1,6 @@ const LinkIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Link', }) => ( diff --git a/app/javascript/gabsocial/assets/list_add_icon.js b/app/javascript/gabsocial/assets/list_add_icon.js index fb46321b..14094958 100644 --- a/app/javascript/gabsocial/assets/list_add_icon.js +++ b/app/javascript/gabsocial/assets/list_add_icon.js @@ -1,8 +1,6 @@ const ListAddIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = 'List Add', }) => ( diff --git a/app/javascript/gabsocial/assets/list_icon.js b/app/javascript/gabsocial/assets/list_icon.js index d4d81361..d77a4926 100644 --- a/app/javascript/gabsocial/assets/list_icon.js +++ b/app/javascript/gabsocial/assets/list_icon.js @@ -1,8 +1,6 @@ const ListIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 64 64', + size = '26px', title = 'List', }) => ( diff --git a/app/javascript/gabsocial/assets/loading_icon.js b/app/javascript/gabsocial/assets/loading_icon.js index 3559d308..4f0b9eda 100644 --- a/app/javascript/gabsocial/assets/loading_icon.js +++ b/app/javascript/gabsocial/assets/loading_icon.js @@ -1,16 +1,14 @@ const LoadingIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 100 100', + size = '24px', }) => ( diff --git a/app/javascript/gabsocial/assets/lock_filled_icon.js b/app/javascript/gabsocial/assets/lock_filled_icon.js index ff28e505..1f865071 100644 --- a/app/javascript/gabsocial/assets/lock_filled_icon.js +++ b/app/javascript/gabsocial/assets/lock_filled_icon.js @@ -1,8 +1,6 @@ const LockFilledIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Lock', }) => ( diff --git a/app/javascript/gabsocial/assets/lock_icon.js b/app/javascript/gabsocial/assets/lock_icon.js index 5f1504c1..9fc20ef1 100644 --- a/app/javascript/gabsocial/assets/lock_icon.js +++ b/app/javascript/gabsocial/assets/lock_icon.js @@ -1,8 +1,6 @@ const LockIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Lock', }) => ( diff --git a/app/javascript/gabsocial/assets/media_icon.js b/app/javascript/gabsocial/assets/media_icon.js index 6512e152..90a4be89 100644 --- a/app/javascript/gabsocial/assets/media_icon.js +++ b/app/javascript/gabsocial/assets/media_icon.js @@ -1,8 +1,6 @@ const MediaIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Media', }) => ( diff --git a/app/javascript/gabsocial/assets/minimize_fullscreen_icon.js b/app/javascript/gabsocial/assets/minimize_fullscreen_icon.js index 42af9d13..a76a3803 100644 --- a/app/javascript/gabsocial/assets/minimize_fullscreen_icon.js +++ b/app/javascript/gabsocial/assets/minimize_fullscreen_icon.js @@ -1,8 +1,6 @@ const MinimizeFullscreenIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 32 32', + size = '24px', title = 'Minimize Fullscreen', }) => ( diff --git a/app/javascript/gabsocial/assets/missing_icon.js b/app/javascript/gabsocial/assets/missing_icon.js index dbf596c9..5381b81f 100644 --- a/app/javascript/gabsocial/assets/missing_icon.js +++ b/app/javascript/gabsocial/assets/missing_icon.js @@ -1,8 +1,6 @@ const MissingIcon = ({ className = '', - width = '32px', - height = '32px', - viewBox = '0 0 84 84', + size = '32px', title = 'Missing', }) => ( diff --git a/app/javascript/gabsocial/assets/more_icon.js b/app/javascript/gabsocial/assets/more_icon.js index 6f9aaac1..1076558b 100644 --- a/app/javascript/gabsocial/assets/more_icon.js +++ b/app/javascript/gabsocial/assets/more_icon.js @@ -1,8 +1,6 @@ const MoreIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'More', }) => ( diff --git a/app/javascript/gabsocial/assets/notifications_icon.js b/app/javascript/gabsocial/assets/notifications_icon.js index 584e74e7..4cd49d1a 100644 --- a/app/javascript/gabsocial/assets/notifications_icon.js +++ b/app/javascript/gabsocial/assets/notifications_icon.js @@ -1,8 +1,6 @@ const NotificationsIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 48 48', + size = '26px', title = 'Notifications', }) => ( diff --git a/app/javascript/gabsocial/assets/ol_list_icon.js b/app/javascript/gabsocial/assets/ol_list_icon.js index 073eb1c4..0c4fe7d3 100644 --- a/app/javascript/gabsocial/assets/ol_list_icon.js +++ b/app/javascript/gabsocial/assets/ol_list_icon.js @@ -1,8 +1,6 @@ const OLListIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Ordered List', }) => ( diff --git a/app/javascript/gabsocial/assets/pause_icon.js b/app/javascript/gabsocial/assets/pause_icon.js index 0a39ddcb..45d8ea05 100644 --- a/app/javascript/gabsocial/assets/pause_icon.js +++ b/app/javascript/gabsocial/assets/pause_icon.js @@ -1,8 +1,6 @@ const PauseIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Pause', }) => ( diff --git a/app/javascript/gabsocial/assets/pencil_icon.js b/app/javascript/gabsocial/assets/pencil_icon.js index b63d2b3d..4e2610f5 100644 --- a/app/javascript/gabsocial/assets/pencil_icon.js +++ b/app/javascript/gabsocial/assets/pencil_icon.js @@ -1,8 +1,6 @@ const PencilIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Pencil', }) => ( diff --git a/app/javascript/gabsocial/assets/pin_icon.js b/app/javascript/gabsocial/assets/pin_icon.js index 7a142e49..523611ad 100644 --- a/app/javascript/gabsocial/assets/pin_icon.js +++ b/app/javascript/gabsocial/assets/pin_icon.js @@ -1,8 +1,6 @@ const PinIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 32 32', + size = '16px', title = 'Pin', }) => ( diff --git a/app/javascript/gabsocial/assets/play_icon.js b/app/javascript/gabsocial/assets/play_icon.js index d4b7dc93..53ecfab4 100644 --- a/app/javascript/gabsocial/assets/play_icon.js +++ b/app/javascript/gabsocial/assets/play_icon.js @@ -1,8 +1,6 @@ const PlayIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Play', }) => ( diff --git a/app/javascript/gabsocial/assets/poll_icon.js b/app/javascript/gabsocial/assets/poll_icon.js index e803c6ed..5caa8135 100644 --- a/app/javascript/gabsocial/assets/poll_icon.js +++ b/app/javascript/gabsocial/assets/poll_icon.js @@ -1,8 +1,6 @@ const PollIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Poll', }) => ( diff --git a/app/javascript/gabsocial/assets/pro_icon.js b/app/javascript/gabsocial/assets/pro_icon.js index 326900e6..d3d9cd73 100644 --- a/app/javascript/gabsocial/assets/pro_icon.js +++ b/app/javascript/gabsocial/assets/pro_icon.js @@ -1,8 +1,6 @@ const ProIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = 'GabPRO Account', }) => ( diff --git a/app/javascript/gabsocial/assets/repost_icon.js b/app/javascript/gabsocial/assets/repost_icon.js index aa2b05ac..a05bf202 100644 --- a/app/javascript/gabsocial/assets/repost_icon.js +++ b/app/javascript/gabsocial/assets/repost_icon.js @@ -1,8 +1,6 @@ const CloseIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Close', }) => ( diff --git a/app/javascript/gabsocial/assets/rich_text_icon.js b/app/javascript/gabsocial/assets/rich_text_icon.js index c770a194..98fb24fd 100644 --- a/app/javascript/gabsocial/assets/rich_text_icon.js +++ b/app/javascript/gabsocial/assets/rich_text_icon.js @@ -1,8 +1,6 @@ const RichTextIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 64 64', + size = '26px', title = 'Rich Text', }) => ( diff --git a/app/javascript/gabsocial/assets/search_alt_icon.js b/app/javascript/gabsocial/assets/search_alt_icon.js index 9630e305..bb9ffd50 100644 --- a/app/javascript/gabsocial/assets/search_alt_icon.js +++ b/app/javascript/gabsocial/assets/search_alt_icon.js @@ -1,7 +1,6 @@ const SearchAltIcon = ({ className = '', - width = '16px', - height = '16px', + size = '16px', viewBox = '0 0 64 64', title = 'Search', }) => ( @@ -11,8 +10,8 @@ const SearchAltIcon = ({ xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' - width={width} - height={height} + width={size} + height={size} viewBox={viewBox} xmlSpace='preserve' aria-label={title} diff --git a/app/javascript/gabsocial/assets/search_icon.js b/app/javascript/gabsocial/assets/search_icon.js index 9d4f2eab..20fecece 100644 --- a/app/javascript/gabsocial/assets/search_icon.js +++ b/app/javascript/gabsocial/assets/search_icon.js @@ -1,8 +1,6 @@ const SearchIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Search', }) => ( diff --git a/app/javascript/gabsocial/assets/select_icon.js b/app/javascript/gabsocial/assets/select_icon.js new file mode 100644 index 00000000..b938bde7 --- /dev/null +++ b/app/javascript/gabsocial/assets/select_icon.js @@ -0,0 +1,25 @@ +const SelectIcon = ({ + className = '', + size = '16px', + title = 'Select', +}) => ( + + + + + + +) + +export default SelectIcon \ No newline at end of file diff --git a/app/javascript/gabsocial/assets/share_icon.js b/app/javascript/gabsocial/assets/share_icon.js index 311f6076..56bacef2 100644 --- a/app/javascript/gabsocial/assets/share_icon.js +++ b/app/javascript/gabsocial/assets/share_icon.js @@ -1,8 +1,6 @@ const ShareIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 24 24', + size = '16px', title = 'Share', }) => ( diff --git a/app/javascript/gabsocial/assets/shop_icon.js b/app/javascript/gabsocial/assets/shop_icon.js index dcddcc44..a448a1da 100644 --- a/app/javascript/gabsocial/assets/shop_icon.js +++ b/app/javascript/gabsocial/assets/shop_icon.js @@ -1,8 +1,6 @@ const ShopIcon = ({ className = '', - width = '26px', - height = '26px', - viewBox = '0 0 64 64', + size = '26px', title = 'Shop', }) => ( diff --git a/app/javascript/gabsocial/assets/strikethrough_icon.js b/app/javascript/gabsocial/assets/strikethrough_icon.js index c02dbdb8..8bbfe637 100644 --- a/app/javascript/gabsocial/assets/strikethrough_icon.js +++ b/app/javascript/gabsocial/assets/strikethrough_icon.js @@ -1,8 +1,6 @@ const StrikethroughIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Strikethrough', }) => ( diff --git a/app/javascript/gabsocial/assets/subtract_icon.js b/app/javascript/gabsocial/assets/subtract_icon.js index 5716665b..4ce2ec72 100644 --- a/app/javascript/gabsocial/assets/subtract_icon.js +++ b/app/javascript/gabsocial/assets/subtract_icon.js @@ -1,8 +1,6 @@ const SubtractIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 64 64', + size = '16px', title = 'Subtract', }) => ( diff --git a/app/javascript/gabsocial/assets/text_size_icon.js b/app/javascript/gabsocial/assets/text_size_icon.js index 934975e0..38cfa19b 100644 --- a/app/javascript/gabsocial/assets/text_size_icon.js +++ b/app/javascript/gabsocial/assets/text_size_icon.js @@ -1,8 +1,6 @@ const TextSizeIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Text Size', }) => ( diff --git a/app/javascript/gabsocial/assets/trends_icon.js b/app/javascript/gabsocial/assets/trends_icon.js index 1e050ecf..94c7c9fc 100644 --- a/app/javascript/gabsocial/assets/trends_icon.js +++ b/app/javascript/gabsocial/assets/trends_icon.js @@ -1,8 +1,6 @@ const TrendsIcon = ({ className = '', - width = '32px', - height = '32px', - viewBox = '0 0 80 80', + size = '32px', title = 'Trends', }) => ( diff --git a/app/javascript/gabsocial/assets/ul_list_icon.js b/app/javascript/gabsocial/assets/ul_list_icon.js index 53c9fb18..15839965 100644 --- a/app/javascript/gabsocial/assets/ul_list_icon.js +++ b/app/javascript/gabsocial/assets/ul_list_icon.js @@ -1,8 +1,6 @@ const ULListIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Unordered List', }) => ( diff --git a/app/javascript/gabsocial/assets/underline_icon.js b/app/javascript/gabsocial/assets/underline_icon.js index 8e8a29f2..503fceed 100644 --- a/app/javascript/gabsocial/assets/underline_icon.js +++ b/app/javascript/gabsocial/assets/underline_icon.js @@ -1,8 +1,6 @@ const UnderlineIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 34 32', + size = '16px', title = 'Underline', }) => ( diff --git a/app/javascript/gabsocial/assets/unlock_filled_icon.js b/app/javascript/gabsocial/assets/unlock_filled_icon.js index 5cc39ae9..45a7c982 100644 --- a/app/javascript/gabsocial/assets/unlock_filled_icon.js +++ b/app/javascript/gabsocial/assets/unlock_filled_icon.js @@ -1,8 +1,6 @@ const UnlockFilledIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 48 48', + size = '24px', title = 'Unlock', }) => ( diff --git a/app/javascript/gabsocial/assets/verified_icon.js b/app/javascript/gabsocial/assets/verified_icon.js index 6a55569d..a107ebd4 100644 --- a/app/javascript/gabsocial/assets/verified_icon.js +++ b/app/javascript/gabsocial/assets/verified_icon.js @@ -1,8 +1,6 @@ const VerifiedIcon = ({ className = '', - width = '24px', - height = '24px', - viewBox = '0 0 24 24', + size = '24px', title = 'Verified Account', }) => ( diff --git a/app/javascript/gabsocial/assets/warning_icon.js b/app/javascript/gabsocial/assets/warning_icon.js index 2293ae48..29b9da8d 100644 --- a/app/javascript/gabsocial/assets/warning_icon.js +++ b/app/javascript/gabsocial/assets/warning_icon.js @@ -1,8 +1,6 @@ const WarningIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Warning', }) => ( diff --git a/app/javascript/gabsocial/assets/website_icon.js b/app/javascript/gabsocial/assets/website_icon.js index 6547db52..dd8286be 100644 --- a/app/javascript/gabsocial/assets/website_icon.js +++ b/app/javascript/gabsocial/assets/website_icon.js @@ -1,8 +1,6 @@ const WebsiteIcon = ({ className = '', - width = '16px', - height = '16px', - viewBox = '0 0 48 48', + size = '16px', title = 'Website', }) => ( diff --git a/app/javascript/gabsocial/components/account.js b/app/javascript/gabsocial/components/account.js index a6df881e..e73deaff 100644 --- a/app/javascript/gabsocial/components/account.js +++ b/app/javascript/gabsocial/components/account.js @@ -16,33 +16,16 @@ import { openModal } from '../actions/modal' import { initMuteModal } from '../actions/mutes' import { unfollowModal } from '../initial_state' import { makeGetAccount } from '../selectors' +import AccountActionButton from './account_action_button' import Avatar from './avatar' import DisplayName from './display_name' import Button from './button' -import Text from './text' -const messages = defineMessages({ - follow: { id: 'follow', defaultMessage: 'Follow' }, - unfollow: { id: 'unfollow', defaultMessage: 'Unfollow' }, - requested: { id: 'requested', defaultMessage: 'Requested' }, - unblock: { id: 'unblock', defaultMessage: 'Unblock' }, - unmute: { id: 'unmute', defaultMessage: 'Unmute' }, - mute_notifications: { id: 'account.mute_notifications', defaultMessage: 'Mute notifications from @{name}' }, - unmute_notifications: { id: 'account.unmute_notifications', defaultMessage: 'Unmute notifications from @{name}' }, - unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' }, +const makeMapStateToProps = (state, props) => ({ + account: makeGetAccount()(state, props.id), }) -const makeMapStateToProps = () => { - const getAccount = makeGetAccount() - - const mapStateToProps = (state, props) => ({ - account: getAccount(state, props.id), - }) - - return mapStateToProps -} - -const mapDispatchToProps = (dispatch, { intl }) => ({ +const mapDispatchToProps = (dispatch) => ({ onFollow (account) { if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { @@ -102,25 +85,13 @@ class Account extends ImmutablePureComponent { dismissAction: PropTypes.func, } - handleFollow = () => { - this.props.onFollow(this.props.account) - } - - handleBlock = () => { - this.props.onBlock(this.props.account) - } - - handleMute = () => { - this.props.onMute(this.props.account) - } - - handleMuteNotifications = () => { - this.props.onMuteNotifications(this.props.account, true) - } - - handleUnmuteNotifications = () => { - this.props.onMuteNotifications(this.props.account, false) - } + updateOnProps = [ + 'account', + 'isHidden', + 'compact', + 'expanded', + 'showDismiss', + ] handleAction = () => { this.props.onActionClick(this.props.account) @@ -155,64 +126,26 @@ class Account extends ImmutablePureComponent { ) } - // : todo : cleanup - let buttonOptions - let buttonText - - if (onActionClick && actionIcon) { - buttonText = actionTitle - buttonOptions = { - onClick: this.handleAction, - outline: true, - color: 'brand', - backgroundColor: 'none', - } - } else if (account.get('id') !== me && account.get('relationship', null) !== null) { - const following = account.getIn(['relationship', 'following']) - const requested = account.getIn(['relationship', 'requested']) - const blocking = account.getIn(['relationship', 'blocking']) - - // : todo : - // unmute - - if (requested || blocking) { - buttonText = intl.formatMessage(requested ? messages.requested : messages.unblock) - buttonOptions = { - narrow: true, - onClick: requested ? this.handleUnrequest : this.handleBlock, - color: 'primary', - backgroundColor: 'tertiary', - className: _s.mt5, - } - } else if (!account.get('moved') || following) { - buttonOptions = { - narrow: true, - outline: !following, - color: !following ? 'brand' : 'white', - backgroundColor: !following ? 'none' : 'brand', - className: _s.mt5, - onClick: this.handleFollow, - } - buttonText = intl.formatMessage(following ? messages.unfollow : messages.follow) - } - } - - const button = !buttonOptions ? null : ( -
- {showDismiss && dismissBtn} - {compact && button} + {dismissBtn} + {compact && actionButton}
diff --git a/app/javascript/gabsocial/components/account_action_button.js b/app/javascript/gabsocial/components/account_action_button.js index 06b1eaec..908764e7 100644 --- a/app/javascript/gabsocial/components/account_action_button.js +++ b/app/javascript/gabsocial/components/account_action_button.js @@ -1,54 +1,160 @@ -wimport classNames from 'classnames/bind' - -const cx = classNames.bind(_s) +import ImmutablePropTypes from 'react-immutable-proptypes' +import ImmutablePureComponent from 'react-immutable-pure-component' +import { injectIntl, defineMessages } from 'react-intl' +import { + followAccount, + unfollowAccount, + unblockAccount, +} from '../actions/accounts' +import { openModal } from '../actions/modal' +import { me, unfollowModal } from '../initial_state' +import Button from './button' +import Text from './text' // : todo : -export default class AccountActionButton extends PureComponent { +const messages = defineMessages({ + follow: { id: 'follow', defaultMessage: 'Follow' }, + following: { id: 'following', defaultMessage: 'Following' }, + unfollow: { id: 'unfollow', defaultMessage: 'Unfollow' }, + requested: { id: 'requested', defaultMessage: 'Requested' }, + unblock: { id: 'unblock', defaultMessage: 'Unblock' }, + blocked: { id: 'account.blocked', defaultMessage: 'Blocked' }, + followers: { id: 'account.followers', defaultMessage: 'Followers' }, + follows: { id: 'account.follows', defaultMessage: 'Follows' }, +}) + +const mapDispatchToProps = (dispatch) => ({ + + onFollow(account) { + if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { + if (unfollowModal) { + dispatch(openModal('UNFOLLOW', { + accountId: account.get('id'), + })); + } else { + dispatch(unfollowAccount(account.get('id'))); + } + } else { + dispatch(followAccount(account.get('id'))); + } + }, + + onBlock(account) { + if (account.getIn(['relationship', 'blocking'])) { + dispatch(unblockAccount(account.get('id'))); + } else { + dispatch(openModal('BLOCK_ACCOUNT', { + accountId: account.get('id'), + })); + } + }, + +}); + +export default +@injectIntl +@connect(null, mapDispatchToProps) +class AccountActionButton extends ImmutablePureComponent { + static propTypes = { - children: PropTypes.any, - size: PropTypes.oneOf(Object.keys(SIZES)), - center: PropTypes.bool, + account: ImmutablePropTypes.map, + intl: PropTypes.object.isRequired, + isSmall: PropTypes.bool, + onBlock: PropTypes.func.isRequired, + onFollow: PropTypes.func.isRequired, } - static defaultProps = { - size: SIZES.h1, + updateOnProps = [ + 'account', + ] + + handleFollow = () => { + this.props.onFollow(this.props.account) + } + + handleBlock = () => { + this.props.onBlock(this.props.account) } render() { - const { children, size, center } = this.props + const { + account, + intl, + isSmall, + } = this.props - const classes = cx({ - default: 1, - text: 1, - textAlignCenter: center, + if (!account) return null - colorPrimary: [SIZES.h1, SIZES.h3].indexOf(size) > -1, - colorSecondary: [SIZES.h2, SIZES.h4, SIZES.h5].indexOf(size) > -1, + // Wait until the relationship is loaded + if (!account.get('relationship')) return null - fontSize24PX: size === SIZES.h1, - fontSize19PX: size === SIZES.h2, - fontSize16PX: size === SIZES.h3, - fontSize13PX: size === SIZES.h4, - fontSize12PX: size === SIZES.h5, + // Don't show if is me + if (account.get('id') === me) return null - mt5: [SIZES.h2, SIZES.h4].indexOf(size) > -1, + const isBlockedBy = account.getIn(['relationship', 'blocked_by']) - lineHeight2: size === SIZES.h5, - py2: size === SIZES.h5, + // Don't show + if (isBlockedBy) return null - // fontWeightNormal: weight === WEIGHTS.normal, - fontWeightMedium: [SIZES.h1, SIZES.h5].indexOf(size) > -1, - fontWeightBold: [SIZES.h3, SIZES.h4].indexOf(size) > -1, - }) + let buttonText = '' + let buttonOptions = {} - return React.createElement( - size, - { - className: classes, - role: 'heading', - }, - children, + const isRequested = account.getIn(['relationship', 'requested']) + const isBlocking = account.getIn(['relationship', 'blocking']) + const isFollowing = account.getIn(['relationship', 'following']) + + if (isRequested) { + buttonText = intl.formatMessage(messages.requested) + buttonOptions = { + onClick: this.handleFollow, + color: 'primary', + backgroundColor: 'tertiary', + } + } else if (isBlocking) { + buttonText = intl.formatMessage(messages.blocked) + buttonOptions = { + onClick: this.handleBlock, + color: 'white', + backgroundColor: 'danger', + } + } else if (isFollowing) { + buttonText = intl.formatMessage(messages.following) + buttonOptions = { + onClick: this.handleFollow, + color: 'white', + backgroundColor: 'brand', + } + } else { + buttonText = intl.formatMessage(messages.follow) + buttonOptions = { + onClick: this.handleFollow, + color: 'brand', + backgroundColor: 'none', + isOutline: true, + } + } + + const textClassName = isSmall ? null : _s.px10 + const textSize = isSmall ? 'normal' : 'medium' + const textWeight = isSmall ? 'normal' : 'bold' + + return ( + ) } + } \ No newline at end of file diff --git a/app/javascript/gabsocial/components/avatar.js b/app/javascript/gabsocial/components/avatar.js index 269c4925..b8edb9dd 100644 --- a/app/javascript/gabsocial/components/avatar.js +++ b/app/javascript/gabsocial/components/avatar.js @@ -1,20 +1,21 @@ import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' -import { Map as ImmutableMap } from 'immutable' import { autoPlayGif } from '../initial_state' import Image from './image' -export default -class Avatar extends ImmutablePureComponent { +/** + * Renders an avatar component + * @param {map} [props.account] - the account for image + * @param {number} [props.size=40] - the size of the avatar + */ +export default class Avatar extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map, - size: PropTypes.number.isRequired, - animate: PropTypes.bool, + size: PropTypes.number, } static defaultProps = { - animate: autoPlayGif, size: 40, } @@ -41,17 +42,17 @@ class Avatar extends ImmutablePureComponent { } render() { - const { account, size, animate } = this.props + const { account, size } = this.props const { hovering, sameImg } = this.state - const shouldAnimate = animate || !sameImg + const shouldAnimate = autoPlayGif || !sameImg const options = { alt: !account ? 'Avatar' : account.get('display_name'), className: [_s.default, _s.circle, _s.overflowHidden].join(' '), onMouseEnter: shouldAnimate ? this.handleMouseEnter : undefined, onMouseLeave: shouldAnimate ? this.handleMouseLeave : undefined, - src: !account ? undefined : account.get((hovering || animate) ? 'avatar' : 'avatar_static'), + src: !account ? undefined : account.get((hovering || autoPlayGif) ? 'avatar' : 'avatar_static'), alt: !account ? undefined : account.get('display_name'), style: { width: `${size}px`, diff --git a/app/javascript/gabsocial/components/block.js b/app/javascript/gabsocial/components/block.js index d8ec1ae6..3873640c 100644 --- a/app/javascript/gabsocial/components/block.js +++ b/app/javascript/gabsocial/components/block.js @@ -1,7 +1,10 @@ +/** + * Renders a block component + */ export default class Block extends PureComponent { static propTypes = { - children: PropTypes.node, + children: PropTypes.any, } render() { diff --git a/app/javascript/gabsocial/components/button.js b/app/javascript/gabsocial/components/button.js index 78e53aa9..59056270 100644 --- a/app/javascript/gabsocial/components/button.js +++ b/app/javascript/gabsocial/components/button.js @@ -3,8 +3,10 @@ import { NavLink } from 'react-router-dom' import classNames from 'classnames/bind' import Icon from './icon' +// Bind CSS Modules global variable `_s` to classNames module const cx = classNames.bind(_s) +// Define colors for enumeration for Button component `color`, `backgroundColor` props const COLORS = { primary: 'primary', secondary: 'secondary', @@ -16,29 +18,60 @@ const COLORS = { none: 'none', } +/** + * Renders a button component + * @param {string} [props.backgroundColor='brand'] - background color of the button + * @param {func|node} [props.buttonRef] - ref to send to button component + * @param {string} [props.className] - add custom className + * @param {string} [props.color='white'] - text color of the button + * @param {string} [props.href] - href to send to on click + * @param {string} [props.icon] - prepend icon id + * @param {string} [props.iconClassName] - add custom className to icon + * @param {string} [props.iconSize] - size of the icon + * @param {bool} [props.isBlock] - if button is width: 100% + * @param {bool} [props.isDisabled] - if the button is disabled + * @param {bool} [props.isNarrow] - if the button is narrow + * @param {bool} [props.isOutline] - if the button is outline design + * @param {bool} [props.noClasses] - if the button has no default classes + * @param {func} [props.onClick] - function to call on button click + * @param {func} [props.onMouseEnter] - function to call on button mouse enter + * @param {func} [props.onMouseLeave] - function to call on button mouse leave + * @param {bool} [props.radiusSmall] - if the button has small radius + * @param {bool} [props.text] - if the button is just text (i.e. link) + * @param {bool} [props.title] - `title` attribute for button + * @param {bool} [props.to] - `to` to send to on click + * @param {bool} [props.type] - `type` attribute for button + * @param {bool} [props.underlineOnHover] - if the button has underline on hover + */ export default class Button extends PureComponent { static propTypes = { - children: PropTypes.node, - to: PropTypes.string, - href: PropTypes.string, - onClick: PropTypes.func, - className: PropTypes.string, - icon: PropTypes.string, - iconWidth: PropTypes.string, - iconHeight: PropTypes.string, - iconClassName: PropTypes.string, - color: PropTypes.string, backgroundColor: PropTypes.string, - block: PropTypes.bool, - text: PropTypes.bool, - disabled: PropTypes.bool, - outline: PropTypes.bool, - narrow: PropTypes.bool, - underlineOnHover: PropTypes.bool, - radiusSmall: PropTypes.bool, + buttonRef: PropTypes.oneOfType([ + PropTypes.func, + PropTypes.node, + ]), + children: PropTypes.node, + className: PropTypes.string, + color: PropTypes.string, + href: PropTypes.string, + icon: PropTypes.string, + iconClassName: PropTypes.string, + iconSize: PropTypes.string, + isBlock: PropTypes.bool, + isDisabled: PropTypes.bool, + isNarrow: PropTypes.bool, + isText: PropTypes.bool, noClasses: PropTypes.bool, - buttonRef: PropTypes.func, + onClick: PropTypes.func, + onMouseEnter: PropTypes.func, + onMouseLeave: PropTypes.func, + isOutline: PropTypes.bool, + radiusSmall: PropTypes.bool, + title: PropTypes.string, + to: PropTypes.string, + type: PropTypes.string, + underlineOnHover: PropTypes.bool, } static defaultProps = { @@ -47,15 +80,18 @@ export default class Button extends PureComponent { } handleClick = (e) => { - if (!this.props.disabled && this.props.onClick) { + if (!this.props.isDisabled && this.props.onClick) { this.props.onClick(e) } } setRef = (c) => { - const { buttonRef } = this.props - if (buttonRef) buttonRef(c) - this.node = c + try { + this.node = c + this.props.buttonRef(c) + } catch (error) { + // + } } focus() { @@ -64,36 +100,31 @@ export default class Button extends PureComponent { render() { const { - block, - className, - disabled, - text, - to, - icon, - iconWidth, - iconHeight, - iconClassName, - children, - href, - outline, - color, backgroundColor, - underlineOnHover, - narrow, - radiusSmall, + children, + className, + color, + href, + icon, + iconClassName, + iconSize, + isBlock, + isDisabled, + isNarrow, + isOutline, + isText, noClasses, - ...otherProps + onClick, + onMouseEnter, + onMouseLeave, + radiusSmall, + title, + to, + type, + underlineOnHover, } = this.props - const theIcon = !!icon ? ( - - ) : undefined - + // Style the component according to props const classes = noClasses ? className : cx(className, { default: 1, noUnderline: 1, @@ -102,8 +133,8 @@ export default class Button extends PureComponent { textAlignCenter: 1, outlineNone: 1, flexRow: !!children && !!icon, - cursorNotAllowed: disabled, - opacity05: disabled, + cursorNotAllowed: isDisabled, + opacity05: isDisabled, backgroundColorPrimary: backgroundColor === COLORS.white, backgroundColorBlack: backgroundColor === COLORS.black, @@ -119,17 +150,17 @@ export default class Button extends PureComponent { colorWhite: !!children && color === COLORS.white, colorBrand: !!children && color === COLORS.brand, - borderColorBrand: color === COLORS.brand && outline, - border1PX: outline, + borderColorBrand: color === COLORS.brand && isOutline, + border1PX: isOutline, - circle: !text, + circle: !isText, radiusSmall: radiusSmall, - py5: narrow, - py10: !text && !narrow, - px15: !text, + py5: isNarrow, + py10: !isText && !isNarrow, + px15: !isText, - width100PC: block, + width100PC: isBlock, underline_onHover: underlineOnHover, @@ -138,17 +169,25 @@ export default class Button extends PureComponent { backgroundColorBrandDark_onHover: backgroundColor === COLORS.brand, backgroundColorDangerDark_onHover: backgroundColor === COLORS.danger, - backgroundColorBrand_onHover: color === COLORS.brand && outline, - colorWhite_onHover: !!children && color === COLORS.brand && outline, + backgroundColorBrand_onHover: color === COLORS.brand && isOutline, + colorWhite_onHover: !!children && color === COLORS.brand && isOutline, fillColorSecondary: !!icon && color === COLORS.secondary, fillColorWhite: !!icon && color === COLORS.white, fillColorBrand: !!icon && color === COLORS.brand, - fillColorWhite_onHover: !!icon && color === COLORS.brand && outline, + fillColorWhite_onHover: !!icon && color === COLORS.brand && isOutline, }) const tagName = !!href ? 'a' : !!to ? 'NavLink' : 'button' + const theIcon = !!icon ? ( + + ) : undefined + const theChildren = !!icon ? ( {theIcon} @@ -156,24 +195,36 @@ export default class Button extends PureComponent { ) : children - const options = { - disabled, - className: classes, - ref: this.setRef, - to: to || undefined, - href: href || undefined, - onClick: this.handleClick || undefined, - ...otherProps, + const handlers = { + onClick: !!onClick ? this.handleClick : undefined, + onMouseEnter: !!onMouseEnter ? onMouseEnter : undefined, + onMouseLeave: !!onMouseLeave ? onMouseLeave : undefined, } if (tagName === 'NavLink' && !!to) { return ( - + {theChildren} ) } + const options = { + title, + type, + disabled: isDisabled, + className: classes, + href: href || undefined, + ref: this.setRef, + ...handlers, + } + return React.createElement(tagName, options, theChildren) } diff --git a/app/javascript/gabsocial/components/character_counter.js b/app/javascript/gabsocial/components/character_counter.js index 4e76d150..377cdc4b 100644 --- a/app/javascript/gabsocial/components/character_counter.js +++ b/app/javascript/gabsocial/components/character_counter.js @@ -1,5 +1,10 @@ import { length } from 'stringz' +/** + * Renders a character counter + * @param {string} props.text - text to use to measure + * @param {number} props.max - max text allowed + */ export default class CharacterCounter extends PureComponent { static propTypes = { @@ -9,6 +14,7 @@ export default class CharacterCounter extends PureComponent { render () { const { text, max } = this.props + const actualRadius = '16' const radius = 12 const circumference = 2 * Math.PI * radius @@ -20,7 +26,6 @@ export default class CharacterCounter extends PureComponent { @@ -57,10 +56,7 @@ export default class ColumnHeader extends PureComponent { - { - !!tabs && - - } + { !!actions && @@ -75,8 +71,7 @@ export default class ColumnHeader extends PureComponent { className={[_s.ml5, _s.fillColorBrand_onHover, _s.backgroundColorBrandLightOpaque_onHover, _s.px10].join(' ')} icon={action.icon} iconClassName={_s.inheritFill} - iconWidth='15px' - iconHeight='15px' + iconSize='15px' /> )) } diff --git a/app/javascript/gabsocial/components/column_indicator.js b/app/javascript/gabsocial/components/column_indicator.js index 7a690bef..da2503f5 100644 --- a/app/javascript/gabsocial/components/column_indicator.js +++ b/app/javascript/gabsocial/components/column_indicator.js @@ -31,7 +31,7 @@ class ColumnIndicator extends PureComponent { return (
- + { type !== 'loading' && { - const getStatus = makeGetStatus() - - const mapStateToProps = (state, props) => { - const status = getStatus(state, props) - - return { - status, - } - } - - return mapStateToProps -} +const makeMapStateToProps = (state, props) => ({ + status: makeGetStatus()(state, props) +}) export default @injectIntl @@ -81,7 +71,7 @@ class Comment extends ImmutablePureComponent {
diff --git a/app/javascript/gabsocial/components/media_gallery.js b/app/javascript/gabsocial/components/media_gallery.js index 18b4150d..aed09ea5 100644 --- a/app/javascript/gabsocial/components/media_gallery.js +++ b/app/javascript/gabsocial/components/media_gallery.js @@ -151,7 +151,7 @@ class Item extends ImmutablePureComponent { if (attachment.get('type') === 'unknown') { return ( -
+
@@ -216,7 +216,7 @@ class Item extends ImmutablePureComponent { playsInline /> -
+
GIF
@@ -224,7 +224,7 @@ class Item extends ImmutablePureComponent { } return ( -
+
{ !visible && !this.state.loaded && @@ -257,6 +257,7 @@ class MediaGallery extends PureComponent { static defaultProps = { standalone: false, + height: 110, }; state = { @@ -517,7 +518,7 @@ class MediaGallery extends PureComponent { //If reduced (i.e. like in a quoted post) //then we need to make media smaller if (reduced) { - style.height = width / 2 + style.height = width / 2 || '50%' } if (!visible) { @@ -568,7 +569,7 @@ class MediaGallery extends PureComponent { { visible && sensitive && -
+
@@ -258,8 +257,8 @@ class GifCategoriesCollection extends PureComponent { height={150} src={category.image} /> -
- +
+ {category.searchterm}
diff --git a/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js b/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js index 21498cf8..a09fe61a 100644 --- a/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js +++ b/app/javascript/gabsocial/components/modal/group_timeline_settings_modal.js @@ -40,7 +40,6 @@ class HomeTimelineSettingsModal extends ImmutablePureComponent {
diff --git a/app/javascript/gabsocial/components/moved_note.js b/app/javascript/gabsocial/components/moved_note.js index 74c9518e..83620d01 100644 --- a/app/javascript/gabsocial/components/moved_note.js +++ b/app/javascript/gabsocial/components/moved_note.js @@ -5,6 +5,7 @@ import { NavLink } from 'react-router-dom' import DisplayName from './display_name' import Icon from './icon' +// : todo : export default class MovedNote extends ImmutablePureComponent { static contextTypes = { diff --git a/app/javascript/gabsocial/components/panel/group_info_panel.js b/app/javascript/gabsocial/components/panel/group_info_panel.js index 65cd96d3..78138a8d 100644 --- a/app/javascript/gabsocial/components/panel/group_info_panel.js +++ b/app/javascript/gabsocial/components/panel/group_info_panel.js @@ -37,17 +37,17 @@ class GroupInfoPanel extends ImmutablePureComponent { {group.get('title')} - +
- + {intl.formatMessage(messages.members)}
- + {group.get('description')} diff --git a/app/javascript/gabsocial/components/panel/list_details_panel.js b/app/javascript/gabsocial/components/panel/list_details_panel.js index b8bf00ed..5aa964d3 100644 --- a/app/javascript/gabsocial/components/panel/list_details_panel.js +++ b/app/javascript/gabsocial/components/panel/list_details_panel.js @@ -55,10 +55,10 @@ class ListDetailsPanel extends ImmutablePureComponent {
- +
- +
- +
- + state.get('lists')], lists => { - if (!lists) return lists - - return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title'))) -}) - const messages = defineMessages({ title: { id: 'lists.subheading', defaultMessage: 'Your Lists' }, show_all: { id: 'groups.sidebar-panel.show_all', defaultMessage: 'Show all' }, diff --git a/app/javascript/gabsocial/components/panel/panel_layout.js b/app/javascript/gabsocial/components/panel/panel_layout.js index 1efaff31..abdc5d0a 100644 --- a/app/javascript/gabsocial/components/panel/panel_layout.js +++ b/app/javascript/gabsocial/components/panel/panel_layout.js @@ -45,7 +45,7 @@ export default class PanelLayout extends PureComponent { (!!headerButtonTitle && (!!headerButtonAction || !!headerButtonTo)) &&
diff --git a/app/javascript/gabsocial/components/panel/profile_info_panel.js b/app/javascript/gabsocial/components/panel/profile_info_panel.js index e18d78da..a5b1cb8b 100644 --- a/app/javascript/gabsocial/components/panel/profile_info_panel.js +++ b/app/javascript/gabsocial/components/panel/profile_info_panel.js @@ -62,12 +62,12 @@ class ProfileInfoPanel extends ImmutablePureComponent { hasNote &&
- + }
- + {identityProofs.map((proof, i) => ( - +
- + @@ -113,7 +113,7 @@ class ProfileInfoPanel extends ImmutablePureComponent { { fields.map((pair, i) => ( - +
({ account: makeGetAccount()(state, me), }) +const mapDispatchToProps = (dispatch) => ({ + onOpenEditProfile() { + dispatch(openModal('EDIT_PROFILE')) + }, +}) + export default -@connect(mapStateToProps) +@connect(mapStateToProps, mapDispatchToProps) @injectIntl class UserPanel extends ImmutablePureComponent { static propTypes = { - account: ImmutablePropTypes.map, + account: ImmutablePropTypes.map.isRequired, intl: PropTypes.object.isRequired, + onOpenEditProfile: PropTypes.func.isRequired, } state = { hovering: false, } + updateOnProps = [ + 'account' + ] + handleOnMouseEnter = () => { this.setState({ hovering: true }) } @@ -47,12 +60,16 @@ class UserPanel extends ImmutablePureComponent { this.setState({ hovering: false }) } + handleOnOpenEditProfile = () => { + this.props.onOpenEditProfile() + } + render() { const { account, intl } = this.props const { hovering } = this.state const buttonClasses = cx({ - positionAbsolute: 1, + posAbs: 1, mt10: 1, mr10: 1, top0: 1, @@ -60,14 +77,17 @@ class UserPanel extends ImmutablePureComponent { displayNone: !hovering, }) + const acct = account.get('acct') + return (
this.handleOnMouseEnter()} - onMouseLeave={() => this.handleOnMouseLeave()} + onMouseEnter={this.handleOnMouseEnter} + onMouseLeave={this.handleOnMouseLeave} > {intl.formatMessage(messages.headerPhoto)} @@ -76,6 +96,7 @@ class UserPanel extends ImmutablePureComponent { backgroundColor='secondary' radiusSmall className={buttonClasses} + onClick={this.handleOnOpenEditProfile} > {intl.formatMessage(messages.edit_profile)} @@ -83,9 +104,9 @@ class UserPanel extends ImmutablePureComponent { -
+
@@ -95,17 +116,17 @@ class UserPanel extends ImmutablePureComponent {
diff --git a/app/javascript/gabsocial/components/panel/who_to_follow_panel.js b/app/javascript/gabsocial/components/panel/who_to_follow_panel.js index 970336d9..95a2eda7 100644 --- a/app/javascript/gabsocial/components/panel/who_to_follow_panel.js +++ b/app/javascript/gabsocial/components/panel/who_to_follow_panel.js @@ -1,19 +1,19 @@ -import { defineMessages, injectIntl } from 'react-intl'; -import { fetchSuggestions, dismissSuggestion } from '../../actions/suggestions'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import Account from '../../components/account'; -import PanelLayout from './panel_layout'; +import { defineMessages, injectIntl } from 'react-intl' +import { fetchSuggestions, dismissSuggestion } from '../../actions/suggestions' +import ImmutablePureComponent from 'react-immutable-pure-component' +import ImmutablePropTypes from 'react-immutable-proptypes' +import Account from '../../components/account' +import PanelLayout from './panel_layout' const messages = defineMessages({ dismissSuggestion: { id: 'suggestions.dismiss', defaultMessage: 'Dismiss suggestion' }, title: { id: 'who_to_follow.title', defaultMessage: 'Who to Follow' }, show_more: { id: 'who_to_follow.more', defaultMessage: 'Show more' }, -}); +}) const mapStateToProps = (state) => ({ suggestions: state.getIn(['suggestions', 'items']), -}); +}) const mapDispatchToProps = (dispatch) => ({ fetchSuggestions: () => dispatch(fetchSuggestions()), @@ -26,25 +26,26 @@ export default class WhoToFollowPanel extends ImmutablePureComponent { static propTypes = { - suggestions: ImmutablePropTypes.list.isRequired, - fetchSuggestions: PropTypes.func.isRequired, dismissSuggestion: PropTypes.func.isRequired, + fetchSuggestions: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - }; + suggestions: ImmutablePropTypes.list.isRequired, + } + + updateOnProps = [ + 'suggestions', + ] componentDidMount () { - this.props.fetchSuggestions(); + this.props.fetchSuggestions() } render() { - const { intl, /* suggestions, */ dismissSuggestion } = this.props; - // : testing!!! : - const suggestions = [ - "1","1","1", - ] - // if (suggestions.isEmpty()) { - // return null; - // } + const { intl, suggestions, dismissSuggestion } = this.props + + if (suggestions.isEmpty()) { + return null + } return (
- {suggestions && suggestions.map(accountId => ( - - ))} + { + suggestions.map(accountId => ( + + )) + }
- ); - }; -}; \ No newline at end of file + ) + } +} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/poll.js b/app/javascript/gabsocial/components/poll.js index 6fb43a52..52c735be 100644 --- a/app/javascript/gabsocial/components/poll.js +++ b/app/javascript/gabsocial/components/poll.js @@ -87,7 +87,7 @@ class Poll extends ImmutablePureComponent { const chartClasses = cx({ default: 1, - positionAbsolute: 1, + posAbs: 1, top0: 1, left0: 1, radiusSmall: 1, @@ -199,9 +199,9 @@ class Poll extends ImmutablePureComponent { { !showResults && -
-
- -
-
-
- -
-
- - {shortNumberFormat(account.get('following_count'))} - Following - -
-
- - {shortNumberFormat(account.get('followers_count'))} - Followers - -
-
- -
- - ) - } -} \ No newline at end of file diff --git a/app/javascript/gabsocial/components/popover/status_visibility_popover.js b/app/javascript/gabsocial/components/popover/status_visibility_popover.js index c2b210f7..6d2e6c31 100644 --- a/app/javascript/gabsocial/components/popover/status_visibility_popover.js +++ b/app/javascript/gabsocial/components/popover/status_visibility_popover.js @@ -106,7 +106,7 @@ class StatusVisibilityDropdown extends PureComponent { onClick={() => this.handleChange(option.value)} className={containerClasses} > - +
{option.title} diff --git a/app/javascript/gabsocial/components/popover/user_info_popover.js b/app/javascript/gabsocial/components/popover/user_info_popover.js index c3eca9b8..362f9fb7 100644 --- a/app/javascript/gabsocial/components/popover/user_info_popover.js +++ b/app/javascript/gabsocial/components/popover/user_info_popover.js @@ -1,11 +1,10 @@ import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' -import { shortNumberFormat } from '../../utils/numbers' +import { NavLink } from 'react-router-dom' import PopoverLayout from './popover_layout' +import AccountActionButton from '../account_action_button' import Avatar from '../avatar' -import Button from '../button' import DisplayName from '../display_name' -import Text from '../text' export default class UserInfoPopover extends ImmutablePureComponent { static propTypes = { @@ -16,46 +15,32 @@ export default class UserInfoPopover extends ImmutablePureComponent { const { account } = this.props const content = !account ? null : { __html: account.get('note_emojified') } + const to = !account ? '' : `/${account.get('acct')}` + + // : todo : is remote return ( - -
+ +
-
+ -
+ +
- +
-
+
-
-
- - {shortNumberFormat(account.get('following_count'))} - Following - -
-
- - {shortNumberFormat(account.get('followers_count'))} - Followers - -
-
-
) diff --git a/app/javascript/gabsocial/components/profile_header.js b/app/javascript/gabsocial/components/profile_header.js index cb745a25..e656196d 100644 --- a/app/javascript/gabsocial/components/profile_header.js +++ b/app/javascript/gabsocial/components/profile_header.js @@ -1,18 +1,11 @@ import ImmutablePropTypes from 'react-immutable-proptypes' import ImmutablePureComponent from 'react-immutable-pure-component' -import { defineMessages, injectIntl, FormattedMessage } from 'react-intl' +import { defineMessages, injectIntl } from 'react-intl' import Sticky from 'react-stickynode' import classNames from 'classnames/bind' -import { - followAccount, - unfollowAccount, - blockAccount, - unblockAccount, -} from '../actions/accounts' -import { openPopover, closePopover } from '../actions/popover' -import { initReport } from '../actions/reports' -import { openModal } from '../actions/modal' -import { unfollowModal, me } from '../initial_state' +import { openPopover } from '../actions/popover' +import { me } from '../initial_state' +import AccountActionButton from './account_action_button' import Avatar from './avatar' import Button from './button' import DisplayName from './display_name' @@ -25,72 +18,28 @@ import Text from './text' const cx = classNames.bind(_s) const messages = defineMessages({ - follow: { id: 'follow', defaultMessage: 'Follow' }, - following: { id: 'following', defaultMessage: 'Following' }, - unfollow: { id: 'unfollow', defaultMessage: 'Unfollow' }, - requested: { id: 'requested', defaultMessage: 'Requested' }, - unblock: { id: 'unblock', defaultMessage: 'Unblock' }, - blocked: { id: 'account.blocked', defaultMessage: 'Blocked' }, followers: { id: 'account.followers', defaultMessage: 'Followers' }, follows: { id: 'account.follows', defaultMessage: 'Follows' }, profile: { id: 'account.profile', defaultMessage: 'Profile' }, + headerPhoto: { id: 'header_photo', defaultMessage: 'Header photo' }, }) -const mapStateToProps = (state) => ({ - -}) - -const mapDispatchToProps = (dispatch, { intl }) => ({ +const mapDispatchToProps = (dispatch) => ({ openProfileOptionsPopover(props) { - console.log('props:', props) dispatch(openPopover('PROFILE_OPTIONS', props)) }, - onFollow(account) { - if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { - if (unfollowModal) { - dispatch(openModal('UNFOLLOW', { - accountId: account.get('id'), - })); - } else { - dispatch(unfollowAccount(account.get('id'))); - } - } else { - dispatch(followAccount(account.get('id'))); - } - }, - - onBlock(account) { - if (account.getIn(['relationship', 'blocking'])) { - dispatch(unblockAccount(account.get('id'))); - } else { - dispatch(openModal('BLOCK_ACCOUNT', { - accountId: account.get('id'), - })); - } - }, - - onRepostToggle(account) { - if (account.getIn(['relationship', 'showing_reblogs'])) { - dispatch(followAccount(account.get('id'), false)); - } else { - dispatch(followAccount(account.get('id'), true)); - } - }, - }); export default -@connect(mapStateToProps, mapDispatchToProps) +@connect(null, mapDispatchToProps) @injectIntl class ProfileHeader extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map, intl: PropTypes.object.isRequired, - onFollow: PropTypes.func.isRequired, - onBlock: PropTypes.func.isRequired, openProfileOptionsPopover: PropTypes.func.isRequired, } @@ -107,14 +56,6 @@ class ProfileHeader extends ImmutablePureComponent { }) } - handleFollow = () => { - this.props.onFollow(this.props.account) - } - - handleBlock = () => { - this.props.onBlock(this.props.account) - } - // : todo : makeInfo = () => { const { account, intl } = this.props @@ -178,64 +119,11 @@ class ProfileHeader extends ImmutablePureComponent { const headerSrc = !!account ? account.get('header') : '' const headerMissing = headerSrc.indexOf('/headers/original/missing.png') > -1 || !headerSrc - const avatarSize = headerMissing ? '75' : '150' - - let buttonText = '' - let buttonOptions = {} - - if (!account) { - // - } else { - if (!account.get('relationship')) { - // Wait until the relationship is loaded - } else { - const isRequested = account.getIn(['relationship', 'requested']) - const isBlocking = account.getIn(['relationship', 'blocking']) - const isFollowing = account.getIn(['relationship', 'following']) - const isBlockedBy = account.getIn(['relationship', 'blocked_by']) - - if (isRequested) { - buttonText = intl.formatMessage(messages.requested) - buttonOptions = { - onClick: this.handleFollow, - color: 'primary', - backgroundColor: 'tertiary', - } - } else if (isBlocking) { - buttonText = intl.formatMessage(messages.blocked) - buttonOptions = { - onClick: this.handleBlock, - color: 'white', - backgroundColor: 'danger', - } - } else if (isFollowing) { - buttonText = intl.formatMessage(messages.following) - buttonOptions = { - onClick: this.handleFollow, - color: 'white', - backgroundColor: 'brand', - } - } else if (isBlockedBy) { - //Don't show - } - else { - buttonText = intl.formatMessage(messages.follow) - buttonOptions = { - onClick: this.handleFollow, - color: 'brand', - backgroundColor: 'none', - outline: true, - } - } - } - } - - console.log('buttonOptions:', buttonText, buttonOptions) - console.log('account: ', account) + const avatarSize = headerMissing ? 75 : 150 const avatarContainerClasses = cx({ circle: 1, - marginTopNeg75PX: !headerMissing, + mtNeg75PX: !headerMissing, borderColorWhite: 1, border2PX: 1, }) @@ -263,7 +151,7 @@ class ProfileHeader extends ImmutablePureComponent { !headerMissing &&
Cover Photo @@ -281,7 +169,7 @@ class ProfileHeader extends ImmutablePureComponent { { account && account.get('locked') && - + } { /* : todo : @@ -294,7 +182,7 @@ class ProfileHeader extends ImmutablePureComponent {
- +
@@ -308,7 +196,7 @@ class ProfileHeader extends ImmutablePureComponent { account && account.get('id') === me &&
- } +
} diff --git a/app/javascript/gabsocial/components/progress_bar.js b/app/javascript/gabsocial/components/progress_bar.js index de7c7043..2c07afd5 100644 --- a/app/javascript/gabsocial/components/progress_bar.js +++ b/app/javascript/gabsocial/components/progress_bar.js @@ -24,28 +24,26 @@ export default class ProgressBar extends PureComponent { width: `${completed}%`, } - const containerOptions = { - href, - className: cx({ - default: 1, - backgroundPanel: !small, - backgroundSubtle2: small, - noUnderline: 1, - circle: 1, - overflowHidden: 1, - cursorPointer: 1, - height22PX: !small, - height4PX: small, - }), - } + const containerClassName = cx({ + default: 1, + backgroundPanel: !small, + backgroundSubtle2: small, + noUnderline: 1, + circle: 1, + overflowHidden: 1, + cursorPointer: 1, + height22PX: !small, + height4PX: small, + }) return (
} @@ -219,7 +219,7 @@ export default class Card extends ImmutablePureComponent { } else { embed = (
- +
) } diff --git a/app/javascript/gabsocial/components/status_check_box.js b/app/javascript/gabsocial/components/status_check_box.js index b512e415..fde5e8eb 100644 --- a/app/javascript/gabsocial/components/status_check_box.js +++ b/app/javascript/gabsocial/components/status_check_box.js @@ -63,7 +63,7 @@ class StatusCheckBox extends ImmutablePureComponent { } else { media = ( - {Component => } + {Component => } ); } diff --git a/app/javascript/gabsocial/components/status_content.js b/app/javascript/gabsocial/components/status_content.js index 6e5e3e68..38162248 100644 --- a/app/javascript/gabsocial/components/status_content.js +++ b/app/javascript/gabsocial/components/status_content.js @@ -201,7 +201,7 @@ class StatusContent extends ImmutablePureComponent { const mentionLinks = status.get('mentions').map(item => ( ) } + } \ No newline at end of file diff --git a/app/javascript/gabsocial/components/text.js b/app/javascript/gabsocial/components/text.js index 840401a5..ec08356b 100644 --- a/app/javascript/gabsocial/components/text.js +++ b/app/javascript/gabsocial/components/text.js @@ -1,7 +1,9 @@ import classNames from 'classnames/bind' +// Bind CSS Modules global variable `_s` to classNames module const cx = classNames.bind(_s) +// Define colors for enumeration for Text component `color` prop const COLORS = { primary: 'primary', secondary: 'secondary', @@ -10,9 +12,9 @@ const COLORS = { error: 'error', white: 'white', inherit: 'inherit', - pro: 'pro', } +// Define sizes for enumeration for Text component `size` prop const SIZES = { extraSmall: 'extraSmall', small: 'small', @@ -22,6 +24,7 @@ const SIZES = { extraLarge: 'extraLarge', } +// Define weights for enumeration for Text component `weight` prop const WEIGHTS = { normal: 'normal', medium: 'medium', @@ -29,27 +32,42 @@ const WEIGHTS = { extraBold: 'extraBold', } +// Define alignments for enumeration for Text component `align` prop const ALIGNMENTS = { center: 'center', left: 'left', } +/** + * Renders a text component + * @param {string} [props.align='left] - the alignment of the text + * @param {bool} [props.isBadge] - to style the text as a badge + * @param {string} [props.className] - add custom className + * @param {string} [props.color='primary'] color of the text + * @param {bool} [props.hasUnderline] - if the text is underlined + * @param {string} [props.htmlFor] - define the `for` attribute on the tag + * @param {string} [props.size='normal'] size of the text + * @param {string} [props.tagName='span'] tagName of the text element + * @param {string} [props.weight='normal'] weight of the text + */ export default class Text extends PureComponent { + static propTypes = { - tagName: PropTypes.string, - className: PropTypes.string, - children: PropTypes.any, - color: PropTypes.oneOf(Object.keys(COLORS)), - size: PropTypes.oneOf(Object.keys(SIZES)), - weight: PropTypes.oneOf(Object.keys(WEIGHTS)), align: PropTypes.oneOf(Object.keys(ALIGNMENTS)), - underline: PropTypes.bool, - badge: PropTypes.bool, + isBadge: PropTypes.bool, + children: PropTypes.any, + className: PropTypes.string, + color: PropTypes.oneOf(Object.keys(COLORS)), + hasUnderline: PropTypes.bool, htmlFor: PropTypes.string, + size: PropTypes.oneOf(Object.keys(SIZES)), + tagName: PropTypes.string, + weight: PropTypes.oneOf(Object.keys(WEIGHTS)), } static defaultProps = { tagName: 'span', + align: ALIGNMENTS.left, color: COLORS.primary, size: SIZES.normal, weight: WEIGHTS.normal, @@ -63,26 +81,26 @@ export default class Text extends PureComponent { color, size, weight, - underline, align, htmlFor, - badge + isBadge, + hasUnderline, } = this.props + // Style the component according to props const classes = cx(className, { default: 1, text: 1, - radiusSmall: badge, - lineHeight15: badge, - px5: badge, + radiusSmall: isBadge, + lineHeight15: isBadge, + px5: isBadge, colorPrimary: color === COLORS.primary, colorSecondary: color === COLORS.secondary, colorTertiary: color === COLORS.tertiary, colorBrand: color === COLORS.brand, colorWhite: color === COLORS.white, - colorGabPro: color === COLORS.pro, inherit: color === COLORS.inherit, fontSize19PX: size === SIZES.large, @@ -99,7 +117,7 @@ export default class Text extends PureComponent { textAlignLeft: align === ALIGNMENTS.left, textAlignCenter: align === ALIGNMENTS.center, - underline: underline, + underline: hasUnderline, }) return React.createElement( @@ -111,4 +129,5 @@ export default class Text extends PureComponent { children, ) } + } \ No newline at end of file diff --git a/app/javascript/gabsocial/components/timeline_queue_button_header.js b/app/javascript/gabsocial/components/timeline_queue_button_header.js index f5025547..e1544de0 100644 --- a/app/javascript/gabsocial/components/timeline_queue_button_header.js +++ b/app/javascript/gabsocial/components/timeline_queue_button_header.js @@ -27,7 +27,7 @@ export default class TimelineQueueButtonHeader extends PureComponent { const classes = cx({ default: 1, - positionFixed: 1, + posFixed: 1, displayNone: !hasItems, top80PX: 1, z4: 1, @@ -37,7 +37,7 @@ export default class TimelineQueueButtonHeader extends PureComponent { return (
diff --git a/app/javascript/gabsocial/features/compose/components/compose_form/compose_form.js b/app/javascript/gabsocial/features/compose/components/compose_form/compose_form.js index 9a219a7a..dc0d5b16 100644 --- a/app/javascript/gabsocial/features/compose/components/compose_form/compose_form.js +++ b/app/javascript/gabsocial/features/compose/components/compose_form/compose_form.js @@ -43,10 +43,6 @@ class ComposeForm extends ImmutablePureComponent { composeFocused: false, } - static contextTypes = { - router: PropTypes.object, - }; - static propTypes = { intl: PropTypes.object.isRequired, edit: PropTypes.bool, @@ -81,6 +77,7 @@ class ComposeForm extends ImmutablePureComponent { scheduledAt: PropTypes.instanceOf(Date), setScheduledAt: PropTypes.func.isRequired, replyToId: PropTypes.string, + reduxReplyToId: PropTypes.string, hasPoll: PropTypes.bool, }; @@ -141,7 +138,7 @@ class ComposeForm extends ImmutablePureComponent { return; } - this.props.onSubmit(this.context.router ? this.context.router.history : null, this.props.group); + this.props.onSubmit(this.props.group, this.props.replyToId); } onSuggestionsClearRequested = () => { @@ -234,15 +231,18 @@ class ComposeForm extends ImmutablePureComponent { scheduledAt, spoiler, replyToId, + reduxReplyToId, hasPoll, isUploading, isMatch, + isChangingUpload, + isSubmitting, } = this.props - const disabled = this.props.isSubmitting; + const disabled = isSubmitting const text = [this.props.spoilerText, countableText(this.props.text)].join(''); - const disabledButton = disabled || isUploading || this.props.isChangingUpload || length(text) > maxPostCharacterCount || (text.length !== 0 && text.trim().length === 0 && !anyMedia); + const disabledButton = disabled || isUploading || isChangingUpload || length(text) > maxPostCharacterCount || (text.length !== 0 && text.trim().length === 0 && !anyMedia); const shouldAutoFocus = autoFocus && !showSearch && !isMobile(window.innerWidth) - + const parentContainerClasses = cx({ default: 1, width100PC: 1, @@ -272,6 +272,12 @@ class ComposeForm extends ImmutablePureComponent { marginLeftAuto: shouldCondense, }) + const commentPublishBtnClasses = cx({ + default: 1, + justifyContentCenter: 1, + displayNone: length(this.props.text) === 0 || anyMedia, + }) + return (
@@ -288,6 +294,16 @@ class ComposeForm extends ImmutablePureComponent { onClick={this.handleClick} > + { + !!reduxReplyToId && !shouldCondense && +
+ +
+ } + { !!spoiler &&
@@ -311,7 +327,7 @@ class ComposeForm extends ImmutablePureComponent { { - shouldCondense /* && (hasPoll || anyMedia || text) */ && -
+ shouldCondense && +
diff --git a/app/javascript/gabsocial/features/compose/components/media_upload_item.js b/app/javascript/gabsocial/features/compose/components/media_upload_item.js index a6353c03..7ca859a4 100644 --- a/app/javascript/gabsocial/features/compose/components/media_upload_item.js +++ b/app/javascript/gabsocial/features/compose/components/media_upload_item.js @@ -32,8 +32,8 @@ const mapDispatchToProps = (dispatch) => ({ dispatch(changeUploadCompose(id, { description })); }, - onSubmit (router) { - dispatch(submitCompose(router)); + onSubmit () { + dispatch(submitCompose()); }, }); @@ -69,7 +69,7 @@ class Upload extends ImmutablePureComponent { handleSubmit = () => { this.handleInputBlur() - this.props.onSubmit(this.context.router.history) + this.props.onSubmit() } handleUndoClick = e => { @@ -117,7 +117,7 @@ class Upload extends ImmutablePureComponent { const descriptionContainerClasses = cx({ default: 1, - positionAbsolute: 1, + posAbs: 1, right0: 1, bottom0: 1, left0: 1, @@ -149,10 +149,9 @@ class Upload extends ImmutablePureComponent { title={intl.formatMessage(messages.delete)} onClick={this.handleUndoClick} icon='close' - iconWidth='10px' - iconHeight='10px' + iconSize='10px' iconClassName={_s.inherit} - className={[_s.top0, _s.right0, _s.positionAbsolute, _s.mr5, _s.mt5, _s.px10].join(' ')} + className={[_s.top0, _s.right0, _s.posAbs, _s.mr5, _s.mt5, _s.px10].join(' ')} />
diff --git a/app/javascript/gabsocial/features/compose/components/poll_form.js b/app/javascript/gabsocial/features/compose/components/poll_form.js index da2cd037..dd68ed2f 100644 --- a/app/javascript/gabsocial/features/compose/components/poll_form.js +++ b/app/javascript/gabsocial/features/compose/components/poll_form.js @@ -34,16 +34,15 @@ class PollFormOption extends ImmutablePureComponent { onFetchSuggestions: PropTypes.func.isRequired, onSuggestionSelected: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - }; + } handleOptionTitleChange = e => { this.props.onChange(this.props.index, e.target.value); - }; + } handleOptionRemove = () => { this.props.onRemove(this.props.index); - }; - + } handleToggleMultiple = e => { this.props.onToggleMultiple(); @@ -103,13 +102,11 @@ class PollFormOption extends ImmutablePureComponent { { index > 1 &&