From 196a906ceca2d593d74c18dae0a364d8f952d640 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Sat, 2 May 2020 02:25:55 -0400 Subject: [PATCH] Progress --- app/controllers/api/v1/gifs_controller.rb | 4 +- app/controllers/api/v1/statuses_controller.rb | 4 +- app/javascript/gabsocial/actions/compose.js | 17 ++- app/javascript/gabsocial/actions/tenor.js | 9 +- app/javascript/gabsocial/assets/globe_icon.js | 4 +- .../gabsocial/assets/verified_icon.js | 4 +- .../components/autosuggest_textbox.js | 54 ++++++-- .../gabsocial/components/comment.js | 111 +++++++++++++-- .../gabsocial/components/comment_list.js | 42 ++++-- .../gabsocial/components/composer.js | 33 +++-- .../gabsocial/components/display_name.js | 2 +- .../gabsocial/components/emoji/emoji.js | 4 +- .../components/extended_video_player.js | 33 ++--- .../gabsocial/components/group_header.js | 3 +- app/javascript/gabsocial/components/input.js | 7 +- .../gabsocial/components/load_more.js | 2 +- .../gabsocial/components/media_gallery.js | 15 +- .../components/modal/confirmation_modal.js | 6 +- .../components/modal/gif_picker_modal.js | 23 ++-- .../gabsocial/components/modal/media_modal.js | 20 ++- .../gabsocial/components/modal/modal_root.js | 2 +- .../components/modal/pro_upgrade_modal.js | 5 - .../components/modal/report_modal.js | 4 +- app/javascript/gabsocial/components/poll.js | 12 +- .../components/popover/date_picker_popover.js | 104 ++++++++++---- .../popover/emoji_picker_popover.js | 15 +- .../components/popover/popover_root.js | 6 - .../gabsocial/components/scrollable_list.js | 2 +- .../gabsocial/components/sidebar.js | 28 +++- app/javascript/gabsocial/components/status.js | 80 +++-------- .../gabsocial/components/status_action_bar.js | 2 +- .../gabsocial/components/status_content.js | 6 +- .../gabsocial/components/status_header.js | 40 +++++- .../gabsocial/components/status_media.js | 120 ++++++++++++++++ .../gabsocial/components/zoomable_image.js | 128 +++++++++--------- .../gabsocial/containers/status_container.js | 37 +++-- .../compose/components/compose_form.js | 75 +++++----- .../features/compose/components/gif_form.js | 43 +++--- .../compose/components/media_upload_button.js | 2 +- .../compose/components/media_upload_item.js | 36 +++-- .../features/compose/components/poll_form.js | 51 +------ .../containers/compose_form_container.js | 78 +++++++---- .../list_editor_search/list_editor_search.js | 4 +- app/javascript/gabsocial/features/search.js | 2 +- app/javascript/gabsocial/locales/bg.json | 2 +- .../gabsocial/locales/defaultMessages.json | 2 +- app/javascript/gabsocial/locales/en.json | 2 +- app/javascript/gabsocial/locales/hi.json | 2 +- app/javascript/gabsocial/locales/lv.json | 2 +- app/javascript/gabsocial/locales/ms.json | 2 +- app/javascript/gabsocial/locales/ta.json | 2 +- app/javascript/gabsocial/reducers/compose.js | 20 ++- app/javascript/gabsocial/reducers/tenor.js | 15 +- app/javascript/styles/global.css | 18 ++- app/services/edit_status_service.rb | 3 +- app/services/hashtag_query_service.rb | 2 +- app/services/post_status_service.rb | 3 +- config/locales/en.yml | 2 +- config/locales/en_GB.yml | 2 +- config/locales/io.yml | 2 +- package.json | 2 + yarn.lock | 13 ++ 62 files changed, 866 insertions(+), 509 deletions(-) create mode 100644 app/javascript/gabsocial/components/status_media.js diff --git a/app/controllers/api/v1/gifs_controller.rb b/app/controllers/api/v1/gifs_controller.rb index 2a723dbf..e4c797a0 100644 --- a/app/controllers/api/v1/gifs_controller.rb +++ b/app/controllers/api/v1/gifs_controller.rb @@ -9,7 +9,7 @@ class Api::V1::GifsController < Api::BaseController def categories uri = URI('https://api.tenor.com/v1/categories') - theOptions = { :key => "QHFJ0C5EWGBH" } + theOptions = { :key => "TENOR_KEY" } uri.query = URI.encode_www_form(theOptions) res = Net::HTTP.get_response(uri) @@ -19,7 +19,7 @@ class Api::V1::GifsController < Api::BaseController def search uri = URI('https://api.tenor.com/v1/search') theOptions = { - :key => "QHFJ0C5EWGBH", + :key => "TENOR_KEY", :media_filter => "minimal", :limit => 30, :q => params[:search], diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 43059ebf..62d39615 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -22,8 +22,10 @@ class Api::V1::StatusesController < Api::BaseController render json: @status, serializer: REST::StatusSerializer end + # direct descendants only def comments - descendants_results = @status.descendants(CONTEXT_LIMIT, current_account) + descendants_results = @status.descendants(CONTEXT_LIMIT, current_account, nil, nil, 1) + puts "descendants_results: " + descendants_results.inspect loaded_descendants = cache_collection(descendants_results, Status) @context = Context.new(descendants: loaded_descendants) diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index 352e538b..fe9ae66b 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -1,6 +1,7 @@ import api from '../api'; import { CancelToken, isCancel } from 'axios'; import throttle from 'lodash.throttle' +import moment from 'moment-mini' import { search as emojiSearch } from '../components/emoji/emoji_mart_search_light'; import { urlRegex } from '../features/ui/util/url_regex' import { tagHistory } from '../settings'; @@ -77,23 +78,26 @@ export const ensureComposeIsVisible = (getState, routerHistory) => { } }; -export function changeCompose(text, markdown) { - console.log("changeCompose:", markdown) +export function changeCompose(text, markdown, replyId) { + console.log("changeCompose:", text) return { type: COMPOSE_CHANGE, text: text, markdown: markdown, + replyId: replyId, }; }; -export function replyCompose(status) { +export function replyCompose(status, router, showModal) { return (dispatch) => { dispatch({ type: COMPOSE_REPLY, status: status, }); - dispatch(openModal('COMPOSE')); + if (showModal) { + dispatch(openModal('COMPOSE')); + } }; }; @@ -169,7 +173,7 @@ export function handleComposeSubmit(dispatch, getState, response, status) { } } -export function submitCompose(group, replyToId=null) { +export function submitCompose(group, replyToId = null) { return function (dispatch, getState) { if (!me) return; @@ -202,8 +206,7 @@ export function submitCompose(group, replyToId=null) { const method = id === null ? 'post' : 'put'; const scheduled_at = getState().getIn(['compose', 'scheduled_at'], null); - // : todo : - // if (scheduled_at !== null) scheduled_at = moment.utc(scheduled_at).toDate(); + if (scheduled_at !== null) scheduled_at = moment.utc(scheduled_at).toDate(); api(getState)[method](endpoint, { status, diff --git a/app/javascript/gabsocial/actions/tenor.js b/app/javascript/gabsocial/actions/tenor.js index 3f0653b1..cab02a2c 100644 --- a/app/javascript/gabsocial/actions/tenor.js +++ b/app/javascript/gabsocial/actions/tenor.js @@ -52,9 +52,14 @@ export const clearGifResults = () => ({ type: GIFS_CLEAR_RESULTS, }) -export const setSelectedGif = (url) => ({ +export const clearSelectedGif = () => ({ + type: GIF_CLEAR_SELECTED, + result, +}) + +export const setSelectedGif = (result) => ({ type: GIF_SET_SELECTED, - url, + result, }) export function changeGifSearchText(text) { diff --git a/app/javascript/gabsocial/assets/globe_icon.js b/app/javascript/gabsocial/assets/globe_icon.js index f517d46b..189d6cde 100644 --- a/app/javascript/gabsocial/assets/globe_icon.js +++ b/app/javascript/gabsocial/assets/globe_icon.js @@ -16,8 +16,8 @@ const GlobeIcon = ({ aria-label={title} > - - + + ) diff --git a/app/javascript/gabsocial/assets/verified_icon.js b/app/javascript/gabsocial/assets/verified_icon.js index a107ebd4..04671d09 100644 --- a/app/javascript/gabsocial/assets/verified_icon.js +++ b/app/javascript/gabsocial/assets/verified_icon.js @@ -11,12 +11,12 @@ const VerifiedIcon = ({ y='0px' width={size} height={size} - viewBox='0 0 24 24' + viewBox='0 0 32 32' xmlSpace='preserve' aria-label={title} > - + ) diff --git a/app/javascript/gabsocial/components/autosuggest_textbox.js b/app/javascript/gabsocial/components/autosuggest_textbox.js index 04ed5dd9..9d237596 100644 --- a/app/javascript/gabsocial/components/autosuggest_textbox.js +++ b/app/javascript/gabsocial/components/autosuggest_textbox.js @@ -3,6 +3,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes' import isObject from 'lodash.isobject' import classNames from 'classnames/bind' import ImmutablePureComponent from 'react-immutable-pure-component' +import Textarea from 'react-textarea-autosize' import { isRtl } from '../utils/rtl' import { textAtCursorMatchesToken } from '../utils/cursor_token_match' import AutosuggestAccount from './autosuggest_account' @@ -226,27 +227,56 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { direction: isRtl(value) ? 'rtl' : 'ltr', } - const textClasses = cx({ + const textareaClasses = cx({ default: 1, - lineHeight125: 1, + font: 1, + wrap: 1, resizeNone: 1, - text: 1, - displayBlock: 1, + bgTransparent: 1, outlineNone: 1, - bgPrimary: !small, - bgSubtle: small, - py15: !small, - py10: small, + lineHeight125: 1, + height100PC: small, + width100PC: !small, + pt15: !small, + px15: !small, + px10: small, + pb10: !small, fs16PX: !small, fs14PX: small, - mr5: small, + heightMax200PX: small, + heightMax80VH: !small, + heightMin100PX: !small, + }) + + const textareaContainerClasses = cx({ + default: 1, + maxWidth100PC: 1, + flexGrow1: small, + height100PC: small, + justifyContentCenter: small, }) if (textarea) { return ( -
- +