mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-11 20:21:10 +00:00
修改了reducer,action,container。出现错误,无法加载css,json parse error
This commit is contained in:
parent
6f83b7cb91
commit
056db885d1
|
@ -81,6 +81,8 @@ export const COMPOSE_CHANGE_MEDIA_ORDER = 'COMPOSE_CHANGE_MEDIA_ORDER';
|
|||
export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS';
|
||||
export const COMPOSE_FOCUS = 'COMPOSE_FOCUS';
|
||||
|
||||
export const COMPOSE_CHANGE_IS_SCHEDULED = 'COMPOSE_CHANGE_IS_SCHEDULED';
|
||||
|
||||
const messages = defineMessages({
|
||||
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
|
||||
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
|
||||
|
@ -835,3 +837,9 @@ export const changeMediaOrder = (a, b) => ({
|
|||
a,
|
||||
b,
|
||||
});
|
||||
|
||||
export function changeIsScheduled() {
|
||||
return {
|
||||
type: COMPOSE_IS_SCHEDULED_CHANGE,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -71,6 +71,11 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
singleColumn: PropTypes.bool,
|
||||
lang: PropTypes.string,
|
||||
maxChars: PropTypes.number,
|
||||
|
||||
schedule_time: PropTypes.string,
|
||||
schedule_timezone: PropTypes.string,
|
||||
is_scheduled: PropTypes.bool.isRequired,
|
||||
scheduled_at: PropTypes.string,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -312,6 +317,7 @@ class ComposeForm extends ImmutablePureComponent {
|
|||
<div>
|
||||
<label>计划时间(UTC)</label>
|
||||
<input
|
||||
className='search__input'
|
||||
type='datetime-local'
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -1,31 +1,26 @@
|
|||
import { injectIntl,defineMessages } from "react-intl";
|
||||
import { injectIntl, defineMessages } from "react-intl";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import ScheduleIcon from '@/material-icons/400-20px/schedule.svg?react';
|
||||
import { IconButton } from "@/mastodon/components/icon_button";
|
||||
|
||||
import { changeIsScheduled } from '../../actions/compose';
|
||||
|
||||
|
||||
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
iconComponent: ScheduleIcon,
|
||||
title: defineMessages({
|
||||
title: {
|
||||
id: 'compose.schedule_button.title',
|
||||
defaultMessage: 'Schedule',
|
||||
},
|
||||
}),
|
||||
active: false,
|
||||
ariaControls: 'schedule-compose-form',
|
||||
title: 'schedule',
|
||||
active: state.getIn(['compose', 'is_scheduled']),
|
||||
|
||||
size: 18,
|
||||
inverted: true,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onClick () {
|
||||
dispatch({ type: 'SCHEDULE_COMPOSE' });
|
||||
dispatch(changeIsScheduled());
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ import {
|
|||
COMPOSE_CHANGE_MEDIA_ORDER,
|
||||
COMPOSE_SET_STATUS,
|
||||
COMPOSE_FOCUS,
|
||||
COMPOSE_CHANGE_IS_SCHEDULED,
|
||||
} from '../actions/compose';
|
||||
import { REDRAFT } from '../actions/statuses';
|
||||
import { STORE_HYDRATE } from '../actions/store';
|
||||
|
@ -94,6 +95,11 @@ const initialState = ImmutableMap({
|
|||
focusY: 0,
|
||||
dirty: false,
|
||||
}),
|
||||
|
||||
schedule_time: new Date().toLocaleString('zh-CN').split('/').join('-').split(' ').join('T')+'.0',
|
||||
schedule_timezone: new Date().getTimezoneOffset() > 0?'-':'+' + (0 - new Date().getTimezoneOffset() / 60) + ':' + ((0 - new Date().getTimezoneOffset() % 60) === 30 ? '30' :'00'),
|
||||
is_scheduled: false,
|
||||
scheduled_at: null,
|
||||
});
|
||||
|
||||
const initialPoll = ImmutableMap({
|
||||
|
@ -560,6 +566,12 @@ export default function compose(state = initialState, action) {
|
|||
|
||||
return list.splice(indexA, 1).splice(indexB, 0, moveItem);
|
||||
});
|
||||
case COMPOSE_CHANGE_IS_SCHEDULED:
|
||||
return state.withMutations(map => {
|
||||
map.set('is_scheduled', !state.get('is_scheduled'));
|
||||
map.set('scheduled_at', state.get('schedule_time') + state.get('schedule_timezone'));
|
||||
map.set('idempotencyKey', uuid());
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user