diff --git a/app/javascript/gabsocial/actions/dropdown_menu.js b/app/javascript/gabsocial/actions/dropdown_menu.js deleted file mode 100644 index 14f2939c..00000000 --- a/app/javascript/gabsocial/actions/dropdown_menu.js +++ /dev/null @@ -1,10 +0,0 @@ -export const DROPDOWN_MENU_OPEN = 'DROPDOWN_MENU_OPEN'; -export const DROPDOWN_MENU_CLOSE = 'DROPDOWN_MENU_CLOSE'; - -export function openDropdownMenu(id, placement, keyboard) { - return { type: DROPDOWN_MENU_OPEN, id, placement, keyboard }; -} - -export function closeDropdownMenu(id) { - return { type: DROPDOWN_MENU_CLOSE, id }; -} diff --git a/app/javascript/gabsocial/actions/favourites.js b/app/javascript/gabsocial/actions/favourites.js index a25c0afe..03703853 100644 --- a/app/javascript/gabsocial/actions/favourites.js +++ b/app/javascript/gabsocial/actions/favourites.js @@ -10,7 +10,7 @@ export const FAVOURITED_STATUSES_EXPAND_REQUEST = 'FAVOURITED_STATUSES_EXPAND_RE export const FAVOURITED_STATUSES_EXPAND_SUCCESS = 'FAVOURITED_STATUSES_EXPAND_SUCCESS'; export const FAVOURITED_STATUSES_EXPAND_FAIL = 'FAVOURITED_STATUSES_EXPAND_FAIL'; -export function fetchFavouritedStatuses() { +export function fetchFavoritedStatuses() { return (dispatch, getState) => { if (!me) return; @@ -18,26 +18,26 @@ export function fetchFavouritedStatuses() { return; } - dispatch(fetchFavouritedStatusesRequest()); + dispatch(fetchFavoritedStatusesRequest()); api(getState).get('/api/v1/favourites').then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(importFetchedStatuses(response.data)); - dispatch(fetchFavouritedStatusesSuccess(response.data, next ? next.uri : null)); + dispatch(fetchFavoritedStatusesSuccess(response.data, next ? next.uri : null)); }).catch(error => { - dispatch(fetchFavouritedStatusesFail(error)); + dispatch(fetchFavoritedStatusesFail(error)); }); }; }; -export function fetchFavouritedStatusesRequest() { +export function fetchFavoritedStatusesRequest() { return { type: FAVOURITED_STATUSES_FETCH_REQUEST, skipLoading: true, }; }; -export function fetchFavouritedStatusesSuccess(statuses, next) { +export function fetchFavoritedStatusesSuccess(statuses, next) { return { type: FAVOURITED_STATUSES_FETCH_SUCCESS, statuses, @@ -46,7 +46,7 @@ export function fetchFavouritedStatusesSuccess(statuses, next) { }; }; -export function fetchFavouritedStatusesFail(error) { +export function fetchFavoritedStatusesFail(error) { return { type: FAVOURITED_STATUSES_FETCH_FAIL, error, @@ -54,7 +54,7 @@ export function fetchFavouritedStatusesFail(error) { }; }; -export function expandFavouritedStatuses() { +export function expandFavoritedStatuses() { return (dispatch, getState) => { if (!me) return; @@ -64,25 +64,25 @@ export function expandFavouritedStatuses() { return; } - dispatch(expandFavouritedStatusesRequest()); + dispatch(expandFavoritedStatusesRequest()); api(getState).get(url).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); dispatch(importFetchedStatuses(response.data)); - dispatch(expandFavouritedStatusesSuccess(response.data, next ? next.uri : null)); + dispatch(expandFavoritedStatusesSuccess(response.data, next ? next.uri : null)); }).catch(error => { - dispatch(expandFavouritedStatusesFail(error)); + dispatch(expandFavoritedStatusesFail(error)); }); }; }; -export function expandFavouritedStatusesRequest() { +export function expandFavoritedStatusesRequest() { return { type: FAVOURITED_STATUSES_EXPAND_REQUEST, }; }; -export function expandFavouritedStatusesSuccess(statuses, next) { +export function expandFavoritedStatusesSuccess(statuses, next) { return { type: FAVOURITED_STATUSES_EXPAND_SUCCESS, statuses, @@ -90,7 +90,7 @@ export function expandFavouritedStatusesSuccess(statuses, next) { }; }; -export function expandFavouritedStatusesFail(error) { +export function expandFavoritedStatusesFail(error) { return { type: FAVOURITED_STATUSES_EXPAND_FAIL, error, diff --git a/app/javascript/gabsocial/actions/pin_statuses.js b/app/javascript/gabsocial/actions/pin_statuses.js deleted file mode 100644 index 8be3dd87..00000000 --- a/app/javascript/gabsocial/actions/pin_statuses.js +++ /dev/null @@ -1,43 +0,0 @@ -import api from '../api'; -import { importFetchedStatuses } from './importer'; -import { me } from '../initial_state'; - -export const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; -export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; -export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL'; - -export function fetchPinnedStatuses() { - return (dispatch, getState) => { - if (!me) return; - - dispatch(fetchPinnedStatusesRequest()); - - api(getState).get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => { - dispatch(importFetchedStatuses(response.data)); - dispatch(fetchPinnedStatusesSuccess(response.data, null)); - }).catch(error => { - dispatch(fetchPinnedStatusesFail(error)); - }); - }; -}; - -export function fetchPinnedStatusesRequest() { - return { - type: PINNED_STATUSES_FETCH_REQUEST, - }; -}; - -export function fetchPinnedStatusesSuccess(statuses, next) { - return { - type: PINNED_STATUSES_FETCH_SUCCESS, - statuses, - next, - }; -}; - -export function fetchPinnedStatusesFail(error) { - return { - type: PINNED_STATUSES_FETCH_FAIL, - error, - }; -}; diff --git a/app/javascript/gabsocial/actions/popover.js b/app/javascript/gabsocial/actions/popover.js new file mode 100644 index 00000000..5863e08c --- /dev/null +++ b/app/javascript/gabsocial/actions/popover.js @@ -0,0 +1,18 @@ +export const POPOVER_OPEN = 'POPOVER_OPEN' +export const POPOVER_CLOSE = 'POPOVER_CLOSE' + +export function openPopover(type, keyboard = false, placement = 'top') { + return { + keyboard, + placement, + type: POPOVER_OPEN, + popoverType: type, + } +} + +export function closePopover(type) { + return { + type: POPOVER_CLOSE, + popoverType: type, + } +} diff --git a/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js b/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js index aa81a9f0..5f0f8816 100644 --- a/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js +++ b/app/javascript/gabsocial/components/autosuggest_textbox/autosuggest_textbox.js @@ -1,6 +1,6 @@ import { Fragment } from 'react' import ImmutablePropTypes from 'react-immutable-proptypes'; -import classNames from 'classnames'; +import classNames from 'classnames/bind' import ImmutablePureComponent from 'react-immutable-pure-component'; import Textarea from 'react-textarea-autosize'; import { isRtl } from '../../utils/rtl'; @@ -8,6 +8,8 @@ import { textAtCursorMatchesToken } from '../../utils/cursor_token_match'; import AutosuggestAccount from '../autosuggest_account'; import AutosuggestEmoji from '../autosuggest_emoji'; +const cx = classNames.bind(_s) + export default class AutosuggestTextbox extends ImmutablePureComponent { static propTypes = { @@ -30,6 +32,7 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { onFocus: PropTypes.func, onBlur: PropTypes.func, textarea: PropTypes.bool, + small: PropTypes.bool, }; static defaultProps = { @@ -188,7 +191,7 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { } render () { - const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, className, id, maxLength, textarea } = this.props; + const { value, small, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, className, id, maxLength, textarea } = this.props; const { suggestionsHidden } = this.state; const style = { direction: 'ltr' }; @@ -196,14 +199,30 @@ export default class AutosuggestTextbox extends ImmutablePureComponent { style.direction = 'rtl'; } + const textClasses = cx({ + default: 1, + lineHeight125: 1, + resizeNone: 1, + text: 1, + displayBlock: 1, + outlineNone: 1, + backgroundColorPrimary: !small, + backgroundSubtle: small, + paddingVertical15PX: !small, + paddingVertical10PX: small, + fontSize16PX: !small, + fontSize14PX: small, + marginRight5PX: small, + }) + if (textarea) { return ( -
+